96a82bbffb34f71beaa2f8932d752a936b46cecd
4 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
35478b615e |
refactor(#1646): route capability routers through Command Routing Hub per ADR-959 (#1647)
* refactor(#1646): route capability routers through Command Routing Hub per ADR-959 Phase 2 of parent #1641. Converts graphify, intel, and audit command routers from hand-rolled if/else dispatch to routeHubCommandFamily, implementing the ADR-959 §III(B) line 75 mandate. The three routers now share the uniform dispatch shape with the 14 host routers. src/cjs-command-router-adapter.cts * Imported ERROR_REASON from io.cjs. * UnknownCommand translation now passes ERROR_REASON.SDK_UNKNOWN_COMMAND as the second arg to error() — additive for host routers (their existing one-arg error callbacks ignore the second arg), required for capability routers whose tests assert reason === 'sdk_unknown_command' on the JSON-error envelope. src/graphify-command-router.cts * Replaced 4-branch if/else with routeHubCommandFamily + handlers map. * Validation handlers (missing term, missing/invalid --budget) now return makeInvalidArgs(arg, reason, ERROR_REASON.USAGE) Results instead of calling error() directly (Q2=C, Q4=ii from grilling). * Success handlers keep direct output() calls. * Subcommands array is alphabetical for byte-identical 'Available:' text in the unknown-subcommand message. * The unknown-subcommand path is now owned by the Hub's manifest check (the adapter passes SDK_UNKNOWN_COMMAND). src/intel-command-router.cts * Replaced 9-branch if/else with routeHubCommandFamily + handlers map. * Validation handlers (missing term, missing filePath for patch-meta and extract-exports) return makeInvalidArgs Results. * Preserved the timeAgo mutation in the non-raw status handler. * Preserved the lazy require('./intel.cjs') inside the route function. src/audit-command-router.cts * routeAuditUat: routes through the Hub with a synthetic 'run' defaultSubcommand (no real subcommands). Gives uniform observability. * routeAuditOpen: captures --json in a closure, strips it from args before Hub dispatch (so it isn't mistaken for a subcommand by the manifest check), then branches on wantJson inside the handler to preserve the formatAuditReport success-path quirk. docs/CONFIGURATION.md * Observability section: noted capability commands (graphify, intel, audit-uat, audit-open) now emit DispatchEvent records since #1646. .changeset/capability-routers-via-hub.md * Changed fragment describing the user-visible audit-trail expansion. pr:0 placeholder will be backfilled after gh pr create returns the real PR number (DEFECT.CHANGESET-PR-FIELD-DRIFT). Verification * graphify cutover tests: 119/119 pass (all unit, dispatch, behavior, error path, JSON-errors, and registry assertions) * intel cutover tests: 39/39 pass * audit cutover tests: 24/24 pass * bug-974-graphify-budget-missing-value regression test: pass * npm run test:unit (full suite): 2384 tests, 0 fail * gsd-test-summary on docker: outcome=passed, 0 failures (RULESET.PR-FLOW.docker-before-push) JSON-error envelope parity verified byte-identical: reason values ('usage', 'sdk_unknown_command') and message texts are preserved across all three routers' error paths. * chore(#1646): backfill changeset pr: 1647 (DEFECT.CHANGESET-PR-FIELD-DRIFT) |
||
|
|
ec2ecdf28b |
refactor(#1283): T3 — migrate 9 multi-leaf callers off the core spine (batch 2) (#1285)
Migrate 9 files' entire core surface to the leaf modules directly (behaviour-identical — leaves are the objects core re-exports by reference): config, docs, gap-checker, graphify-command-router (namespace core.output -> io.output), init (17 core symbols -> 8 leaves), profile-output, uat, verification, workstream. All 9 now import zero core symbols and are removed from the allowlist (18 -> 9). Stale core.* docstrings corrected. core.cts re-exports untouched (still serve the remaining 9 files); teardown is T-final. No behaviour change. Closes #1283 Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
921a7cd618 |
fix(#974): error on graphify --budget with missing/non-numeric value instead of silent NaN no-op (#986)
* fix(#974): error on graphify --budget with missing/non-numeric value instead of silent NaN no-op When `--budget` was the last arg or followed by a non-numeric token, parseInt(undefined/NaN-string, 10) produced NaN. NaN is falsy so both the router check and applyBudget gate silently skipped budget trimming. The query ran unbounded with no warning. Fix: guard in graphify-command-router.cts — if args[budgetIdx+1] is absent or parses to NaN, emit ERROR_REASON.USAGE and return early. Defensive fix in graphify.cts: tighten `if (!budgetTokens)` → `if (budgetTokens == null)` and `if (options.budget)` → `if (options.budget != null)` so a real 0/NaN caller is handled predictably by both independent guards. Regression tests: 16 cases (unit/mock, subprocess, property-based) covering boundary inputs: missing value, non-numeric, valid integers, and fast-check properties over the budget parse contract. Closes #974 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(#974): backfill changeset pr number (986) * fix(#974): convert static property (b) to real fc.assert property with constrained generator + deterministic seed The test named "property: --budget as last arg always produces usage error" was a static test with no fc.assert — it only checked a single hardcoded term ("someterm") and could never flake or produce a fast-check path. This is a generator/property bug (case b): the test was mislabeled as a property test but lacked parameterization. Root-cause of CI path "46:0:0" / seed 42 failure: a naive parameterized version without the !startsWith('--') filter could feed term='--budget', causing args.indexOf('--budget') to hit index 2 (the term slot) rather than index 3 (the flag slot), placing the router in a different code path. The property still holds — NaN detection fires on rawBudget='--budget' — but the assertion text referenced the wrong invariant, making the failure appear spurious. Fix: constrain the generator to non-flag terms (filter out strings starting with '--') and pass explicit { seed: 42, numRuns: 200 } to fc.assert so the test is fully deterministic in CI regardless of GSD_FC_SEED. No change to src/graphify-command-router.cts (router is correct). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test(#974): constrain non-numeric budget property generator to genuinely-NaN values and pin fast-check seeds (CI determinism) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test(#974): use a strict valid-term generator and pin seeds so budget property tests are deterministic Replace fc.string({minLength:1}).filter(!startsWith('--')) term generators in properties (b) and (d) with a shared validTerm = fc.stringMatching(/^[A-Za-z0-9][A-Za-z0-9_.-]{0,29}$/) that is alphanumeric-leading and contains no whitespace, flags, or sign-numerics. This eliminates the class of CI failures where the old generator produced out-of- contract inputs (" ", "+5", empty) that the router legitimately rejects for reasons outside the budget-parse contract under test. Pin distinct seeds (1001–1004) on every fc.assert for CI determinism. Stress-tested at numRuns=100000 per property and across 10 seeds (1,2,7,13,42,43,44,99,12345,999999) at numRuns=2000 — all pass. No src change: gsd-core/bin/lib/graphify-command-router.cjs is correct. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test(#974): replace flaky term-fuzzing properties with deterministic examples; keep value-fuzzing properties The validTerm regex /^[A-Za-z0-9][A-Za-z0-9_.-]{0,29}$/ admitted single-digit strings like "0" which are falsy; the router's `if (!term)` guard fires before the budget-missing-value path, producing a spurious errFn call. Properties (b) and (d), which test the BUDGET contract (not term handling), are replaced with deterministic example loops over fixed valid terms. Properties (a) and (c), which fuzz the BUDGET VALUE with a fixed term, are kept unchanged (seed+numRuns pinned). The validTerm generator is fully removed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|
|
77bfd943dd |
feat(#972): graphify command cutover — first capability owning a command family (ADR-857 phase 4d-impl-2) (#975)
Migrate graphify into a Capability that owns its `graphify` command family, dispatched via the registry (#961 mechanism) instead of a hardcoded case. graphify is now an enable/disable plug-in. - src/graphify-command-router.cts: routeGraphifyCommand (standard route*Command), reproduces the removed case EXACTLY (query +--budget, status, diff, build, hidden build snapshot, usage/unknown errors); injectable _graphify test seam. - capabilities/graphify/capability.json: role feature, tier:full, skills:[graphify], config:{graphify.enabled default false}, commands:[{family:graphify, module, router:routeGraphifyCommand}]. - removed case 'graphify' from gsd-tools.cjs; graphify now flows default -> dispatchCapabilityCommand -> commandFamilies.graphify -> router. - regenerated registry (commandFamilies/bySkill/configSchema/profileMembership/ capabilityClusters for graphify); tier:full keeps 4c install/surface a no-op. Equivalence-proven: 8 recording-mock unit tests assert the exact fn+args per subcommand (budget, snapshot-vs-build); 9 subprocess tests assert distinguishing output shapes; existing graphify tests pass unchanged through the new path. Surfaced (not silently accepted): the pre-existing --budget-no-value NaN no-op quirk, preserved for equivalence, filed separately. Closes #972 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> |