-
Notifications
You must be signed in to change notification settings - Fork 374
fix(spec-enforcer): add explicit noop branch when all tests are already up-to-date #28289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -214,9 +214,9 @@ find pkg/<package> -name 'spec_test.go' -type f | |
| cat pkg/<package>/spec_test.go 2>/dev/null || echo "No spec tests exist" | ||
| ``` | ||
|
|
||
| ## Phase 3: Generate Specification Tests | ||
| ## Phase 3: Create or Update Specification Tests | ||
|
|
||
| Write tests in `pkg/<package>/spec_test.go` that validate the specification. | ||
| Create or update `pkg/<package>/spec_test.go` to validate the specification. If the file already exists, review it against the current README.md and update any tests that are outdated, missing, or incorrect. Use `edit` to write the complete updated file contents (this overwrites the existing file). | ||
|
|
||
| ### Test File Structure | ||
|
|
||
|
|
@@ -340,9 +340,11 @@ cat > /tmp/gh-aw/cache-memory/spec-enforcer/enforcements/<package>.json <<EOF | |
| EOF | ||
| ``` | ||
|
|
||
| ### Create Pull Request | ||
| ### Create Pull Request or Call Noop | ||
|
|
||
| If any spec test files were created or updated: | ||
| After reviewing all selected packages, choose exactly **one** of the following: | ||
|
Comment on lines
+343
to
+345
|
||
|
|
||
| **Option A — If any spec test files were created or updated**, create a PR: | ||
|
|
||
| **PR Title**: `Enforce specifications for <pkg1>, <pkg2>` | ||
|
|
||
|
|
@@ -375,6 +377,14 @@ All tests are derived from README.md specifications, not from implementation sou | |
| *Auto-generated by Package Specification Enforcer workflow* | ||
| ``` | ||
|
|
||
| **Option B — If no spec test files were changed** (all selected packages already have up-to-date tests that fully reflect their README.md specifications), call `noop` instead of creating a PR: | ||
|
|
||
| ```json | ||
| {"noop": {"message": "No changes needed: reviewed <pkg1>, <pkg2>, <pkg3>. All spec_test.go files are up-to-date with current README.md specifications."}} | ||
| ``` | ||
|
|
||
| > **Important**: Every run MUST end by either creating a PR (Option A) or calling `noop` (Option B). Completing the analysis without doing either is an error. | ||
|
|
||
| ## Important Guidelines | ||
|
|
||
| 1. **Specification-first**: Tests MUST come from the README.md, not source code | ||
|
|
@@ -389,11 +399,11 @@ All tests are derived from README.md specifications, not from implementation sou | |
| ## Success Criteria | ||
|
|
||
| - ✅ 2-3 packages with specifications processed per run | ||
| - ✅ `spec_test.go` created or updated for each package | ||
| - ✅ `spec_test.go` created or updated for each package that needs changes | ||
| - ✅ All tests derived from README.md content | ||
| - ✅ Tests compile and pass (or mismatches documented) | ||
| - ✅ Cache memory updated with enforcement state | ||
| - ✅ Round-robin rotation advances correctly | ||
| - ✅ PR created with test changes | ||
| - ✅ PR created with test changes **OR** `noop` called when all tests are already up-to-date | ||
|
|
||
| {{#import shared/noop-reminder.md}} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heading uses "Call Noop"; elsewhere the safe-output tool is referred to as
noop(lowercase, in backticks), e.g..github/workflows/shared/noop-reminder.md:1. Consider renaming this heading to usenoopfor consistency and clarity that it’s a tool name.