Skip to content

refactor(cli): route reconcile/materialize commands through AppEnv.repository - #3356

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/route-repository-facade-a7uk
Jul 27, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/route-repository-facade-a7uk

Conversation

@Sinity

@Sinity Sinity commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

Routes reconcile_work_effects_command and materialize_incident_evidence_command through the standard AppEnv.repository / @click.pass_obj context-object pattern instead of constructing SessionRepository(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 SessionRepository directly from polylogue.storage.repository and constructed it manually instead of going through AppEnv.repository — the pattern every other CLI command uses. tests/unit/architecture/test_surface_storage_boundary.py had to special-case both files in its ALLOWED set rather than fix the violation (tracked by polylogue-a7uk).

Solution

  • Added @click.pass_obj to both commands, with env: AppEnv as the first parameter.
  • Replaced the manual async with SessionRepository(db_path=active_index_db_path()) as repository: construction with env.repository, which resolves to the same cached repository via RuntimeServices.get_repository() (same underlying archive path).
  • Removed the now-unneeded allow-list entries in test_surface_storage_boundary.py.
  • Updated both commands' CLI tests (test_reconcile_work_effects_command.py, test_materialize_incident_evidence_command.py) to invoke through the real cli root group (ops reconcile-work-effects / ops materialize-incident-evidence) instead of the bare leaf command, matching test_excise.py's existing pattern — this is what lets the root callback build a properly runtime-resolved AppEnv (an ad hoc AppEnv() 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 passed
  • mypy --strict polylogue/cli/commands/reconcile_work_effects.py polylogue/cli/commands/materialize_incident_evidence.py → Success: no issues found in 2 source files
  • ruff check / ruff format --check on all changed files → clean
  • devtools render all --check → no "out of sync" surfaces
  • Pre-push hook (devtools verify --quick) passed on push

Ref polylogue-a7uk

…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]>
@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.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 003d3cdf-db04-4465-8fe3-256d93d99cae

📥 Commits

Reviewing files that changed from the base of the PR and between 1e6e85f and ed565f6.

📒 Files selected for processing (5)
  • polylogue/cli/commands/materialize_incident_evidence.py
  • polylogue/cli/commands/reconcile_work_effects.py
  • tests/unit/architecture/test_surface_storage_boundary.py
  • tests/unit/cli/test_materialize_incident_evidence_command.py
  • tests/unit/cli/test_reconcile_work_effects_command.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/route-repository-facade-a7uk

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.

@Sinity
Sinity merged commit d67e3e2 into master Jul 27, 2026
3 checks passed
@Sinity
Sinity deleted the feature/refactor/route-repository-facade-a7uk branch July 27, 2026 20:48
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