Skip to content

fix(check): detect stale generated outputs - #102

Merged
sampleXbro merged 11 commits into
sampleXbro:developfrom
VVeb1250:check-stale-outputs
Jul 21, 2026
Merged

fix(check): detect stale generated outputs#102
sampleXbro merged 11 commits into
sampleXbro:developfrom
VVeb1250:check-stale-outputs

Conversation

@VVeb1250

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #99 after the checksum-based fix for #98 landed on master.

  • extract a read-only findStaleGeneratedOutputs helper from the existing generate-time cleanup
  • detect files present in configured targets' managed output locations but absent from the lock outputs map
  • expose additive canonicalDrift, outputDrift, and outputsStale fields across the core/programmatic API, CLI JSON, and MCP check result
  • document stale-output detection and add a patch changeset

Design

This keeps check on the fast lock/checksum path: it does not invoke the generation pipeline. The lock outputs map remains the expected-output set, so canonical edits do not create output-noise. Output scanning is skipped for old-format locks and for check --no-outputs, preserving the existing migration and gitignored-output escape hatches.

The stale finder is read-only. Normal generation still owns deletion by calling the existing cleanup wrapper.

Validation

  • build, lint, typecheck, and website build pass
  • focused check/core/CLI/MCP/stale-cleanup suites: 81 tests pass
  • contract suite: 665 tests pass
  • full suite: 10,482 tests pass; 42 pre-existing Windows-only symlink tests cannot create symlinks (EPERM)
  • E2E: 620 tests pass; remaining failures are unrelated Windows exact-tree/symlink cases plus an existing 10-second performance threshold on this host

Implements the follow-up requested in #99 and builds on the resolution of #98.

@VVeb1250
VVeb1250 marked this pull request as ready for review July 21, 2026 12:13
The stale-output scan spread config.pluginTargets directly; every other
call site in the codebase guards it with '?? []'. ValidatedConfig always
populates the field, so this is a robustness/consistency fix for configs
constructed outside the Zod parse path.
Per the repo 'plugins are first-class targets' contract, any code that
iterates targets must hold for registered plugin descriptors, not just
builtins. The stale-output scan iterates config.pluginTargets, so add a
lock-sync test that registers a plugin descriptor with a managedOutputs
layout and asserts a hand-added file under its managed dir is reported in
outputsStale (resolved via getDescriptor, not builtin-only).
Stale-output detection adds new user-facing behavior plus additive CLI
JSON and MCP result fields (canonicalDrift, outputDrift, outputsStale).
Under semver that is a backward-compatible feature, so minor is the
correct bump for a 0.x release rather than patch.
@sampleXbro
sampleXbro changed the base branch from master to develop July 21, 2026 16:11
pnpm audit --prod --audit-level=high failed on tar versions up to 7.5.18:
- critical GHSA-23hp-3jrh-7fpw (decompression/parse DoS), patched 7.5.19+
- high GHSA-8x88-c5mf-7j5w (negative entry size infinite loop), patched 7.5.18+

tar is a direct prod dependency, so bumping the pin from 7.5.13 to 7.5.20
clears both. Lockfile regenerated with pnpm 10 to match CI; frozen install
and the audit gate both verified green. Pre-existing issue, unrelated to
the check changes on this branch.
@sampleXbro

Copy link
Copy Markdown
Owner

Hey @VVeb1250 ! Thanks for the PR. I added a few corrections and merge it

@sampleXbro
sampleXbro merged commit 65c1537 into sampleXbro:develop Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants