feat(identity-resolution): make attribute policy and account assignment readable from the warehouse - #2313
Closed
aleksdotbar wants to merge 2 commits into
Closed
Conversation
The query path reads both from the analytical store, so it consults no administrative service per request. - Policy crosses a store boundary, so it is published: a full snapshot with count verification and an atomic swap. Mechanics are now shared with the persons-log publisher rather than copied. - Assignment crosses nothing — the persons journal is already in ClickHouse and swapped wholesale — so it is a view. Zero copy, and consistent with its source by construction rather than by schedule. - Latest-wins is keyed by account, not by person: the two disagree exactly when an account is rebound, which is what the relation exists to answer. - Unchanged policy short-circuits, but only after confirming the published snapshot still matches what was journalled; a checksum alone would skip forever against a warehouse that had been wiped. - CREATE DATABASE cannot run on a client pinned to that database, so the bootstrap DDL now goes through one that always exists. The publisher's fresh-environment path had never worked. - The raw-to-UUID identifier mapping becomes a named macro, since it is the recipe for joining raw-keyed relations to identity ones. Refs #2028 Signed-off-by: Aleksandr Barkhatov <pm@aleks.bar>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
An admin who edits attribute policy could not make it take effect without cluster credentials — the publish ran only on its schedule. The seed's HTTP trigger was removed with its in-process queue and 503-when-full path, but that reasoning was the queue's, not the trigger's, and it had been carried forward three times without being re-derived. The handler decides admission synchronously — gate, tenant, lock, journal row — then hands an admitted run to a detached task. Back-pressure is the advisory lock, so a concurrent run is a 409 rather than a queue that can fill; nothing buffered comes back. The caller is recorded as the run's author, and the journal names which path started it. Both paths resolve the journal tenant the same way, and a caller outside that tenant is refused: one snapshot keeps one journal, or the short-circuit stops firing and callers cannot read the runs they started. Comments in these files now follow the workspace rules: no module headers, no doc comments, tagged lines only where code cannot carry the fact. Endpoint paths are gone from handler docs — they live in the route table. Promotes identity-resolution to a generated schema target, which the drift gate has demanded since its document started describing the service rather than the retired one. The internal routes keep hand-written models; nothing publishes them. Closes #2312 Signed-off-by: Aleksandr Barkhatov <pm@aleks.bar>
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.
Problem
The query path cannot see attribute policy or account-to-person assignment.
Policy is administrative state edited elsewhere; assignment is only implicit
in the persons journal. Without both readable from the analytical store, a
grouped or comparative request either consults a service it should not
depend on, or proceeds without knowing what it is allowed to do and who the
evidence belongs to.
Change
Two projections, reached two different ways.
identity.person_attribute_policy_snapshot— a published snapshot.Policy crosses a store boundary, so it is copied: full snapshot, count
verification, atomic swap. Keys stay the raw warehouse strings, so the
relation joins the claim relations byte-equal.
identity.person_account_assignments_current— a view. The personsjournal is already in ClickHouse and is replaced wholesale by an atomic
swap, so nothing needs copying: the view is consistent with its source by
construction, and its revision is the journal's own publication stamp.
Latest-wins is keyed by account rather than by person — the two disagree
exactly when an account is rebound, which is the case this relation exists
to resolve.
Supporting changes:
swap, staging GC) move into a writer shared with the persons-log publisher
instead of being copied alongside it.
publish-policysubcommand and hourly CronJob, journalled like the otherruns. An unchanged policy set short-circuits, but only after confirming the
published snapshot still matches what was journalled — a checksum alone
would skip forever against a warehouse that had been wiped or re-pointed.
Skips are journalled too, so the journal still answers whether the schedule
fired.
/v1/person-attributes-policy-publish, behind theexisting admin gate.
insight_uuid_from_rawmacro, replacing eight inline copies. It is the recipe for joining
raw-keyed relations to identity ones, and writing it by hand is how such a
join silently returns nothing.
empty on every seeded environment.
Fix carried along
CREATE DATABASE IF NOT EXISTScannot run on a client pinned to thatdatabase — ClickHouse resolves the request's database first and rejects the
statement. The persons-log publisher's fresh-environment path had therefore
never worked; it survived only because the init migration creates the
database. The bootstrap DDL now goes through a database that always exists.
Out of scope
The attribute catalog and the grouping and comparison APIs; mirroring the
account-person map (the projection contract deliberately allows swapping its
producer later).
Validation
dbt parseclean; OpenAPI drift gate passing on the regenerated spec.unchanged set skips; a warehouse wiped behind the journal re-publishes
rather than skipping; a policy edit republishes at the new revision; every
run is journalled, skips included.
person, email observations stay out of the projection, and the policy
snapshot joins the assignment view through the documented recipe.
Notes for the consuming layer
by hashing the claims side with
insight_uuid_from_raw, account ids raw.publishing an empty snapshot depends on it.
jobs, so they are two diagnostics values, not one.
Closes #2312