Skip to content

fix: resolve post-integration review findings (closes #1656)#1657

Merged
curdriceaurora merged 6 commits into
mainfrom
claude/issue-1656-post-integration-followups
Jul 24, 2026
Merged

fix: resolve post-integration review findings (closes #1656)#1657
curdriceaurora merged 6 commits into
mainfrom
claude/issue-1656-post-integration-followups

Conversation

@curdriceaurora

@curdriceaurora curdriceaurora commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Closes #1656.

Resolves the four findings captured after PR #1655 merged.

Changes

1. job_repo.py — error-field carry-forward for rollback states

JobRepository.update_status now mirrors lifecycle.py's behavior: when transitioning to ROLLING_BACK, ROLLED_BACK, or RECOVERY_REQUIRED without a new error argument, the prior error fields are carried forward rather than nulled. Adds a DB-path regression test asserting preservation across those transitions.

2. verify_claims_freshness.py — anchor self-consistency

Adds build_capability_anchor_map() which extracts the capability→anchor mapping from the parsed matrix document. _verify_matrix_links() now drives its ID-anchor check from that map instead of re-deriving the anchor via cap_id.replace(".", ""), so the checker validates against the real document rather than an independent formula.

3. Capability registry — TUI evidence narrowed

Removes OrganizationPreviewView from entry_points for organization.execute/tui and organization.preview/tui. The conformance driver exercises TUIOrganizationAdapter directly; the widget layer is not reachable by the corpus. Regenerates capability-matrix.md to match.

4. test_capabilities.py — verified-flag guard

Adds test_verified_flags_are_backed_by_corpus_evidence() with _CORPUS_COVERED as the authoritative set of exercised (capability_id, surface) pairs. Any new verified flag outside that set now fails CI until corpus coverage is added or the set is explicitly updated.


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Preserved existing job error details during rollback and recovery transitions.
    • Expired organization plans are now automatically removed and treated as unavailable, improving dashboard reliability.
  • Documentation

    • Updated capability documentation to accurately reflect current organization execution and preview entry points.
  • Quality Improvements

    • Added validation to ensure verified capabilities are supported by documented evidence and that plan expiration behavior remains consistent.

Four findings from the cross-surface parity integration review, in
order of concreteness:

1. job_repo.py carry-forward: mirror lifecycle.py's behavior of
   preserving prior error fields when transitioning to ROLLING_BACK,
   ROLLED_BACK, or RECOVERY_REQUIRED without a new error argument.
   Adds a DB-path regression test asserting error preservation across
   those three transitions.

2. verify_claims_freshness.py anchor self-consistency: add
   build_capability_anchor_map() that extracts the capability→anchor
   mapping from the parsed matrix document. Drive the ID-anchor check
   in _verify_matrix_links() from the map rather than re-deriving the
   anchor via cap_id.replace('.', ''), so the checker validates against
   the real document instead of an independent formula.

3. TUI evidence narrowed: remove OrganizationPreviewView from the
   entry_points of organization.execute/tui and
   organization.preview/tui in the registry. The conformance driver
   exercises TUIOrganizationAdapter directly; the widget layer is not
   reachable by the corpus. Regenerate capability-matrix.md to match.

4. Registry verified-flag guard: add test_verified_flags_are_backed_by_
   corpus_evidence() with _CORPUS_COVERED as the authoritative set of
   exercised (capability_id, surface) pairs. Any new verified flag
   outside that set fails CI until corpus coverage is added or the set
   is explicitly updated.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JVm2ys4rBjNALZCUNoyYrx
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 40 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: CHILL

Plan: Pro Plus

Run ID: d84e1894-3212-4498-8932-e4adcd42e330

📥 Commits

Reviewing files that changed from the base of the PR and between 2e54c1f and 33fee59.

📒 Files selected for processing (4)
  • src/file_organizer/web/organize_services.py
  • tests/integration/test_executable_plan_review_regressions.py
  • tests/integration/test_job_repo_integration.py
  • tests/web/test_organize_services.py
📝 Walkthrough

Walkthrough

The changes align TUI capability metadata with adapter entry points, validate README anchors against generated matrix anchors, guard verified capability coverage, preserve job errors during rollback transitions, and add TTL expiration to stored organization plans.

Changes

Capability metadata and validation

Layer / File(s) Summary
TUI capability entry points
src/file_organizer/core/capability_registry.json, docs/developer/capability-matrix.md
The organization execute and preview capabilities now list only their corresponding TUIOrganizationAdapter methods as TUI entry points.
Matrix-derived claim anchors
scripts/verify_claims_freshness.py
Capability anchors are parsed from the generated matrix and used to validate README capability links.
Verified coverage enforcement
tests/core/test_capabilities.py
A corpus allowlist and test now validate that every verified capability surface is explicitly covered.

Job rollback error retention

Layer / File(s) Summary
Rollback error preservation
src/file_organizer/api/repositories/job_repo.py, tests/integration/test_job_repo_integration.py
Rollback-related status transitions preserve existing job error fields, including serialized details, and integration tests cover the behavior.

Organization plan expiration

Layer / File(s) Summary
Plan TTL lifecycle
src/file_organizer/web/organize_services.py, tests/integration/test_executable_plan_review_regressions.py, tests/web/test_organize_services.py
Stored plans use a one-hour TTL, expired records are pruned or treated as missing on lookup, and both paths are tested.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The web organize-plan TTL changes and their tests are unrelated to #1656’s listed objectives. Move the organize-plan TTL work to a separate PR or remove it from this change set.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the PR’s main theme of resolving review findings for #1656.
Linked Issues check ✅ Passed The PR addresses all four linked follow-ups: job error preservation, anchor-map verification, TUI evidence correction, and verified-flag validation.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-1656-post-integration-followups

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.

claude added 3 commits July 23, 2026 23:59
_prune_plan_store now sweeps expired plans (older than
ORGANIZE_PLAN_TTL_SECONDS = 3600s) before falling back to
count-based eviction. _get_organize_plan returns None and
eagerly evicts plans whose TTL has elapsed, preventing stale
plan data from persisting across the full store-limit window.
Covers the P2 code-review finding that the store lacked
time-based expiration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JVm2ys4rBjNALZCUNoyYrx
Records injected directly into _ORGANIZE_PLAN_STORE without a
created_at key (as in the existing regression test) now treat
themselves as freshly created (effective age 0s), so they are never
TTL-expired and count-based pruning still handles them. Fixes the
KeyError: 'created_at' failure in test_web_organize_helper_validation_branches
on py3.14.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JVm2ys4rBjNALZCUNoyYrx
The integration coverage floor for organize_services.py dropped to
89.6% after the TTL addition because the new branches (expired-plan
loop in _prune_plan_store, TTL guard in _get_organize_plan) weren't
hit by any integration-marked test. Add test_plan_store_ttl_evicts_expired_records
to the existing regression file to cover both paths under TTL=-1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JVm2ys4rBjNALZCUNoyYrx
@curdriceaurora
curdriceaurora marked this pull request as ready for review July 24, 2026 00:30

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 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.

Inline comments:
In `@src/file_organizer/web/organize_services.py`:
- Around line 108-112: Update _get_organize_plan to retrieve created_at with the
same tolerant fallback used by _prune_plan_store, removing and returning None
for records with missing or invalid timestamps instead of raising KeyError.
Preserve the existing TTL expiration behavior, and add a regression test
covering lookup of a stored plan without created_at.

In `@tests/integration/test_job_repo_integration.py`:
- Around line 198-225: Extend test_rollback_states_preserve_prior_error_fields
to assert error, error_code, error_retryable, and error_details_json after
ROLLED_BACK, matching the existing ROLLING_BACK assertions. Add a
RECOVERY_REQUIRED transition and assert all four error fields there as well,
preserving the original values throughout each target state.

In `@tests/web/test_organize_services.py`:
- Around line 195-201: Update tests/web/test_organize_services.py lines 195-201
in test_plan_store_ttl_expiry_returns_none to store the record with a valid TTL,
modify its created_at timestamp to make it expired, then assert
_get_organize_plan returns None and clean up the ID. Update
tests/integration/test_executable_plan_review_regressions.py lines 354-371 to
separately age records for _prune_plan_store() and _get_organize_plan(),
preserving both records through storage and cleaning up both IDs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 842507c8-0ff7-40ac-bab6-d0b9c1fbf4c9

📥 Commits

Reviewing files that changed from the base of the PR and between 038846c and 2e54c1f.

📒 Files selected for processing (9)
  • docs/developer/capability-matrix.md
  • scripts/verify_claims_freshness.py
  • src/file_organizer/api/repositories/job_repo.py
  • src/file_organizer/core/capability_registry.json
  • src/file_organizer/web/organize_services.py
  • tests/core/test_capabilities.py
  • tests/integration/test_executable_plan_review_regressions.py
  • tests/integration/test_job_repo_integration.py
  • tests/web/test_organize_services.py
💤 Files with no reviewable changes (1)
  • src/file_organizer/core/capability_registry.json

Comment on lines +108 to +112
now = datetime.now(UTC)
if (now - plan["created_at"]).total_seconds() > ORGANIZE_PLAN_TTL_SECONDS:
_ORGANIZE_PLAN_STORE.pop(plan_id, None)
return None
plan["updated_at"] = now

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Handle missing created_at during retrieval.

_prune_plan_store() tolerates missing timestamps via .get(...), but _get_organize_plan() still evaluates plan["created_at"]. A legacy or malformed stored record can therefore raise KeyError during lookup. Reuse the same fallback/removal policy here and add a regression test.

🤖 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 `@src/file_organizer/web/organize_services.py` around lines 108 - 112, Update
_get_organize_plan to retrieve created_at with the same tolerant fallback used
by _prune_plan_store, removing and returning None for records with missing or
invalid timestamps instead of raising KeyError. Preserve the existing TTL
expiration behavior, and add a regression test covering lookup of a stored plan
without created_at.

Comment thread tests/integration/test_job_repo_integration.py
Comment thread tests/web/test_organize_services.py Outdated
claude added 2 commits July 24, 2026 00:44
- Use .get("created_at", now) fallback in _get_organize_plan to match
  the defensive pattern already in _prune_plan_store; prevents KeyError
  on any malformed record without a timestamp.
- Rewrite both TTL tests to store a plan normally then age its
  created_at to a past datetime, so the tests exercise the actual
  TTL-expiry code path rather than the already-proven "plan missing
  from store" branch caused by immediate eviction during store.
- Add error_retryable and error_details_json assertions after
  ROLLED_BACK in test_rollback_states_preserve_prior_error_fields and
  add a full RECOVERY_REQUIRED transition path (running → failed →
  rolling_back → recovery_required) asserting all four error fields.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JVm2ys4rBjNALZCUNoyYrx
@curdriceaurora
curdriceaurora merged commit 16ef804 into main Jul 24, 2026
79 checks passed
curdriceaurora pushed a commit that referenced this pull request Jul 24, 2026
- Use .get("created_at", now) fallback in _get_organize_plan to match
  the defensive pattern already in _prune_plan_store; prevents KeyError
  on any malformed record without a timestamp.
- Rewrite both TTL tests to store a plan normally then age its
  created_at to a past datetime, so the tests exercise the actual
  TTL-expiry code path rather than the already-proven "plan missing
  from store" branch caused by immediate eviction during store.
- Add error_retryable and error_details_json assertions after
  ROLLED_BACK in test_rollback_states_preserve_prior_error_fields and
  add a full RECOVERY_REQUIRED transition path (running → failed →
  rolling_back → recovery_required) asserting all four error fields.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JVm2ys4rBjNALZCUNoyYrx
@curdriceaurora
curdriceaurora deleted the claude/issue-1656-post-integration-followups branch July 24, 2026 01:02
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.

Post-integration follow-ups: cross-surface parity review findings (from #1655)

2 participants