Skip to content

docs(api): distinguish globally-unique id from MAX+1 external_key (TRA-885)#202

Merged
mikestankavich merged 3 commits into
mainfrom
miks2u/tra-885-docs-distinguish-distributed-surrogate-id-from-sequential
May 30, 2026
Merged

docs(api): distinguish globally-unique id from MAX+1 external_key (TRA-885)#202
mikestankavich merged 3 commits into
mainfrom
miks2u/tra-885-docs-distinguish-distributed-surrogate-id-from-sequential

Conversation

@mikestankavich

Copy link
Copy Markdown
Contributor

TRA-885 — distinguish the globally-unique surrogate id from the MAX+1 external_key

Consumer-docs prose fix sharpening the line between the two identifier tiers. The original
blur (the id-format page called "the id" randomly distributed without naming the field) let
the random-distribution property bleed onto external_key, which produced a false contract
finding in round 2.4/2.5.

⚠️ Merge gate — do not merge yet. Holding for Mike's diff review, and the id
global-uniqueness claim is gated on TRA-886 (single shared sequence) being live in prod.
Both must clear first.

What changed

  • docs/api/id-format.md — the distribution sentence now names the field: the surrogate
    id is high-entropy, globally unique across every resource type, opaque, and permanent
    (never reused — no hard delete, shared id sequence never reseeded). Added a :::note pinning
    idexternal_key.
  • docs/api/resource-identifiers.md — the "Numeric id is a surrogate key" section now
    states global uniqueness (no cross-type id equality) + opaque/permanent. The external_key
    auto-mint mechanism is corrected from "lowest unused slot / gap-filling" to MAX(live key) + 1: permanent middle-delete gaps, only the current highest live key's number freed
    for re-issue, zero-padded ASSET-%04d / LOC-%03d.
  • docs/api/changelog.md — new entry for both clarifications; fixed the stale "lowest
    unused slot"
    assertions in the existing LOC-NNN-finalize and BB52 non-monotonic entries.

Source of truth

The TRA-885 ticket text is stale (confirmed by Mike — substantial post-ticket
investigation). Authoritative wording is the bb-253 round-2.5 §0 convergence:

  • id global uniqueness — operator-confirmed; backed by TRA-886 (PR fix(db): TRA-886 — single shared sequence for surrogate ids platform#443,
    Done — collapses to one shared sequence → globally unique by construction).
  • external_key = MAX(live key) + 1 — platform code-confirmed (assets.go:60
    GetNextAssetSequence, locations.go:57 GetNextLocationSequence) and independently
    code-read here.

Verification

  • pnpm build passes (Redocusaurus + broken-link check; all new anchors resolve).
  • Read-through: no standalone "randomly distributed"; no "lowest unused slot / gap-filling"
    except where quoted-as-corrected in the new changelog entry; every distribution/allocation
    claim names its field.

🤖 Generated with Claude Code

Mike Stankavich and others added 3 commits May 30, 2026 11:12
…xternal_key

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… external_key

Ticket text is stale (Mike confirmed); source of truth is the bb-253 round-2.5
convergence. id is globally unique/opaque/permanent; external_key auto-mint is
MAX(live key)+1, not lowest-unused-slot.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… to MAX+1 (TRA-885)

- id-format.md: scope the distribution claim to the surrogate id (high-entropy,
  globally unique, opaque, permanent/never-reused); add an id-vs-external_key note.
- resource-identifiers.md: surrogate-key section now states global uniqueness
  (no cross-type id equality) + opaque/permanent; auto-mint corrected from
  'lowest unused slot' to MAX(live key)+1 (permanent middle-delete gaps,
  only highest-freed reused, zero-padded).
- changelog.md: new entry for both clarifications; fix stale 'lowest unused
  slot' assertions in the LOC-NNN and BB52 non-monotonic entries.

Source: bb-253 round-2.5 convergence; platform-confirmed (assets.go:60 /
locations.go:57 = MAX(live)+1). id global uniqueness backed by TRA-886
(single shared sequence). Ticket text superseded per Mike.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment Update

✅ This PR has been successfully merged into the preview branch.

The preview environment will update shortly at: https://docs.preview.trakrf.id

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 30, 2026

Copy link
Copy Markdown

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: ef7ca6e
Status: ✅  Deploy successful!
Preview URL: https://434fcd37.docs-4n7.pages.dev
Branch Preview URL: https://miks2u-tra-885-docs-distingu.docs-4n7.pages.dev

View logs

@mikestankavich mikestankavich merged commit 42d7f1e into main May 30, 2026
2 checks passed
@mikestankavich mikestankavich deleted the miks2u/tra-885-docs-distinguish-distributed-surrogate-id-from-sequential branch May 30, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant