Repository navigation
Commit 1dabcfa
committed
fix(rules): reject delivered paths that collide before writing any of them
Two ways a file set passed assessment and then failed mid-write, leaving the
half-written rule directory this module exists to make impossible.
ONE PATH BEING AN ANCESTOR OF ANOTHER. `check.ts` and `check.ts/nested.ts`
are not duplicates, neither is unsafe, and the set can still be complete — so
every check passed. Then the same name has to be a file and a directory at
once: `mkdir` throws `ENOTDIR` when the parent was already written as a file,
`writeFile` throws `EISDIR` when a recursive `mkdir` got there first. Which
one depends on array order. In the second order the rule ends up with its
captures written and no `check.ts` file, which is the "never blessed, sits in
unknown[]" case the completeness check exists to prevent, reached with debris
on disk instead of a clean refusal.
TWO PATHS DIFFERING ONLY IN CASE. APFS and NTFS are case-insensitive by
default, so `captures/Logs.yml` and `captures/logs.yml` are distinct strings
and one file: the second write clobbers the first and the rule silently loses
a capture. Capture names are arbitrary, unlike `check.ts` and the engine's
config file, so no other check would have caught it. The duplicate check is
now case-folded, and the ancestor check folds too.
Both proven to bite: removing the ancestor check fails both orderings and
nothing else; removing the case folding fails only the case test.
Found by the review on #219.1 parent 6d103ef commit 1dabcfa
3 files changed
Lines changed: 84 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
152 | 157 | | |
153 | 158 | | |
154 | 159 | | |
155 | 160 | | |
156 | 161 | | |
157 | | - | |
158 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
159 | 193 | | |
160 | | - | |
161 | 194 | | |
162 | 195 | | |
163 | 196 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
168 | 209 | | |
169 | 210 | | |
170 | 211 | | |
| |||
0 commit comments