Skip to content

Fix build-dependent matching for two Claude Code 2.1.282 prompts - #1012

Merged
bl-ue merged 2 commits into
mainfrom
fix-282-prompt-snapshot-matching
Sep 25, 2026
Merged

bl-ue merged 2 commits into
mainfrom
fix-282-prompt-snapshot-matching

Conversation

@mike1858

@mike1858 mike1858 commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Why

Testing the 2.1.282 snapshot from #1010 with the native-module prompt support in #1011 exposed two remaining Could not find system prompt warnings:

  • Skill: /doctor slash command embeds a build object whose HOOKS_WORKER_URL is npm-relative in the snapshot but points into /$bunfs/root/ in the native executable.
  • System Reminder: Directory sync restored files mismatch hard-codes the minified formatter WOs, while the native build calls it Bo.

A permissive matcher alone would be insufficient: customized doctor prompts must retain the target executable's worker path, and customized recovery reminders must call its actual formatter.

This PR is stacked on #1010 (prompts/2.1.282) so its diff contains the snapshot correction rather than the entire new snapshot. Native end-to-end validation combines this change with #1011; that PR supplies the module-aware apply path.

What changed

  • Match the serialized HOOKS_WORKER_URL property without capturing its value into the positional identifier groups. Keep surrounding metadata literal, reject raw newlines/unterminated strings, and leave snapshots with ambiguous multiple worker properties on exact matching.
  • Preserve the matched executable's worker property when applying otherwise customized doctor Markdown. Substitute only inside live interpolations; preserve explanatory prose and explicitly customized worker URLs.
  • Split the directory-sync show formatter into its own FORMAT_RESTORED_PATH_FN identifier slot. The same-version identifier-drift check recognizes old Markdown after the corrected snapshot is loaded.
  • Add 11 regression cases using the actual 2.1.282 snapshot: npm/Unix-native/Windows-style paths, identifier capture alignment, ambiguous metadata, prose preservation, explicit overrides, multiple minified formatter names, and same-version drift. Evaluate customized templates as JavaScript, not just regex matches.

Validation

  • pnpm test — 594 passed, 5 skipped.
  • pnpm lint — passed.
  • pnpm build — passed.
  • Built an isolated integration checkout containing Apply system prompts across native JavaScript chunks and embedded text modules #1011 plus this PR's matcher and corrected snapshot. Ran node dist/index.mjs --apply --yes --patches "$PROMPT_IDS" against a disposable copy of the actual Claude Code 2.1.282 executable, with isolated configuration/cache and all 777 snapshot IDs selected: zero missing-prompt warnings, and the vanilla executable remained byte-identical.
  • Customized both affected Markdown files, then ran node dist/index.mjs --apply --yes --patches skill-doctor-slash-command,system-reminder-directory-sync-restored-files-mismatch: zero warnings, exactly two modules changed, the doctor retained HOOKS_WORKER_URL:"/$bunfs/root/src/plugins/functionHooks/hooks-worker/hooks-worker.js", and the reminder retained show:Bo.
  • Re-extraction verified every unrelated module remained byte-identical; the original installation was untouched. The patched executable returned 2.1.282 (Claude Code) from --version.

Compatibility

The worker-path correction also handles existing doctor Markdown because it preserves the baseline property during application rather than introducing a new placeholder. Installations that already cached the old 2.1.282 JSON must refresh that version's cached snapshot to receive the new directory-sync identifier slot; the existing identifier-drift sync mechanism then recognizes the old Markdown. This PR does not change cache freshness policy, private extraction tooling, other snapshots, or non-prompt feature patches.

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility with Claude Code 2.1.282 prompts by preserving build-specific hook worker paths when matching customized prompts.
    • Updated the directory-sync reminder to format restored file paths correctly.

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 12e2bda5-1e41-4aa4-90b6-30da362783e3

📥 Commits

Reviewing files that changed from the base of the PR and between 70a0e80 and 8d312b3.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 22fac4e9-4083-456b-ada0-a20de90b2816

📥 Commits

Reviewing files that changed from the base of the PR and between ed6ad02 and 70a0e80.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • data/prompts/prompts-2.1.282.json
  • src/systemPromptSync.ts
  • src/tests/promptSnapshot282.test.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The 2.1.282 directory-sync reminder now references the restored-files formatter. The prompt synchronization pipeline supports matching and preserving a single build-specific hook worker URL in customized prompt content. Tests cover URL matching, interpolation, formatter rebinding, and identifier drift.

Changes

Prompt compatibility

Layer / File(s) Summary
Directory-sync formatter identifier
data/prompts/prompts-2.1.282.json, src/tests/promptSnapshot282.test.ts, CHANGELOG.md
The reminder replaces the WOs placeholder with the show formatter and adds the FORMAT_RESTORED_PATH_FN identifier mapping. Tests check formatter rebinding and detect identifier drift. The changelog records the update.
Worker URL matching and interpolation
src/systemPromptSync.ts, src/tests/promptSnapshot282.test.ts
The matcher allows a single serialized HOOKS_WORKER_URL property to vary. Customized prompt content preserves the matched property in interpolation regions before identifier mapping. Tests cover URL forms, capture alignment, ambiguous properties, and customized content.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested reviewers: bl-ue

Merge Risk: ⚪ Minimal · up to 70a0e

The prompt compatibility changes are mergeable after normal checks; no concrete defect has been established.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 70a0e

The change is designed to preserve the target installation’s worker location while applying customizations. No new public access path or verified security defect was identified, but combined native-release behavior remains unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed binding can affect customized content applied to a matching target executable; the flagged tests do not themselves add an attacker-accessible caller.

Trust Boundaries and Controls

  • observed — The target content supplies the matched worker property; local Markdown supplies the replacement content. The new logic copies that property only under the single-property and snapshot-equality conditions, rather than treating any replacement value as an override.
🚥 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 clearly and concisely describes the main change: fixing build-dependent matching for the two Claude Code 2.1.282 prompts.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (2 skipped: 2 …
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

A rabbit checks the prompt at dawn,
And finds the formatter freshly drawn.
One worker URL stays in view,
While custom words keep theirs there too.
The changelog marks the update bright,
Then hops away into the night.

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

mike1858 added a commit that referenced this pull request Sep 25, 2026
Record the assigned pull request number in the Unreleased changelog.
@mike1858

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Pull request base or head changed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mike1858
mike1858 added this pull request to stack #1013 September 25, 2026 02:37
Base automatically changed from prompts/2.1.282 to main September 25, 2026 19:40
Match the doctor prompt across npm and native worker paths while
preserving the target build's path during customization. Keep
substitutions inside live interpolations and leave explicit user
overrides unchanged.

Capture the directory-sync path formatter as a mapped identifier instead
of hard-coding its minified name. Add snapshot-backed matching and
executable-template regression tests.
Record the assigned pull request number in the Unreleased changelog.
@bl-ue
bl-ue force-pushed the fix-282-prompt-snapshot-matching branch from 70a0e80 to 8d312b3 Compare September 25, 2026 19:40
@bl-ue
bl-ue merged commit d3fc4c2 into main Sep 25, 2026
2 checks passed
@bl-ue
bl-ue deleted the fix-282-prompt-snapshot-matching branch September 25, 2026 20:00
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.

2 participants