forked from flaviocopes/fstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Harden cloud-agent validation and CI diff checks #2
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b62adda
Add validator regression tests
naytewilson fbff7d4
Handle validator paths safely
naytewilson 365596f
Make CI validate push diffs correctly
naytewilson 6513d67
Require validator regression tests
naytewilson fa2564f
Document validator regression gate
naytewilson 37df5b5
Align cloud-agent validation docs
naytewilson df8df14
Add validator tests to PR checklist
naytewilson 67529e4
Keep Copilot checks aligned
naytewilson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| #!/bin/sh | ||
|
|
||
| set -eu | ||
|
|
||
| root=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) | ||
| tmp_root="${TMPDIR:-/tmp}/fstack-validator-tests.$$" | ||
| fixture="$tmp_root/fstack fixture" | ||
|
|
||
| cleanup() { | ||
| rm -rf "$tmp_root" | ||
| } | ||
|
|
||
| trap cleanup EXIT HUP INT TERM | ||
| umask 077 | ||
| mkdir -p "$fixture/scripts" "$fixture/skills/fstack" "$fixture/skills/fstack-run" | ||
| cp "$root/scripts/validate.sh" "$fixture/scripts/validate.sh" | ||
|
|
||
| write_valid_fixture() { | ||
| cat > "$fixture/README.md" <<'MARKDOWN' | ||
| `/fstack` | ||
| `/fstack-run` | ||
| MARKDOWN | ||
|
|
||
| cat > "$fixture/skills/fstack/SKILL.md" <<'MARKDOWN' | ||
| --- | ||
| name: fstack | ||
| description: Front door. | ||
| --- | ||
| MARKDOWN | ||
|
|
||
| cat > "$fixture/skills/fstack-run/SKILL.md" <<'MARKDOWN' | ||
| --- | ||
| name: fstack-run | ||
| description: Continuous runner. | ||
| --- | ||
| MARKDOWN | ||
| } | ||
|
|
||
| expect_failure() { | ||
| expected=$1 | ||
| if sh "$fixture/scripts/validate.sh" > "$tmp_root/stdout" 2> "$tmp_root/stderr"; then | ||
| printf 'ERROR: validator unexpectedly passed: %s\n' "$expected" >&2 | ||
| exit 1 | ||
| fi | ||
| if ! grep -Fq "$expected" "$tmp_root/stderr"; then | ||
| printf 'ERROR: validator failed without expected message: %s\n' "$expected" >&2 | ||
| cat "$tmp_root/stderr" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| write_valid_fixture | ||
| output=$(sh "$fixture/scripts/validate.sh") | ||
| if [ "$output" != 'Validated 2 skills.' ]; then | ||
| printf 'ERROR: unexpected validator output: %s\n' "$output" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| sed 's/name: fstack-run/name: wrong-name/' \ | ||
| "$fixture/skills/fstack-run/SKILL.md" > "$tmp_root/invalid-skill" | ||
| mv "$tmp_root/invalid-skill" "$fixture/skills/fstack-run/SKILL.md" | ||
| expect_failure 'declares name wrong-name but directory is fstack-run.' | ||
|
|
||
| write_valid_fixture | ||
| cat > "$fixture/README.md" <<'MARKDOWN' | ||
| `/fstack` | ||
| MARKDOWN | ||
| expect_failure 'README.md does not document /fstack-run.' | ||
|
|
||
| printf '%s\n' 'Validator tests passed.' |
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
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.
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.
When a new
feat/**orfix/**branch is pushed, GitHub setsbeforeto the all-zero SHA and leavesGITHUB_BASE_REFempty, so this fallback runs. Thegit show [<options>] <object>...command receives onlyHEAD, meaning whitespace errors in earlier commits from the same initial push are skipped; for example, a two-commit branch whose first commit adds trailing whitespace passes when its tip is clean. Compare the new branch with its base branch instead so the repository's requiredgit diff --checkgate covers the complete change.AGENTS.md reference: AGENTS.md:L41-L49
Useful? React with 👍 / 👎.