Skip to content

fix: land dspack contract-surface review fixes that missed PR #3#5

Merged
ryandmonk merged 1 commit into
mainfrom
fix/dspack-contract-review-followup
Jun 12, 2026
Merged

fix: land dspack contract-surface review fixes that missed PR #3#5
ryandmonk merged 1 commit into
mainfrom
fix/dspack-contract-review-followup

Conversation

@ryandmonk

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #3 ("Add dspack contract surface to cross-surface drift analysis"). The review fixes were committed locally (09d7187) but never pushed, so #3 merged without them. This PR cherry-picks that commit onto current main so the review feedback actually lands.

  • Contract presence is now based on lookup success (contractData !== null), not on non-empty prop/variant inventories. A component declared in the dspack file with no props/variants is no longer falsely flagged missing-in-contract; its empty inventory yields staleness findings for whatever code has. New regression test covers the declared-but-empty case.
  • missing-in-code findings carry the contract's declared display name (e.g. "Button") in both message and contractValue, even when the component was requested by kebab ID. New test asserts this.
  • findRepoRoot() is now lazy — moved inside the --dspack/config branch so the common no-contract path skips the extra filesystem walk.

Test plan

  • Full watcher suite passes: 78 files, 1992 tests (pnpm test)
  • Cherry-pick applied cleanly onto origin/main with no conflicts

🤖 Generated with Claude Code

…s, lazy repo-root

- Contract presence is now based on lookup success (contractData !== null),
  not on non-empty prop/variant inventories. A component declared in the
  dspack file with no props/variants is no longer falsely flagged
  missing-in-contract; its empty inventory yields staleness findings for
  whatever code has. New regression test covers the declared-but-empty case.
- missing-in-code component findings now carry the contract's declared
  display name (e.g. "Button") in both message and contractValue, even when
  the component was requested by kebab ID. New test asserts this.
- findRepoRoot() for contract path resolution moved inside the
  --dspack/config branch so the common no-contract path skips the extra
  filesystem walk.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 12, 2026 19:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Cherry-picks missed review fixes from PR #3 to make dspack contract-surface drift analysis behave correctly and avoid unnecessary work in the no-contract CLI path.

Changes:

  • Treat contract component presence as “declared iff lookup succeeded” (contractData !== null), allowing declared-but-empty contract entries to produce staleness findings instead of “missing-in-contract”.
  • Ensure “missing-in-code” findings use the contract’s declared display name (in both message and contractValue) even when the query uses a kebab-case ID.
  • Make findRepoRoot() lazy for contract-path resolution so the early “no contract configured / abort” path doesn’t do an extra repo-root walk.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/watcher/src/crossSurfaceDrift/cliCrossSurfaceDrift.ts Lazily calls findRepoRoot() only when resolving a configured --dspack/config contract path.
packages/watcher/src/crossSurfaceDrift/analyze.ts Updates contract presence semantics and uses contract-declared display name for “missing-in-code” findings.
packages/watcher/src/crossSurfaceDrift/tests/contractDrift.test.ts Adds regression tests for declared-but-empty contract entries and for contract display-name propagation.

@ryandmonk ryandmonk merged commit 241c0dd into main Jun 12, 2026
2 checks passed
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.

2 participants