Repository navigation
#882 feat: readable record ownership, and owned_by_dataset (v0.81.0) - #891
Merged
Merged
Conversation
AssignmentDetail.ownership and OrgDetail.parent_ownership answer self | other | none | dataset relative to the calling key (getAssignment, getOrg, batchGetOrgs). `dataset` comes first: a subscribed dataset's in-scope crosswalk anchor means its nightly apply reverts any observation write, whoever holds source_key_id. The detail ETag folds the value (make_etag(..., *relative)), so two keys never share a validator and a dataset adopting a row moves it. The three reads take require_key for the key id. Writes the apply would revert: an id-addressed assignment update or retract, or an id-addressed reparent, is refused `owned_by_dataset` before the source_key_id gate; an identical assertion never claims a dataset row; the natural-key close-enrichment and the write-if-null parent fill are skipped and listed in `unapplied` (operator, 2026-11-25). The principle is in OBSERVATIONS.md § Record ownership, held by tests/core/test_source_key_gates.py: a gate exists exactly where the API can overwrite or remove, and every source_key_id column is declared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te, as what ignores the stamp Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hout IF NOT EXISTS Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ip is a closed set (CR 2) OBSERVATIONS.md and PUBLIC_API.md were already over the 10,000-token doc budget, and #882 added 900 and 1,084 tokens to them. The reason-code table, the one-name paragraph and the Record ownership section move to docs/PRODUCER_CONTRACT.md, reached from both. The growth falls to 65 and 397. The new doc also says Ownership's four values are a closed set (the second half of CR 2). The guard, the docstrings and API_ASSIGNMENTS point at the new doc; the client is regenerated, as ObservationReasonCode's docstring is in the spec. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gregoryfoster
force-pushed
the
feat/882-ownership
branch
from
November 26, 2026 01:31
6ff0e8c to
bfbe741
Compare
This was referenced Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 2 of 2 for #882. Stacked on #889 (base
feat/882-reason-code). Merge #889 first; GitHub then retargets this PR tomain. Design doc:docs/plans/2026-11-25-reason-code-ownership-design.md. Decisions: operator comments 7172492503, 7175854705 and 7177148696.What changes
Ownership on reads, relative to the calling key
AssignmentDetail.ownershipcovers the tenure:start_date,end_date,is_current.OrgDetail.parent_ownershipcoversparent_id, the only org column the gate guards.self | other | none | dataset, typed as theOwnershipenum in the spec.getAssignment,getOrgandbatchGetOrgs. These three now takerequire_keyfor the key id.datasetcomes first. A subscribed dataset's in-scopeproducer_crosswalkanchor means its nightly apply reverts any observation write, whoever holdssource_key_id.make_etag(id, updated_at, *relative)gives"<id>-<ms>-<ownership>". Two keys never share a validator, and the ETag changes when a dataset starts owning a row, thoughupdated_atdoesn't. The batch ETags still equalgetOrg's.Writes the apply would revert (
owned_by_dataset, a newObservationReasonCode)source_key_idgate:unapplied(operator, 2026-11-25), so the rest of the observation lands:The principle and its guard
source_key_idgate exists exactly where the observation API can overwrite or remove a value, and who created a row is not who may overwrite it.tests/core/test_source_key_gates.pydeclares each of the 7 tables that carry the column as a gate or a stamp, and fails on a new one or on a gate for people or roles.Docs
unapplied, the ETag format.make_etag.Release: v0.81.0, with the client regenerated.
Verification
tests/api/public/test_record_ownership.py: 20 integration tests, all passed.scripts/pre-ship.sh: passed.-m integrationsuite was not run here, by the operator's direction (Tests: cut commit-hook and suite wall-clock; integration runs only when asked #890). PR 1's full run, on the shared base, was 5609 passed.Known limits:
datasetuses the overlay's anchor scope. An anchored org whose dataset emits no parent row still readsdataset, and a parent fill there is skipped. Accepted in the design.🤖 Generated with Claude Code