Repository navigation
fix(ci): allow the platform-boundary dylint manifest in the crate hook; test the allowlist parity - #1912
Merged
Conversation
…st the allowlist parity `ci/hooks/crate_guard.py` (real-time PreToolUse) and `ci/check_workspace_crates.py` (batch, crate-gate.yml) each carry a hand-maintained allowlist, and both docstrings only say "keep the two lists in sync". Nothing asserted it, so the real-time list had drifted: `dylints/enforce_platform_boundary` has a real `Cargo.toml` and is listed in the root `[workspace] exclude`, but was missing from `APPROVED_CRATE_DIRS` -- so the hook denied every Edit/Write of that manifest with a "you are creating a new crate" message. That is a blocking false positive on the permanent whole-tree-scanner dylint (#1306/#1315), i.e. exactly the policy work it exists to protect; same bug class as #794 ("a worktree of this repo is still this repo"). * add the missing entry to `APPROVED_CRATE_DIRS`; * new `ci/test_crate_guard_parity.py` asserts the repository facts instead of the list text: `APPROVED_MEMBERS` == `[workspace] members` exactly; every `[workspace] exclude` dir that actually contains a `Cargo.toml` is writable through the hook; the hook authorizes nothing beyond members + exclude + the repo root (a stale entry must not pre-authorize a crate somebody adds later); no entry has rotted to a missing directory; * three of the tests drive the real hook process with JSON on stdin (root manifest allow, excluded dylint manifest allow, new crate deny), so the decision path is covered, not just the constants; * register the module in `ci/local_suites.py` and the drift workflow step; * correct the stale "workspace root + 14 member dirs" note in CLAUDE.md (there are 21 members) and point ci/README.md at the parity test.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This was referenced Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The monocrate policy ("no new crates") is enforced twice from two files that both only ask humans to keep them in sync:
crate-gate.ymlci/check_workspace_crates.pyAPPROVED_MEMBERSci/hooks/crate_guard.pyAPPROVED_CRATE_DIRSThe real-time list had already drifted:
dylints/enforce_platform_boundaryhas a realCargo.tomland is listed in the root[workspace] exclude, but was not inAPPROVED_CRATE_DIRS. The hook therefore denied everyEdit/Writeof that manifest with a "you are creating a new crate" message — a blocking false positive on the permanent whole-tree-scanner dylint (#1306 / #1315), i.e. on exactly the policy work the dylint protects. This is the same bug class as #794 ("a worktree of this repo is still this repo with the same approved-crates contract"): the allowlist misdescribes the repository.Change
dylints/enforce_platform_boundaryentry;ci/test_crate_guard_parity.py— asserts repository facts, not list text:APPROVED_MEMBERS==[workspace] members, exactly, both directions;[workspace] excludedir that actually contains aCargo.tomlis writable through the hook;crates/fbuild-not-approved/Cargo.toml→ deny;ci/local_suites.pyDRIFT_UNITTEST_MODULES+ theci-workflow-drift.ymlstep (soci.test_local_suites' parity and no-unwired-module guards hold);ci/README.mdbullet points at the parity test; CLAUDE.md's stale "workspace root + 14 member dirs" note corrected (there are 21 members).No new workflow, no new crate, no threshold change.
RED → GREEN (real output)
Before the allowlist fix, the new module fails on exactly the two drift assertions:
After the one-line allowlist addition:
Hosted self-test set (
ci-workflow-drift.ymlstep, verbatim module list) went 103 → 110 tests, OK (Ran 110 tests in 1.916s).Other gates:
uv run --no-project python -m ruff check ci/test_crate_guard_parity.py ci/hooks/crate_guard.py ci/local_suites.py→All checks passed!;python ci/check_python_complexity.py→All checks passed!(the new file is tracked, so it is inside the C901/RUF100 ratchet);python ci/check_workspace_crates.py→OK: 21 approved workspace members, no new crates.bash testcannot run on this host (fbuild-pythonlinks-lpython3.14, only libpython 3.13 is installed — pre-existing environmental), and this change touches no Rust.Refs #1315, #1639, #794.