Commit 4e6dcd0
Address Copilot review on PR #86
Two findings:
- The backup/restore flow only caught ValidationFailedError. If any
other exception fired after path.rename(backup) (disk error,
permission denied, unexpected serializer fault), the original would
be left as .yaml.bak_metals with no .yaml. Catch BaseException too:
restore the backup before re-raising so the corpus is never left
with a missing canonical file.
- _evidence_text serializes via yaml.safe_dump, which drops comments
and can reflow scalars — strictly not a perfect raw-text equivalent.
Document the caveat: the keywords we search for live in YAML
content (description, evidence snippet, ecological_state), never in
comments, so the on-disk behavior is identical for the corpus today.
If a future workflow starts encoding evidence in YAML comments, the
function should switch to path.read_text() with a line-strip filter.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 50b34f0 commit 4e6dcd0
1 file changed
Lines changed: 22 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
96 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
97 | 104 | | |
98 | 105 | | |
99 | 106 | | |
| |||
163 | 170 | | |
164 | 171 | | |
165 | 172 | | |
166 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
167 | 179 | | |
168 | 180 | | |
169 | 181 | | |
| |||
176 | 188 | | |
177 | 189 | | |
178 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
179 | 197 | | |
180 | 198 | | |
181 | 199 | | |
| |||
0 commit comments