Commit Graph
79 Commits
Author SHA1 Message Date
Brian R. Bondy 8ea5a96ef4 Remove "Prefer const for Local Variables" best practice (#35882) 2026-04-24 16:51:35 -04:00
cdesouza-chromium 469b21a709 Add best practice: raw_ref<T> vs raw_ptr<T> for non-owning fields (CSM-036) (#35731) 2026-04-21 21:10:37 +01:00
Brian R. Bondy 4dd860c0ae Remove CSM-002 best practice (#35734) 2026-04-21 16:08:30 -04:00
Pete Miller c5cde404d4 Docs updates - introduce Running Tests, introduce Web UI Frontend, small fixes (#35231)
* Docs updates

- New test suites doc (how to run tests)
- New WebUI Frontend doc (basic introduction to Brave's different stack)
- Patches points to best practices
- bug fix in claude code skills doc
- Adjust docs/README.md to prioritize the index
- Preflight skill addition of missing test suites
2026-04-20 22:35:18 -07:00
Shivan bb00e0f82d Remove redundant docs section (#35640)
Accidental miss from https://github.com/brave/brave-core/pull/35637
2026-04-18 07:08:52 -04:00
Shivan f45d6502b9 Add crypto.md to docs/ (#35637) 2026-04-17 12:38:09 -07:00
Jackson 8a0d7c89bc Add detail to the premium account token docs (#35503) 2026-04-14 15:21:15 -04:00
Brian R. Bondy 73d4857336 Add premium account documentation (#35498)
Add premium account information
2026-04-14 14:39:15 -04:00
Anirudha Bose a667af3258 [Rewards] Make gate3 URL environment-aware via CLI switches (#34801)
* [Rewards] Make gate3 URL environment-aware via CLI switches

* Address review: network audit list, public_deps, CHECK

- Add gate3 prod and dev endpoints to network audit allowed list
- Move //base to public_deps in :constants (BS-024)
- Replace DCHECK with CHECK in GetGate3URL (CS-025)

* Fix broken tests

* Remove gate3 endpoints from network audit list

* Add gate3 endpoints to TLS pin list

* Replace auto with explicit type

* Refactor GetGate3URL tests into table-driven loop

* Move kEnvGate3Switch to header and use named constants in tests

* Add explicit default for gate3_url in RewardsEngineOptions

* Fix MaybeWarnSwitchValue comment to describe both log paths

* Remove gate3 entries from brave_network_audit_allowed_lists.h

* Simplify GetGate3URL to delegate to GetServicesDomain

* Use std::optional<std::string> for gate3_url instead of empty sentinel

* Rename brave_domains/constants.h/cc to urls.h/cc

* Switch to GURL in GetGate3URL

* Clean up review nits from gate3 env switch

* Add comment in brave_domains/urls.h
2026-04-14 23:05:38 +05:30
Anthony Tseng fa14702bf3 Split ARCH-062 into separate CUJ test and change detector rules (#35182)
ARCH-062 combined two distinct concerns under one heading, causing
the bot to demand CUJ InteractiveBrowserTest for non-UI code like
tab helpers and services. Split into:

- ARCH-062: CUJ tests required only for features with UI changes
- ARCH-062b: Avoid change detector tests (general testing guidance)

Clarify that non-UI components should use unit tests or browser tests
appropriate to the code rather than CUJ tests.
2026-04-03 18:55:26 +02:00
Kyle Den Hartog 0ae4cc76a5 Add --update-crate flag to update a single vendored tool crate (#34929)
* Add --update-crate flag to update a single vendored tool crate

Adds a --update-crate=<name>@<version> option to tools/crates/update.py
that updates one crate in-place without running cargo vendor. It downloads
the tarball directly from crates.io, replaces the vendor directory, patches
Cargo.lock, and regenerates .cargo-checksum.json. This avoids collateral
version bumps from a full re-vendor and is useful for targeted security
advisory fixes.

Exposes the flag via `npm run update_brave_tools_crates -- --update-crate=`.
2026-04-03 10:40:38 +13:00
Brian R. Bondy bb8e455038 Clarify best practice applicability and reduce upstream hallucinations (#35219)
* Clarify best practice applicability and reduce upstream hallucinations

- ARCH-020: Clarify rule applies to bypassing access control, not
  normal inheritance patterns (calling protected methods from subclasses)
- ARCH-062: Clarify CUJ test requirement applies to UI features, not
  backend services or infrastructure
- Review rules: Add explicit instruction to verify upstream code claims
  by reading actual files rather than relying on training data

* Update ARCH-020 friend class example to modern #define pattern

Replace outdated BRAVE_CLASS_NAME_H guidance with the current
chromium_src #define approach for adding friend declarations.
2026-04-02 13:36:07 -04:00
Anthony Tseng a23d6fd1ee Update ARCH-064 to clarify when Unowned User Data pattern is needed (#35175)
Self-contained tab features that don't need external retrieval can use
simple unique_ptr ownership in BraveTabFeatures. The Unowned User Data
pattern should only be used when external code needs to look up the
feature via a static From() method.
2026-04-02 13:09:36 -04:00
Brian R. Bondy 53985f7beb Update CSA-053: distinguish workarounds from permanent design decisions (#34996)
Clarify that CSA-053 only applies to temporary workarounds, not
permanent design decisions. Comments explaining why an alternative
API was not used due to a known limitation do not need TODO tracking
issues when the current code is the intended long-term solution.
2026-03-25 16:48:16 -04:00
Brian R. Bondy bdd31d10f5 Fix stale wiki link in patching docs (#35000)
The wiki content was moved into the docs folder, so the external
link to brave-browser/wiki/Patching-Chromium#making-methods-virtual
now just redirects. Use a local anchor instead.
2026-03-25 15:14:04 -04:00
Brian R. Bondy 92aae1ccc6 Update network endpoint best practices (#34906)
Clarify that network auditor entries are only needed for
endpoints that do not require user opt-in. Add new best
practice (BS-056) requiring all new Brave endpoints be
added to the HSTS pin list.
2026-03-24 08:44:56 -04:00
Brian R. Bondy 0b14f04c96 Remove ARCH-052 mojom default values best practice (#34912)
Mojom code generation already value-initializes all struct fields
via the default constructor, making explicit defaults redundant.
2026-03-24 08:22:20 -04:00
Sangwoo Ko ce0f439a19 [Tree Tabs] Support tab groups in tree tab strip (#34826)
* Support tab groups in tree tab strip

Integrate tab groups with the tree tab strip so that groups are represented
as a single tree node wrapping the group (not one tree node per tab). Tabs
inside a group remain direct children of the group collection.

Collection and delegate:
- BraveTreeTabStripCollectionDelegate: When adding a tab with new_group_id,
  add to collection without wrapping in a tree node; the group wraps it.
  MoveTabsRecursive: handle empty tab_indices (no-op when moving within same
  group), and route move-out-of-group and move-into-group to new helpers.
- MoveTabsIntoGroup: unwrap tabs from tree nodes (or detach from other
  groups), add to target group; when group is detached (new group), wrap
  group in a TreeTabNode and attach at the correct tree position.
- MoveTabsOutOfGroup: move tabs from TabGroupTabCollection back into the
  tree by wrapping each in a tree node at the destination index.
- BraveTabStripCollection: add PopDetachedGroupCollectionForDelegate and
  GetTreeTabNodeIdForGroup; chromium_src TabStripCollection gains virtual
  GetTreeTabNodeIdForGroup. BraveTabStripCollectionDelegate implements
  GetTreeTabNodeIdForGroup.

TreeTabNodeTabCollection:
- BuildTreeTabs: wrap entire groups in one tree node (processed_groups set);
  grouped tabs stay as direct children of the group.
- New constructor that wraps a TabGroupTabCollection (for creating a group
  in tree mode). Single-tab constructor allows null for GetEmptyTreeTabNode
  when a tab was moved into a group and the view still holds the old node id.

Model, controller, and UI:
- BraveTabStripModel::GetTreeTabNodeIdForGroup returns the tree node id for
  a group (or nullptr if tree tabs off). Wired through controller and
  BraveTabStripCollection.
- BraveBrowserTabStripController::GetTreeTabNode returns GetEmptyTreeTabNode()
  when the node is null (e.g. tab just moved into group, before
  TabGroupedStateChanged/AddTabToGroup updates the view).
- OnTreeTabChanged: handle tab index kNoTab and detached state during group
  creation; avoid double-clearing when AddTabToGroup will clear the node id.
- BraveTabStrip::AddTabToGroup override sets the tab's tree_tab_node from
  GetTreeTabNodeIdForGroup when adding to a group in tree mode.
2026-03-24 11:18:48 +01:00
Mihai PLESA ae8356fda8 readme migrate from b-b (#34734) 2026-03-23 09:27:39 -07:00
Brian R. Bondy 54d0a15d3a Add best practice: keep PRs focused on a single purpose (#34891) 2026-03-23 11:11:47 -04:00
Anthony Tseng c11e31c388 Add best practice: don't rely on implicit const char* to string_view for non-null-terminated data (#34866) 2026-03-20 13:37:45 -07:00
Brian R. BondyandClaude Opus 4.6 1f1b6b01cb Update TUF-004: don't use sanitizer-specific filters when upstream flakes broadly (#34874)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 14:20:59 -04:00
Netzenbot 5bb907f22d Add best practices doc for handling upstream docs (#34864)
Add upstream test failures best practices doc

Consolidates upstream-flake filter guidance from testing-isolation.md
(TI-031, TI-032, TI-041, TI-042, TI-043) and patches.md (PATCH-011)
into a dedicated testing-upstream-failures.md. Expands the flake-check
section with full script usage and the LUCI verdict table.
2026-03-20 12:22:23 -04:00
Netzenbot 249704cfca Rename BEST-PRACTICES.md to best_practices.md (#34861)
Update all internal references in skill docs.
2026-03-20 11:23:36 -04:00
Anthony Tseng 5947ff35a8 Revert "Add best practice: use base::as_string_view() for compile-time string length" (#34853)
Revert "Add best practice: use base::as_string_view() for compile-time string…"

This reverts commit 20abc50120.
2026-03-20 11:05:43 +00:00
Anthony Tseng 20abc50120 Add best practice: use base::as_string_view() for compile-time string length (#34838)
Add best practice: use base::as_string_view() for compile-time string length (#34830)
2026-03-19 11:09:40 -07:00
Sangwoo Ko b7a3eeb712 [Tree Tabs] Add split tab support for tree tabs (#34659)
* Add split tab support for tree tabs

In order to support split tabs in tree tabs, mainly we need to reimplment
two methods - CreateSplit and Unsplit.

For CreateSplit, we need to wrap the split tabs in a tree node, and insert it
at the position.
For Unsplit, we need to extract the tabs back to the tree nodes.

- TabStripCollection: virtual CreateSplit, Unsplit, AddCollectionMapping,
  RemoveCollectionMapping; AddTabCollectionAtPosition for delegate.

- BraveTabStripCollection(delegate): override CreateSplit/Unsplit and
  AddCollectionMapping/RemoveCollectionMapping; PassKey overloads for
  AddTabCollectionAtPosition and collection mapping.

- BraveTreeTabStripCollectionDelegate: implement CreateSplit (wrap split in
  tree node, insert at position), Unsplit (extract tabs back to tree nodes),
  AddCollectionMapping/RemoveCollectionMapping for TREE_NODE holding split/group;
  MoveTabsRecursive same-position handling for split/group creation.

- Tab strip API: handle TREE_NODE in tab_converters (unpinned container).

- Docs: tree tabs + split tabs flow and MoveTabsRecursive behavior.
2026-03-17 16:02:52 +09:00
Brian R. Bondy e88f2476b2 Add best practice: use public to restrict header visibility (#34743) 2026-03-15 13:55:46 -04:00
Brian R. Bondy 628bd598c7 Update best practices for feature flags and buildflag confusion (#34722)
* Update best practice: feature flags for significant or experimental features

* Update best practice: clarify buildflag vs feature flag confusion
2026-03-13 18:26:40 -04:00
Brian R. Bondy 8b74765985 Add best practice: PRs should include reasonable test coverage (#34696)
* Add best practice: PRs should include reasonable test coverage

* Add best practice: Use chromium_src include pattern to test upstream overrides
2026-03-12 23:11:13 -04:00
AlexeyBarabash e8302c177f Android settings search indexes (#34576)
Added support for search indexes for Brave preferences fragments
2026-03-12 23:20:56 +02:00
Brian R. Bondy 391da523ab Add Claude skills documentation (#34603) 2026-03-10 10:53:54 -04:00
Aleksei Khoroshilov ce76e01a49 Support contained tabs session restore and sync. (#33313)
* Support contained tabs session restore and sync.

* Review fixes.

* Use struct as a return value instead of optional with out args.

* Add a unit test for view-source: scheme.

* Move TabRestore helper to components.

* Add containers-specific SerializedNavigationBuilder* tests.

* Guard PageState.top.url_string use.

* Add plaster files for few patches.

* Replace browser_tabrestore.cc #define patch with plaster rewrite.

* Replace content_serialized_navigation_builder.cc change with rewrite.

* Fix gn check.

* Add prefix_length check.

* Improve rewrite rules.

* Guard PageState changes with buildflag.

* Rename StoragePartitionKeyToUrlPrefix.

* Add buildflag check into SerializedNavigationEntry.

* Fix build issues with containers buildflag disabled.

* Fix iOS build.
2026-03-10 19:20:50 +07:00
Brian R. Bondy 66d25b65b5 Import best-practice docs from brave-experiments/brave-core-tools (#34568) 2026-03-09 14:15:22 -04:00
Brian Johnson a9fa852335 Add link to plaster best practices in plaster.md (#34517) 2026-03-06 13:43:03 +00:00
Sangwoo Ko 6a49c03cd0 [Tree Tabs] Make TreeTabModel::SetCollapsed/DoesBelongToCollapsedNode() (#34380)
* Make TreeTabModel::SetCollapsed/DoesBelongToCollapsedNode()

TreeTabModel:
- Cache closest collapsed ancestor per node for O(1) visibility checks.
- Add SetCollapsed(id, collapsed) as UI entry point; calls TreeTabNode::set_collapsed()
  and updates cache for affected descendants.
- Add DoesBelongToCollapsedNode(id) for quick "under collapsed" queries.
- Update cache in AddTreeTabNode (new node's closest collapsed), RemoveTreeTabNode
  (recompute nodes that had removed id as closest), and OnTreeTabNodeMoved (recompute
  moved node and its descendants after reparent).

TreeTabNode:
- Add GetClosestCollapsedAncestorId(), IsUnderCollapsedAncestor(), CollectDescendantIds()
  for cache maintenance and tree traversal.

TreeTabNodeTabCollection:
- Add on_move callback; BuildTreeTabs and constructor take on_move.
- OnReparented invokes on_move so TreeTabModel can refresh collapse cache.
- Change on_create signature from void(const TreeTabNode&) to void(TreeTabNode&) so
  delegate can pass AddTreeTabNode (non-const).

BraveTreeTabStripCollectionDelegate:
- Wire on_move to TreeTabModel::OnTreeTabNodeMoved in BuildTreeTabs and in
  single-node TreeTabNodeTabCollection creation sites.
2026-03-05 08:00:19 +09:00
Jay Harris b51cdea900 [docs]: Add a basic overview of frontend testing (#29795) 2026-02-26 22:59:16 +00:00
Artem Samoilenko 79cb1bbb57 [cr145][Android] Replace JavaParamRef -> JavaRef
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/0d6ec7e0f328e9ddd6f5174f61676ff85c777af6

commit 0d6ec7e0f328e9ddd6f5174f61676ff85c777af6
Author: Andrew Grieve <agrieve@chromium.org>
Date:   Tue Dec 2 12:37:02 2025 -0800

    Android: Replace JavaParamRef -> JavaRef (part 5)

    JavaParamRef used to be different, but now is an alias for JavaRef.

    Bug: 40173007
    Change-Id: I9bfa2fcdd012fc90859886ee2e747cb360733421
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7217772
    Commit-Queue: Andrew Grieve <agrieve@chromium.org>
    Owners-Override: Andrew Grieve <agrieve@chromium.org>
    Reviewed-by: Martin Kong <martinkong@google.com>
    Cr-Commit-Position: refs/heads/main@{#1553033}
2026-01-29 13:40:24 -05:00
Aleksei Khoroshilov 110a7e5a42 siso: Include linux toolchain build dependencies. (#32882) 2025-12-22 19:54:36 +01:00
Aleksei Khoroshilov 77b59c1342 siso: Adjust fs_min_flush_timeout value. (#32883) 2025-12-18 23:31:57 +09:00
Aleksei Khoroshilov d1378a7989 Support native RBE in Siso. (#32719)
* Support native RBE in Siso.

* Move sisoenv configuration to gclient custom vars.

* Small adjustments to generation/docs.
2025-12-15 13:16:44 +07:00
Sangwoo Ko 046971c6be Add docs for tree tab architecture (#32520)
This document outlines the planned architecture and design principles
behind the tree tab feature. It covers the responsibilities of
various components, data structures, and interaction patterns to ensure
a cohesive and decoupled implementation.
2025-11-28 01:08:06 +01:00
Brian Johnson 9ebf64af83 Reorganize patching doc (#32512) 2025-11-25 06:14:42 -07:00
Brian Johnson c31f54c9ef Add docs for using forward declarations to minimize dependencies in chromium_src and patches (#32486) 2025-11-24 17:45:14 +01:00
Brian Johnson 0a037ec253 Add docs for stubbing implementations (#32487)
Add docs explaining when replacing upstream implementations is generally acceptable
2025-11-24 09:39:38 -07:00
Brian Johnson 03782c8697 Merge wiki into rust.md (#32475)
Merge the wiki entry into the doc and remove parts that were not correct
2025-11-21 14:01:34 -07:00
Brian Johnson 8d27af6429 Move patching docs to brave-core (#32407)
Copied from https://github.com/brave/brave-browser/wiki/Patching-Chromium
2025-11-18 15:24:54 -07:00
Brian Johnson 7e0819d219 Convert sources.gni codeowner to semgrep (#32229)
see https://github.com/brave/security-action/pull/869
2025-11-17 14:01:26 -07:00
Aleksei Khoroshilov 690938f72c Add docs about ignoring format/presubmit checks. (#32313)
* Add docs about ignoring format/presubmit checks.

* Add java and swift info.

* Sort python info.

* Add link to swift-format doc on ignoring source.
2025-11-17 20:21:59 +07:00
Kyle Hickinson f7fd019e83 Add note about test service creation in keyed service factories (#31984) 2025-10-25 13:18:48 -04:00