@biffo/cli 0.316.2 → 0.317.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -351,6 +351,39 @@ def load_baseline(baseline: Path) -> dict | None:
|
|
|
351
351
|
return json.loads(baseline.read_text())
|
|
352
352
|
|
|
353
353
|
|
|
354
|
+
def _legacy_key(k: str) -> str:
|
|
355
|
+
"""A v2 `path:line:kind:label` key rendered in v1 `path:kind:label` form.
|
|
356
|
+
|
|
357
|
+
Migration shim for #2037: the trusted script that computes `keys` is
|
|
358
|
+
always fetched from the default branch, but `--baseline` is read from the
|
|
359
|
+
checkout under test, so a PR that changes `Branch.key()`'s shape (#2026,
|
|
360
|
+
#2031) is comparing keys the trusted script emits in the OLD format
|
|
361
|
+
against a baseline it wrote in the NEW format — every baselined branch
|
|
362
|
+
then reads NEW and the gate deadlocks structurally, not on anything wrong
|
|
363
|
+
in the PR's diff. Normalising each already-baselined key to its v1 form
|
|
364
|
+
lets a v1-computing script recognise a v2-shaped baseline entry.
|
|
365
|
+
|
|
366
|
+
`split(":", 2)` rather than a regex: `label` legitimately contains colons
|
|
367
|
+
(a bare handler's label is `except:`) while `kind` is never numeric and a
|
|
368
|
+
repo-relative `path` carries no colon, so "is the second field all
|
|
369
|
+
digits" is an unambiguous discriminator between the two shapes. A v1 key
|
|
370
|
+
is returned unchanged (its second field is `except`/`fallback`, never a
|
|
371
|
+
digit), so this is a no-op for every baseline still in v1 form.
|
|
372
|
+
|
|
373
|
+
Retire this — and the union in `main()` that calls it — in Milestone 3 of
|
|
374
|
+
#2037, once every inheriting repo's baseline has been regenerated as v2.
|
|
375
|
+
Kept only for the duration of that migration: while it is in effect, a
|
|
376
|
+
genuinely new v2 branch that collides on `path:kind:label` with an
|
|
377
|
+
already-baselined branch at a different line is absorbed as "known"
|
|
378
|
+
rather than flagged — reintroducing #2026's collision bug for exactly as
|
|
379
|
+
long as this shim lives.
|
|
380
|
+
"""
|
|
381
|
+
parts = k.split(":", 2)
|
|
382
|
+
if len(parts) == 3 and parts[1].isdigit():
|
|
383
|
+
return f"{parts[0]}:{parts[2]}"
|
|
384
|
+
return k
|
|
385
|
+
|
|
386
|
+
|
|
354
387
|
def main() -> int:
|
|
355
388
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
356
389
|
parser.add_argument("--write", action="store_true", help="record the current set as baseline")
|
|
@@ -481,7 +514,15 @@ def main() -> int:
|
|
|
481
514
|
print(f"unexecuted error branches: {len(keys)} (no baseline yet; {coverage_note})")
|
|
482
515
|
return 0
|
|
483
516
|
|
|
484
|
-
|
|
517
|
+
# `keys` (above) comes from THIS script, always fetched from the trusted
|
|
518
|
+
# default branch. `recorded` comes from --baseline, read from the
|
|
519
|
+
# checkout under test — which may already be in the newer key format
|
|
520
|
+
# this script does not compute yet. Widen membership with each
|
|
521
|
+
# baselined key's legacy-normalised form so a v1-computing script still
|
|
522
|
+
# recognises a v2-shaped baseline entry (#2037 migration shim; see
|
|
523
|
+
# `_legacy_key`). `keys` itself is left untouched.
|
|
524
|
+
recorded = set(baseline.get("branches", []))
|
|
525
|
+
known = recorded | {_legacy_key(k) for k in recorded}
|
|
485
526
|
new = [k for k in keys if k not in known]
|
|
486
527
|
|
|
487
528
|
print(
|
|
@@ -351,6 +351,39 @@ def load_baseline(baseline: Path) -> dict | None:
|
|
|
351
351
|
return json.loads(baseline.read_text())
|
|
352
352
|
|
|
353
353
|
|
|
354
|
+
def _legacy_key(k: str) -> str:
|
|
355
|
+
"""A v2 `path:line:kind:label` key rendered in v1 `path:kind:label` form.
|
|
356
|
+
|
|
357
|
+
Migration shim for #2037: the trusted script that computes `keys` is
|
|
358
|
+
always fetched from the default branch, but `--baseline` is read from the
|
|
359
|
+
checkout under test, so a PR that changes `Branch.key()`'s shape (#2026,
|
|
360
|
+
#2031) is comparing keys the trusted script emits in the OLD format
|
|
361
|
+
against a baseline it wrote in the NEW format — every baselined branch
|
|
362
|
+
then reads NEW and the gate deadlocks structurally, not on anything wrong
|
|
363
|
+
in the PR's diff. Normalising each already-baselined key to its v1 form
|
|
364
|
+
lets a v1-computing script recognise a v2-shaped baseline entry.
|
|
365
|
+
|
|
366
|
+
`split(":", 2)` rather than a regex: `label` legitimately contains colons
|
|
367
|
+
(a bare handler's label is `except:`) while `kind` is never numeric and a
|
|
368
|
+
repo-relative `path` carries no colon, so "is the second field all
|
|
369
|
+
digits" is an unambiguous discriminator between the two shapes. A v1 key
|
|
370
|
+
is returned unchanged (its second field is `except`/`fallback`, never a
|
|
371
|
+
digit), so this is a no-op for every baseline still in v1 form.
|
|
372
|
+
|
|
373
|
+
Retire this — and the union in `main()` that calls it — in Milestone 3 of
|
|
374
|
+
#2037, once every inheriting repo's baseline has been regenerated as v2.
|
|
375
|
+
Kept only for the duration of that migration: while it is in effect, a
|
|
376
|
+
genuinely new v2 branch that collides on `path:kind:label` with an
|
|
377
|
+
already-baselined branch at a different line is absorbed as "known"
|
|
378
|
+
rather than flagged — reintroducing #2026's collision bug for exactly as
|
|
379
|
+
long as this shim lives.
|
|
380
|
+
"""
|
|
381
|
+
parts = k.split(":", 2)
|
|
382
|
+
if len(parts) == 3 and parts[1].isdigit():
|
|
383
|
+
return f"{parts[0]}:{parts[2]}"
|
|
384
|
+
return k
|
|
385
|
+
|
|
386
|
+
|
|
354
387
|
def main() -> int:
|
|
355
388
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
356
389
|
parser.add_argument("--write", action="store_true", help="record the current set as baseline")
|
|
@@ -481,7 +514,15 @@ def main() -> int:
|
|
|
481
514
|
print(f"unexecuted error branches: {len(keys)} (no baseline yet; {coverage_note})")
|
|
482
515
|
return 0
|
|
483
516
|
|
|
484
|
-
|
|
517
|
+
# `keys` (above) comes from THIS script, always fetched from the trusted
|
|
518
|
+
# default branch. `recorded` comes from --baseline, read from the
|
|
519
|
+
# checkout under test — which may already be in the newer key format
|
|
520
|
+
# this script does not compute yet. Widen membership with each
|
|
521
|
+
# baselined key's legacy-normalised form so a v1-computing script still
|
|
522
|
+
# recognises a v2-shaped baseline entry (#2037 migration shim; see
|
|
523
|
+
# `_legacy_key`). `keys` itself is left untouched.
|
|
524
|
+
recorded = set(baseline.get("branches", []))
|
|
525
|
+
known = recorded | {_legacy_key(k) for k in recorded}
|
|
485
526
|
new = [k for k in keys if k not in known]
|
|
486
527
|
|
|
487
528
|
print(
|
package/dist/index.js
CHANGED
|
@@ -10330,7 +10330,8 @@ async function checkViaProvenance(name, record, repoUrl, git) {
|
|
|
10330
10330
|
name,
|
|
10331
10331
|
status: "cannot-tell",
|
|
10332
10332
|
method: "unresolvable",
|
|
10333
|
-
detail: `could not reach ${repoUrl} (network or authentication failure)
|
|
10333
|
+
detail: `could not reach ${repoUrl} (network or authentication failure)`,
|
|
10334
|
+
source: repoUrl
|
|
10334
10335
|
};
|
|
10335
10336
|
}
|
|
10336
10337
|
if (remoteHeadSha === record.sha) {
|
|
@@ -10338,7 +10339,8 @@ async function checkViaProvenance(name, record, repoUrl, git) {
|
|
|
10338
10339
|
name,
|
|
10339
10340
|
status: "up-to-date",
|
|
10340
10341
|
method: "provenance",
|
|
10341
|
-
detail: `matches ${repoUrl}'s default branch (${shortSha(remoteHeadSha)})
|
|
10342
|
+
detail: `matches ${repoUrl}'s default branch (${shortSha(remoteHeadSha)})`,
|
|
10343
|
+
source: repoUrl
|
|
10342
10344
|
};
|
|
10343
10345
|
}
|
|
10344
10346
|
let clone;
|
|
@@ -10349,7 +10351,8 @@ async function checkViaProvenance(name, record, repoUrl, git) {
|
|
|
10349
10351
|
name,
|
|
10350
10352
|
status: "cannot-tell",
|
|
10351
10353
|
method: "unresolvable",
|
|
10352
|
-
detail: `could not clone ${repoUrl} to count commits behind (network or authentication failure)
|
|
10354
|
+
detail: `could not clone ${repoUrl} to count commits behind (network or authentication failure)`,
|
|
10355
|
+
source: repoUrl
|
|
10353
10356
|
};
|
|
10354
10357
|
}
|
|
10355
10358
|
try {
|
|
@@ -10359,7 +10362,8 @@ async function checkViaProvenance(name, record, repoUrl, git) {
|
|
|
10359
10362
|
name,
|
|
10360
10363
|
status: "cannot-tell",
|
|
10361
10364
|
method: "unresolvable",
|
|
10362
|
-
detail: `recorded commit ${shortSha(record.sha)} was not found in ${repoUrl}'s history (rebased or force-pushed?) \u2014 cannot count commits behind
|
|
10365
|
+
detail: `recorded commit ${shortSha(record.sha)} was not found in ${repoUrl}'s history (rebased or force-pushed?) \u2014 cannot count commits behind`,
|
|
10366
|
+
source: repoUrl
|
|
10363
10367
|
};
|
|
10364
10368
|
}
|
|
10365
10369
|
if (commitsBehind === 0) {
|
|
@@ -10367,7 +10371,8 @@ async function checkViaProvenance(name, record, repoUrl, git) {
|
|
|
10367
10371
|
name,
|
|
10368
10372
|
status: "up-to-date",
|
|
10369
10373
|
method: "provenance",
|
|
10370
|
-
detail: `matches ${repoUrl}'s default branch (${shortSha(remoteHeadSha)})
|
|
10374
|
+
detail: `matches ${repoUrl}'s default branch (${shortSha(remoteHeadSha)})`,
|
|
10375
|
+
source: repoUrl
|
|
10371
10376
|
};
|
|
10372
10377
|
}
|
|
10373
10378
|
return {
|
|
@@ -10375,7 +10380,8 @@ async function checkViaProvenance(name, record, repoUrl, git) {
|
|
|
10375
10380
|
status: "behind",
|
|
10376
10381
|
commitsBehind,
|
|
10377
10382
|
method: "provenance",
|
|
10378
|
-
detail: `${commitsBehind} commit(s) behind ${repoUrl}'s default branch
|
|
10383
|
+
detail: `${commitsBehind} commit(s) behind ${repoUrl}'s default branch`,
|
|
10384
|
+
source: repoUrl
|
|
10379
10385
|
};
|
|
10380
10386
|
} finally {
|
|
10381
10387
|
git.cleanup(clone);
|
|
@@ -10392,7 +10398,8 @@ async function checkViaContentDiff(name, pluginDir2, sourceDir, opts, git) {
|
|
|
10392
10398
|
name,
|
|
10393
10399
|
status: "cannot-tell",
|
|
10394
10400
|
method: "unresolvable",
|
|
10395
|
-
detail: `could not clone ${sourceDir} for a content comparison (network or authentication failure)
|
|
10401
|
+
detail: `could not clone ${sourceDir} for a content comparison (network or authentication failure)`,
|
|
10402
|
+
source: sourceDir
|
|
10396
10403
|
};
|
|
10397
10404
|
}
|
|
10398
10405
|
effectiveSourceDir = cloneDir;
|
|
@@ -10406,7 +10413,8 @@ async function checkViaContentDiff(name, pluginDir2, sourceDir, opts, git) {
|
|
|
10406
10413
|
status: "up-to-date",
|
|
10407
10414
|
method: "content-diff",
|
|
10408
10415
|
filesDiffering: 0,
|
|
10409
|
-
detail: `byte-identical to ${originDescription} (no provenance recorded, so an exact commit could not be named)
|
|
10416
|
+
detail: `byte-identical to ${originDescription} (no provenance recorded, so an exact commit could not be named)`,
|
|
10417
|
+
source: originDescription
|
|
10410
10418
|
};
|
|
10411
10419
|
}
|
|
10412
10420
|
return {
|
|
@@ -10414,7 +10422,8 @@ async function checkViaContentDiff(name, pluginDir2, sourceDir, opts, git) {
|
|
|
10414
10422
|
status: "behind",
|
|
10415
10423
|
filesDiffering,
|
|
10416
10424
|
method: "content-diff",
|
|
10417
|
-
detail: `${filesDiffering} file(s) differ from ${originDescription} (no provenance recorded, so an exact commit count could not be determined)
|
|
10425
|
+
detail: `${filesDiffering} file(s) differ from ${originDescription} (no provenance recorded, so an exact commit count could not be determined)`,
|
|
10426
|
+
source: originDescription
|
|
10418
10427
|
};
|
|
10419
10428
|
} finally {
|
|
10420
10429
|
if (cloneDir) git.cleanup(cloneDir);
|