refactor(ci): reform zombie-import gate (ADR 0005 H3)#2357
Merged
alexey-pelykh merged 1 commit intomainfrom Apr 14, 2026
Merged
refactor(ci): reform zombie-import gate (ADR 0005 H3)#2357alexey-pelykh merged 1 commit intomainfrom
alexey-pelykh merged 1 commit intomainfrom
Conversation
… existence scan + allowlist sunset (ADR 0005 H3) Three-part reform of the zombie-import CI gate: 1. **Registry-derived patterns**: Dead module patterns are now derived from scripts/data/tombstones.json (generated from HQ disposition registry) combined with 8 fallback directory-level patterns. Eliminates hardcoded pattern drift — adding a tombstone to the registry automatically extends gate coverage. 2. **Tombstone existence scan**: For each tombstoned path, the gate checks whether the file exists on disk. Re-introduced files are caught even when nothing imports them. Uses .zombie-tombstone-baseline (currently 12) to track known debt (#2356) while preventing growth. 3. **Allowlist sunset**: The hardcoded allowedCallsites Set is replaced by scripts/data/zombie-import-allowlist.json — each entry requires a tracked issue URL. Growth is prevented by .zombie-import-allowlist-baseline. Stale entries removed; 71 live entries baselined with #2355. **Critical bug fix**: The original gate used resolveRepoRoot() (designed for scripts/lib/) which resolved 2 levels up from scripts/ — pointing to the repo's PARENT directory. Source roots didn't exist there, so the gate scanned zero files and vacuously passed. Fixed to resolveRepoRootFromScript() (1 level up), consistent with check-stub-debt.mjs. Gate runs in ~2.5s on current fork (AC: <5s). Refs: remoteclaw/hq#24 Tracked debt: #2355 (71 allowlisted imports), #2356 (12 tombstoned files) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
alexey-pelykh
added a commit
that referenced
this pull request
Apr 21, 2026
… + rebaseline allowlist (#2355) Restore ADR 0005 H3 (PR #2357) after it was reverted by the v2026.3.7→v2026.3.8 sync (PR #2360, `fc2cefeeab`), which rolled `scripts/check-no-zombie-imports.mjs` back to its pre-H3 hardcoded form and orphaned the JSON allowlist + baselines. Changes: 1. Restore H3 gate script with registry-derived `deadModulePatterns`, JSON allowlist loader, tombstone existence scan, and baseline comparison — identical to `af4169bf9a` minus the targeted narrowing in point 2. 2. Narrow `acp/runtime` fallback pattern: split broad `acp/runtime` into `acp/runtime/session-meta` and `acp/runtime/session-identifiers` (the only 4-line stubs in that namespace). `acp/runtime/errors`, `acp/runtime/registry`, and `acp/runtime/types` are live public API re-exported by `src/plugin-sdk` — the broad pattern was catching them as false positives. 3. Rebaseline allowlist JSON from 68 → 23 entries: - 42 stale entries removed (line drift during H3's offline period) - 11 false-positive entries removed post-narrowing - 8 previously-unallowed new violations retained - Remaining 23: 13 `agents/model-selection`, 7 `agents/sandbox`, 3 `acp/runtime/session-meta`, 1 `agents/skills` 4. Decrement baselines: - `.zombie-import-allowlist-baseline`: 71 → 23 - `.zombie-tombstone-baseline`: 12 → 0 (all tombstoned files already absent; #2356 is auto-satisfied) `agents/model-selection` broad pattern is KEPT despite the file having live H9-attested functions — those are pending gutting per the Middleware Boundary Principle, tracked debt rather than gate false positives. Follow-up gutting issue to be filed. Gate passes locally: `Zombie-import gate: 36 tombstones, 45 patterns, 23 allowlisted callsites. Import scan: clean.` Refs: ADR 0005 H3 (engineering/decisions/0005-fork-sync-hardening.md) Regression source: #2360 (sync v2026.3.7→v2026.3.8) Auto-satisfied: #2356 (0 tombstoned files exist) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
4 tasks
alexey-pelykh
added a commit
that referenced
this pull request
Apr 21, 2026
… + rebaseline allowlist (#2355) (#2454) Restore ADR 0005 H3 (PR #2357) after it was reverted by the v2026.3.7→v2026.3.8 sync (PR #2360, `fc2cefeeab`), which rolled `scripts/check-no-zombie-imports.mjs` back to its pre-H3 hardcoded form and orphaned the JSON allowlist + baselines. Changes: 1. Restore H3 gate script with registry-derived `deadModulePatterns`, JSON allowlist loader, tombstone existence scan, and baseline comparison — identical to `af4169bf9a` minus the targeted narrowing in point 2. 2. Narrow `acp/runtime` fallback pattern: split broad `acp/runtime` into `acp/runtime/session-meta` and `acp/runtime/session-identifiers` (the only 4-line stubs in that namespace). `acp/runtime/errors`, `acp/runtime/registry`, and `acp/runtime/types` are live public API re-exported by `src/plugin-sdk` — the broad pattern was catching them as false positives. 3. Rebaseline allowlist JSON from 68 → 23 entries: - 42 stale entries removed (line drift during H3's offline period) - 11 false-positive entries removed post-narrowing - 8 previously-unallowed new violations retained - Remaining 23: 13 `agents/model-selection`, 7 `agents/sandbox`, 3 `acp/runtime/session-meta`, 1 `agents/skills` 4. Decrement baselines: - `.zombie-import-allowlist-baseline`: 71 → 23 - `.zombie-tombstone-baseline`: 12 → 0 (all tombstoned files already absent; #2356 is auto-satisfied) `agents/model-selection` broad pattern is KEPT despite the file having live H9-attested functions — those are pending gutting per the Middleware Boundary Principle, tracked debt rather than gate false positives. Follow-up gutting issue to be filed. Gate passes locally: `Zombie-import gate: 36 tombstones, 45 patterns, 23 allowlisted callsites. Import scan: clean.` Refs: ADR 0005 H3 (engineering/decisions/0005-fork-sync-hardening.md) Regression source: #2360 (sync v2026.3.7→v2026.3.8) Auto-satisfied: #2356 (0 tombstoned files exist) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Three-part reform of the zombie-import CI gate, implementing H3 from ADR 0005 (Fork Sync Hardening):
Critical bug fix: The original gate used `resolveRepoRoot()` (designed for `scripts/lib/`) which resolved 2 levels up from `scripts/` — pointing to the repo's PARENT directory. The gate scanned zero files and vacuously passed on every run since it was added (#2247). Fixed to `resolveRepoRootFromScript()` (1 level up), consistent with `check-stub-debt.mjs`.
Changes
Test plan
Refs: remoteclaw/hq#24, ADR 0005
Tracked debt: #2355 (71 allowlisted imports), #2356 (12 tombstoned files on disk)
🤖 Generated with Claude Code