Skip to content

refactor(ci): shard product-file line-count ratchet - #9942

Merged
Git-on-my-level merged 1 commit into
mainfrom
refactor/shard-product-line-ratchets
Jul 18, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
refactor/shard-product-line-ratchets

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 17, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Replace the shared product-file line-count baseline with 15 deterministic, ownership-scoped JSON shards.
  • Keep file caps and raise_justifications together in the same shard, with no mutable global index/manifest.
  • Preserve mandatory same-PR downward ratcheting; a post-merge writer is deliberately not made authoritative.
  • Load the legacy monolithic baseline at historical refs so this migration preserves raise/removal validation for branches spanning the transition.

Why

The monolithic baseline received 35 commits in roughly 46 hours and became a conflict hotspot for unrelated backend, Rust, and macOS work. PR #9853 had to reconcile it repeatedly while rebasing.

The new baseline_shard_relative() uses only stable source-path ownership rules:

  • backend/{database,routers,utils,other}
  • desktop-rust
  • immediate Desktop/Sources/<subsystem> Swift shards, plus a root shard

This avoids replacing the hotspot with a central registry. The checker aggregates shards in memory and rejects duplicate, misplaced, unsupported, or orphaned entries.

Sol critique incorporated

  • Keep same-PR downward updates: a nonblocking post-merge bot would permit a source to regrow against its stale higher cap before the bot writes the reduction.
  • Rewrite only the shard(s) owning changed source paths.
  • Keep each justification beside its cap and validate global aggregation.
  • Support legacy-at-base and sharded-at-head transition validation.

Verification

  • python3 -m py_compile .github/scripts/check_product_file_line_count_ratchet.py .github/scripts/test_check_product_file_line_count_ratchet.py
  • python3 .github/scripts/test_check_product_file_line_count_ratchet.py — 8 passed
  • python3 .github/scripts/test_run_checks.py — 20 passed
  • python3 .github/scripts/check_product_file_line_count_ratchet.py --changed-files /tmp/omi-ratchet-changed-files.txt --base origin/main
    • confirmed the 44 file caps and 31 justifications match the legacy baseline exactly across 15 shards

Failure-Class: none

Review in cubic

Replace the shared ratchet baseline with deterministic ownership-scoped JSON shards.\n\nKeep same-PR downward ratcheting intact, validate shard placement and aggregation, and load the legacy baseline at historical refs so the migration does not weaken transition checks.
@Git-on-my-level
Git-on-my-level force-pushed the refactor/shard-product-line-ratchets branch from c49e7da to aebb888 Compare July 18, 2026 01:09
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Omi monitor — rebase conflict resolved, CI green

The PR was DIRTY/conflicting with main (the auto-rebase aborted). I resolved it and force-pushed aebb888e.

What changed

  • Rebased onto latest origin/main. The conflict was a modify/delete on the retired monolithic product_file_line_count_ratchet_baseline.json: the PR deletes it in favor of 15 ownership-scoped shards, but main had updated 5 caps in the monolith after this PR branched. I reconciled the 5 affected shard entries to main's authoritative values so the sharded baseline aggregates to exactly main's current state (no ratchet regression):
    • TasksPage.swift 5490 → 5510, TasksStore.swift 2949 → 2961 (main raised)
    • ProactiveAssistantsPlugin.swift 1608 → 1607, ActionItemStorage.swift 1610 → 1607, RewindPage.swift 1907 → 1850 (main lowered)
    • Updated the 3 corresponding raise_justifications to main's current text (the other 2 were already identical).
  • Fixed a pre-push hook failure in the new test. test_baseline_at_ref_supports_legacy_then_sharded_migration (added by this PR) spawns git subprocesses, and its helper plus baseline_at_ref inherited GIT_DIR/GIT_WORK_TREE from the hook context, redirecting those subprocesses at the parent repo. Added a shared _clean_git_env() and scrub those vars in both the test helper and the checker's baseline_at_ref subprocess calls, so the migration path is robust under any hook (pre-push/pre-receive) that exports them.

Verification

  • python3 .github/scripts/test_check_product_file_line_count_ratchet.py — 8 passed (verified under both clean env and a simulated pre-push GIT_DIR env)
  • python3 .github/scripts/test_run_checks.py — 20 passed
  • python3 .github/scripts/check_product_file_line_count_ratchet.py --changed-files <pr diff> --base origin/main — OK (no transition errors, no growth failures)
  • make preflight — 14 checks passed (Repo Checks hygiene, product-file-line-count-ratchet + its tests, manifest contract, diff-hygiene, architecture guardrails)
  • Aggregated shards equal main's monolithic baseline exactly (files + justifications) — confirmed programmatically
  • Pre-push gate passed; CI: 8 SUCCESS, 0 FAILURE (Desktop Swift Build & Tests ✅, Hygiene ✅, Formatting ✅, Detect Changes ✅)

PR is now MERGEABLE (was DIRTY); remaining BLOCKED is only REVIEW_REQUIRED, which is outside this monitor's scope.

@Git-on-my-level
Git-on-my-level merged commit 3da5eaf into main Jul 18, 2026
22 checks passed
@Git-on-my-level
Git-on-my-level deleted the refactor/shard-product-line-ratchets branch July 18, 2026 03:00
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
## Summary

- Replace the shared product-file line-count baseline with 15
deterministic, ownership-scoped JSON shards.
- Keep file caps and `raise_justifications` together in the same shard,
with no mutable global index/manifest.
- Preserve mandatory same-PR downward ratcheting; a post-merge writer is
deliberately **not** made authoritative.
- Load the legacy monolithic baseline at historical refs so this
migration preserves raise/removal validation for branches spanning the
transition.

## Why

The monolithic baseline received 35 commits in roughly 46 hours and
became a conflict hotspot for unrelated backend, Rust, and macOS work.
PR BasedHardware#9853 had to reconcile it repeatedly while rebasing.

The new `baseline_shard_relative()` uses only stable source-path
ownership rules:

- `backend/{database,routers,utils,other}`
- `desktop-rust`
- immediate `Desktop/Sources/<subsystem>` Swift shards, plus a `root`
shard

This avoids replacing the hotspot with a central registry. The checker
aggregates shards in memory and rejects duplicate, misplaced,
unsupported, or orphaned entries.

## Sol critique incorporated

- Keep same-PR downward updates: a nonblocking post-merge bot would
permit a source to regrow against its stale higher cap before the bot
writes the reduction.
- Rewrite only the shard(s) owning changed source paths.
- Keep each justification beside its cap and validate global
aggregation.
- Support legacy-at-base and sharded-at-head transition validation.

## Verification

- `python3 -m py_compile
.github/scripts/check_product_file_line_count_ratchet.py
.github/scripts/test_check_product_file_line_count_ratchet.py`
- `python3
.github/scripts/test_check_product_file_line_count_ratchet.py` — 8
passed
- `python3 .github/scripts/test_run_checks.py` — 20 passed
- `python3 .github/scripts/check_product_file_line_count_ratchet.py
--changed-files /tmp/omi-ratchet-changed-files.txt --base origin/main`
- confirmed the 44 file caps and 31 justifications match the legacy
baseline exactly across 15 shards

Failure-Class: none


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/9942?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant