fix(audit): use semantic database object names - #653
Draft
seonghobae wants to merge 14 commits into
Draft
Conversation
|
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: trueThanks 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 |
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.
Purpose
Repair the ScopeWeave Audit Trail persistence vocabulary so organization-owned SQLite identifiers are semantically specific while preserving the established
/api/orgs/:id/audit, audit CSV, and workspace-export wire contracts.TDD evidence
The branch was cut from protected
develop@2c328875e00e86537df3e965170be80532571cad. A regression was introduced before production repair to require semantic Audit Trail storage, preserve seeded legacy audit data through migration, and replace the generic audit index. Final tests now cover fresh storage, realistic legacy migration, idempotent reopen, semantic index creation, and wire compatibility. Predecessor/base results are not used as final evidence.Persistence repair
The authoritative durable relation is now
audit_eventswithaudit_event_id,audit_action, andaudit_metadata_json, plusaudit_events_org_event_idx(org_id, audit_event_id). Production audit writes and durable reads use those names directly.A historical
audit_logis handled only as a startup migration source. Migration validates an unambiguous legacy/intermediate shape, refuses dual populated authorities, copies and removes the legacy table/indexes insideBEGIN IMMEDIATE, and rolls back on failure. Existing foreign-key semantics, one-event-per-row 3NF shape, append-only/no-UPSERT behavior, tenant hot read path, and runtime read/write topology remain unchanged.Compatibility boundary
Historical public fields
id,action, andmetaremain unchanged for JSON, CSV, and workspace export. They are produced by explicit SQL aliases in the web adapter; no durable or temporaryaudit_logcompatibility object remains.Documentation
ARCHITECTURE.md,CHANGELOG.md,docs/doctoring/audit-persistence-semantic-naming.md, anddocs/product-technical-gap-baseline.mdrecord old→new terminology, bounded-context rationale, migration/rollback behavior, compatibility ownership, and exact source evidence.Merge discipline
Fresh required GitHub verification and qualifying independent current approval are required on the unchanged final head before merge. No force push, bypass, self-approval, stale status transfer, or weakened test/security gate is acceptable.