Repository navigation
[spec-enforcer] Enforce specifications for workflow/lint, workflowcontract, workflow/shellpattern - #80709
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The discovery test scans all _test.go files without honoring Go build constraints, so it can falsely validate excluded contract declarations as runnable entry points.
1 open issue
What changed in this PR
Adds README-derived specification checks for workflow contract test entry points and three newly documented built-in lint rule registrations.
Changes:
- Adds AST-based validation for five documented
workflowcontracttest functions and their signatures. - Extends lint specification coverage to verify registration of
OverprovisionedSecretsRule,UnsoundContainsRule, andBotConditionsRule. - Preserves the existing documented
Severity.Stringmismatch annotation and skip.
| File | Description |
|---|---|
| pkg/workflowcontract/spec_test.go | Adds AST-based checks for documented workflow contract test declarations and signatures. |
| pkg/workflow/lint/spec_test.go | Adds specification checks for registration of three documented built-in lint rules. |
Review effort: Lite (adaptive)
Comment on lines
+27
to
+34
| entries, err := os.ReadDir(".") | ||
| require.NoError(t, err, "the documented test-only package must be readable") | ||
| for _, entry := range entries { | ||
| if entry.IsDir() || !strings.HasSuffix(entry.Name(), "_test.go") { | ||
| continue | ||
| } | ||
| file, err := parser.ParseFile(token.NewFileSet(), entry.Name(), nil, parser.SkipObjectResolution) | ||
| require.NoError(t, err, "Go test declarations must parse in %s", entry.Name()) |
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.

Specification Test Enforcement
Add README-derived checks for three newly documented lint registrations and five documented workflowcontract test entry points. The reviewed shellpattern specification suite is up-to-date.
workflow/lintworkflowcontractworkflow/shellpatternCounts represent leaf test cases: 75 pass, with one existing lint case skipped.
Test Derivation
All tests are derived from README.md specifications, not implementation behavior. The lint additions verify that
Default()registersOverprovisionedSecretsRule,UnsoundContainsRule, andBotConditionsRule. The workflowcontract suite checks the exported names and valid Go test signatures listed in its README without reproducing existing assertion logic.Spec-Implementation Mismatches
The existing
TestSpec_PublicAPI_SeverityStringremains skipped: the lint README documentsSeverity.String, but the exported severity type does not implement it. Its existingSPEC_MISMATCHannotation is preserved.Validation and specification limits
go buildand theirTestSpecruns.make fmtand the finalmake agent-report-progresspass, including Go lint, impacted tests, and drift validation: all 371 workflow lock files remain in sync.spec-enforcer/generated-tests.SPEC_AMBIGUITYand enforces documented entry-point availability and signatures; it does not claim independent behavioral coverage of those workflows.Round-Robin State
workflow/lint,workflowcontract,workflow/shellpatternworkflow/taint,workflowcontract,workqueueRotation, enforcement records, and merged README hashes were saved and read back successfully; unprocessed hashes were preserved.
References: §45383914828