Skip to content

fix(gap-5): PostgreSQL audit persistence — replaces warning-only stub in ComplianceEngine#83

Open
cryptoxdog wants to merge 2 commits into
base/pre-gap-fixesfrom
fix/gap5-audit-persistence
Open

fix(gap-5): PostgreSQL audit persistence — replaces warning-only stub in ComplianceEngine#83
cryptoxdog wants to merge 2 commits into
base/pre-gap-fixesfrom
fix/gap5-audit-persistence

Conversation

@cryptoxdog

Copy link
Copy Markdown
Collaborator

Gap 5

File: engine/compliance/audit_persistence.py

Wires asyncpg pool into audit flush so entries actually persist instead of being silently dropped.

  • configure_audit_pool(pool) — call once at startup; auto-creates audit_log table + index
  • flush_audit_entries(entries) — bulk INSERT via executemany, returns row count
  • Graceful: logs error + returns 0 if pool not configured
  • Schema: audit_log(id, tenant_id, actor, action, detail, created_at) + idx on (tenant_id, created_at DESC)
pool = await asyncpg.create_pool(dsn)
await configure_audit_pool(pool)

Tests: tests/gap_fixes/test_gap5_audit.py — no pool, empty list, mock pool insert

@coderabbitai

coderabbitai Bot commented Mar 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 869cdf8b-61fb-4137-9f8a-6918d8c10007

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/gap5-audit-persistence

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

Copy link
Copy Markdown

PR size is within recommended limits

@sonarqubecloud

Copy link
Copy Markdown

@cryptoxdog

Copy link
Copy Markdown
Collaborator Author

PR #83 Review: fix(gap-5): PostgreSQL audit persistence — replaces warning-only stub in ComplianceEngine

Author: cryptoxdog
Branch: fix/gap5-audit-persistence
HEAD: 730d17d4
Created: 2026-03-31T07:23:16Z
Changes: +147 / -0
Reviewed: 2026-04-21T18:09:33+00:00

Description

Gap 5

File: engine/compliance/audit_persistence.py

Wires asyncpg pool into audit flush so entries actually persist instead of being silently dropped.

  • configure_audit_pool(pool) — call once at startup; auto-creates audit_log table + index
  • flush_audit_entries(entries) — bulk INSERT via executemany, returns row count
  • Graceful: logs error + returns 0 if pool not configured
  • Schema: audit_log(id, tenant_id, actor, action, detail, created_at) + idx on (tenant_id, created_at DESC)
pool = await asyncpg.create_pool(dsn)
await configure_audit_pool(pool)

Tests: tests/gap_fixes/test_gap5_audit.py — no pool, empty list, mock pool insert

Commits

730d17d4 fix(gap-5): PostgreSQL audit persistence — replaces warning-only stub

Changed Files

🐍 Python (3 files)

  • engine/compliance/audit_persistence.py
  • tests/gap_fixes/__init__.py
  • tests/gap_fixes/test_gap5_audit.py

Automated Analysis

Diff Findings

✅ No issues found in diff analysis

Test Coverage

Files without corresponding test changes:

  • engine/compliance/audit_persistence.py

Local Lint

Skipped (repo not checked out locally or linters not found).

Summary

LOOKS GOOD — No automated issues found. Ready for human review.


Automated PR review • 2026-04-21 18:09

@cryptoxdog

Copy link
Copy Markdown
Collaborator Author

Automated PR patrol review — 2026-04-22 UTC

Patrol note only; not a human approval. This PR has been open for 538.6h with no review.

  • CI status: FAILURE
  • Review decision: NONE
  • Draft: False
  • Files changed: 3 (python:3)
  • Heuristic scan: typing=1

Top findings:

  • engine/compliance/audit_persistence.py:26 — Type ignore comment

Suggested next action: fix failing CI, then request review .

@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant