Commit 6f31c8d
Address PR R2 P1: steady-state filename parsing + zero-extracted fallback
The R1 fix added `-z` to the bootstrap branch but left the steady-state
extraction branch on newline-delimited `git diff --name-only`. Under git's
default `core.quotePath=true`, that produces C-quoted paths for filenames
with non-ASCII or special bytes — `[ -f "$nb" ]` then fails on the quoted
form, the notebook is silently skipped, and the workflow emits an empty
`<notebook-prose untrusted="true">` wrapper. Same blind spot this PR is
meant to close.
Two fixes:
1. Steady-state loop now reads NUL-delimited from a `git diff --name-only
-z` process substitution via `while IFS= read -r -d ''`. CHANGED_NB
stays as a newline-rendered list (used for the existence check and
the bootstrap-branch display), but the loop reads the raw NUL stream.
Bash strips embedded nulls in variables, so the only safe way to
preserve null-delimited filenames is to pipe directly to `read -d ''`.
2. Wrapper emission now gates on `[ -s /tmp/notebook-prose.md ]` — the
extracted-content file being non-empty. If the diff lists changed
tutorials but none pass `[ -f "$nb" ]` (e.g., all deleted at HEAD or
rename-only diffs where the old path is gone), an explicit "0 notebooks
extracted" placeholder fires instead of a vacuous empty wrapper.
Tests: extended `TestWorkflowPromptHardening` with three locks —
`test_workflow_bootstrap_branch_has_parity_with_steady_state` upgraded
to require `git diff --name-only -z` in BOTH branches (catches asymmetric
removal); `test_workflow_steady_state_uses_null_delimited_read_loop`
asserts `read -r -d ''` is in the workflow; `test_workflow_steady_state_has_zero_extracted_fallback`
asserts `[ -s /tmp/notebook-prose.md ]` and the "0 notebooks extracted"
placeholder are both present.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 2907698 commit 6f31c8d
2 files changed
Lines changed: 118 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
264 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
265 | 273 | | |
266 | 274 | | |
267 | 275 | | |
268 | | - | |
| 276 | + | |
269 | 277 | | |
270 | 278 | | |
271 | 279 | | |
| |||
275 | 283 | | |
276 | 284 | | |
277 | 285 | | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
283 | 293 | | |
284 | 294 | | |
285 | 295 | | |
286 | 296 | | |
287 | 297 | | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
297 | 325 | | |
298 | 326 | | |
299 | 327 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1782 | 1782 | | |
1783 | 1783 | | |
1784 | 1784 | | |
1785 | | - | |
1786 | | - | |
1787 | | - | |
1788 | | - | |
1789 | | - | |
1790 | | - | |
1791 | | - | |
1792 | | - | |
1793 | | - | |
1794 | | - | |
1795 | | - | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
1796 | 1801 | | |
1797 | 1802 | | |
1798 | 1803 | | |
| |||
1818 | 1823 | | |
1819 | 1824 | | |
1820 | 1825 | | |
1821 | | - | |
1822 | | - | |
1823 | | - | |
1824 | | - | |
1825 | | - | |
1826 | | - | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
1827 | 1883 | | |
1828 | 1884 | | |
1829 | 1885 | | |
| |||
0 commit comments