BC5 readiness: pairwise BC4↔BC5 + check-bc5-compat orchestrator + scheduled CI
Summary
Closes the BC5-readiness canary loop: PRs 1–3 built the per-backend live capture (TS) and cross-language decode (Ruby/Python/Go/Kotlin) infrastructure. PR 4 adds the pairwise BC4↔BC5 comparison that catches the additive-only invariant — and the orchestrator + scheduled CI that runs the whole pipeline end-to-end on a daily cron.
Stacked on #301 (PR 3 — cross-language wire-replay decoders). Once #301 merges, this PR retargets main.
Why pairwise
Per-backend schema validation alone can't detect a class of regression: with every new BC5 field marked optional, a case where BC4 emits memories: [items] and BC5 emits memories: [] passes each backend's schema independently — yet that's exactly the additive-only invariant the canary should catch. This is not hypothetical: BC5 ships precisely this divergence — now codified as documented contract (see below).
The canonical canary rule lives on GetMyNotifications. The intended invariant: BC5 memories[] should remain a superset of BC4's. But BC5 ships json.memories [] while BC4 (the four branch) still populates it — and bc3 has settled this as a permanent, documented contract divergence: doc/api/sections/my_notifications.md (bc3 #11628) codifies memories as an always-empty placeholder superseded by bubble_ups, and the once-planned alias (json.memories @bubble_ups, bc3 #10947) never shipped — #10947 is closed unmerged. So the pairwiseSupersetArray: ["memories"] rule stays as the encoded additive-only invariant, permanently waived by the pairwiseDeltaAllowed: ["memories"] entry — the machine-readable record of the accepted BC4→BC5 subtractive delta, tracked in spec/api-gaps/memories-emptied-regression.md and indexed by the public compatibility report. Retire the waiver only if BC4 empties memories too (the superset rule then passes clean) or BC5's documented contract changes.
What's in this PR
conformance/schema.json—pairwiseAssertions[]with four rule types:pairwiseSupersetArray,pairwiseSupersetKeys,pairwiseEqual,pairwiseDeltaAllowed(with requiredreasonso a future public compatibility report can index accepted divergences).conformance/tests/live-my-surface.json— thememoriesSupersetArray rule + a top-level SupersetKeys rule onGetMyNotifications.scripts/compare-canary-runs.sh— applies pairwise rules to a pair of snapshot directories. Exit 0 clean / 1 violation / 2 operator error.Makefile—make conformance-live(one backend's capture + 4 replays) andmake check-bc5-compat(BC4 pass + BC5 pass + pairwise). Both opt-in; not inmake check..github/workflows/live-canary.yml— nightly cron +workflow_dispatch, gated on repo secrets (no-ops with a log message when missing rather than failing the run). Uploads snapshots as a 14-day artifact so failures can be inspected post-hoc without rerunning.CONTRIBUTING.md— new "Pairwise BC4↔BC5 comparison", "Orchestrator", and "Scheduled CI" subsections under "Live canary".
Path syntax (dotted identifiers on each snapshot)
""(empty string) addresses the body root.foo.bardefaults topages[0].body.foo.bar— the common single-page case.pages[N].body.Xaddresses a specific page.pages[*].body.Xaggregates across pages into a list (each page's value becomes one element; useful when you want a per-page count, not a sum of inner lengths).
Test plan
-
jq empty conformance/schema.json— clean JSON -
jq empty conformance/tests/live-my-surface.json— clean JSON -
bash -n scripts/compare-canary-runs.sh— shell syntax clean - Synthetic-fixture test:
pairwiseSupersetArrayflags BC5 memories shorter than BC4 - Synthetic-fixture test:
pairwiseSupersetKeysflags BC5 missing a top-level key BC4 has - Synthetic-fixture test:
pairwiseEqualflags value divergence - Synthetic-fixture test:
pairwiseDeltaAllowedwaives a flagged path - Synthetic-fixture test:
pages[*].bodyaggregation collects per-page values -
make -n check-bc5-compatresolves correctly -
actionlint .github/workflows/live-canary.ymlclean -
zizmor .github/workflows/live-canary.ymlclean -
make validate-api-gapsclean -
make check-bucket-flat-parityclean - Real-backend run — requires BASECAMP_TOKEN/ACCOUNT_ID/BC5_HOST; CI will be the first opportunity once secrets are configured.
Operational requirement
Pairwise rules assume identical account state across the BC4 and BC5 runs. The same project list, same notifications, etc. Without that, naturally-drifting collections (unreads, etc.) will false-fail rules. CONTRIBUTING.md calls this out explicitly; the canary needs a dedicated test account with stable, equivalent fixtures replicated to each backend before scheduled CI can pass meaningfully.
Sequencing
After this lands, the BC5-readiness canary infrastructure is feature-complete (PRs 1–4). Remaining BC5 readiness work:
- PR 5 —
scripts/detect-api-gaps.sh+ weekly cron workflow (api-gap detection tooling; validation already shipped in PR 1). - PR 6 — Go wrapper forward-compat audit + drift check (filed separately; unblocks basecamp-cli Phase 1).
- PR 7+ — BC3 contract-drift handoff passes (5 passes targeting
main).
Summary by cubic
Adds pairwise BC4↔BC5 comparison with a check-bc5-compat orchestrator, nightly CI, and a hardened compare script + Makefile backed by a regression harness. The canonical memories rule stays encoded and is permanently waived via pairwiseDeltaAllowed to reflect BC5’s documented always‑empty memories; violation output redacts live values, path grammar is strictly validated, and pages[*] compares item totals.
-
New Features
conformance/schema.json:pairwiseAssertions[]withpairwiseSupersetArray,pairwiseSupersetKeys,pairwiseEqual,pairwiseDeltaAllowed;pathsrequire at least one entry; waivers require non‑emptyreason.- Orchestrator:
make conformance-liveandmake check-bc5-compat;.github/workflows/live-canary.yml(nightly + manual, gated on secrets, defaultsBASECAMP_HOSTtohttps://3.basecampapi.com, uploads decode‑only artifacts; excludeswire/). conformance/tests/live-my-surface.json:GetMyNotificationscarries top‑levelpairwiseSupersetKeysand a SupersetArray rule onmemories, permanently waived viapairwiseDeltaAllowed(BC5’s documented always‑emptymemories).- Regression suite:
make check-compare-canaryrunsscripts/test-compare-canary-runs.sh(bash ≥ 4.4,jqrequired; uses portablegrep -Eon BSD/macOS).
-
Bug Fixes
- Compare script: exact TS snapshot filename mapping; missing snapshots hard‑fail (exit 2); validates snapshot shape (including per‑page key types) and recorded
operation; strict path grammar (only dotted segments or leadingpages[N]/pages[*]into.body; no hyphens or jq punctuation; rejects bare[]streams and non‑leading[*]); shorthand paths are forbidden once either capture paginates;pages[N]must exist on both;pages[*]arrays compare total item counts;pairwiseSupersetKeysrejects non‑object targets and does not acceptpages[*];pairwiseEqualuses deep equality and fully redacts live values in messages. - Rule/waiver validation: tests file must be a top‑level array; reject unknown rule types up‑front (before waiver skips); rule
pathsmust be non‑empty arrays of strings; waivers require non‑emptyreasonand non‑emptypaths; waiver paths validated like enforcing paths (waivers do not bypass path checks). - Makefile/CI/docs: absolutizes
LIVE_RECORD_DIR; safe cleanup with segment‑aware..checks, checkout‑ancestor refusal, full trailing‑slash strip, refusal when the canonicalized path is the filesystem root, andrm -rf --on the original path; GNU make 3.81‑safe env defaults; fast env preflight;check-compare-canarywired intomake check; CI artifacts upload decode results only and exclude rawwire/.
- Compare script: exact TS snapshot filename mapping; missing snapshots hard‑fail (exit 2); validates snapshot shape (including per‑page key types) and recorded