Files
truthmark/tests/evals/no-cli-fallback-cases.ts
a083b703fa feat: add Truthmark health scorecard and bounded workflow contracts (#13)
* feat: add OpenSpec-driven workflow state

* docs: plan generated playbooks workflow contract

* feat: add truth health scorecard

Release Truthmark 2.1.0 with check JSON scorecard output.

Archive the completed OpenSpec pass 4 scorecard change and update generated truth surfaces.

* fix: unblock truthmark scorecard review

- restore and update coverage for scorecard/evidence/workflow behavior
- make truthmark-sync select a cheap local base when --base is omitted
- report malformed evidence YAML blocks as diagnostics instead of throwing

* fix: tighten workflow boundaries

* fix: fail closed when sync has no comparison base

* fix: tighten truth health review coverage

- only parse fenced YAML evidence blocks with top-level evidence markers
- convert coverage fixtures to valid v2 config and assert non-vacuous diagnostics
- update Truthmark truth docs for source traceability and workflow-state tests

* docs: clarify source traceability diagnostics

* docs: harden optional CLI workflow boundary

* docs: clarify product boundary is repo-local

* fix: bound truthmark workflow fallback behavior

- make live workflow preflight use the one-call instructions contract
- keep missing-CLI fallback bounded for Sync, Document, Structure, and Realize
- add routing and generated-surface coverage plus refreshed host surfaces

* test: cover no-cli workflow fallback bounds

- assert route-first fallback wording in generated workflow surfaces
- clarify progressive-disclosure support files are conditional
- align overview docs with bounded no-CLI behavior

* docs: route workflow eval coverage

* fix: remove workflow instructions preflight

* fix: remove stale workflow preflight wording

* fix: remove generic workflow validation blocks

* fix: avoid duplicated markdown context JSON

* fix: keep workflow status manifest-only

* docs: align truth docs with v2 hierarchy

---------

Co-authored-by: MerlinH <merlinh221@gmail.com>
2026-06-13 04:09:45 +10:00

116 lines
3.9 KiB
TypeScript

export type NoCliFallbackOutcomeAxis =
| "same target docs"
| "same block/apply decision"
| "same write boundary"
| "same evidence status";
export type NoCliFallbackEvalCase = {
id: string;
scenario: string;
changedSurface: readonly string[];
expectedCliOutcome: {
targetDocs: readonly string[] | "none" | "structure-repair";
decision: "apply" | "block" | "structure";
writeBoundary: "truth-doc-write" | "route-write" | "none";
evidenceStatus: "current" | "missing-or-stale" | "requires-preservation-check";
};
equivalenceAxes: readonly NoCliFallbackOutcomeAxis[];
};
const ALL_EQUIVALENCE_AXES: readonly NoCliFallbackOutcomeAxis[] = [
"same target docs",
"same block/apply decision",
"same write boundary",
"same evidence status",
];
export const NO_CLI_FALLBACK_EVAL_CASES: NoCliFallbackEvalCase[] = [
{
id: "single-file-one-truth-doc",
scenario: "Single-file code change mapped to one truth doc.",
changedSurface: ["src/auth/session.ts"],
expectedCliOutcome: {
targetDocs: ["docs/truthmark/truth/authentication/session-timeout.md"],
decision: "apply",
writeBoundary: "truth-doc-write",
evidenceStatus: "current",
},
equivalenceAxes: ALL_EQUIVALENCE_AXES,
},
{
id: "multi-file-one-truth-doc",
scenario: "Multi-file change mapped to one truth doc.",
changedSurface: ["src/auth/session.ts", "src/auth/session-policy.ts"],
expectedCliOutcome: {
targetDocs: ["docs/truthmark/truth/authentication/session-timeout.md"],
decision: "apply",
writeBoundary: "truth-doc-write",
evidenceStatus: "current",
},
equivalenceAxes: ALL_EQUIVALENCE_AXES,
},
{
id: "multi-route-multiple-truth-docs",
scenario: "Multi-route change that legitimately needs multiple truth docs.",
changedSurface: ["src/auth/session.ts", "src/billing/invoices.ts"],
expectedCliOutcome: {
targetDocs: [
"docs/truthmark/truth/authentication/session-timeout.md",
"docs/truthmark/truth/billing/invoices.md",
],
decision: "apply",
writeBoundary: "truth-doc-write",
evidenceStatus: "current",
},
equivalenceAxes: ALL_EQUIVALENCE_AXES,
},
{
id: "ambiguous-unmapped-code-blocks",
scenario: "Ambiguous/unmapped code change that should block.",
changedSurface: ["src/unmapped/feature.ts"],
expectedCliOutcome: {
targetDocs: "none",
decision: "block",
writeBoundary: "none",
evidenceStatus: "current",
},
equivalenceAxes: ALL_EQUIVALENCE_AXES,
},
{
id: "broad-index-truth-doc-triggers-structure",
scenario: "Broad/index-like truth doc that should trigger Structure.",
changedSurface: ["docs/truthmark/truth/repository/overview.md"],
expectedCliOutcome: {
targetDocs: "structure-repair",
decision: "structure",
writeBoundary: "route-write",
evidenceStatus: "requires-preservation-check",
},
equivalenceAxes: ALL_EQUIVALENCE_AXES,
},
{
id: "evidence-reference-stale-or-missing",
scenario: "Evidence reference stale/missing.",
changedSurface: ["src/auth/session.ts", "docs/truthmark/truth/authentication/session-timeout.md"],
expectedCliOutcome: {
targetDocs: ["docs/truthmark/truth/authentication/session-timeout.md"],
decision: "block",
writeBoundary: "truth-doc-write",
evidenceStatus: "missing-or-stale",
},
equivalenceAxes: ALL_EQUIVALENCE_AXES,
},
{
id: "preserve-product-decisions-rationale",
scenario: "Product Decisions/Rationale preservation during split or update.",
changedSurface: ["docs/truthmark/routes/areas.md", "docs/truthmark/truth/authentication/session-timeout.md"],
expectedCliOutcome: {
targetDocs: "structure-repair",
decision: "structure",
writeBoundary: "route-write",
evidenceStatus: "requires-preservation-check",
},
equivalenceAxes: ALL_EQUIVALENCE_AXES,
},
];