Repository navigation
Commit c7bbc22
committed
fix: Address review on the PATH host-format change
Four findings from the automated review. Three were correct, one was not.
**Correct.** The comment claiming this is "idempotent for a value a rule did
match" overclaimed. It holds for a POSIX- or WINDOWS-format rule, whose output
`apply` rebuilds through `PureWindowsPath`, but not for a URI-format rule:
`_apply_uri` copies `destination_path` verbatim and uses the host separator only
for the appended child parts. Measured, a URI rule with a POSIX-spelled
destination on a Windows host gives `/tmp/openjd\scene\out` from `apply` alone,
which this then completes to `\tmp\openjd\scene\out`. That is a real behaviour
change on a matched rule and no test covered it.
It is also exactly what openjd-rs produces for the same mapped string, measured
through `new_path(mapped, host())`, so completing it is the intent rather than a
side effect. The comment now states both cases and
`test_a_matching_uri_rule_is_completed_not_left_mixed` pins them, asserting the
`apply`-only value first so a future change to `_apply_uri` says which half moved.
**Correct.** Two maintainability points: `to_host_path_separators` was defined
above the `_URI_SOURCE_RE` it reads, which worked only because the global is
resolved at call time; it now follows the regex. And the test module's docstring
named a `host_path_format` that never shipped -- an earlier name for this
function -- so a reader following it found nothing.
**Not an error.** The review flagged `_URI_SOURCE_RE`'s one-character scheme as
misclassifying a Windows drive letter, since `C://Users/foo` is treated as a URI
and returned unchanged while `C:/Users/foo` is converted, and asked whether
openjd-rs guards against a one-character scheme. It does not. Measured through the
engine, openjd-rs renders `C://Users/foo`, `C:/Users/foo`, `x://y/z` and four
other cases identically to this function -- 7/7 agreement. RFC 3986 §3.1 admits a
single-character scheme and the Expression Language states the pattern as
`^[a-zA-Z][a-zA-Z0-9+.-]*://`, so this is the specified behaviour, and tightening
the regex would make this package diverge from the implementation it is being
aligned with. Pinned deliberately by
`test_a_one_character_scheme_matches_the_engine` so it is not later "fixed" into
a divergence; if the behaviour is wrong it is wrong in the specification.
Also, per review feedback, the three branches now carry the openjd-expr source
they were transcribed from -- `normalize_path_separators` in
`crates/openjd-expr/src/value.rs` -- quoted inline so the copy can be diffed
against the original without leaving the file. `normalize_path_separators` and
the `uri_path::parse` behind its `is_uri` are byte identical in openjd-expr 0.5.0
and 0.6.0, checked against both crates.io sources rather than assumed.
No production logic changed: the diff is one moved function, comments, and tests.
21 tests now (was 17), all 7 mutants still caught, and the full suite is unchanged
at the same 8 pre-existing environmental failures with 1007 passing (was 1003).
Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>1 parent 9cd6b77 commit c7bbc22
3 files changed
Lines changed: 131 additions & 17 deletions
File tree
- src/openjd/sessions
- test/openjd/sessions_v0
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
29 | 37 | | |
30 | 38 | | |
31 | 39 | | |
| |||
53 | 61 | | |
54 | 62 | | |
55 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
56 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
57 | 97 | | |
58 | 98 | | |
59 | 99 | | |
60 | 100 | | |
61 | 101 | | |
62 | 102 | | |
63 | 103 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | 104 | | |
73 | 105 | | |
74 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1677 | 1677 | | |
1678 | 1678 | | |
1679 | 1679 | | |
1680 | | - | |
1681 | | - | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
1682 | 1692 | | |
1683 | 1693 | | |
1684 | 1694 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
| |||
179 | 183 | | |
180 | 184 | | |
181 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
182 | 225 | | |
183 | 226 | | |
184 | 227 | | |
| |||
207 | 250 | | |
208 | 251 | | |
209 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
210 | 282 | | |
211 | 283 | | |
212 | 284 | | |
| |||
0 commit comments