Skip to content

tests: workstream methods keep the wire contract's shapes (conformance) - #2288

Merged
AbirAbbas merged 5 commits into
workstreams/mainfrom
workstreams/conformance
Nov 3, 2026
Merged

AbirAbbas merged 5 commits into
workstreams/mainfrom
workstreams/conformance

Conversation

@AbirAbbas

@AbirAbbas AbirAbbas commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Wire conformance for the workstream methods (the Workstreams plan, CONF). The desktop app and the engine were built in parallel against one written wire contract; each side's tests check its own reading. This adds the missing check: the real engine's answers, through the real wire handler, must have the shapes the contract's examples have.

  • cmd/codeaf/testdata/workstreams-wire/: the contract's examples, field tables, enums and error codes, one file per method and event (wire shapes only), plus the extractor that regenerates them when the contract changes.
  • cmd/codeaf/appworkstreams_conformance_test.go: TestAppWorkstreamWireConformance. For each method it seeds a store (workstream with origin chat and a member job, nested pages, records, a go-ahead, a plan; job facts through the fake Factory queue), prepares the example params (values only; the test proves the shape is unchanged), sends them as a JSON line through appwire.Server.Serve, and compares the answer: same keys at every level as the paired example, JSON kinds and enum words from the field tables, no null, integers integral.

Validation contract

  • (a) Every method in the contract has a case; coverage fails if the contract gains a method, event or file without one, or disagrees with appwire.WorkstreamMethods.
  • (b) Every case passes against the real wire handler: TestAppWorkstreamWireConformance/<method>/example_N, collections.add, workstream.changed; the shape rules have their own positive/negative checks (shape_rules), and every contract example is checked against its own field table (doc_self_check).
  • (c) Every engine-sent error code has a wire call checking its code and detail keys: errors/bad_params, not_found, conflict, collection_owner and create_owner (in_other_workstream), page_version and plan_version (version_conflict), cycle, too_large, unknown_method (exact not-yet message), busy (a held writer, ~10 s).
  • (d) Differences are fixed in the engine or listed as contract questions in one list the test tolerates and that fails when an entry goes stale (doc_questions_are_current).

Engine fixes / contract questions

  • Engine fixes: none. CI ran the test against the real handler (cmd/codeaf completed in 796 s); every method, the event, collections.add and every error code conform to the contract's examples and field tables.
  • Contract shape questions: none. The workstreamWireDocQuestions list is empty.
  • Wording only (not shapes, not asserted): workstream.get not_found says workstream target not found where the contract's example says workstream not found; page.save version_conflict says the version changed since it was read where the example says the page changed since it was read. Only the unknown_method stub message is fixed by the contract, and it matches.
  • The workstream.changed event always carries parts from this engine; the parts-less form is checked against the field table only.

CI

Red only on baseline failures also red on workstreams/main: the laws ratchet in internal/session (light gate), and in cmd/codeaf TestAppChatRowsR2SavedTurnTime, TestAppChatStartupR3QuietRelease, TestRecipeDoorWritesTheWorktreeWhenOnlyTheCheckoutIsHeld. The busy case holds a real writer for the store's 10 s wait.

🤖 Generated with Claude Code

AbirAbbas and others added 5 commits November 3, 2026 00:35
The examples, field tables, enums and error codes the Workstreams wire
contract carries, one file per method and event, with the extractor that
regenerates them when the contract changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each method's example params go through the real wire handler against a
seeded store; each answer must have its example's keys at every level, the
field tables' JSON kinds and enum words, no nulls and integral integers.
Every engine-sent error code has a call that checks its code and detail keys.
A method, event or error code the contract gains without a case fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A reply array shorter than its example no longer skips the elements the
example illustrates (a plan's draft item, an unattributed page version);
page.delete must return exactly the seeded parent and descendant. Request
writes to the wire are bounded like replies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AbirAbbas
AbirAbbas merged commit 7232f12 into workstreams/main Nov 3, 2026
2 of 6 checks passed
@AbirAbbas
AbirAbbas deleted the workstreams/conformance branch November 3, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant