ci(generated-code-checks): Print actionable error message when generated-code-checks detect stale files (resolves #2160).#2161
Conversation
…ted-code-checks detect stale files (resolves #2160).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughTwo CI workflow files were updated to capture Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
| | grep . > /dev/null \ | ||
| && exit 1 \ | ||
| || exit 0 | ||
| run: |- |
There was a problem hiding this comment.
technically we can extract a .github/actions/ action so we don't repeat those two very similar steps. that said, we only have two occurrences of those so the extraction is a bit overdoing things. in the future if we have more such workflow steps we can consider extraction of an action
gibber9809
left a comment
There was a problem hiding this comment.
LGTM. PR title fine as well.
Description
The
check-generatedstep in bothclp-docs-generated-code-checksandclp-s-generated-code-checksCI workflows currently fails silently when generated files are out of date. The check usesgit status --porcelain ... | grep . > /dev/null && exit 1 || exit 0, which produces a non-zero exit code with no explanatory output — the developer has to read the workflow YAML, understand thegit statuspipeline, and figure out whichtaskcommand to run locally.This PR replaces the silent check in both workflows with an actionable error message that prints:
git status --porcelainoutput).git diffoutput).taskcommand the developer needs to run to regenerate them.Additionally, this fixes a minor duplication in the workflows where the paths were duplicated in the
git statuscommand.Checklist
breaking change.
Validation performed
Scenario 1: Success path — no stale files
Task: Verify the updated check exits cleanly when no generated files are stale.
Command:
Output:
Explanation: When
git status --porcelainreturns an empty string (no modifications), the check exits with code 0 and produces no error output.Scenario 2: Failure path — stale files detected
Task: Verify the updated check prints an actionable error message, lists stale files, shows the diff, and exits with a non-zero code.
Setup: Created a temporary git repo with a modified generated file to simulate staleness.
Command:
Output:
Explanation: When stale files are detected, the check prints the stale file list, the full diff, and the exact command to run, then exits with code 1. This gives the developer all the information they need to resolve the issue without reading the workflow YAML.
Scenario 3:
clp-s-generated-code-checks— same behaviourTask: Verify the
clp-sworkflow check follows the same pattern with the correcttaskcommand (task codegen:clp-s-generate-parsers).Verification: Read the updated workflow file and confirmed:
git status --porcelaincaptures bothkql/generatedandsql/generatedpaths.task codegen:clp-s-generate-parsers.git diffcovers both generated directories.Summary by CodeRabbit