Skip to content

test(generate): fill correctness-census followup assertions - #638

Merged
joshua-temple merged 1 commit into
mainfrom
test/generation-correctness-followup
Jul 18, 2026
Merged

joshua-temple merged 1 commit into
mainfrom
test/generation-correctness-followup

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

The generation-correctness census classifies every emitted-affecting manifest field as either a named correctness assertion or a reviewed marker. It shipped with a set of followup markers: fields with a distinct emitted semantic shape whose assertion was deferred. A followup is a tracked acknowledgment, not a silent skip, but it still leaves the field's emitted contract unpinned.

Fix

Fill the followup entries with real assertions (each proven red-first by breaking the emitter and watching the assertion fail):

  • gpg_key_id / gpg_key_secret (security-critical): pin that the emitted git setup imports the private key, sets commit.gpgsign true, and wires user.signingkey. A dropped signing line reds the assertion, so a regression cannot silently ship unsigned commits.
  • run_policy (builds / deploys / validate): the emitted if: gate matches the policy (change-detection gate vs always()).
  • depends_on / optional_depends_on (build + deploy): required deps both sequence (needs:) and gate (if:); optional deps only sequence.
  • environments role: role: release moves the release stage off the positional-last environment.
  • pin_mode: sha mode emits SHA refs, tag mode emits tag refs.
  • release_trigger: dispatch drops the push: trigger.
  • reconcile.commit: append vs followup emit their distinct steps.

Honestly reclassified rather than asserted:

  • reconcile.source: not-emitted. It has a single valid value and no emitted consumer in the generate package, so there is no distinct shape to pin.
  • external[].deploys[].optional_depends_on[]: kept followup. The same-repo optional contract is now asserted, but the external-deploy emit path is distinct and not exercised here.

Also adds a positive deploy-side permissions case: a configured deploy permission is asserted to emit, not only the least-privilege omission (reviewer nit from the prior PR).

Where a field's correctness has a runtime component (run_policy gating, depends_on skip behavior), the assertion pins the emitted shape and notes that the runtime proof is fleet-only.

Verification

  • go build ./..., go vet, golangci-lint run ./...: clean.
  • go test ./...: green except the documented TestPushWithRebaseRetry_FailsFastOnRemoteRejection flake.
  • go test ./internal/generate/ -race: clean.
  • cascade verify --own-repo: no drift.
  • Census followup markers drop from 14 to 1; the census still forces a new field and every touched field stays classified.
  • Each assertion proven red-first by mutating its emitter.

Turn the reviewed followup markers in the generation-correctness census into
named assertions that pin each field's emitted shape, and reclassify the one
field with no distinct emitted contract.

- gpg_key_id / gpg_key_secret: assert the emitted git setup imports the key,
  turns on commit.gpgsign, and wires the signing key, so state and finalize
  commits are actually signed.
- run_policy (builds, deploys, validate): assert the emitted job if: gate
  matches the policy (change-detection gate vs always()).
- depends_on / optional_depends_on (build and deploy): assert required deps
  both sequence and gate, while optional deps only sequence.
- environments role: assert role: release moves the release stage off the
  positional-last environment.
- pin_mode: assert sha mode emits SHA refs, tag mode emits tag refs.
- release_trigger: assert dispatch drops the push trigger.
- reconcile.commit: assert append vs followup emit their distinct steps.
- reconcile.source: reclassify as not-emitted (single valid value, no sink).

Also add a positive deploy-side permissions case, so a configured deploy
permission is asserted to emit, not only the least-privilege omission.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple merged commit 333cf8a into main Jul 18, 2026
21 checks passed
@joshua-temple
joshua-temple deleted the test/generation-correctness-followup branch July 18, 2026 14:17
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