Repository navigation
feat(workspace): writer conformance suite with the amnesia test, and work evidence as a command - #3316
Merged
Conversation
…work evidence as a command The writer suite holds a tool to the write contract (ws-074): it drives a script of the thirteen write actions through the tool's writer, checks that each is one chant command whose document validates and whose file and ref changes chant reports, then deletes the tool's private state and requires the same facts back. It ships from @intentius/chant/workspace/conformance beside the reader suite, with a vitest wrapper. chant workspace work evidence wraps the workEvidence activity so a writer outside an Op attaches evidence through chant under its lease. Closes #3159
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.
This adds a writer conformance suite beside the reader suite in @intentius/chant/workspace/conformance. It holds a tool to the write contract that ws-074 (the repo is the database) sets out, the same way the reader suite holds hud to the read contract. A consumer wires it like the reader suite. It passes a factory that builds its writer over a recording transport, plus a state directory outside the workspace for its private state. Then it calls runWorkspaceWriterConformance, or describeWorkspaceWriterConformance from the vitest entry.
The suite drives a script that performs each of the thirteen write actions at least once on a generated workspace: records new, amend, review and close; points ask and answer; work claim, renew, evidence and release; runs start, end and record. Each step the writer performs must make exactly one call, the step's command with its arguments and fields. The document it returns must be the one chant printed, valid against the command's output schema, and not a refusal. The only files and git refs that may change are the ones the document reports writing. After the script, facts() may only read. Anything left in the state directory must be declared in privateState as cache, telemetry, secret or runtime. With the state directory deleted and the writer rebuilt, facts() must return the same value (the amnesia test). Whatever the optional holds() names must exist in the repository, and every fact the script produced must read back through records --uncommitted, work history and runs. When a writer doesn't list an action, the suite performs that step itself, so later steps still have what they depend on.
The workspace is the reader suite's fixture plus a new overlay, writer_fixture, holding the reference workspace's work, answer and session kinds, its decision points and one open work item. A unit test checks those files against reference-workspace byte for byte.
workEvidence existed only as an Op activity, so a writer like hud had no way to attach evidence through chant. This adds chant workspace work evidence --holder --token --from <file|->, a thin wrapper over attachWorkEvidence that prints the existing work-evidence document. The ChantTransport's run takes an optional { input } for stdin, and the recorded ChantRun carries it. Existing readers are unaffected.
Shared files touched: packages/core/src/cli/main.ts (one help entry), docs/data/boundary.yaml and the generated boundary page (a row for work evidence and one for writer conformance), the docs sidebar, and scripts/docs-sentences-baseline.json (one entry for the new page, whose findings are on its front matter).
Verified locally with core tsc and build, the new unit test (writer.test.ts), the writer e2e and reader e2e tests (writer-conformance.e2e.test.ts, conformance.e2e.test.ts), work-cli.e2e.test.ts with new evidence cases, the boundary roster test, docs-check, the prose lint and the citations check. The full unit project passes apart from tests that need the sql lexicon's generated artifacts, which this worktree lacks.
Closes #3159