Lint: catch 'the server checks and lands it'; value fallbacks are not silent guards
This commit is contained in:
@@ -208,7 +208,7 @@ func undeclaredOutcomes(prompt string, edges map[string]string) []outcomeMention
|
||||
}
|
||||
|
||||
// deliveryClaim matches affirmative statements that the server lands work.
|
||||
var deliveryClaim = regexp.MustCompile(`(?i)\bthe server (?:then |will |automatically |itself )?(?:lands?|merges?|delivers?)\b|\b(?:landed|merged|delivered) by the server\b|\bserver[- ]side (?:landing|delivery)\b|\bthe (?:server's )?delivery gate\b`)
|
||||
var deliveryClaim = regexp.MustCompile(`(?i)\bthe server (?:(?:then|will|automatically|itself|checks|verifies|tests|validates|and|,)\s*){0,4}(?:lands?|merges?|delivers?)\b|\b(?:landed|merged|delivered) by the server\b|\bserver[- ]side (?:landing|delivery)\b|\bthe (?:server's )?delivery gate\b`)
|
||||
|
||||
// runnerBoilerplate are phrases the runner itself injects around every model
|
||||
// prompt (internal/stage/model_prompt.go) or that restate its output contract.
|
||||
@@ -261,7 +261,7 @@ var silentGuards = []struct {
|
||||
re *regexp.Regexp
|
||||
name string
|
||||
}{
|
||||
{regexp.MustCompile(`\|\|\s*(?:true\b|:(?:\s|;|\)|$)|exit\s+0\b|echo\b)`), "an || fallback that succeeds"},
|
||||
{regexp.MustCompile(`\|\|\s*(?:true\b|:(?:\s|;|\)|$)|exit\s+0\b|echo\b[^|&;()]*(?:;|$))`), "an || fallback that succeeds"},
|
||||
{regexp.MustCompile(`(?:\[\[?|\btest)\s+!\s+-[a-zA-Z]\s+[^|&;]+?\]?\]?\s*\|\|`), "a negated file test that skips the command"},
|
||||
{regexp.MustCompile(`!\s*command\s+-v\s+\S+[^|&;]*\|\|`), "a missing-tool guard that skips the command"},
|
||||
{regexp.MustCompile(`;\s*(?:true|exit\s+0)\s*$`), "a trailing command that always succeeds"},
|
||||
|
||||
@@ -110,6 +110,14 @@ func TestLintDeliveryClaimWithoutDeliveryStage(t *testing.T) {
|
||||
if errs, _ := lintRules(t, claim); len(errs["delivery"]) == 0 {
|
||||
t.Fatal("delivery claim without delivery=true was accepted")
|
||||
}
|
||||
checksAndLands := modelStage("Land", "Report success; the server checks and lands it.", "read\nshell", okEdges, "```checks\nnone: commits locally only\n```")
|
||||
if errs, _ := lintRules(t, checksAndLands); len(errs["delivery"]) == 0 {
|
||||
t.Fatal("\"the server checks and lands it\" without delivery=true was accepted")
|
||||
}
|
||||
never := modelStage("Land", "Commit locally; the server never lands this.", "read\nshell", okEdges, "```checks\nnone: commits locally only\n```")
|
||||
if errs, _ := lintRules(t, never); len(errs["delivery"]) != 0 {
|
||||
t.Fatalf("negated claim flagged: %v", errs)
|
||||
}
|
||||
honest := modelStage("Land", "Commit the change locally; the operator lands it.", "read\nshell", okEdges, "```checks\nnone: commits locally only\n```")
|
||||
if errs, _ := lintRules(t, honest); len(errs["delivery"]) != 0 {
|
||||
t.Fatalf("honest committer flagged: %v", errs)
|
||||
@@ -161,6 +169,7 @@ func TestLintSilentCheckGuards(t *testing.T) {
|
||||
"if [ -f pubspec.yaml ]; then flutter test; else exit 1; fi": false,
|
||||
"make check || echo skipped": true,
|
||||
"go test ./... && go vet ./...": false,
|
||||
`F=$(command -v flutter || echo /opt/flutter) && "$F" test`: false,
|
||||
"gofmt -l . | (! grep .)": false,
|
||||
} {
|
||||
if got := silentGuard(check) != ""; got != silent {
|
||||
|
||||
Reference in New Issue
Block a user