@warpgogol/forge 6.3.6 → 8.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/README.md +2 -1
- package/bin/cli.js +6 -12
- package/bin/resolve-entry.js +24 -0
- package/dist/os/compass/comment-safety.d.ts +83 -0
- package/dist/os/compass/comment-safety.d.ts.map +1 -0
- package/dist/os/compass/comment-safety.js +305 -0
- package/dist/os/compass/comment-safety.js.map +1 -0
- package/dist/os/compass/compass.module.d.ts.map +1 -1
- package/dist/os/compass/compass.module.js +47 -4
- package/dist/os/compass/compass.module.js.map +1 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.d.ts +2 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.js +34 -10
- package/dist/os/compass/handlers/compass-change-summary-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-docs-scaffold.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-docs-scaffold.js +54 -17
- package/dist/os/compass/handlers/compass-docs-scaffold.js.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts +14 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js +261 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold.d.ts +31 -0
- package/dist/os/compass/handlers/compass-header-scaffold.d.ts.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold.js +739 -0
- package/dist/os/compass/handlers/compass-header-scaffold.js.map +1 -0
- package/dist/os/compass/handlers/compass-inventory-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-inventory-handler.js +8 -4
- package/dist/os/compass/handlers/compass-inventory-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-inventory.d.ts +6 -0
- package/dist/os/compass/handlers/compass-inventory.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-inventory.js +28 -13
- package/dist/os/compass/handlers/compass-inventory.js.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.js +12 -26
- package/dist/os/compass/handlers/compass-migrate-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-migrate.d.ts +15 -2
- package/dist/os/compass/handlers/compass-migrate.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-migrate.js +58 -20
- package/dist/os/compass/handlers/compass-migrate.js.map +1 -1
- package/dist/os/compass/handlers/git-revision.d.ts +10 -0
- package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
- package/dist/os/compass/handlers/git-revision.js +58 -4
- package/dist/os/compass/handlers/git-revision.js.map +1 -1
- package/dist/os/compass/handlers/summary-record.d.ts +20 -5
- package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
- package/dist/os/compass/handlers/summary-record.js +175 -44
- package/dist/os/compass/handlers/summary-record.js.map +1 -1
- package/dist/os/compass/index.d.ts +1 -0
- package/dist/os/compass/index.d.ts.map +1 -1
- package/dist/os/compass/index.js +2 -0
- package/dist/os/compass/index.js.map +1 -1
- package/dist/os/compass/policy.d.ts +9 -0
- package/dist/os/compass/policy.d.ts.map +1 -1
- package/dist/os/compass/policy.js +11 -2
- package/dist/os/compass/policy.js.map +1 -1
- package/dist/os/core/core.module.js +1 -1
- package/dist/os/core/handlers/package-health.d.ts.map +1 -1
- package/dist/os/core/handlers/package-health.js +1 -6
- package/dist/os/core/handlers/package-health.js.map +1 -1
- package/dist/os/queue/types.d.ts +2 -0
- package/dist/os/queue/types.d.ts.map +1 -1
- package/dist/os/queue/types.js +3 -1
- package/dist/os/queue/types.js.map +1 -1
- package/dist/os/rfc/acceptance.d.ts.map +1 -1
- package/dist/os/rfc/acceptance.js +66 -2
- package/dist/os/rfc/acceptance.js.map +1 -1
- package/dist/os/rfc/decision-log.d.ts.map +1 -1
- package/dist/os/rfc/decision-log.js +21 -3
- package/dist/os/rfc/decision-log.js.map +1 -1
- package/dist/os/rfc/dna-trace.d.ts +2 -0
- package/dist/os/rfc/dna-trace.d.ts.map +1 -1
- package/dist/os/rfc/dna-trace.js +13 -4
- package/dist/os/rfc/dna-trace.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-origin.d.ts +37 -0
- package/dist/os/rfc/handlers/implement-stamp-origin.d.ts.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp-origin.js +118 -0
- package/dist/os/rfc/handlers/implement-stamp-origin.js.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp.d.ts +41 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +645 -47
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts +42 -0
- package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts.map +1 -0
- package/dist/os/rfc/handlers/rfc-evidence-sync.js +147 -0
- package/dist/os/rfc/handlers/rfc-evidence-sync.js.map +1 -0
- package/dist/os/rfc/handlers/validate-rules.d.ts +9 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +71 -10
- package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
- package/dist/os/rfc/reachable-symbol.d.ts +17 -0
- package/dist/os/rfc/reachable-symbol.d.ts.map +1 -0
- package/dist/os/rfc/reachable-symbol.js +376 -0
- package/dist/os/rfc/reachable-symbol.js.map +1 -0
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +99 -10
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +112 -14
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +27 -10
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts +25 -0
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +244 -13
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-origin.d.ts +58 -0
- package/dist/os/rfc/verification-origin.d.ts.map +1 -0
- package/dist/os/rfc/verification-origin.js +346 -0
- package/dist/os/rfc/verification-origin.js.map +1 -0
- package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
- package/dist/os/rfc/verification-refresh.js +11 -1
- package/dist/os/rfc/verification-refresh.js.map +1 -1
- package/dist/os/rfc/verify-workspace.d.ts +23 -0
- package/dist/os/rfc/verify-workspace.d.ts.map +1 -0
- package/dist/os/rfc/verify-workspace.js +278 -0
- package/dist/os/rfc/verify-workspace.js.map +1 -0
- package/dist/os/session/handlers/metrics-rfc.d.ts.map +1 -1
- package/dist/os/session/handlers/metrics-rfc.js +3 -0
- package/dist/os/session/handlers/metrics-rfc.js.map +1 -1
- package/dist/os/spec/spec-status.d.ts.map +1 -1
- package/dist/os/spec/spec-status.js +5 -23
- package/dist/os/spec/spec-status.js.map +1 -1
- package/dist/os/spec/spec-validate.d.ts.map +1 -1
- package/dist/os/spec/spec-validate.js +30 -9
- package/dist/os/spec/spec-validate.js.map +1 -1
- package/dist/os/workflow/handlers.d.ts +0 -4
- package/dist/os/workflow/handlers.d.ts.map +1 -1
- package/dist/os/workflow/handlers.js +9 -36
- package/dist/os/workflow/handlers.js.map +1 -1
- package/dist/os/workflow/index.d.ts +2 -2
- package/dist/os/workflow/index.d.ts.map +1 -1
- package/dist/os/workflow/index.js +1 -1
- package/dist/os/workflow/index.js.map +1 -1
- package/dist/os/workflow/types.d.ts +0 -19
- package/dist/os/workflow/types.d.ts.map +1 -1
- package/dist/os/workflow/types.js +0 -2
- package/dist/os/workflow/types.js.map +1 -1
- package/dist/os/workflow/workflow.module.d.ts.map +1 -1
- package/dist/os/workflow/workflow.module.js +6 -15
- package/dist/os/workflow/workflow.module.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +5 -0
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +5 -2
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/onboarding/agents-generate.js +1 -1
- package/dist/src/onboarding/doctor.js +3 -3
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/init.js +2 -2
- package/dist/src/onboarding/nested-agents-templates.js +1 -1
- package/dist/src/onboarding/prettierignore.js +1 -1
- package/dist/src/onboarding/upgrade.js +2 -2
- package/dist/src/onboarding/workspace-discovery.js +1 -1
- package/dist/src/profiles/profile-schema.d.ts +2 -0
- package/dist/src/profiles/profile-schema.d.ts.map +1 -1
- package/dist/src/profiles/profile-schema.js +1 -0
- package/dist/src/profiles/profile-schema.js.map +1 -1
- package/dist/src/profiles/stack-profile.d.ts +1 -0
- package/dist/src/profiles/stack-profile.d.ts.map +1 -1
- package/dist/src/skill-schema.d.ts +2 -0
- package/dist/src/skill-schema.d.ts.map +1 -1
- package/dist/src/skill-schema.js +9 -1
- package/dist/src/skill-schema.js.map +1 -1
- package/dist/src/types.d.ts +23 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +2 -1
- package/dist/src/types.js.map +1 -1
- package/docs/reference/cli.md +0 -1
- package/docs/reference/programmatic-api.md +1 -1
- package/os/adr/handlers/validate.test.ts +14 -0
- package/os/compass/comment-safety.ts +331 -0
- package/os/compass/compass.module.ts +50 -4
- package/os/compass/handlers/compass-change-summary-handler.ts +41 -11
- package/os/compass/handlers/compass-docs-scaffold.ts +59 -17
- package/os/compass/handlers/compass-game-extensions.test.ts +3 -7
- package/os/compass/handlers/compass-header-scaffold-handler.ts +352 -0
- package/os/compass/handlers/compass-header-scaffold.ts +847 -0
- package/os/compass/handlers/compass-inventory-handler.ts +9 -4
- package/os/compass/handlers/compass-inventory.ts +29 -13
- package/os/compass/handlers/compass-migrate-handler.ts +13 -27
- package/os/compass/handlers/compass-migrate.ts +77 -21
- package/os/compass/handlers/git-revision.ts +59 -4
- package/os/compass/handlers/resolve-scan-root-package.test.ts +14 -0
- package/os/compass/handlers/resolve-scan-root-workpiece.test.ts +14 -0
- package/os/compass/handlers/summary-record.ts +194 -41
- package/os/compass/handlers/tests/compass-audit-plan.test.ts +6 -0
- package/os/compass/handlers/tests/compass-audit-record.test.ts +6 -0
- package/os/compass/handlers/tests/compass-audit-validate.test.ts +6 -0
- package/os/compass/handlers/tests/compass-change-summary-handler.test.ts +131 -0
- package/os/compass/handlers/tests/compass-docs-validate.test.ts +6 -0
- package/os/compass/handlers/tests/compass-header-scaffold.test.ts +896 -0
- package/os/compass/handlers/tests/compass-ledger-scope.test.ts +6 -0
- package/os/compass/handlers/tests/compass-migrate.test.ts +87 -9
- package/os/compass/handlers/tests/compass-policy.test.ts +1 -1
- package/os/compass/handlers/tests/compass-text-safety.test.ts +271 -0
- package/os/compass/handlers/tests/compass-v2-contract.test.ts +52 -3
- package/os/compass/handlers/tests/summary-record.test.ts +324 -3
- package/os/compass/index.ts +15 -0
- package/os/compass/policy.ts +27 -2
- package/os/core/core.module.ts +1 -1
- package/os/core/handlers/invariant-engine.test.ts +3 -1
- package/os/core/handlers/note-frontmatter-validate.test.ts +6 -1
- package/os/core/handlers/note-link-validate.test.ts +6 -1
- package/os/core/handlers/note-orphan-detect.test.ts +6 -1
- package/os/core/handlers/package-health.test.ts +6 -0
- package/os/core/handlers/package-health.ts +1 -6
- package/os/mission/handlers/archive.test.ts +14 -0
- package/os/naming/naming-convention.test.ts +14 -0
- package/os/queue/decision-ledger.test.ts +27 -4
- package/os/queue/queue-validate.test.ts +14 -0
- package/os/queue/types.ts +3 -1
- package/os/rfc/acceptance-reachable.test.ts +146 -0
- package/os/rfc/acceptance.test.ts +136 -0
- package/os/rfc/acceptance.ts +71 -2
- package/os/rfc/decision-log.ts +22 -4
- package/os/rfc/dna-trace.ts +17 -5
- package/os/rfc/frontmatter-io.test.ts +14 -0
- package/os/rfc/handlers/implement-stamp-acceptance-verification.test.ts +81 -0
- package/os/rfc/handlers/implement-stamp-binding.test.ts +79 -0
- package/os/rfc/handlers/implement-stamp-origin.test.ts +132 -0
- package/os/rfc/handlers/implement-stamp-origin.ts +154 -0
- package/os/rfc/handlers/implement-stamp-stale.test.ts +285 -0
- package/os/rfc/handlers/implement-stamp.ts +783 -55
- package/os/rfc/handlers/lifecycle.test.ts +14 -0
- package/os/rfc/handlers/rfc-evidence-sync.ts +221 -0
- package/os/rfc/handlers/validate-rules-rfc0997.test.ts +14 -0
- package/os/rfc/handlers/validate-rules-rfc1006.test.ts +14 -0
- package/os/rfc/handlers/validate-rules-rfc1330.test.ts +120 -0
- package/os/rfc/handlers/validate-rules-rfc1334.test.ts +65 -0
- package/os/rfc/handlers/validate-rules.test.ts +56 -0
- package/os/rfc/handlers/validate-rules.ts +101 -10
- package/os/rfc/handlers/validate.test.ts +4 -3
- package/os/rfc/reachable-symbol.ts +441 -0
- package/os/rfc/rfc-0000-template.md +21 -1
- package/os/rfc/rfc-create-concurrent.test.ts +6 -0
- package/os/rfc/rfc-create-hint.test.ts +6 -0
- package/os/rfc/rfc-read-only-no-side-effects.test.ts +6 -0
- package/os/rfc/rfc.module.ts +106 -10
- package/os/rfc/types.ts +151 -14
- package/os/rfc/verification-emit-check.test.ts +215 -0
- package/os/rfc/verification-emit-freshness.test.ts +415 -0
- package/os/rfc/verification-emit.test.ts +14 -0
- package/os/rfc/verification-evidence.ts +301 -13
- package/os/rfc/verification-normalize.test.ts +75 -0
- package/os/rfc/verification-origin.test.ts +236 -0
- package/os/rfc/verification-origin.ts +417 -0
- package/os/rfc/verification-refresh.test.ts +14 -0
- package/os/rfc/verification-refresh.ts +12 -1
- package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +78 -0
- package/os/rfc/verifier/rfc-1333/imp12-gate.acceptance.test.ts +81 -0
- package/os/rfc/verifier/rfc-1333/skills-and-types.acceptance.test.ts +50 -0
- package/os/rfc/verifier/rfc-1333/verify-workspace.acceptance.test.ts +103 -0
- package/os/rfc/verify-workspace.test.ts +122 -0
- package/os/rfc/verify-workspace.ts +342 -0
- package/os/session/handlers/metrics-rfc.ts +3 -0
- package/os/spec/spec-status.test.ts +130 -0
- package/os/spec/spec-status.ts +5 -18
- package/os/spec/spec-validate.test.ts +76 -1
- package/os/spec/spec-validate.ts +26 -7
- package/os/workflow/handlers.ts +8 -42
- package/os/workflow/index.ts +1 -4
- package/os/workflow/types.ts +0 -22
- package/os/workflow/workflow.module.ts +6 -16
- package/package.json +1 -1
- package/skills/_shared/agent-operating-model.md +83 -0
- package/skills/_shared/fo-pipeline-conventions.md +1 -0
- package/skills/fo/fo-add-tests/SKILL.md +14 -0
- package/skills/fo/fo-fix/SKILL.md +2 -1
- package/skills/fo/fo-handoff/SKILL.md +1 -1
- package/skills/fo/fo-idea/SKILL.md +6 -3
- package/skills/fo/fo-idea-create-rfc/acceptance-criteria-standard.md +8 -0
- package/skills/fo/fo-idea-i-just-want-to-see-the-result/SKILL.md +4 -2
- package/skills/fo/fo-idea-implement/SKILL.md +68 -53
- package/skills/fo/fo-idea-plan/SKILL.md +3 -1
- package/skills/fo/fo-review/SKILL.md +12 -0
- package/skills/fo/fo-session-save/learned-principles.md +13 -0
- package/skills/fo/fo-step-commit/SKILL.md +1 -1
- package/src/bin-entry.test.ts +37 -0
- package/src/compass/contract-registry.test.ts +14 -0
- package/src/compass/types.test.ts +14 -0
- package/src/config/__tests__/resolve-terminology.test.ts +14 -0
- package/src/config/forge-config.test.ts +14 -0
- package/src/config/forge-config.ts +7 -2
- package/src/forge-module.test.ts +14 -0
- package/src/knowledge/__tests__/promote.test.ts +14 -0
- package/src/knowledge/__tests__/serialize.test.ts +14 -0
- package/src/knowledge/__tests__/sync.test.ts +4 -1
- package/src/knowledge/budgets.test.ts +14 -0
- package/src/knowledge/compact.test.ts +14 -0
- package/src/knowledge/parse.test.ts +14 -0
- package/src/knowledge/schema.test.ts +14 -0
- package/src/migration-adapters/__tests__/ignored-files.test.ts +14 -0
- package/src/migration-adapters/__tests__/registry.test.ts +14 -0
- package/src/migration-adapters/__tests__/types.test.ts +14 -0
- package/src/onboarding/__tests__/workspace-discovery.test.ts +14 -0
- package/src/onboarding/agents-generate.ts +1 -1
- package/src/onboarding/compass-docs/semantic-layer-block.test.ts +6 -0
- package/src/onboarding/create.test.ts +14 -0
- package/src/onboarding/doctor-token-check.test.ts +3 -0
- package/src/onboarding/doctor.test.ts +14 -0
- package/src/onboarding/doctor.ts +3 -3
- package/src/onboarding/init.test.ts +14 -0
- package/src/onboarding/init.ts +2 -2
- package/src/onboarding/nested-agents-templates.ts +1 -1
- package/src/onboarding/prettierignore.ts +1 -1
- package/src/onboarding/scaffold.test.ts +14 -0
- package/src/onboarding/site-workshop-profile.test.ts +3 -0
- package/src/onboarding/templates/behavioral-layer-core.md +8 -0
- package/src/onboarding/upgrade.test.ts +14 -0
- package/src/onboarding/upgrade.ts +2 -2
- package/src/onboarding/workspace-discovery.ts +1 -1
- package/src/pipeline-status.test.ts +14 -0
- package/src/plugin/forge-plugin-manifest.test.ts +14 -0
- package/src/profiles/__tests__/profile-schema.test.ts +14 -0
- package/src/profiles/__tests__/stack-profile.test.ts +14 -0
- package/src/profiles/__tests__/terminology-utils.test.ts +14 -0
- package/src/profiles/profile-schema.ts +1 -0
- package/src/skill-schema.ts +9 -1
- package/src/tests/acceptance-criteria.test.ts +14 -0
- package/src/tests/acceptance-probe-kinds.test.ts +14 -0
- package/src/tests/adr-implement-stamp.test.ts +14 -0
- package/src/tests/agents-generate-domain.test.ts +3 -0
- package/src/tests/agents-generate.test.ts +3 -0
- package/src/tests/bindings-schema.test.ts +2 -0
- package/src/tests/budgets.test.ts +14 -0
- package/src/tests/compact.test.ts +14 -0
- package/src/tests/compass-docs-flag.test.ts +6 -0
- package/src/tests/compass-docs-scaffold.test.ts +6 -0
- package/src/tests/compass-docs-validate-scope.test.ts +6 -0
- package/src/tests/contract-registry.test.ts +14 -0
- package/src/tests/create.test.ts +3 -0
- package/src/tests/discover-pack-skills.test.ts +14 -0
- package/src/tests/doctor-autonomy.test.ts +3 -0
- package/src/tests/doctor-bindings.test.ts +6 -1
- package/src/tests/doctor-dist-freshness.test.ts +26 -2
- package/src/tests/doctor-domain.test.ts +6 -1
- package/src/tests/doctor-fix.test.ts +3 -0
- package/src/tests/doctor-nested-agents.test.ts +3 -0
- package/src/tests/doctor-profile-id-known.test.ts +3 -0
- package/src/tests/doctor-skills-unmanaged.test.ts +3 -0
- package/src/tests/doctor-version-sync.test.ts +4 -1
- package/src/tests/editable-generated-region.test.ts +6 -3
- package/src/tests/exploration-handlers.test.ts +14 -0
- package/src/tests/file-size-lint.test.ts +6 -1
- package/src/tests/fixtures/agents-generate-business-before.txt +8 -0
- package/src/tests/forge-autonomy-validate.test.ts +3 -1
- package/src/tests/forge-config.test.ts +6 -1
- package/src/tests/forge-validate-compass-docs.test.ts +6 -0
- package/src/tests/fs-atomic.test.ts +14 -0
- package/src/tests/fs.test.ts +14 -0
- package/src/tests/generated-marker.test.ts +14 -0
- package/src/tests/hash.test.ts +14 -0
- package/src/tests/implement-stamp.test.ts +476 -10
- package/src/tests/init-bindings.test.ts +6 -1
- package/src/tests/knowledge-parse.test.ts +14 -0
- package/src/tests/knowledge-pbt.test.ts +14 -0
- package/src/tests/markdown-table.test.ts +6 -3
- package/src/tests/memory-compact.test.ts +3 -0
- package/src/tests/memory-scaffold.test.ts +6 -1
- package/src/tests/metrics-rfc-1053.test.ts +14 -0
- package/src/tests/migration-adapters.test.ts +3 -0
- package/src/tests/package-files.test.ts +4 -1
- package/src/tests/package-health-lint-surface.test.ts +3 -0
- package/src/tests/pinned-check.test.ts +14 -0
- package/src/tests/pinned-init.test.ts +14 -0
- package/src/tests/pinned-validate.test.ts +14 -0
- package/src/tests/plugin-manifest.test.ts +14 -0
- package/src/tests/prettierignore-manage.test.ts +3 -0
- package/src/tests/profile-schema.test.ts +6 -1
- package/src/tests/profile-validate.test.ts +6 -1
- package/src/tests/program-lease.test.ts +3 -0
- package/src/tests/program-paths-extended.test.ts +3 -0
- package/src/tests/program-paths.test.ts +3 -0
- package/src/tests/program-property.test.ts +3 -0
- package/src/tests/program-schemas.test.ts +3 -0
- package/src/tests/program-spec-node.test.ts +3 -0
- package/src/tests/promote.test.ts +14 -0
- package/src/tests/public-surface.test.ts +6 -1
- package/src/tests/registry.test.ts +14 -0
- package/src/tests/rfc-evidence-sync.test.ts +347 -0
- package/src/tests/rfc-implement-stamp-governance.test.ts +403 -0
- package/src/tests/scaffold-project.test.ts +3 -0
- package/src/tests/session-handlers.test.ts +14 -0
- package/src/tests/session-pbt.test.ts +14 -0
- package/src/tests/skill-agents-sync.test.ts +3 -4
- package/src/tests/skill-schema.test.ts +53 -0
- package/src/tests/skill-sync-marker.test.ts +3 -0
- package/src/tests/skill-validate-knowledge.test.ts +14 -0
- package/src/tests/skill-validate.test.ts +14 -0
- package/src/tests/stack-profile.test.ts +6 -1
- package/src/tests/string-utils.test.ts +14 -0
- package/src/tests/upgrade.test.ts +6 -1
- package/src/tests/werkstatt-lock.test.ts +14 -0
- package/src/tests/workspace-discovery-domain.test.ts +6 -1
- package/src/tests/workspace-discovery.test.ts +6 -1
- package/src/types.test.ts +14 -0
- package/src/types.ts +30 -1
- package/src/utils/__tests__/fs-idempotent.test.ts +17 -0
- package/src/utils/__tests__/fs-trash.test.ts +17 -0
- package/src/utils/fs-atomic.test.ts +17 -0
- package/src/utils/fs-trash-sync.test.ts +17 -0
- package/src/utils/fs.test.ts +17 -0
- package/src/utils/generated-marker.test.ts +17 -0
- package/src/utils/hash.test.ts +17 -0
- package/src/utils/string-utils.test.ts +17 -0
- package/src/validators/__tests__/note-orphan-detect.test.ts +14 -0
|
@@ -12,25 +12,25 @@ a JSON evidence envelope to docs/rfcs/verification/<slug>.generated.yaml.
|
|
|
12
12
|
</non-goals>
|
|
13
13
|
</MODULE_CONTRACT>
|
|
14
14
|
<CHANGE_SUMMARY>
|
|
15
|
-
<item>RFC-0330: initial implementation.</item>
|
|
16
|
-
<item>RFC-0999: exported captureGitContext, getKernelVersion, byteHashHex, VERIFICATION_DIR for reuse by verification-refresh.ts.</item>
|
|
17
|
-
<item>RFC-1237: dual-read dry-run (context.dryRun || flags["dry-run"]),
|
|
18
|
-
io.writeFile port routing, dry-run summary marker; serializeEvidenceEnvelope —
|
|
19
|
-
shared emit-canonical serializer restoring the structured YAML marker-key
|
|
20
|
-
header (generatedMarker/doNotEdit/ownerCommand/editInstead/regenerateCommand
|
|
21
|
-
with "pnpm exec werkstatt run" prefix), also consumed by refresh.</item>
|
|
22
15
|
<item>RFC-1249: wire werkstatt.commands.validate into packages.check + retire CMD-OUTPUT debt</item>
|
|
16
|
+
<item>RFC-1271: review wave — deep probe normalization, malformed-envelope fail-closed, post-stamp re-emit, honest repair hints</item>
|
|
17
|
+
<item>RFC-1320: pre-probe generated-artifact freshness gate — EVIDENCE-FRESH-01 blocks emission on stale/missing probe dependencies via generated.drift.validate --target=workspace; EVIDENCE-FRESH-02 warns on unverifiable; EVIDENCE-FRESH-03 fails loudly on unknown probe kinds; emit-owned envelopes excluded; blocking diagnostics flip the run's exit code</item>
|
|
18
|
+
<item>RFC-1330: emit attaches git-derived origin; origin is volatile for --check.</item>
|
|
19
|
+
<item>RFC-1334: step 4 — reachable acceptance probe (symbol and command modes) and V-45</item>
|
|
20
|
+
<history>RFC-0330, RFC-0999, RFC-1237</history>
|
|
23
21
|
</CHANGE_SUMMARY>
|
|
24
22
|
*/
|
|
25
23
|
|
|
26
24
|
import { execFile } from "../../src/utils/sync-fs.ts";
|
|
27
25
|
import { ambientIo, resolveIo } from "../../src/utils/io.ts";
|
|
28
26
|
|
|
29
|
-
import { join } from "node:path";
|
|
27
|
+
import { join, relative } from "node:path";
|
|
30
28
|
import { performance } from "node:perf_hooks";
|
|
31
29
|
import { byteHash } from "../../src/utils/hash.ts";
|
|
32
30
|
|
|
33
31
|
import { runProbe } from "./acceptance.ts";
|
|
32
|
+
import { attachProbeOrigins } from "./verification-origin.ts";
|
|
33
|
+
import { EVIDENCE_SYNC_STEPS } from "./handlers/rfc-evidence-sync.ts";
|
|
34
34
|
import { listRfcFiles, readAndParseRfc } from "./frontmatter-io.ts";
|
|
35
35
|
import { generatedHeaderFields } from "../../src/utils/generated-marker.ts";
|
|
36
36
|
import { parse as yamlParse, stringify as yamlStringify } from "yaml";
|
|
@@ -56,6 +56,192 @@ import type {
|
|
|
56
56
|
export const VERIFICATION_DIR = join(RFC_DIR, "verification");
|
|
57
57
|
const HASH_PREFIX = "sha" + "256:";
|
|
58
58
|
|
|
59
|
+
// RFC-1320: emitted envelopes are owned by this command — an RFC's own
|
|
60
|
+
// evidence artifact must never freshness-block its own emission.
|
|
61
|
+
const EMIT_OWNED_EVIDENCE_RE = /^docs\/rfcs\/verification\/.*\.generated\.yaml$/;
|
|
62
|
+
const COMMAND_MANIFEST_PATH = "docs/command-manifest.generated.yaml";
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* RFC-1320: exhaustive probe-kind → candidate-artifact mapping. Probes that
|
|
66
|
+
* execute live (run/test/page) carry no generated dependency; path-bearing
|
|
67
|
+
* probes map to their referenced file; command-registered reads the command
|
|
68
|
+
* manifest via acceptance.ts's manifest fallback. An unrecognized kind fails
|
|
69
|
+
* loudly — a future kind must opt into this table.
|
|
70
|
+
*/
|
|
71
|
+
export function probeArtifactCandidates(probe: AcceptanceProbe): string[] {
|
|
72
|
+
switch (probe.probe) {
|
|
73
|
+
case "command-registered":
|
|
74
|
+
return [COMMAND_MANIFEST_PATH];
|
|
75
|
+
case "file-contains":
|
|
76
|
+
case "file-exists":
|
|
77
|
+
if (typeof probe.path !== "string" || probe.path.length === 0) {
|
|
78
|
+
throw new Error(
|
|
79
|
+
`EVIDENCE-FRESH-03: probe "${probe.probe}" carries no string path — fix the acceptance frontmatter.`,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
return [probe.path];
|
|
83
|
+
case "json-schema":
|
|
84
|
+
if (typeof probe.artifact !== "string" || probe.artifact.length === 0) {
|
|
85
|
+
throw new Error(
|
|
86
|
+
'EVIDENCE-FRESH-03: probe "json-schema" carries no string artifact — fix the acceptance frontmatter.',
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return [probe.artifact];
|
|
90
|
+
case "reachable":
|
|
91
|
+
return "command" in probe
|
|
92
|
+
? [COMMAND_MANIFEST_PATH]
|
|
93
|
+
: [probe.module, ...(probe.root ? [probe.root] : [])];
|
|
94
|
+
case "run":
|
|
95
|
+
case "test":
|
|
96
|
+
case "page":
|
|
97
|
+
return [];
|
|
98
|
+
default:
|
|
99
|
+
throw new Error(
|
|
100
|
+
`EVIDENCE-FRESH-03: unknown probe kind "${String((probe as { probe?: unknown }).probe)}" — extend the freshness artifact map.`,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface DriftArtifactVerdict {
|
|
106
|
+
path: string;
|
|
107
|
+
owner: string | null;
|
|
108
|
+
verdict:
|
|
109
|
+
| "fresh"
|
|
110
|
+
| "stale"
|
|
111
|
+
| "missing"
|
|
112
|
+
| "skipped-volatile"
|
|
113
|
+
| "skipped-binary"
|
|
114
|
+
| "render-unavailable"
|
|
115
|
+
| "unowned";
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function toPosixPath(p: string): string {
|
|
119
|
+
return p.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* RFC-1320: pre-probe freshness gate. Collects probe-referenced artifacts,
|
|
124
|
+
* delegates byte-comparison to `generated.drift.validate --target=workspace
|
|
125
|
+
* --paths` via context.invoke, and maps verdicts: stale/missing → blocking
|
|
126
|
+
* EVIDENCE-FRESH-01 (no envelope written); invoke-absent/throw/payload-gap/
|
|
127
|
+
* render-unavailable → EVIDENCE-FRESH-02 warning and probes still run.
|
|
128
|
+
* `unowned` verdicts mean no generates[] declaration — no fire.
|
|
129
|
+
*/
|
|
130
|
+
async function freshnessPrecheck(
|
|
131
|
+
rfcId: string,
|
|
132
|
+
probes: AcceptanceProbe[],
|
|
133
|
+
context: ForgeRuntimeContext,
|
|
134
|
+
): Promise<{ block?: Diagnostic; warnings: Diagnostic[] }> {
|
|
135
|
+
const warnings: Diagnostic[] = [];
|
|
136
|
+
const warn = (message: string): Diagnostic => ({
|
|
137
|
+
ruleId: "EVIDENCE-FRESH-02",
|
|
138
|
+
severity: "warning",
|
|
139
|
+
message: `${rfcId}: ${message}`,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const candidates = new Set<string>();
|
|
143
|
+
for (const probe of probes) {
|
|
144
|
+
try {
|
|
145
|
+
const paths = probeArtifactCandidates(probe);
|
|
146
|
+
for (const p of paths) {
|
|
147
|
+
const norm = toPosixPath(p);
|
|
148
|
+
if (EMIT_OWNED_EVIDENCE_RE.test(norm)) continue;
|
|
149
|
+
candidates.add(norm);
|
|
150
|
+
}
|
|
151
|
+
} catch (err) {
|
|
152
|
+
// Loud failure — a future probe kind must opt into the artifact map
|
|
153
|
+
// rather than silently mapping to none, and a malformed path-bearing
|
|
154
|
+
// probe must fail this RFC, never crash the sweep (RFC-1320 review).
|
|
155
|
+
return {
|
|
156
|
+
warnings,
|
|
157
|
+
block: {
|
|
158
|
+
ruleId: "EVIDENCE-FRESH-03",
|
|
159
|
+
severity: "error",
|
|
160
|
+
message: `${rfcId}: ${err instanceof Error ? err.message : String(err)}`,
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (candidates.size === 0) return { warnings };
|
|
166
|
+
|
|
167
|
+
const invoke = context.invoke;
|
|
168
|
+
if (!invoke) {
|
|
169
|
+
warnings.push(
|
|
170
|
+
warn(
|
|
171
|
+
`EVIDENCE-FRESH-02: no kernel host (context.invoke absent) — probe-referenced generated artifact freshness unverified: ${[...candidates].join(", ")}`,
|
|
172
|
+
),
|
|
173
|
+
);
|
|
174
|
+
return { warnings };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
let report: Awaited<ReturnType<typeof invoke>>;
|
|
178
|
+
try {
|
|
179
|
+
report = await invoke("generated.drift.validate", {
|
|
180
|
+
target: "workspace",
|
|
181
|
+
paths: [...candidates],
|
|
182
|
+
});
|
|
183
|
+
} catch (err) {
|
|
184
|
+
warnings.push(
|
|
185
|
+
warn(
|
|
186
|
+
`EVIDENCE-FRESH-02: freshness check threw (${err instanceof Error ? err.message : String(err)}) — artifacts trusted unverified: ${[...candidates].join(", ")}`,
|
|
187
|
+
),
|
|
188
|
+
);
|
|
189
|
+
return { warnings };
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const data =
|
|
193
|
+
report && typeof report.data === "object" && report.data !== null
|
|
194
|
+
? (report.data as { artifacts?: unknown })
|
|
195
|
+
: undefined;
|
|
196
|
+
const artifacts = Array.isArray(data?.artifacts)
|
|
197
|
+
? (data.artifacts as DriftArtifactVerdict[])
|
|
198
|
+
: undefined;
|
|
199
|
+
if (!artifacts) {
|
|
200
|
+
warnings.push(
|
|
201
|
+
warn(
|
|
202
|
+
`EVIDENCE-FRESH-02: freshness check returned no artifact verdicts — trusted unverified: ${[...candidates].join(", ")}`,
|
|
203
|
+
),
|
|
204
|
+
);
|
|
205
|
+
return { warnings };
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const blocking = artifacts.filter((a) => a.verdict === "stale" || a.verdict === "missing");
|
|
209
|
+
if (blocking.length > 0) {
|
|
210
|
+
const details = blocking
|
|
211
|
+
.map((a) => {
|
|
212
|
+
const remedy =
|
|
213
|
+
a.owner && EVIDENCE_SYNC_STEPS.includes(a.owner)
|
|
214
|
+
? `werkstatt run rfc.evidence.sync --id ${rfcId}`
|
|
215
|
+
: `werkstatt run ${a.owner ?? "<generator>"}`;
|
|
216
|
+
return `"${a.path}" (${a.verdict}, owner: ${a.owner ?? "unowned"}, remedy: ${remedy})`;
|
|
217
|
+
})
|
|
218
|
+
.join("; ");
|
|
219
|
+
return {
|
|
220
|
+
warnings,
|
|
221
|
+
block: {
|
|
222
|
+
ruleId: "EVIDENCE-FRESH-01",
|
|
223
|
+
severity: "error",
|
|
224
|
+
message: `${rfcId}: probe-referenced generated artifact(s) not fresh — ${details}. Emission blocked; regenerate the artifact(s) and re-run rfc.verification.emit.`,
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const unverifiable = artifacts.filter(
|
|
230
|
+
(a) =>
|
|
231
|
+
a.verdict === "render-unavailable" ||
|
|
232
|
+
a.verdict === "skipped-volatile" ||
|
|
233
|
+
a.verdict === "skipped-binary",
|
|
234
|
+
);
|
|
235
|
+
if (unverifiable.length > 0) {
|
|
236
|
+
warnings.push(
|
|
237
|
+
warn(
|
|
238
|
+
`EVIDENCE-FRESH-02: freshness unverifiable for ${unverifiable.map((a) => `"${a.path}" (${a.verdict}${a.owner ? `, owner: ${a.owner}` : ""})`).join(", ")} — probes still run`,
|
|
239
|
+
),
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
return { warnings };
|
|
243
|
+
}
|
|
244
|
+
|
|
59
245
|
function execGit(workspaceRoot: string, args: string[]): Promise<string> {
|
|
60
246
|
return new Promise((resolve) => {
|
|
61
247
|
execFile("git", args, { cwd: workspaceRoot, timeout: 5000 }, (err, stdout) => {
|
|
@@ -160,8 +346,27 @@ export function serializeEvidenceEnvelope(envelope: VerificationEvidence): strin
|
|
|
160
346
|
})}\n`;
|
|
161
347
|
}
|
|
162
348
|
|
|
163
|
-
|
|
164
|
-
|
|
349
|
+
/**
|
|
350
|
+
* RFC-1271: canonical serialization for acceptanceHash. Keys are sorted
|
|
351
|
+
* recursively at every depth and NO key is filtered — every probe field
|
|
352
|
+
* (top-level or nested inside expect/schemaInline) must reach the hash,
|
|
353
|
+
* otherwise retargeting a nested probe field leaves the hash unchanged.
|
|
354
|
+
* Exported so rfc.implement.stamp recomputes with the identical function.
|
|
355
|
+
*/
|
|
356
|
+
export function normalizeProbes(probes: AcceptanceProbe[]): string {
|
|
357
|
+
return JSON.stringify(sortKeysDeep(probes));
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function sortKeysDeep(value: unknown): unknown {
|
|
361
|
+
if (Array.isArray(value)) return value.map(sortKeysDeep);
|
|
362
|
+
if (value !== null && typeof value === "object") {
|
|
363
|
+
return Object.fromEntries(
|
|
364
|
+
Object.entries(value as Record<string, unknown>)
|
|
365
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
366
|
+
.map(([k, v]) => [k, sortKeysDeep(v)]),
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
return value;
|
|
165
370
|
}
|
|
166
371
|
|
|
167
372
|
export function buildEvidenceEnvelope(
|
|
@@ -191,6 +396,33 @@ export function buildEvidenceEnvelope(
|
|
|
191
396
|
};
|
|
192
397
|
}
|
|
193
398
|
|
|
399
|
+
/**
|
|
400
|
+
* RFC-1271 `--check`: compare a committed envelope against a fresh
|
|
401
|
+
* computation on non-volatile fields only. Volatile per-run metadata
|
|
402
|
+
* (emittedAt, lastRefreshedAt, durationMs, commit, workingTreeDirty,
|
|
403
|
+
* kernelVersion, probe details) is per-run evidence context, not evidence
|
|
404
|
+
* identity — it is intentionally not compared. RFC-1330 `origin` records are
|
|
405
|
+
* volatile too: they depend on git history, not on the RFC bytes.
|
|
406
|
+
*/
|
|
407
|
+
export function checkEvidenceEnvelope(
|
|
408
|
+
committed: Partial<VerificationEvidence>,
|
|
409
|
+
fresh: VerificationEvidence,
|
|
410
|
+
): string[] {
|
|
411
|
+
const mismatches: string[] = [];
|
|
412
|
+
if (committed.rfcFileHash !== fresh.rfcFileHash) mismatches.push("rfcFileHash");
|
|
413
|
+
if (committed.acceptanceHash !== fresh.acceptanceHash) mismatches.push("acceptanceHash");
|
|
414
|
+
const committedProbes = committed.probes ?? [];
|
|
415
|
+
if (committedProbes.length !== fresh.probes.length) {
|
|
416
|
+
mismatches.push("probes.length");
|
|
417
|
+
} else {
|
|
418
|
+
fresh.probes.forEach((rec, i) => {
|
|
419
|
+
if (committedProbes[i]?.ok !== rec.ok) mismatches.push(`probes[${i}].ok`);
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
if (committed.overall !== fresh.overall) mismatches.push("overall");
|
|
423
|
+
return mismatches;
|
|
424
|
+
}
|
|
425
|
+
|
|
194
426
|
export async function runRfcVerificationEmit(
|
|
195
427
|
input: ForgeCommandInput,
|
|
196
428
|
context: ForgeRuntimeContext,
|
|
@@ -199,6 +431,7 @@ export async function runRfcVerificationEmit(
|
|
|
199
431
|
const { workspaceRoot, logger, outputFormat } = context;
|
|
200
432
|
const rfcDirPath = join(workspaceRoot, RFC_DIR);
|
|
201
433
|
const targetId = input.flags["id"] as string | undefined;
|
|
434
|
+
const checkOnly = input.flags["check"] === true;
|
|
202
435
|
const targetStatus = input.flags["status"] as string | undefined;
|
|
203
436
|
// RFC-1237: consumeCommonFlags strips --dry-run into context.dryRun before
|
|
204
437
|
// dispatch — the input.flags read stays for direct/programmatic callers.
|
|
@@ -235,13 +468,14 @@ export async function runRfcVerificationEmit(
|
|
|
235
468
|
}
|
|
236
469
|
const kernelVersion = await getKernelVersion(workspaceRoot);
|
|
237
470
|
const verificationDirAbs = join(workspaceRoot, VERIFICATION_DIR);
|
|
238
|
-
if (!dryRun) await io.mkdir(verificationDirAbs);
|
|
471
|
+
if (!dryRun && !checkOnly) await io.mkdir(verificationDirAbs);
|
|
239
472
|
|
|
240
473
|
const processFile = async (
|
|
241
474
|
fileName: string,
|
|
242
475
|
): Promise<{
|
|
243
476
|
emittedEntry?: NonNullable<RfcVerificationEmitResult["emitted"]>[number];
|
|
244
477
|
skippedEntry?: NonNullable<RfcVerificationEmitResult["skipped"]>[number];
|
|
478
|
+
checkEntry?: NonNullable<RfcVerificationEmitResult["check"]>[number];
|
|
245
479
|
diagnostic?: Diagnostic;
|
|
246
480
|
}> => {
|
|
247
481
|
const parsedFile = await readAndParseRfc(rfcDirPath, fileName);
|
|
@@ -259,6 +493,26 @@ export async function runRfcVerificationEmit(
|
|
|
259
493
|
}
|
|
260
494
|
|
|
261
495
|
const probes = acceptance as AcceptanceProbe[];
|
|
496
|
+
|
|
497
|
+
// RFC-1320: generated-artifact freshness gate runs BEFORE any probe —
|
|
498
|
+
// a probe reading stale bytes proves nothing. EVIDENCE-FRESH-01 skips
|
|
499
|
+
// emission (blocking diagnostic, non-zero exit); EVIDENCE-FRESH-02 only
|
|
500
|
+
// warns.
|
|
501
|
+
const fresh = await freshnessPrecheck(rfcId, probes, context);
|
|
502
|
+
diagnostics.push(...fresh.warnings);
|
|
503
|
+
if (fresh.block) {
|
|
504
|
+
return {
|
|
505
|
+
skippedEntry: {
|
|
506
|
+
rfcId,
|
|
507
|
+
reason:
|
|
508
|
+
fresh.block.ruleId === "EVIDENCE-FRESH-03"
|
|
509
|
+
? "unknown-probe-kind"
|
|
510
|
+
: "stale-generated-artifact",
|
|
511
|
+
},
|
|
512
|
+
diagnostic: fresh.block,
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
|
|
262
516
|
const probeRecords: VerificationEvidenceProbeRecord[] = [];
|
|
263
517
|
const rfcFilePath = join(rfcDirPath, fileName);
|
|
264
518
|
const rfcMarkdown = await io.readFile(rfcFilePath);
|
|
@@ -276,6 +530,15 @@ export async function runRfcVerificationEmit(
|
|
|
276
530
|
});
|
|
277
531
|
}
|
|
278
532
|
|
|
533
|
+
// RFC-1330: git-derived origin per probe (post-cutoff RFCs only).
|
|
534
|
+
await attachProbeOrigins({
|
|
535
|
+
workspaceRoot,
|
|
536
|
+
rfcRelPath: relative(workspaceRoot, rfcFilePath),
|
|
537
|
+
frontmatter: fm,
|
|
538
|
+
probes,
|
|
539
|
+
records: probeRecords,
|
|
540
|
+
});
|
|
541
|
+
|
|
279
542
|
const envelope = buildEvidenceEnvelope(
|
|
280
543
|
rfcId,
|
|
281
544
|
String(fm["title"] ?? ""),
|
|
@@ -293,6 +556,21 @@ export async function runRfcVerificationEmit(
|
|
|
293
556
|
const evidenceRelPath = join(VERIFICATION_DIR, evidenceFileName);
|
|
294
557
|
const evidenceAbsPath = join(workspaceRoot, evidenceRelPath);
|
|
295
558
|
|
|
559
|
+
// RFC-1271 --check: same probe run as emit, but the committed envelope is
|
|
560
|
+
// compared to the fresh computation and nothing is written. A missing
|
|
561
|
+
// envelope is itself a divergence.
|
|
562
|
+
if (checkOnly) {
|
|
563
|
+
let committed: Partial<VerificationEvidence> | null = null;
|
|
564
|
+
try {
|
|
565
|
+
committed = yamlParse(await io.readFile(evidenceAbsPath)) as Partial<VerificationEvidence>;
|
|
566
|
+
} catch {
|
|
567
|
+
// No committed envelope.
|
|
568
|
+
}
|
|
569
|
+
const mismatches =
|
|
570
|
+
committed === null ? ["envelope-missing"] : checkEvidenceEnvelope(committed, envelope);
|
|
571
|
+
return { checkEntry: { rfcId, match: mismatches.length === 0, mismatches } };
|
|
572
|
+
}
|
|
573
|
+
|
|
296
574
|
// Committed-envelope baseline for the sweep delta — lets a fail-heavy run
|
|
297
575
|
// separate still-failing drift from fresh regressions without git diff.
|
|
298
576
|
let previousOverall: "pass" | "fail" | undefined;
|
|
@@ -340,13 +618,20 @@ export async function runRfcVerificationEmit(
|
|
|
340
618
|
};
|
|
341
619
|
|
|
342
620
|
const results = await mapWithConcurrency(allFiles, concurrency, processFile);
|
|
621
|
+
const checked: NonNullable<RfcVerificationEmitResult["check"]> = [];
|
|
343
622
|
for (const r of results) {
|
|
344
623
|
if (r.emittedEntry) emitted.push(r.emittedEntry);
|
|
345
624
|
if (r.skippedEntry) skipped.push(r.skippedEntry);
|
|
625
|
+
if (r.checkEntry) checked.push(r.checkEntry);
|
|
346
626
|
if (r.diagnostic) diagnostics.push(r.diagnostic);
|
|
347
627
|
}
|
|
348
628
|
|
|
349
|
-
|
|
629
|
+
// RFC-1320: a blocking diagnostic (EVIDENCE-FRESH-01/03) means the run
|
|
630
|
+
// failed even when nothing was emitted.
|
|
631
|
+
const hasFailures =
|
|
632
|
+
emitted.some((e) => e.overall === "fail") ||
|
|
633
|
+
checked.some((c) => !c.match) ||
|
|
634
|
+
diagnostics.some((d) => d.severity === "error");
|
|
350
635
|
const status: RfcVerificationEmitResult["status"] = hasFailures ? "fail" : "pass";
|
|
351
636
|
const delta = {
|
|
352
637
|
recovered: emitted
|
|
@@ -369,8 +654,11 @@ export async function runRfcVerificationEmit(
|
|
|
369
654
|
skipped,
|
|
370
655
|
diagnostics,
|
|
371
656
|
delta,
|
|
657
|
+
...(checkOnly ? { check: checked } : {}),
|
|
372
658
|
},
|
|
373
659
|
exitCode: hasFailures ? 1 : 0,
|
|
374
|
-
summary:
|
|
660
|
+
summary: checkOnly
|
|
661
|
+
? `rfc.verification.emit --check: ${checked.filter((c) => c.match).length} match, ${checked.filter((c) => !c.match).length} diverged, ${skipped.length} skipped`
|
|
662
|
+
: `rfc.verification.emit: ${emitted.length} emitted, ${skipped.length} skipped${deltaSummary}${dryRun ? ", dry-run" : ""}`,
|
|
375
663
|
};
|
|
376
664
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for verification normalize covering normalizeProbes — acceptanceHash identity (RFC-1271).
|
|
5
|
+
</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1311: Compass header sweep — declares the verification suite's contract for test-file scaffold coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// @vitest-environment node
|
|
16
|
+
import { describe, expect, test } from "vitest";
|
|
17
|
+
|
|
18
|
+
import { byteHashHex, normalizeProbes } from "./verification-evidence.ts";
|
|
19
|
+
import type { AcceptanceProbe } from "./types.ts";
|
|
20
|
+
|
|
21
|
+
const hash = (probes: AcceptanceProbe[]) => byteHashHex(normalizeProbes(probes));
|
|
22
|
+
|
|
23
|
+
describe("normalizeProbes — acceptanceHash identity (RFC-1271)", () => {
|
|
24
|
+
test("key order inside a probe does not change the hash", () => {
|
|
25
|
+
const a = [
|
|
26
|
+
{ probe: "file-exists", path: "src/a.ts", criterion: "AC-1" },
|
|
27
|
+
] as AcceptanceProbe[];
|
|
28
|
+
const b = [
|
|
29
|
+
{ criterion: "AC-1", probe: "file-exists", path: "src/a.ts" },
|
|
30
|
+
] as unknown as AcceptanceProbe[];
|
|
31
|
+
expect(hash(a)).toBe(hash(b));
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("a field unique to a LATER probe changes the hash (union-keys regression)", () => {
|
|
35
|
+
// Regression: whitelisting keys from probes[0] only drops criterion/
|
|
36
|
+
// pattern fields that exist solely on later probes — a retarget passes
|
|
37
|
+
// undetected.
|
|
38
|
+
const base = [
|
|
39
|
+
{ probe: "file-exists", path: "src/a.ts" },
|
|
40
|
+
{ probe: "file-contains", path: "src/b.ts", pattern: "alpha", criterion: "AC-2" },
|
|
41
|
+
] as AcceptanceProbe[];
|
|
42
|
+
const retargeted = [
|
|
43
|
+
{ probe: "file-exists", path: "src/a.ts" },
|
|
44
|
+
{ probe: "file-contains", path: "src/b.ts", pattern: "alpha", criterion: "AC-9" },
|
|
45
|
+
] as AcceptanceProbe[];
|
|
46
|
+
expect(hash(base)).not.toBe(hash(retargeted));
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("a nested expect/schemaInline field change changes the hash (deep-bind regression)", () => {
|
|
50
|
+
// Regression: an array replacer whitelists keys recursively — nested
|
|
51
|
+
// probe interiors (expect.exitCode, schemaInline) serialize as {} and
|
|
52
|
+
// never reach acceptanceHash.
|
|
53
|
+
const base = [
|
|
54
|
+
{ probe: "run", command: "werkstatt run x.validate", expect: { exitCode: 0 }, criterion: "AC-1" },
|
|
55
|
+
] as AcceptanceProbe[];
|
|
56
|
+
const nestedChanged = [
|
|
57
|
+
{ probe: "run", command: "werkstatt run x.validate", expect: { exitCode: 1 }, criterion: "AC-1" },
|
|
58
|
+
] as AcceptanceProbe[];
|
|
59
|
+
expect(hash(base)).not.toBe(hash(nestedChanged));
|
|
60
|
+
|
|
61
|
+
const schemaA = [
|
|
62
|
+
{ probe: "json-schema", artifact: "out.json", schemaInline: { type: "object" } },
|
|
63
|
+
] as AcceptanceProbe[];
|
|
64
|
+
const schemaB = [
|
|
65
|
+
{ probe: "json-schema", artifact: "out.json", schemaInline: { type: "array" } },
|
|
66
|
+
] as AcceptanceProbe[];
|
|
67
|
+
expect(hash(schemaA)).not.toBe(hash(schemaB));
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test("probe ordering changes the hash (list identity is ordered)", () => {
|
|
71
|
+
const p1 = { probe: "file-exists", path: "src/a.ts" } as AcceptanceProbe;
|
|
72
|
+
const p2 = { probe: "file-exists", path: "src/b.ts" } as AcceptanceProbe;
|
|
73
|
+
expect(hash([p1, p2])).not.toBe(hash([p2, p1]));
|
|
74
|
+
});
|
|
75
|
+
});
|