Files
0pt/evidence/bi-p061/dashboard-release-race.json
T
Claude Opus 5 1a12e8a882
CI (SIAX Cloud) / quality (push) Successful in 50s
Security Scan (SIAX Cloud) / security (push) Successful in 45s
CI (SIAX Cloud) / security (push) Successful in 1m0s
CI (SIAX Cloud) / integration (push) Successful in 1m12s
CI (SIAX Cloud) / quality (pull_request) Successful in 1m6s
CI (SIAX Cloud) / security (pull_request) Successful in 33s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 32s
CI (SIAX Cloud) / integration (pull_request) Successful in 47s
feat(analytics): BI-P061 — dashboard releases, with the publish race measured both ways
DRAFT -> PUBLISHED -> SUPERSEDED as a ledger (sql/010) rather than a column on
the frozen version: sql/008 already makes DashboardVersion immutable at the
database, and a lifecycle column there would have meant weakening that.

Rollback mints a NEW version carrying the old document and publishes it, so
"we went back to v3" is a timestamped fact (v5 = rollback_of_version 3) rather
than a hole where v4 used to be. It is verified by BI-P060 canonical hash, and
documentOf() refuses to serve a stored document whose hash no longer matches
the release — a dashboard that renders an unapproved definition is worse than
one that will not open.

The claim worth attacking is "only one release can be live". The application
check is read-then-write, so it is NOT the guarantee, and the evidence says so
in both directions against Postgres 16.15:

  guard_absent   partial unique index dropped -> BOTH concurrent publishes
                 commit, dashboard ends with TWO live versions
  guard_present  index in place -> loser fails 23505 on
                 opt_analytics_dashboard_release_one_published, one live

evidence/bi-p061/dashboard-release-race.json, reproducible with
scripts/bi-p061-release-race.mjs.

Two findings while writing the tests, both fixed here rather than papered over:
the one-draft-per-dashboard index makes the two-draft race impossible to even
construct (so the race is run as two create-and-publish transactions, which is
what a "save and publish" button does), and an UPDATE matching zero rows
raises nothing — which reads as "refused" to a careless test, so the
immutability test asserts the row exists first.

23 tests: 8 unit + 15 against live Postgres.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-07 03:51:04 +02:00

43 lines
1.1 KiB
JSON

{
"recorded_at": "2026-09-07T01:50:09.216Z",
"postgres_version": "16.15",
"guard_present": {
"partial_unique_index_present": true,
"transactions_committed": 1,
"rejections": [
{
"code": "23505",
"constraint": "opt_analytics_dashboard_release_one_published"
}
],
"published_releases_after": [
{
"release_id": "rel_1",
"version": 1
}
]
},
"guard_absent": {
"partial_unique_index_present": false,
"transactions_committed": 2,
"rejections": [],
"published_releases_after": [
{
"release_id": "rel_1",
"version": 1
},
{
"release_id": "rel_2",
"version": 2
}
]
},
"verdict": {
"counterfactual_produced_two_live_dashboards": true,
"guard_left_exactly_one": true,
"loser_error_code": "23505",
"application_check_alone_is_sufficient": false,
"note": "DashboardReleaseService.publish() reads for a live release before writing. Both sessions in guard_absent passed that check and both committed. The partial unique index is what holds."
}
}