Skip to content

fix(patchesAppliedIndication): defer findBoxComponent lookup to PATCH 3#713

Open
risenowrise wants to merge 1 commit intoPiebald-AI:mainfrom
risenowrise:fix/box-component-deferred
Open

fix(patchesAppliedIndication): defer findBoxComponent lookup to PATCH 3#713
risenowrise wants to merge 1 commit intoPiebald-AI:mainfrom
risenowrise:fix/box-component-deferred

Conversation

@risenowrise
Copy link
Copy Markdown

@risenowrise risenowrise commented May 1, 2026

Problem

writePatchesAppliedIndication looks up findBoxComponent unconditionally near the top, then aborts the entire indicator if Box isn't found. But only PATCH 3 (the patches-applied list block) actually uses the Box component — PATCH 1 (--version string) and PATCH 2 (header banner + tweakcc v… tag) don't reference it at all.

This bites on CC 2.1.126, where the Box function is now:

function o21({children:H,ref:_,tabIndex:q,autoFocus:K,onClick:O,onFocus:T, ...})

None of findBoxComponent's four strategies match this shape (Method 2 expects flexWrap as the second destructured key; Method 4 expects a single-arg function NAME(A){let q=memo(N)…}). Result: the whole patch fails with failed to find Box component and CC users on 2.1.126 lose both the version-output tweak and the header banner indicator that don't depend on Box at all.

Fix

Move the findBoxComponent call inside the if (showPatchesApplied) branch and return content (preserving PATCH 1 + PATCH 2) when Box can't be located, instead of returning null and discarding everything. PATCH 3 is the one feature that genuinely needs Box detection — it should be the only one that gets skipped when detection lags.

Verified on

CC 2.1.126 — both --version output and TUI header banner now show the tweakcc tag (PATCH 1 + PATCH 2 active). PATCH 3 logs PATCH 3 skipped (Box component not located on this CC version) and continues. Once findBoxComponent is updated for 2.1.126's Box shape, PATCH 3 will start applying again with no further changes here.

Note

This is a minimal, targeted fix — it doesn't try to fix findBoxComponent itself for 2.1.126. That's a separate change.


Authored with help from Claude Opus 4.7 (claude-opus-4-7) via Claude Code.

Summary by CodeRabbit

  • Bug Fixes
    • Improved patch application resilience and robustness by restructuring component checks. The patching system now preserves all successfully applied modifications even when later patch components are unavailable, ensuring better continuity and preventing loss of earlier valid changes. This delivers a more reliable patching experience in various system configurations.

PATCHES 1 (--version string) and 2 (banner +tweakcc tag) don't use the
Box component — only the (now-active) PATCH 3 patches-applied list does.
Looking it up unconditionally upfront aborts the whole patch when Box
can't be located (e.g. CC 2.1.126, where the Box function destructures
{children,ref,tabIndex,autoFocus,onClick,...} and none of the four
findBoxComponent strategies match).

Move the lookup inside the showPatchesApplied branch and skip just
PATCH 3 with a clear log line if Box isn't found, instead of failing
the entire indicator. This restores the version output tweak and
header banner indicator on CC versions where Box detection lags.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7c581c0a-9f1d-4efa-aaac-81bd5789cc84

📥 Commits

Reviewing files that changed from the base of the PR and between 3a6b5e6 and d45fbc3.

📒 Files selected for processing (1)
  • src/patches/patchesAppliedIndication.ts

📝 Walkthrough

Walkthrough

The function writePatchesAppliedIndication was refactored to move Box component detection from an early pre-check to the PATCH 3 section. This allows earlier patches to complete successfully even when the Box component cannot be located, returning the current content state instead of failing immediately.

Changes

Cohort / File(s) Summary
Patches Applied Indication
src/patches/patchesAppliedIndication.ts
Moved Box component detection logic from top-level check into PATCH 3 conditional block; now logs a skip message and returns accumulated content when Box is unavailable, preserving earlier patch modifications.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

  • Multiple patches fail on Claude Code 2.1.92 #663: Directly addresses the same Box component detection failures for patches-applied indication that this PR resolves by making Box lookup conditional and skipping PATCH 3 gracefully when unavailable.

Possibly related PRs

  • Fix patch patterns for Claude Code 2.1.23 #437: Both PRs modify Box component detection and add fallback behavior when Box is missing; this PR moves detection into the PATCH 3 step while that PR adds augmented detection patterns and null-return fallbacks.
  • Fix patching for 2.1.9 #388: Both modify Box component detection logic; this PR changes where lookup occurs in patchesAppliedIndication while that PR modifies the findBoxComponent detection itself.

Poem

🐰 A box once blocked the patchy way,
Now patches dance and skip the fray,
When boxes hide, we gracefully stay,
With earlier marks preserved in play,
Sweet refactoring saves the day! 📦✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: deferring the findBoxComponent lookup from the top-level pre-check into the PATCH 3 section where it's actually needed, allowing PATCH 1 and PATCH 2 to succeed independently.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

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