feat: derive the batch command union from the as-const registry (simplify #909) — Phase 1 step 7#912
Merged
Merged
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks: no changes in the largest emitted chunks. |
3dca1c8 to
f938536
Compare
d5bc90f to
f322cb0
Compare
f938536 to
e8e4a81
Compare
f322cb0 to
0a488e8
Compare
e8e4a81 to
ef61c90
Compare
0a488e8 to
537a9d6
Compare
ef61c90 to
3d4fcb2
Compare
537a9d6 to
30798a9
Compare
…lify #909) — Phase 1 step 7 The command-descriptor registry is now `as const` (#910), so each entry keeps its literal `name` and literal `batchable`. Derive StructuredBatchCommandName from it via `Extract<…, { batchable: true }>['name']` instead of the 43-member hand-authored union from #909, and delete the now-tautological exhaustive Record membership assertion in parity.test.ts (type and value now derive from the same `batchable: true` entries). Strictly behaviorless: the derived union is the identical 43-member set (confirmed bidirectionally assignable to the old hand union, member count unchanged), the runtime allowlist value is unchanged, and the public BatchCommandName re-export is structurally identical (consumer switches on specific batch command names still typecheck).
30798a9 to
167cf6d
Compare
|
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.
Phase 1 step 7 of the command-descriptor migration (ADR 0008)
Stacked on #911.
What
The command-descriptor registry became
as constand started exportingtype Commandin #910. With literalnameand literalbatchablepreserved per entry, the batch command-name union can now derive from the registry instead of being hand-authored.This PR:
StructuredBatchCommandNameunion (introduced in feat: build batch allowlist from descriptors, delete the hand list — Phase 1 step 4 #909, when the registry was not yetas const) with a derivation from the registry:Record<StructuredBatchCommandName, true>membership assertion inparity.test.ts— the type and the runtime value now derive from the samebatchable: trueentries, so the exhaustive cross-check is a tautology.tscenforces the type; the kept invariant guards the runtime value (exported allowlist === derived fold, no dupes, all public, control-plane stays out).Why it is strictly behaviorless
STRUCTURED_BATCH_COMMAND_NAMESstill folds the registry viaderiveStructuredBatchCommandNames; only the narrowing cast's source-of-truth comment changed.BatchCommandNamestructurally identical. The re-export throughcommand-surface.tsresolves to the same union; a consumer switching on specific batch command names still typechecks (tscgreen across the project, including thesatisfies readonly DaemonCommandName[]guard incommands/batch/projection.ts).Verification
tsc -p tsconfig.json --noEmit— exit 0oxfmt --write+oxlint --deny-warningson changed files — exit 0vitest run batch core/command-descriptor command-surface-metadata projection— all pass