Repository navigation
fix(auth): events stay readable when a newer release recorded an actor this one doesn't know - #689
Draft
PiquelChips wants to merge 2 commits into
Draft
PiquelChips wants to merge 2 commits into
PiquelChips wants to merge 2 commits into
Conversation
…r this one doesn't know A stored actor of a type this release does not know, or a known type naming a value it does not know such as a new job, read as unknown with its JSON instead of failing the whole events read. A known actor that does not decode is still an error, and writes stay typed. Closes #676
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
…with one recorded Review follow-ups: the test gives the unknown actors' events a recorded IP address and device and checks the history and export show neither, through an optional origin on insert_written_elsewhere that shares record's personal-data insert. known_flat borrows the stored actor instead of cloning it on every read. The database docs name alert_updates.author as still strict (#701), and the history fields say an unknown actor's origin is hidden.
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.
Closes #676. Stacked on #673 (
refactor/544-boundary-event-actor), which addsEvent::actor(), so this PR targets that branch.After a rollback, one event whose actor a newer release recorded broke every page that lists events: the dashboard's events list,
auth-service audit events, the owner's security history and the account export. The actor column decoded straight intoActor, so a new actor type, or a newJobNameinsideActor::System, failed the whole read. #587 already made event payloads from a newer release read as unknown; the actor wasn't covered.Now the stored actor reads as
RecordedActor:Known(Actor), orUnknown(Value)with the JSON as stored, by the sameKindProberule #587 uses.KindProbe::known_flatprobes the actor'stypeand the strings beside it, such asjob. Event payloads, alerts and notifications keep the probe they had.userwith nouser_id, is stillInvalidStoredData.auditCLI: the events list passes the stored JSON through, so the existing fallbacks apply: "nobody recorded" on the dashboard, and the raw JSON in the CLI. No change to either.actor: null, no byline, and no IP address or device, since the actor may be an administrator. It can't be reported, and it isn't marked worrying: with no byline there is nothing to say who acted, so it is shown like the account's own entries. The CLI's account history leaves the "BY" cell empty, and a notification's history entry drops "(by …)". Known actors show what they did before.docs/dev/architecture/database.mdsaid an unknownJobNamefails the read; it now states the actor rule, and namesalert_updates.authoras still strict (fix(auth): alert updates stay readable when a newer release recorded an author this one doesn't know #701, not fixed here).Tests.
actors_a_newer_release_wrote_read_as_unknown(repository) andactors_a_newer_release_wrote_are_read(auth-service: admin list, history, export) store{"type": "from_a_newer_release"}and{"type": "system", "job": "from_a_newer_release"}. Before the fix both failed withstored column 5 is invalid: JSON that does not match its type. The auth-service test gives both events a recorded IP address and device, and checks that the history and export show neither.insert_written_elsewherenow takes the actor to store and an optional origin, written by the same personal-data insertrecorduses. Existing tests compare throughstored.actor.known().Checks.
just db prepare(the events query changed);cargo clippy -p auth-service -p sourceorigin-repository -p sourceorigin-ui --all-targets -- -D warnings, with and without--all-features;cargo fmt --check;just db test --test-threads 2: 511 of 511 pass, includingprepare-check(at full parallelism, two unrelated invitation tests timed out on a lock under load);just test -p sourceorigin-common -p sourceorigin-ui: 51 of 51;just docs.sourceorigin-commonis untouched, so no semver check.Note
Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus 5.5 (via T3 Code)