beads/cmd/bd/protocol
Julian Knutsen 8c7db45c8b
fix(show): expose guarded-write revision in JSON (#5353)
* fix(show): expose guarded-write revision in JSON (bd-bwa7n)

Project RowVersion only at the bd show CLI edge so guarded subprocess clients receive the current opaque token without changing generic Issue, JSONL, or HTTP serialization. This preserves main's object-model boundary while restoring the show contract established by PR #4682.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of CI Bot

* fix(show): resolve revision CLI/HTTP parity + emit legacy-zero token (bd-bwa7n)

Maintainer adoption fixup for PR #5353 (adopt-pr): pre-review CI normalization
plus the review-loop resolution of the CLI/HTTP parity decision that pre-review
deliberately deferred.

PR #5353 exposes the guarded-write revision (the row_lock optimistic-concurrency
token) in `bd show --json` via the CLI-edge DTO. That token is a per-write random
int64, so several oracles that pin bd's JSON shape needed to learn about it.

Pre-review CI normalization (mechanical volatile-token gaps):

- Contract corpus golden (cmd/bd/protocol): CanonicalizeJSON did not scrub the
  new field, so the show blob diffed on the random value and the double-run
  determinism check failed. Add a volatileValueKeys scrub for `revision` (pin the
  field's presence, replace its value with <REVISION>, same treatment as
  timestamps) and regenerate the two show goldens + manifest SHAs.
- Differential regression (tests/regression): the v0.49.6 baseline never emitted
  `revision`, and its value is random per write, so it is pure cross-version
  noise. Add it to volatileFields so normalizeIssue strips it before the
  baseline/candidate diff.

Review-loop resolution (was DEFERRED at pre-review; now decided):

- CLI/HTTP read-parity (major): `bd show --json` emits `revision` but the
  apigen-frozen GET /v0/beads/issues/{id} keeps RowVersion json:"-", so the
  field-level parity oracle (TestProxiedServerServeReadParity/show) would flag it
  as unreviewed drift. Resolve as an accepted CLI-only surface: add a documented
  readsParityAllowlist["revision"] entry and rewrite the allowlist narrative.
  Exposing the token over the frozen v0 HTTP object is out of scope; the token is
  only meaningful to the CLI guarded-write path.
- Legacy-zero token (minor): drop `omitempty` from the show DTO so a legitimate
  RowVersion==0 CAS token is emitted instead of being conflated with an absent
  field; a guarded client must read the 0 it needs to send on un-mutated legacy
  migration-0054 rows.
- Test evidence (minor): add TestProjectShowJSONDetailsEmitsZeroRevision pinning
  the legacy-zero wire behavior.

Validated locally: git diff --check; go test ./internal/types (RowVersion),
./cmd/bd (focused show unit tests incl. the new zero-revision case),
./cmd/bd/protocol (corpus goldens unchanged), and the proxied Dolt parity oracle
TestProxiedServerServeReadParity (the show subtest now excuses `revision`).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: CI Bot <ci@beads.test>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-05 19:51:49 -07:00
..
testdata/corpus fix(show): expose guarded-write revision in JSON (#5353) 2026-08-05 19:51:49 -07:00
assignee_test.go test(protocol): pin data-model + ready-front production-scar clauses (wy-nzybu) 2026-07-13 09:46:16 -07:00
blocked_status_test.go feat(test): parallelize protocol tests for 3x speedup (bd-dgp) 2026-02-27 20:04:00 -08:00
blocked_test.go feat(test): parallelize protocol tests for 3x speedup (bd-dgp) 2026-02-27 20:04:00 -08:00
blocking_semantics_test.go feat(test): parallelize protocol tests for 3x speedup (bd-dgp) 2026-02-27 20:04:00 -08:00
canonicalize_test.go test(protocol): make corpus determinism pure (bd-qq1qn) (#5281) 2026-08-02 07:14:30 -07:00
CATALOG.md Merge remote-tracking branch 'upstream/main' into pr-4232-fix 2026-07-13 20:43:10 -07:00
child_id_test.go test(protocol): pin data-model + ready-front production-scar clauses (wy-nzybu) 2026-07-13 09:46:16 -07:00
children_test.go fix(cli): implement children pretty and defer reason 2026-06-13 21:22:38 -07:00
close_guard_test.go feat(test): parallelize protocol tests for 3x speedup (bd-dgp) 2026-02-27 20:04:00 -08:00
comments_test.go feat(test): parallelize protocol tests for 3x speedup (bd-dgp) 2026-02-27 20:04:00 -08:00
corpus.go fix(show): expose guarded-write revision in JSON (#5353) 2026-08-05 19:51:49 -07:00
corpus_test.go test(protocol): make corpus determinism pure (bd-qq1qn) (#5281) 2026-08-02 07:14:30 -07:00
defer_test.go fix(cli): implement children pretty and defer reason 2026-06-13 21:22:38 -07:00
dep_identity_test.go test(protocol): pin data-model + ready-front production-scar clauses (wy-nzybu) 2026-07-13 09:46:16 -07:00
errors_contract_test.go test(protocol): pin §E/§M/§V conformance clauses at the CLI level (wy-ge2h8) 2026-07-13 10:30:24 -07:00
exit_codes_init_test.go test(protocol): pin §E/§M/§V conformance clauses at the CLI level (wy-ge2h8) 2026-07-13 10:30:24 -07:00
exit_codes_test.go feat(test): parallelize protocol tests for 3x speedup (bd-dgp) 2026-02-27 20:04:00 -08:00
helpers_test.go feat(storage): refuse test DBs on production dolt servers (AD-01) (#3632) 2026-07-24 01:28:51 -07:00
input_validation_test.go feat(test): parallelize protocol tests for 3x speedup (bd-dgp) 2026-02-27 20:04:00 -08:00
interchange_test.go test(protocol): pin the §J interchange clauses; fix the bd import header gap (wy-ltox1) 2026-07-13 11:20:06 -07:00
json_contract_test.go fix(show): flag comment_count as omitted when comments are not streamed (#4865) 2026-07-25 16:16:41 -07:00
lease_claim_test.go test: fix red main — init-cancel E2E deadline + reclaim JSON assertion (#5039) 2026-07-25 10:10:18 -07:00
lifecycle_test.go feat(test): parallelize protocol tests for 3x speedup (bd-dgp) 2026-02-27 20:04:00 -08:00
memory_contract_test.go test(protocol): pin §E/§M/§V conformance clauses at the CLI level (wy-ge2h8) 2026-07-13 10:30:24 -07:00
preservation_test.go test(protocol): realign show --json contract tests with count-only payload (wy-017ry) 2026-07-13 10:08:34 -07:00
ready_front_test.go test: make ready ordering setup deterministic (bd-y9cjq) (#5238) 2026-08-01 09:55:11 -07:00
roundtrip_test.go test(protocol): realign show --json contract tests with count-only payload (wy-017ry) 2026-07-13 10:08:34 -07:00
stale_test.go feat(test): parallelize protocol tests for 3x speedup (bd-dgp) 2026-02-27 20:04:00 -08:00
status_validation_test.go feat(test): parallelize protocol tests for 3x speedup (bd-dgp) 2026-02-27 20:04:00 -08:00
versioning_contract_test.go test(protocol): pin §E/§M/§V conformance clauses at the CLI level (wy-ge2h8) 2026-07-13 10:30:24 -07:00
wp4_helpers_test.go test(protocol): pin §E/§M/§V conformance clauses at the CLI level (wy-ge2h8) 2026-07-13 10:30:24 -07:00