Skip to content

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
refactor/544-boundary-event-actorfrom
fix/676-unknown-actors
Draft

PiquelChips wants to merge 2 commits into
refactor/544-boundary-event-actorfrom
fix/676-unknown-actors

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Closes #676. Stacked on #673 (refactor/544-boundary-event-actor), which adds Event::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 into Actor, so a new actor type, or a new JobName inside Actor::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), or Unknown(Value) with the JSON as stored, by the same KindProbe rule #587 uses. KindProbe::known_flat probes the actor's type and the strings beside it, such as job. Event payloads, alerts and notifications keep the probe they had.

  • Writes stay typed, and a known actor that doesn't decode, such as a user with no user_id, is still InvalidStoredData.
  • Dashboard and audit CLI: 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.
  • Security history and export: an entry with an unknown actor has 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: docs/dev/architecture/database.md said an unknown JobName fails the read; it now states the actor rule, and names alert_updates.author as 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) and actors_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 with stored 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_elsewhere now takes the actor to store and an optional origin, written by the same personal-data insert record uses. Existing tests compare through stored.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, including prepare-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-common is 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)

…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
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

1 participant