Skip to content

classifyFile: order code/config/test extension checks before the docs/ prefix fallback (latent carry-forward soundness) #1330

Description

@mfittko

Problem

classifyFile() in packages/core/src/analysis/diff-analyzer.mjs returns docs for any path under docs/ because the docs/ prefix check precedes the code/.mjs and config/.json extension checks. A code or config file hosted under docs/ (e.g. docs/example.mjs imported by a test, docs/fixture.json consumed at runtime) classifies as docs.

Two fail-closed consumers depend on this classifier and would then treat such a file as prose:

Status: latent, not active

docs/ currently holds only .md/.html/.css prose + presentation assets — no .mjs/.json/.yml. So no code escapes today. The analogous "load-bearing .md" case (SKILL.md etc.) is intentionally docs (Copilot does not code-review prose) and is correct by design. This is a defense-in-depth hardening against a future docs/-hosted script/config being silently carried forward.

Acceptance criteria

  • classifyFile() classifies a path by known code/config/test extension before the docs/ (and any other directory-prefix) fallback, so a docs/example.mjscode and docs/fixture.jsonconfig, while docs/foo.md stays docs.
  • Unit tests cover a code/config/test-extension file under docs/ classifying by extension, and a .md/.html/.css under docs/ still classifying as docs.
  • Both carry-forward consumers (resolveAngleCarryForward, resolveConvergenceCarryForward) inherit the corrected classification (a docs/-hosted code/config delta now re-runs the angle / re-opens the round).
  • npm run verify green.

Non-goals

Changing the docs/-hosted prose (.md/SKILL.md) → docs behavior. Reworking the surface map or the carry-forward decision logic (only the file-kind classifier's ordering).

Found during the #1329 pre-approval deep review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions