fix: land dspack contract-surface review fixes that missed PR #3#5
Merged
Conversation
…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>
There was a problem hiding this comment.
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
messageandcontractValue) 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. |
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
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.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.messageandcontractValue, 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
pnpm test)origin/mainwith no conflicts🤖 Generated with Claude Code