Commit 420d57c
committed
Lint: reject a check no shell can parse
Burned a full worker run against a check command that no shell could parse.
The manifest linted clean, the worker ran to completion and was paid for, and
the only evidence was an opaque `/bin/sh: syntax error near unexpected token
`('` after the fact. Because a check that fails to parse can never exit 0, the
task can never pass -- every retry attempt is spent before the run fails.
The mistake is easy to make by hand and invisible on the page: single quotes
nested inside a single-quoted argument, which POSIX shells cannot express.
--verify-command 'a && grep -qE '^## Heading (x|y)' out.md'
The inner quote closes the argument early and `(x|y)` is then reparsed as bare
syntax.
lint now runs `sh -n` on each task's check -- which parses without executing,
so it is safe on an arbitrary command -- and reports the shell's own diagnosis
rather than a bare "invalid", per the house rule that a check should print why
it failed.
shlex.split() is deliberately not used: it accepts this exact string happily,
so it cannot catch the mistake. Where no POSIX shell exists (Windows) the
helper returns None and lint stays silent rather than reporting a platform gap
as a manifest defect; the accompanying tests assert only shell-independent
behaviour on that path.
Proof: tests/test_lint.py gains two tests -- one asserting the finding appears
and carries the shell's diagnosis, one asserting four valid checks (including
correctly-escaped nested quotes) are not flagged. Both fail against unfixed
main and pass with this change. Full suite: 255 tests, the single failure being
test_deliverables.test_runner_harvests_when_task_passes, which fails
identically on pristine main with and without this change.1 parent a1a91b8 commit 420d57c
2 files changed
Lines changed: 84 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1815 | 1815 | | |
1816 | 1816 | | |
1817 | 1817 | | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
1818 | 1824 | | |
1819 | 1825 | | |
1820 | 1826 | | |
| |||
1906 | 1912 | | |
1907 | 1913 | | |
1908 | 1914 | | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
1909 | 1957 | | |
1910 | 1958 | | |
1911 | 1959 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
80 | 116 | | |
81 | 117 | | |
82 | 118 | | |
| |||
0 commit comments