Skip to content

fix: PR 755 follow-up regression test and code quality#768

Merged
jevonearth merged 1 commit intomainfrom
fix/pr755-followup-regression-test-and-quality
Mar 4, 2026
Merged

fix: PR 755 follow-up regression test and code quality#768
jevonearth merged 1 commit intomainfrom
fix/pr755-followup-regression-test-and-quality

Conversation

@jevonearth
Copy link
Copy Markdown
Contributor

Summary

Follow-up to PR #755 addressing code quality issues from review and adding a regression test for the config validation vs runtime enforcement seam.

  • Regression test: TestBallotSubkindPolicy_EndToEnd exercises PreparePolicy -> signatory.New -> Sign with ballot:nay, ballot:pass (accepted) and ballot:yay (rejected), covering all three ballot sub-kinds end-to-end. This is the exact seam that broke in PR Request and operation kind validation #657.
  • Typo fix: avilKinds -> availKinds in checkRequestKind and checkOperationKind
  • Single source of truth: Hardcoded []string{"yay", "nay", "pass"} replaced with core.BallotYay.String(), core.BallotNay.String(), core.BallotPass.String()
  • Sub-kind aware fixup: fixupOperations now handles compound op:subkind syntax for deprecated name renames (e.g. endorsement:foo -> attestation:foo), with explicit tests documenting the normalization-before-validation behavior
  • Formatting: Trailing whitespace cleanup flagged by gofmt

Test plan

  • go test ./pkg/signatory/ -run TestBallotSubkindPolicy_EndToEnd -v -count=1
  • go test ./pkg/signatory/ -run TestOperationKindCheck -v -count=1
  • go test ./pkg/signatory/ -run TestPolicy -v -count=1
  • go test ./pkg/signatory/ -count=1 (full package suite)
  • gofmt -l pkg/signatory/signatory.go pkg/signatory/signatory_test.go (clean)

Add end-to-end test (TestBallotSubkindPolicy_EndToEnd) that exercises
PreparePolicy -> New -> Sign for ballot sub-kind config, preventing
the class of regression introduced by PR 657 where config validation
rejected valid runtime syntax.

Code quality fixes:
- Fix typo avilKinds -> availKinds in checkRequestKind/checkOperationKind
- Replace hardcoded ballot values with core.BallotKind constants
- Handle sub-kind syntax in fixupOperations for deprecated name renames
- Fix trailing whitespace flagged by gofmt
- Add tests for deprecated alias normalization with sub-kind syntax
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying signatory with  Cloudflare Pages  Cloudflare Pages

Latest commit: cf7a804
Status: ✅  Deploy successful!
Preview URL: https://f04f5a2a.signatory.pages.dev
Branch Preview URL: https://fix-pr755-followup-regressio.signatory.pages.dev

View logs

@jevonearth jevonearth merged commit 6286f96 into main Mar 4, 2026
9 checks passed
@jevonearth jevonearth deleted the fix/pr755-followup-regression-test-and-quality branch March 6, 2026 14:59
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