Skip to content

feat(lint): effect-receipt guards — leaf rule, plain store, secrets by pointer, baseline refusal (#1833) - #1878

Merged
lex00 merged 1 commit into
mainfrom
feat/1833-receipt-guards
Aug 24, 2026
Merged

lex00 merged 1 commit into
mainfrom
feat/1833-receipt-guards

Conversation

@lex00

@lex00 lex00 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Four guards for effect receipts (#1831's factory + marker), all core.

COR022 — receipt is a leaf (pre-synth rule)

Nothing may reference a receipt's attributes. The rule walks the file's reference graph the way COR011 does: it collects every variable bound to an EffectReceipt(...) call (identifier aliases resolved to a fixpoint, so const r = EffectReceipt(...); other.prop = r.something fires through the indirection) and flags every property or element access rooted at one. Passing the receipt value itself is allowed — the leaf constraint is about attributes, and materialization rows legitimately take the whole declaration.

COR023 — plain-store target (post-synth check)

#1831's declaration shape carries no materialization hints, so this is the honest core half: a post-synth check chant build runs over the FULL build result (receipts are recognized by marker, lexicon-independently, so the check is deliberately not plugin-scoped). It fires when a marker-carrying entity

  • materializes into an entityType matching core's existing secret-kind knowledge (SENSITIVE_KEY_PATTERNS, deep-observation.ts) — K8s::Core::Secret, AWS::SecretsManager::Secret, ...;
  • or declares a Type/Kind prop selecting a secret-capable variant of an otherwise plain kind — SSM's Type: "SecureString" is the canonical case.

Findings go through the same applyConfiguredSeverity funnel as every other post-synth diagnostic. The aws materialization row (#1835) enforces SSM plain String concretely at the source.

COR024 — secrets by pointer (pre-synth rule)

A receipt's inputs feed its expectation hash, and no chant code path may hash or compare secret material (#1365/#1828). The rule reuses COR022's reference walk: a variable is Secret-kind when its initializer names one (new SecretManagerSecret(...), new ExternalSecret(...), declareSecret(...)); an input fires when a property chain rooted at one crosses a material field (data, value, stringData, plaintext, ...), const indirection included (const m = sec.data; inputs: { p: m.password }). The message points at the name+version pointer form — { secretName: sec.name, secretVersion: 3 } — so a rotation re-proposes the effect through an explicit version bump.

Baseline refusal

acceptDeviations (lifecycle/observation-baseline.ts) now refuses a deviation on an effect receipt, throwing before anything is recorded — the whole acceptance aborts, so a partial baseline never lands. Recognition is two-layered: a DeviationToAccept.type of Chant::EffectReceipt is refused unconditionally, and the --update-baseline path threads a marker-based receipt name set (collectEffectReceipts over every target's build entities) so materialized lexicon rows are caught under their own entityType. The error names the receipt and states that the effect() step is the receipt's only writer — accepting the live value would silently defuse the effect.

Tests / docs

  • Firing + passing fixtures per guard; baseline acceptance of a receipt path errors with the named reason (40 new assertions across 4 files).
  • COR022/COR023/COR024 rows added to the core lint-rules docs (correctness.mdx, overview.mdx). The audit-rules page is catalog-generated and unaffected — these are lint rules, not audit-catalog rules.
  • Verified: core tsc clean, npx vitest run packages/core 4542 passed, just lint, just docs-check.

Closes #1833

@lex00
lex00 merged commit c15e13b into main Aug 24, 2026
6 checks passed
@lex00
lex00 deleted the feat/1833-receipt-guards branch August 24, 2026 21:21
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.

lint: receipt guards — leaf rule, plain store, secrets by pointer, baseline refusal

1 participant