Pin the bundled allowlist/exclude-set disjointness invariant with a test (#761) - #767
Conversation
discoverBundledPlugins checks V1_BUNDLED_PLUGIN_ALLOWLIST before V1_EXCLUDED_FROM_DEFAULT, so a plugin name accidentally added to both would load by default while ridersInDefaultSet (walkthrough.js) treats it as excluded. Nothing asserted the two sets stay disjoint; add a test that does.
neutral review - round 1Head reviewed: One nit, on the failure message, which is the whole point of a test like this. Two results worth pulling out of the record below:
Worktree clean, my scratch file removed (other files in the shared scratchpad belong to other sessions and were left alone). Here is the review record. VERDICT: findings The test discriminates, fails informatively, and is the only thing in the suite that catches the general case. One nit on the failure message's wording, which is one clause away from exact. 1. nit -
|
…ng, not default activation (#761)
neutral review - round 2 (final)Head reviewed: VERDICT: clean Nothing ship-blocking, and nothing below blocker either. The round-1 nit is fixed, the Round-1 finding, re-derivedFixed. The message now reads: I re-derived the mechanism from source rather than from the round-1 record or the The question that decides it - is there any site that acts on a plugin purely because
So the old clause was false and the new one is true. Fixed without introducing a new problem. I judged the emitted text as a reader with One correction to the record, since I was asked not to inherit accounts: the round-1 Also checked, clean
|
Closes item 2 of #761. Item 1 of #761 (the JSDoc correction in
hypaware-core/smoke/flows/walkthrough_picker_to_first_query.js:581-584)only exists on PR #757's branch, which is open and held for a human to
merge; there is nothing to edit on
masterfor it, so this PR does nottouch it. #761 should stay open (or be otherwise tracked) until #757 lands
and item 1 can be applied there.
What this adds
src/core/runtime/bundled.jsexportsV1_BUNDLED_PLUGIN_ALLOWLIST(defaultactivation) and
V1_EXCLUDED_FROM_DEFAULT(bundled plugins requiringexplicit opt-in). Several call sites are correct only because those two sets
are disjoint, and nothing asserted it:
discoverBundledPlugins(src/core/runtime/bundled.js:151-157) checksallowlist.has(name)beforeexcludeSet.has(name), so a name present inboth sets lands in
loaded.ridersInDefaultSet(src/core/cli/walkthrough.js:2083-2091) filters onnon-membership of
V1_EXCLUDED_FROM_DEFAULT.A name in both sets would make those two reads disagree, and the resulting
failure would surface downstream (a red release smoke pointing at a golden
config) rather than at the actual cause.
New test:
test/core/bundled-sets.test.js, assertingV1_BUNDLED_PLUGIN_ALLOWLISTandV1_EXCLUDED_FROM_DEFAULTare disjoint,with a failure message that names the offending plugin(s) and explains which
two call sites would disagree.
Where it lives, and why
The issue suggested either
test/core/compose-picker-config.test.js(nextto its existing corpus guards) or a new
test/core/bundled-sets.test.js. Iwent with the new file: the assertion is a pure
Setcomparison over thetwo constants
bundled.jsexports, and needs none ofcompose-picker-config.test.js's picker infrastructure (discoverBundledPluginsmanifest loading,
buildPluginCatalog,composePickerConfig). That file'sown framing is pinning
composePickerConfig's output against the retiredwantsAnthropic/wantsCodexswitch; its two corpus-wide tests near thebottom (
no bundled plugin manifest fails validation,no excluded bundled manifest declares compose_with) earn their place therebecause they matter for the rider-composition behavior under test in that
file. The disjointness invariant belongs to
bundled.jsitself, not to aconsumer's test suite, so it gets its own small file.
Scope: one assertion, not more
I considered two further candidate invariants: that every name in
V1_EXCLUDED_FROM_DEFAULTcorresponds to a real bundled plugin on disk, andlikewise for
V1_BUNDLED_PLUGIN_ALLOWLIST. Neither is load-bearing for thefailure mode this issue is about: a stale or typo'd name in either set with
no matching manifest simply never appears in
loaded/excluded(it has noeffect on
unknownDirseither, since that bucket is populated fromdiscovered manifests, not from set membership). It is not a landmine the
way an in-both-sets name is, so it would be padding rather than a guard
against the documented failure class. I skipped it.
Verifying the test discriminates
Per the task, I temporarily added
@hypaware/hermes(already inV1_BUNDLED_PLUGIN_ALLOWLIST) toV1_EXCLUDED_FROM_DEFAULTand reran thenew test in isolation:
Reverted the injection and reran: back to green (
# pass 1,# fail 0).The working tree diff on
src/core/runtime/bundled.jswas clean after therevert.
Checks (fresh
npm install)npm test- 4030 passed, 1 skipped (unrelated), 0 failed.npm run typecheck- clean.node --test test/core/bundled-sets.test.js- 1 passed.package_bin_bootandwalkthrough_picker_to_first_querysmokes are knownred on
masterfor unrelated reasons (#758, #750, both with open PRs); nottouched by this change.