Skip to content

Add CI zombie-import gate: detect imports from gutted modules #2195

@alexey-pelykh

Description

@alexey-pelykh

Problem

DIFF-SYNC batches silently re-introduce imports from gutted modules (pi-embedded, model-catalog, memory, skills, etc.). These imports compile because stub files exist, but they exercise dead code paths. The existing gates (build, lint, rebrand) don't catch this.

Proposed Solution

A CI check script (similar to check-no-random-messaging-tmp.mjs and the rebrand gate) that:

  1. Maintains a list of known-dead module patterns:

    agents/pi-embedded
    agents/model-catalog
    agents/model-fallback
    agents/model-selection
    agents/skills
    agents/sandbox
    agents/pi-embedded-runner
    memory/
    acp/control-plane
    acp/runtime
    
  2. Greps all .ts files for from ".*{pattern}" or import.*{pattern}

  3. Allows exceptions list (e.g., test files that mock for negative testing, the system-prompt.test.ts negative assertion)

  4. Fails CI if any non-excepted import from a dead module is found

Implementation

  • Script: scripts/check-no-zombie-imports.mjs (matches naming of existing check-no-random-messaging-tmp.mjs)
  • CI integration: Add as a step in the CI workflow, alongside rebrand-gate
  • Dead module list: maintain in the script (or a config file)
  • Exception list: inline comments // zombie-gate-allow: {reason} or a separate config

Why CI, not just DIFF-SYNC

  • DIFF-SYNC gates run only during sync batches
  • Manual changes (feature work, bug fixes) can also accidentally import from dead modules
  • CI catches ALL paths — sync, manual, cherry-pick, hotfix

Relationship to #2192

Issue #2192 (stub audit) eliminates the stub FILES. This gate prevents new IMPORTS. Together they close both vectors:

Priority

Should be implemented alongside or after #2192. The gate is most valuable once stubs are eliminated — at that point, any import from a dead module is a guaranteed build break, but the gate provides earlier, clearer feedback than a type error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions