Skip to content

test: add generator proof-of-behavior gates (Short + classic-manifest path hygiene)#228

Merged
ktn-jamf merged 5 commits into
mainfrom
worktree-feat+generator-proof-gates
May 31, 2026
Merged

test: add generator proof-of-behavior gates (Short + classic-manifest path hygiene)#228
ktn-jamf merged 5 commits into
mainfrom
worktree-feat+generator-proof-gates

Conversation

@ktn-jamf
Copy link
Copy Markdown
Collaborator

Summary

Adds two offline generator-verification gates, inspired by an audit of the cli-printing-press "proof of behavior" layer. Both are pure go test regression guards — no runtime cost, no new CI wiring, no production or generated code touched.

  • TestProofAllCommandsHaveShort (internal/commands/) — fails CI if any command in the NewRootCmd tree ships without a non-empty Short. Short drives --help, the docs site (commands -o json), and agent/MCP summaries; a blank one renders a broken-looking command. 0 violations today — this keeps it that way as new generated/hand-written commands land.
  • TestProofClassicManifestPathsWellFormed + TestIsCleanPathSegment (generator/classic/) — fails CI if a hand-edited path token in specs/classic/resources.yaml has a stray space/slash/control char. That typo otherwise produces a broken /JSSResource/… URL that nothing catches until it 404s against a live instance (or in make smoke).

Scope note (why only two gates)

A pre-implementation audit found 3 of the 4 originally-designed proofs already exist and are implemented as well or better:

  • dead-flag detection → scripts/lint-dead-code/
  • registry-pairing → pro_resources_test.go::TestBackupResources_AllKeysRegistered
  • destructive-annotation policy → destructive_annotations_test.go

So only the two genuine gaps were built. The audit + reasoning are recorded in docs/superpowers/specs/2026-05-31-generator-proof-gates-design.md (with a scope-revision banner) and docs/superpowers/plans/.

Heads-up for reviewers

The Short gate walks the entire command tree (hand-written, Protect, Platform — not just generated), so it polices every command, not only generator output. Reasonable invariant, but slightly broader than "generator verification." Easy to scope to generated-only if preferred.

Test Plan

  • go test ./... passes (exit 0, no failures)
  • golangci-lint run ./internal/commands/... ./generator/classic/... → 0 issues
  • New tests pass; each detector verified failable via a dev-time negative control (and TestIsCleanPathSegment is a permanent guard)
  • git diff --stat main..HEAD confirms zero changes under internal/commands/pro/generated/, internal/commands/platform/generated/, or specs/

Note: repo-wide make lint currently reports pre-existing failures in generated code and a sibling worktree, unrelated to this branch — see PR discussion if relevant.

🤖 Generated with Claude Code

ktn-jamf and others added 4 commits May 31, 2026 00:55
Regression guard over the full NewRootCmd tree; 0 violations today. Reuses
the existing walkCommands/commandPath helpers. Closes the one Proof-D slice
not already covered by destructive_annotations_test.go.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Validates every Path/IDPath/GroupPath token in specs/classic/resources.yaml
is a clean single URL segment and the constructed /JSSResource/ URL is
well-formed. Parses clean today; guards the hand-maintained manifest against
typo'd tokens that nothing else catches. The design's Proof B.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Addresses final-review nit: the prior comment could be misread as implying
hidden commands' children are also skipped; walkCommands descends into them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Addresses local-review finding (1): the manifest proof's floor check guards
against an empty parse but not against the validator logic itself being
weakened. A permanent table test keeps the 'prove the gate can fail' property
after the dev-time negative control was removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ktn-jamf ktn-jamf force-pushed the worktree-feat+generator-proof-gates branch from 0cf3a7e to 76651e6 Compare May 31, 2026 05:56
@ktn-jamf ktn-jamf marked this pull request as ready for review May 31, 2026 05:58
@ktn-jamf ktn-jamf enabled auto-merge (squash) May 31, 2026 05:59
@ktn-jamf ktn-jamf merged commit db20db6 into main May 31, 2026
1 check passed
@ktn-jamf ktn-jamf deleted the worktree-feat+generator-proof-gates branch May 31, 2026 06:01
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.

2 participants