Repository navigation
feat(lifecycle): plan renders effect-will-fire; generic apply never writes a receipt (#1832) - #1879
Merged
Merged
Conversation
…rites a receipt (#1832)
This was referenced Aug 24, 2026
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.
Part of the effect-receipts epic #1703 (decision 3: receipts are declared, diffed, and observed like any resource, but observe-only to the generic apply path — the
effect()step is the sole writer).Plan: effect-will-fire
lifecycle plannow classifies every declared receipt by comparing its live value to the resolved expectation:effectentry, renderedeffect will fire: <effect>, witheffectReason(receipt-absent/receipt-stale) and the digests ineffectDetailnoop(clean)unobserved, loudly — including a receipt no loaded lexicon materializes or observes ("unknown, not clean"), which folds into the existing stderr incompleteness warningeffectwith anunresolved-inputnote, never a guessed digestResolution uses
resolveReceiptExpectation(#1831) with a resolver over the plan's merged observed values (observedValueResolverinpackages/core/src/lifecycle/receipt-plan.ts): an attr-ref resolves to the referenced entity's observed attribute; anything else is an unresolved input. The effect step resolves again at run (#1834).Entry-kind choice: an additive
ChangeAction"effect"rather than reusingruntimewith a reason.runtimemeans "live, undeclared, owned by a declared entity — not drift"; a receipt row is the opposite shape (declared, and something will happen), and the plan's consumers switch onaction, so overloadingruntimewould have made every consumer parse a reason string to tell "ignore this" from "a migration is about to run". The new kind carrieseffect/effectReason/effectDetailbeside thelexicon/physicalIdattribution #1674 added, counts insummarize, and is excluded from the GitLab MR widget projection like the other non-mutating kinds.Whatever the generic classification proposed for a receipt name (a
createfor a declared-absent receipt, adeletefor a live-owned one missing from the declared axis) is replaced by the receipt's own entries (mergeReceiptEntries) — a receipt is never a create, never an update, and never a prune candidate in the plan.Apply write-exclusion
Choke-point choice: build step 7, the serializer-input assembly in
buildFromDiscoveryResult(packages/core/src/build.ts). Core never invokes appliers directly — every applier (temporalnativeApplytargets, the component deploy verbs,npm run deploy) consumes the serialized build outputs (template.json,dist/gcp.yaml, …). Serialization is therefore what feeds appliers, so the exclusion sits in the assembly of the serializer's entity map: entities carryingEFFECT_RECEIPT_MARKERare split out (splitReceiptEntities) before any lexicon code runs, which is how every lexicon inherits it — a receipt can never appear in an apply-bound document, so no applier can write it and no desired-vs-live prune can sweep in a document-borne receipt.Receipts still reach the serializer for visibility (#1835's design) via a new
SerializeContext.receiptsfield — the seam a materializing lexicon renders them from, anywhere but the section an applier writes from. A serializer that ignores the field emits nothing for them, which is the safe default; a partition holding only core-factory receipts (thechantpseudo-lexicon) serializes nothing and no longer trips the missing-serializer warning.packages/core/src/apply.tsneeded no change: the tri-state envelope never sees a receipt because the plan handed to appliers cannot contain one.Tests
receipt-plan.test.ts: absent → fire; stale hash → fire with both digests; matching → clean noop; unobservable → unobserved loudly (both the could-not-look and the nobody-observes cases); unresolved reference → fire with the note; resolved reference → clean; crash-between-effect-and-write → stale/absent receipt re-proposes the fire; genericcreate/deletefor a receipt replaced (never a prune candidate); render containseffect will fire: <effect>effect-receipt-exclusion.test.ts: a real build over a fixture with a receipt — the serializer spy receives only apply-bound entities (receipt ridesctx.receipts); a mock-plugin apply driven from the build output writes only the bucket and its prune candidates hold the genuine orphan, never the receipt; the receipts-only partition warns about nothingcli/handlers/lifecycle.test.ts:runLifecyclePlanend-to-end with mock plugins — absent receipt → oneeffectrow (no create), matching → clean render, stale →effect will firerender, unobservable core receipt → unobserved plus the stderr incompleteness warningDocs: the
lifecycle planaction table and prose gain theeffectrow.Verified: core tsc clean,
npx vitest run packages/core4535 passed,just lint0 errors,just docs-checkclean.Closes #1832