Repository navigation
tests: workstream methods keep the wire contract's shapes (conformance) - #2288
Merged
Merged
Conversation
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>
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.
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 throughappwire.Server.Serve, and compares the answer: same keys at every level as the paired example, JSON kinds and enum words from the field tables, nonull, integers integral.Validation contract
coveragefails if the contract gains a method, event or file without one, or disagrees withappwire.WorkstreamMethods.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).errors/bad_params,not_found,conflict,collection_ownerandcreate_owner(in_other_workstream),page_versionandplan_version(version_conflict),cycle,too_large,unknown_method(exact not-yet message),busy(a held writer, ~10 s).doc_questions_are_current).Engine fixes / contract questions
cmd/codeafcompleted in 796 s); every method, the event,collections.addand every error code conform to the contract's examples and field tables.workstreamWireDocQuestionslist is empty.workstream.getnot_foundsaysworkstream target not foundwhere the contract's example saysworkstream not found;page.saveversion_conflictsaysthe version changed since it was readwhere the example saysthe page changed since it was read. Only theunknown_methodstub message is fixed by the contract, and it matches.workstream.changedevent always carriespartsfrom 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 ininternal/session(light gate), and incmd/codeafTestAppChatRowsR2SavedTurnTime,TestAppChatStartupR3QuietRelease,TestRecipeDoorWritesTheWorktreeWhenOnlyTheCheckoutIsHeld. Thebusycase holds a real writer for the store's 10 s wait.🤖 Generated with Claude Code