Commit 6c4bdb4
committed
fix(sdk-review): FP-K-01 PY-CON-01 respects PR added-lines scope
Discovered live on cloud-sdk-python PR #209 (Ricardo, agentgateway auditlog).
The check was counting string occurrences from the on-disk AST — global to
the file — then anchoring the finding to the first occurrence's line number.
When a PR (a) shifts line numbers by adding upstream code and (b) does not
touch any of the actual repeated-string lines, PY-CON-01 fires for tech debt
that pre-existed the PR.
Fix: read $ADDED_LINES_FILE (already exported by orchestrate.sh) inside
check_con_01. Filter each literal's occurrence list to lines actually in
the PR's added set. Only fire when ${filtered} is non-empty AND total
occurrences (across file, unchanged) still >= threshold. Anchor line
becomes the first added-line occurrence.
Backward-compat: if ADDED_LINES_FILE is unset (bats tests exercising the
lib directly), fall back to the legacy full-file behavior. Two new
regression tests pin both branches (untouched pre-existing repetition
= no fire; at least one occurrence on added line = fires with correct
anchor).
Bats: 81/81 green on both repos.1 parent a436253 commit 6c4bdb4
2 files changed
Lines changed: 558 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
229 | 230 | | |
230 | 231 | | |
231 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
232 | 259 | | |
233 | 260 | | |
234 | 261 | | |
| |||
244 | 271 | | |
245 | 272 | | |
246 | 273 | | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
257 | 295 | | |
258 | 296 | | |
259 | 297 | | |
| |||
0 commit comments