BrowserOS icon indicating copy to clipboard operation
BrowserOS copied to clipboard

Patch set: hardcoded enum/ID values drift on every Chromium roll

Open WindriseAI opened this issue 3 weeks ago • 1 comments

Problem

Several patch files insert entries into shared enum/ID lists using absolute numbers. Every Chromium roll shifts those lists, so the same numeric values silently conflict with new upstream entries and the patch either lands on the wrong value or fails to apply with context drift.

Concrete drift observed while rebasing this patch stack from the public pin (155.0.8059.26 / 16c3e5547) to 158.0.8127.18:

  • chrome/app/chrome_command_ids.h: BrowserOS used 40306-40308. Chromium 158 added IDC_SHOW_TTC_MENU 40306, so the three IDs had to move to 40307-40309.
  • chrome/browser/ui/toasts/api/toast_id.h: kBrowserOSToast = 59. Chromium's tail grew to kEnterpriseCopyFailClosed = 64, so the value had to move to 65.
  • extensions/common/mojom/api_permission_id.mojom: kBrowserOS = 275. Chromium 158 took 275, so it had to move to 276.
  • extensions/browser/extension_function_histogram_value.h: the comment // Chromium owns 1978..1988 was accurate at 155 and stale at 158 (Chromium reached 1993), forcing the BrowserOS entries to be renumbered and the comment to be rewritten by hand.
  • components/infobars/core/infobar_delegate.h: BrowserOS used 140/141 at 155. Chromium 158 added CONTEXTUAL_CUE_INFOBAR_DELEGATE_IOS = 140, so they had to move to 141/142; they still sit directly after the upstream tail, so the next delegate collides again.
  • The histogram/permission mirrors under tools/metrics/** (enums.xml, histograms.xml, actions.xml) must be re-synced by hand in lockstep; LINT.ThenChange only pins the file relationship, not the values.

Net effect: a version bump is not just "resolve patch conflicts". A missed renumber compiles and records the wrong enum value, and upstream has no automated way to notice.

Suggested fix

  • A scheduled CI job that dry-run applies the full patch stack against the next Chromium snapshot (canary / pinned roll candidate) and fails on rejected hunks, fuzzy offsets, and "inserted value already used upstream" for command IDs, toast IDs, infobar delegates, mojom permissions, and histogram enums.
  • A lightweight pre-submit check that parses the patch files for inserted absolute values and compares them against the list tails at the target pin, instead of relying on hand-maintained reserved-range comments that drift.
  • Longer term, prefer append-at-end markers that the roll tooling rewrites (or a reserved sentinel range), so the patch does not hardcode absolute values.

I can share the exact per-file collision list from the rebase above as reference data if useful.

WindriseAI avatar Nov 11 '26 05:11 WindriseAI

Eight days on, with repo evidence instead of a plain ping.

  • The numbers in the report are still the numbers on main: packages/browseros/CHROMIUM_VERSION is 155.0.8059.26, chromium_patches/.store.yaml base_commit is 16c3e55476d3564bea713314b2fff638749ce3e6, and chromium_patches has had no commit since #2805 (2026-10-02), so nothing has been renumbered or re-checked in the meantime.
  • The only version guard in the tree is release-only and compares declared versions, not patch values: bos_build/config/BROWSEROS_RELEASE_MIN_CHROMIUM_VERSION reads 158.0.8127.18, and validate_release_chromium_version merely rejects a selected source below that floor.
  • bos-build-tests.yml triggers on bos_build/** and chromium_files/products/** but not on chromium_patches/**, so editing a patch that renumbers an enum produces no CI signal at all.

If you want the pre-submit half of the proposal first, I can prototype a standalone check that extracts the inserted absolute values from the patch files and diffs them against the target pin's list tails, and open it as a small PR once the expected failure output is agreed on.

WindriseAI avatar Nov 19 '26 01:11 WindriseAI