Repository navigation
feat(ops): effect() read-compare-run-write, gated effects on ApplyOp, WatchOp staleness (#1834) - #1880
Merged
Conversation
… WatchOp staleness (#1834)
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
Third leg of the effect-receipts epic #1703 (decisions 3 and 6): the
effect()op step is the sole writer of a receipt — on success of its nested steps, last — andeffects: "gated"lands besidedelete: "gated"on the temporal ApplyOp.effect(receipt, steps, opts?)step builder (core)receiptis typed to theEffectReceiptDeclarationshape — no string overloads; a string receipt name does not compile (type-level test under core tsc) and is refused at runtime.receiptExpectation; a hash receipt with reference inputs carries placeholder inputs and resolves at run (decision 5), never by hashing placeholders.gate(...)authored inside the nested steps pauses only when the effect will fire.Injectable
ReceiptStoreseam (packages/core/src/op/receipt-store.ts)ReceiptStore = { read(receipt) -> current | absent, write(receipt, expectation) }over anEffectReceiptRef({ name, effect, flavor, inputs }).receiptActivities(store, opts?)binds the three activities —receiptRead,receiptWrite,receiptStaleness— that the receipt row's lexicon exports from itsop/activitiesmodule (#1835 implements the store over SSM; tests bind a mock), registered by name through the activity registry exactly likeensureSecret(#1829/#1830). The local executor runs effect steps through the same activity names;receiptStalenessis read-only by construction.Serializer
The op codegen emits the read-compare-run-write as workflow code with the receipt identity and expectation as data: one
receiptReadcall carrying the receipt (and static expectation) as JSON, the compare in workflow code, the nested steps inside the mismatch branch, and the singlereceiptWritelast. Authored order is preserved andreceiptRead/receiptWriteget one proxy binding at thefastIdempotentprofile (#1698 rules).effects: "gated"on ApplyOpBeside
delete: "gated", same durable-signal shape: the run pauses at the Approve gate so the Plan phase's effect-will-fire rows (#1832) are reviewed before any effect runs. The generic apply never writes a receipt regardless.WatchOp staleness
receipts: [...](typed EffectReceipt references) adds a read-onlyReceiptsphase: reads each receipt via the store seam, reports absent/differing values as findings and aStaleReceiptssearch attribute, runs nothing, writes nothing.Testing
npx tsc --noEmit -p packages/core/tsconfig.jsonclean (includes the type-level no-string-receipt test)npx vitest run packages/core/src/op lexicons/temporal/src— 527 passednpx vitest run packages/core/src/cli packages/core/src/components— all passednpm run build -w @intentius/chant-lexicon-temporalcleanjust lint,just docs-checkcleanCloses #1834