Skip to content

feat(testing): return manifest disagreements as data - #50

Merged
kkdev92 merged 1 commit into
mainfrom
feat/manifest-diff-4.1.0
Aug 29, 2026
Merged

feat(testing): return manifest disagreements as data#50
kkdev92 merged 1 commit into
mainfrom
feat/manifest-diff-4.1.0

Conversation

@kkdev92

@kkdev92 kkdev92 commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Summary

assertManifestMatches compares package.json with the declarations in src — 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, returning ManifestMismatch[]:

{
  kind: 'setting',                 // 'command' | 'setting' | 'view'
  direction: 'drift',              // 'missing-in-manifest' | 'missing-in-src' | 'drift'
  id: 'sample.limit',
  summary: 'setting "sample.limit" is "number" in the manifest and "integer" in src',
  paste: undefined,                // the JSON that settles it, when the fix is mechanical
}

What paste carries, and what it deliberately does not

A command declared in src and 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. assertManifestMatches reports exactly what it did — it is now implemented on top of diffManifest, and a test pins that its message contains every summary the diff returns, so the two cannot disagree. Exported from @kkdev92/vscode-ext-kit/testing alongside the assertion.

Verification

npm run quality (1074 tests) and npm run verify:package pass. Four new cases cover an agreeing manifest, one disagreement of every kind and direction in check order, where paste is 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

`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>
@kkdev92
kkdev92 merged commit 47f114d into main Aug 29, 2026
10 checks passed
@kkdev92 kkdev92 mentioned this pull request Aug 29, 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.

1 participant