Skip to content

#879 feat: producer-minted person_co_operator / org_co_operator identifier types - #894

Merged
gregoryfoster merged 6 commits into
mainfrom
feat/879-co-operator-ids
Nov 26, 2026
Merged

gregoryfoster merged 6 commits into
mainfrom
feat/879-co-operator-ids

Conversation

@gregoryfoster

@gregoryfoster gregoryfoster commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

#879: create a person or org with no external identifier, by a producer-minted id

This implements the operator's 2026-11-25 decision on #879: producer-minted ids, not op: "create".

What changes

  • Two new external identifier types:
    • person_co_operator (01M8ARJWG12ZK4V10BA5PM0N7J);
    • org_co_operator (01M8ARJWFZJMP5XDQECCMSRXZB).
    • The value is a ULID the cli mints. Today's create-on-unknown-value behaviour then gives a deliberate create:
      • an unknown value creates the record (new);
      • a re-send attaches to it (auto-attached), for good;
      • people/search / orgs/search with identifier_type + identifier_value recover it after a timeout.
  • One value, one record: both ids are added to uq_identifiers_cannabis_observer (Unique (type, value) for the *_cannabis_observer identifier types #812), which keeps its name.
    • A second record attaching the value gets identifier_taken naming the holder. The pre-check and the race mapping already key on the type-id set and the index name.
    • CREATE … IF NOT EXISTS never changes an existing predicate. So the DO block now drops and rebuilds an index that lacks any of the six ids.
    • On a duplicate, the EXCEPTION clause rolls the DROP back too, so the narrower Unique (type, value) for the *_cannabis_observer identifier types #812 index stays. It never leaves no index.
  • replaces (Observations: let a producer replace or retract a *_cannabis_observer identifier value #848) now covers the two new types too, because it uses the same one-holder set.
  • Docs:
    • PRODUCER_CONTRACT.md § Creating a record with no external identifier: the producer rules, moved there in CR 1 because OBSERVATIONS.md was over its token budget;
    • OBSERVATIONS.md § Identifier types: two table rows, a pointer, and the one-value rule extended to the new types;
    • ANCILLARY.md § Replacing;
    • API_PEOPLE / API_ORGS: pointers.
  • v0.82.0; the client is regenerated (the ObservationAdditionalIdentifier docstring is in the spec).

Deploy notes

  • Schema-only on restart: the seed rows plus the index rebuild. The rebuild takes a short lock on identifiers inside the apply transaction.
  • Production holds no value of the new types yet, so the rebuild cannot hit a duplicate.
  • Deadline: the next schema-parity run, 2026-11-27 00:04 UTC.
    • The shared test DB, the audit's reference, already carries the six-id index (apply-schema --test from this branch).
    • The schema-parity: a worktree's --test apply turns the daily audit red before deploy (reference ahead of prod) #632 ahead-of-deploy rule covers only missing objects; a changed definition always fails. So the audit fails unique_index.identifiers.uq_identifiers_cannabis_observer until this deploys.
    • The OpenAPI-parity timer isn't affected: it compares the served spec with the main checkout, which changes only on a pull, and the restart follows the pull.

Tests

Known limits:

  • One run of test_one_value_on_a_second_entity_is_refused[org_cannabis_observer] failed right after apply-schema --test on the shared test DB. It didn't reproduce in three later runs, all of which passed.
  • Duplicate prevention (name search, operator confirmation) stays with the cli, as decided. Citations are recommended, not enforced.

Refs #879

🤖 Generated with Claude Code

gregoryfoster and others added 6 commits November 26, 2026 02:17
…ifier types

A producer that knows only a name creates a person or organization by minting a
ULID and observing by it: an unknown value creates the record (new), a re-send
attaches to it (auto-attached), and a search on the value recovers it after a
timeout. Both types join uq_identifiers_cannabis_observer (#812), so a value
names one record; the index's DO block now rebuilds an index that predates
them, and a duplicate rolls the rebuild back and keeps the old index. Both
types join the replaces set (#848) with the other one-holder types.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…amily, not inside it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…CT.md; OBSERVATIONS.md keeps a pointer

OBSERVATIONS.md was already over its token budget (#428); the producer-facing
rule belongs with the rest of the producer contract.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… frees the minted value

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… re-created

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gregoryfoster
gregoryfoster merged commit 97cd03c into main Nov 26, 2026
1 check passed
@gregoryfoster
gregoryfoster deleted the feat/879-co-operator-ids branch November 26, 2026 03:27
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