Skip to content

audit-mixin-rollout-tier3: budget + users (groups 3 & 4) — created_by/updated_by - #306

Merged
arutsh merged 2 commits into
mainfrom
Shared/feat/Issue-305/audit-mixin-rollout-tier3-group3
Sep 21, 2026
Merged

arutsh merged 2 commits into
mainfrom
Shared/feat/Issue-305/audit-mixin-rollout-tier3-group3

Conversation

@arutsh

@arutsh arutsh commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • PrivilegedAccessLog in services/budget and services/users now inherits AuditMixin, adding created_by/updated_by (append-only, so updated_by stays permanently NULL) — and updated_at, the mixin's third mapped column, which the initial migration draft omitted and /code-review caught before merge (verified live against the sibling ai/chat migrations from this same rollout, and confirmed via schema inspection after running alembic upgrade head locally against both services).
  • UserProfileModel (budget's user cache) is exempted from AuditColumnsMixin — decision recorded in design.md Decision 2: its RabbitMQ event-consumer writer has no actor in scope, and its request-scoped cache writer would misattribute rows to the viewer rather than the cached user. Removed now-dead code with the same misattribution shape (get_user_from_cache, get_user_from_cache_or_fallback, user_client.get_user, UserServiceError).
  • Fixed a mypy error caught by the pre-push hook: both PrivilegedAccessLog models redundantly redeclared id with the wrong mapped type (Mapped[t.GUID] instead of Mapped[uuid.UUID]), conflicting with AuditMixin's own id column — removed the redeclaration.

Closes #305 (users service, group 4, has no separate sub-issue — folded into this PR alongside budget).

Test plan

  • services/budget and services/users test suites pass, including new test_tier3_audit_columns.py in each
  • black/mypy/flake8 clean on both services (pre-push hook passed)
  • alembic upgrade head run against real local Postgres for both services; confirmed via \d privileged_access_logs that created_by/updated_by/updated_at all exist post-migration

🤖 Generated with Claude Code

arutsh and others added 2 commits September 21, 2026 16:47
…by/updated_by (#305)

PrivilegedAccessLog in both services now inherits AuditMixin, adding
created_by/updated_by (and the updated_at column the mixin also maps,
missing from the initial migration draft and caught in code review).
UserProfileModel is exempted from AuditColumnsMixin (design.md Decision
2): its RabbitMQ event-consumer writer has no actor context, and its
request-scoped cache writer would misattribute rows to the viewer
rather than the cached user. Dead code with the same misattribution
shape (get_user_from_cache_or_fallback and its now-unused callees) is
removed.

Closes #305

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…xes mypy

AuditMixin already maps id: Mapped[uuid.UUID]; the subclass's own copy
was typed Mapped[t.GUID] (the column type, not the mapped Python type),
which mypy flagged as incompatible with the base class after inheriting
AuditMixin. Removing the redundant redeclaration keeps AuditMixin's
correctly-typed column as the single source of truth.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
grant-flow Ready Ready Preview Sep 21, 2026 3:50pm UTC

@arutsh
arutsh merged commit c00bc21 into main Sep 21, 2026
23 of 25 checks passed
@arutsh
arutsh deleted the Shared/feat/Issue-305/audit-mixin-rollout-tier3-group3 branch September 21, 2026 16:03

This branch was successfully deployed

1 active deployment
Preview — 141742e7 Deployed Sep 21, 2026 by vercel[bot]
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.

audit-mixin-rollout-tier3: budget service — depends on 1 (group 3)

1 participant