Skip to content

Fix Phase 3 startup schema migration and audit log rotation#26

Merged
Mukku27 merged 1 commit into
mainfrom
cursor/fix-startup-audit-6a40
Jul 10, 2026
Merged

Fix Phase 3 startup schema migration and audit log rotation#26
Mukku27 merged 1 commit into
mainfrom
cursor/fix-startup-audit-6a40

Conversation

@Mukku27

@Mukku27 Mukku27 commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

Implements PR C / Phase 3 of the bug-fix plan: migrate schema on app startup and rotate oversized audit logs.

Changes

  1. Startup schema migrationapp.py calls ensure_schema(db_path) before validate_product_schema(db_path), so a fresh clone no longer requires a separate migrate step before launch.
  2. Empty inventory hint — when PRODUCT has 0 rows, the UI shows an st.info pointing to python database.py --seed (seeding remains opt-in).
  3. Audit log rotation — when ai_operation_audit.jsonl reaches 100 MB, it is rotated to .1 / .2 / .3 (newest 3 archives kept) before the next event is written; emits a UserWarning on rotation.

Tests

  • Rotation + archive retention coverage in tests/test_audit.py
  • Startup ordering / seed-hint source checks
  • ruff check clean on touched files
  • pytest: 85 passed

Completes the bug-fix plan

Phases 1–3 (PRs #24, #25, and this PR) cover the prioritized correctness bugs from the action plan.

Open in Web Open in Cursor 

- Call ensure_schema before validate on app startup; hint when PRODUCT is empty
- Rotate ai_operation_audit.jsonl at 100 MB, keeping the newest 3 archives

Co-authored-by: Mukesh Vemulapalli <vemulapallimukesh@gmail.com>
@Mukku27
Mukku27 marked this pull request as ready for review July 10, 2026 12:13
@cursor

cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@Mukku27
Mukku27 merged commit 381a8f3 into main Jul 10, 2026
5 checks passed
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.

2 participants