ci(backend): adopt safe migrate-once database reset#186
Conversation
📝 WalkthroughWalkthroughThis PR adds a schema-fingerprinted PostgreSQL reset harness, centralized database fixtures, reset safety tests, and migration-contract markers. Backend test modules now use pre-cleaned databases, while initiative metadata and review evidence document WS-CI-001-02A acceptance conditions. ChangesBackend CI acceleration
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
backend/tests/conftest.py (1)
250-257: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the unused
include_canonical_actorsflag
_reset_test_database_state()ignores this parameter, and there are no callers passing it. Dropping it (and tighteningTestDatabaseResetif needed) keeps the fixture contract aligned with behavior.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@backend/tests/conftest.py` around lines 250 - 257, Remove the unused include_canonical_actors parameter and its del statement from _reset_test_database_state. Update the TestDatabaseReset contract or related type definitions if they still expose this flag, while preserving the existing database reset and after_disable behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@backend/tests/conftest.py`:
- Around line 250-257: Remove the unused include_canonical_actors parameter and
its del statement from _reset_test_database_state. Update the TestDatabaseReset
contract or related type definitions if they still expose this flag, while
preserving the existing database reset and after_disable behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8df6b7fe-eefb-4a95-8116-4668a4c56b97
📒 Files selected for processing (19)
.agent-loop/initiatives/WS-CI-001-backend-ci-acceleration/STATUS.md.agent-loop/initiatives/WS-CI-001-backend-ci-acceleration/reviews/WS-CI-001-02A-internal-review-evidence.md.agent-loop/initiatives/WS-CI-001-backend-ci-acceleration/reviews/WS-CI-001-02A-pr-trust-bundle.md.agent-loop/merge-intents/WS-CI-001-02A.jsonbackend/pyproject.tomlbackend/tests/conftest.pybackend/tests/test_actors.pybackend/tests/test_alembic.pybackend/tests/test_api_rate_controls.pybackend/tests/test_artifact_admission.pybackend/tests/test_artifact_recovery.pybackend/tests/test_audit.pybackend/tests/test_auth.pybackend/tests/test_authorization.pybackend/tests/test_checkers.pybackend/tests/test_database_reset.pybackend/tests/test_outbox.pybackend/tests/test_projects.pybackend/tests/test_tasks.py
PR Trust Bundle
Chunk
WS-CI-001-02A— Safe Migrate-Once Database ResetMerge intent:
.agent-loop/merge-intents/WS-CI-001-02A.jsonGoal
Adopt Konan's migrate-once fixture work while proving that every destructive
reset is confined to an exact runner-owned database and reviewed schema.
What Changed
database resets.
fingerprint, including generic public namespace-object membership.
workflows, runner topology, product code, and migrations.
Scope and Attribution
The implementation stays within the signed 02A allowlist. The adopted source
work is preserved in commit
58125242with Konan as author; subsequent commitsare bounded safety and review repairs. No workflow or product behavior changed.
Acceptance Evidence
reset tests; no existing node was lost.
migration state and leave all seven guarded triggers enabled.
before reset and remains present after rejection.
CI Integrity
Internal Review
Reviewed code SHA: 6bfd9fe
Reviewed at: 2026-07-22T13:36:15Z
Reviewer run IDs: eng006_senior_arch_docs, eng006_qa_ci_tests, eng006_security_ops_reuse
Senior/architecture and QA/CI/test-delta passed with only hosted evidence
conditions. Security/auth, product/ops, reuse/dedup, and documentation passed
without a code blocker. All valid internal findings were repaired.
Remaining Risk and Human Review Focus
The fingerprint intentionally binds PostgreSQL catalog definitions, so the
hosted PostgreSQL run is the portability proof. Review database/role custody,
schema fingerprint completeness, rollback restoration, exact test delta, and
Konan's preserved attribution.
Local duration is not used to claim performance success. Only the complete
GitHub Backend job and all coverage gates determine acceptance.
Follow-up
Do not start
WS-CI-001-02Bautomatically. After this PR merges and signedmemory reconciles, it remains a same-initiative successor requiring explicit
start.
Human Merge Ownership
Summary by CodeRabbit