Repository navigation
fix(aggregator): reject unsafe OpenChamber quota lib checkouts (#5721) - #11225
Conversation
resolveLibDir() in gather-quota.ts fell through to the first existing checkout (~/git/openchamber-fork) gated only by existsSync(quota/index.js), so a parked or stale checkout was imported. Candidates are now validated by src/openchamber-lib.ts: clean working tree, branch main, valid HEAD. No candidate is imported unless it passes; the keeper fails soft and the subcommand readings still run. The export check moves to loadOpenChamberLib(), after ensureLibDependencies (#8759 ordering). Oracle: test/openchamber-lib.test.ts (fake git states, named rejection messages), test/gather-quota.test.ts #8759 end-to-end on a clean main checkout.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Closes #5721.
Problem
resolveLibDir()inpm-stack/aggregator/scripts/gather-quota.tsreturned the first candidate withquota/index.js, gated only byexistsSync. On the laptop thedevtoday-openchambercheckout is parked onqueue/8357-224, so a stale or parked checkout could be imported. PR #7133 carried the fix and closed unmerged; this re-lands it on current main.Change
src/openchamber-lib.ts:resolveLibDir(candidates)accepts only a clean checkout onmainwith a valid HEAD, and imports nothing.loadOpenChamberLib(lib)runs the export check after dependencies are installed (keeps the quota-gatherer: opendesign-renewal fails on every tick — "Cannot find package 'yaml'" in the OPENCHAMBER_LIB_DIR checkout (no node_modules) #8759 ordering).scripts/gather-quota.ts: the keeper resolves through the gate inside its existing fail-softtry. A rejected checkout skips the keeper; subcommand readings still run. The module-levellibDirfallthrough is removed.test/openchamber-lib.test.ts(oracle: fake git states, named rejection messages).test/gather-quota.test.tsquota-gatherer: opendesign-renewal fails on every tick — "Cannot find package 'yaml'" in the OPENCHAMBER_LIB_DIR checkout (no node_modules) #8759 fixture is now a cleanmaincheckout.Verification
bun test test/openchamber-lib.test.ts test/gather-quota.test.ts: 14 pass, 0 fail.bunx tsc --noEmit: clean.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.