feat(testing): return manifest disagreements as data - #50
Merged
Conversation
`assertManifestMatches` compared `package.json` with what `src` declares and reported every disagreement as a sentence in one thrown error. That is the right shape for a test and the wrong one for anything else: a tool that wants to print the disagreements, count them, or apply the mechanical part of the fix had to parse prose. `diffManifest` is the comparison on its own, returning each disagreement as data: which contribution point, which side is missing the entry -- or `drift`, when both have it and disagree about its type, default, enum or scope -- the id it concerns, and the JSON that would settle it when the fix is mechanical. A missing command or setting carries that JSON; a missing view does not, because a view needs a container and which one is a decision the declaration does not carry. The assertion is unchanged in what it reports, and is now built on the diff, so the two cannot disagree about what disagrees. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Merged
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
assertManifestMatchescomparespackage.jsonwith the declarations insrc— command ids, setting types, defaults, enums, scopes, view ids — and throws one error listing every disagreement. That is what a test wants. A tool wants the same comparison as data, and had no way to get it.diffManifest(manifest, declared)is that comparison, returningManifestMismatch[]:What
pastecarries, and what it deliberately does notA command declared in
srcand absent from the manifest gets{ "command": "…", "title": "TODO" }; a setting gets its type, default, enum and scope with a placeholder description. Both are mechanical facts the declaration already states.A missing view gets no
paste: it needs a container, and which one is a design decision the declaration does not carry. Drift gets none either — both sides have the entry and disagree about a value, and the fix is a judgement about which side is right, not a paste.Compatibility
Additive.
assertManifestMatchesreports exactly what it did — it is now implemented on top ofdiffManifest, and a test pins that its message contains every summary the diff returns, so the two cannot disagree. Exported from@kkdev92/vscode-ext-kit/testingalongside the assertion.Verification
npm run quality(1074 tests) andnpm run verify:packagepass. Four new cases cover an agreeing manifest, one disagreement of every kind and direction in check order, wherepasteis and is not attached, and the assertion's message matching the diff.A published extension built on this package — whose own test suite uses
assertManifestMatches— was run against this build unchanged: type-check, lint and 271 tests pass.🤖 Generated with Claude Code