Commit 1116d4d
fix(schedule3-subpage): address PR #344 review — one parser, gated commit, keyed contract
All three findings confirmed against the code; the reviewer's analysis of the
parser split was exactly right (toNum yields 1000/16/1234 for 1e3/0x10/12,34
where committedNum yields null).
1. The row cells and the footer now share one parse. `numeric()` moves from lax
`toNum` to strict `committedNum`, so a derived Crown cannot disagree with the
Subtotal Crown above it. Also closes the sidebar: `toNum` had no finiteness
guard, so Infinity rendered as ∞.
2. The blur commit now holds invalid and unusable entries, as every other
surface does. One correction to the review here: gating on `errs` would not
have worked. `rowErrors` is populated only by `persist`
(useEditableCostRows.ts:204) — i.e. on a Save attempt — so it is still empty
during the entry the gate has to catch, and the field is not marked invalid
until Save either. The gate runs `config.validate` on the blurred value
instead.
3. The `deriveSummary` doc comment now states the keyed contract and points at
the note in schedule3OtherAcceptableCosts/derived.ts that explains why.
Three tests added, each mutation-verified against the specific fix it covers.
Finding 1 needed the in-flight-add path to be observable at all: once the commit
gate is in place, a lax-only value can never reach `committed`, so the only
surface where the two parsers still meet is a locally added row, which falls back
to its live values while its PUT is in flight — and `1e3` clears validation, so
it can be added.
Also dropped a fourth test I had written for "one field's blur commits its
neighbours' half-typed entries": that is unreachable, because moving focus to
another field blurs the first one. The `prev[row.key]` merge is kept as a
correctness tidy, not a bug fix, and is commented as such.
Suite 1294/1296 (two timeout flakes, 221/221 in isolation), zero unhandled
errors, build clean, no new type errors.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 0f20f60 commit 1116d4d
2 files changed
Lines changed: 118 additions & 5 deletions
File tree
- frontend/src/components
- schedule3OtherAcceptableCosts/__tests__
- schedule3SubPage
Lines changed: 76 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
104 | 152 | | |
105 | 153 | | |
106 | 154 | | |
| |||
126 | 174 | | |
127 | 175 | | |
128 | 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 | + | |
129 | 205 | | |
130 | 206 | | |
131 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
104 | 109 | | |
105 | 110 | | |
106 | 111 | | |
| |||
162 | 167 | | |
163 | 168 | | |
164 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
165 | 182 | | |
166 | | - | |
| 183 | + | |
167 | 184 | | |
168 | 185 | | |
169 | 186 | | |
| |||
219 | 236 | | |
220 | 237 | | |
221 | 238 | | |
222 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
223 | 242 | | |
224 | 243 | | |
225 | 244 | | |
226 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
227 | 263 | | |
228 | 264 | | |
229 | | - | |
| 265 | + | |
| 266 | + | |
230 | 267 | | |
231 | 268 | | |
232 | 269 | | |
| |||
0 commit comments