Repository navigation
refactor(cli): route reconcile/materialize commands through AppEnv.repository - #3356
Conversation
…pository Problem: reconcile_work_effects.py and materialize_incident_evidence.py constructed SessionRepository(db_path=active_index_db_path()) directly instead of going through the established AppEnv.repository property that every other CLI command uses. This was a real architecture-boundary violation that tests/unit/architecture/test_surface_storage_boundary.py had to special-case as a tracked allow-list exception rather than fix. What changed: - Wired both commands into the standard @click.pass_obj/AppEnv context-object pattern (env: AppEnv as the first parameter) and replaced the manual `async with SessionRepository(db_path=active_index_db_path())` construction with `env.repository`, which resolves to the same cached repository via RuntimeServices.get_repository(). - Removed the now-unnecessary allow-list entries for both files in test_surface_storage_boundary.py. - Updated the two commands' CLI tests to invoke through the real `cli` root group (`ops reconcile-work-effects` / `ops materialize-incident-evidence`) instead of the bare leaf command, so the root callback builds a properly runtime-resolved AppEnv (matching test_excise.py's existing pattern) rather than needing an ad hoc AppEnv() that lacks a resolved database path. Verification: - devtools test tests/unit/cli/test_reconcile_work_effects_command.py tests/unit/cli/test_materialize_incident_evidence_command.py tests/unit/architecture/test_surface_storage_boundary.py -> 162 passed - mypy --strict polylogue/cli/commands/reconcile_work_effects.py polylogue/cli/commands/materialize_incident_evidence.py -> Success - ruff check / ruff format --check on all changed files -> clean - devtools render all --check -> no "out of sync" surfaces Ref polylogue-a7uk Co-Authored-By: Claude <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 15 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 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 |
Summary
Routes
reconcile_work_effects_commandandmaterialize_incident_evidence_commandthrough the standardAppEnv.repository/@click.pass_objcontext-object pattern instead of constructingSessionRepository(db_path=active_index_db_path())directly, removing a tracked architecture-boundary allow-list exception.Problem
Both commands (from PR #3199/#3327 and PR #3336) imported
SessionRepositorydirectly frompolylogue.storage.repositoryand constructed it manually instead of going throughAppEnv.repository— the pattern every other CLI command uses.tests/unit/architecture/test_surface_storage_boundary.pyhad to special-case both files in itsALLOWEDset rather than fix the violation (tracked by polylogue-a7uk).Solution
@click.pass_objto both commands, withenv: AppEnvas the first parameter.async with SessionRepository(db_path=active_index_db_path()) as repository:construction withenv.repository, which resolves to the same cached repository viaRuntimeServices.get_repository()(same underlying archive path).test_surface_storage_boundary.py.test_reconcile_work_effects_command.py,test_materialize_incident_evidence_command.py) to invoke through the realcliroot group (ops reconcile-work-effects/ops materialize-incident-evidence) instead of the bare leaf command, matchingtest_excise.py's existing pattern — this is what lets the root callback build a properly runtime-resolvedAppEnv(an ad hocAppEnv()constructed directly in a test has no resolved database path).Verification
devtools test tests/unit/cli/test_reconcile_work_effects_command.py tests/unit/cli/test_materialize_incident_evidence_command.py tests/unit/architecture/test_surface_storage_boundary.py→ 162 passedmypy --strict polylogue/cli/commands/reconcile_work_effects.py polylogue/cli/commands/materialize_incident_evidence.py→ Success: no issues found in 2 source filesruff check/ruff format --checkon all changed files → cleandevtools render all --check→ no "out of sync" surfacesdevtools verify --quick) passed on pushRef polylogue-a7uk