fix(platform-integrations): make bob custom-mode merge robust#263
Conversation
The Bob custom_modes.yaml merge had two faults that combined to silently drop the evolve-lite mode while still reporting success: - Sentinel detection used a substring check (`if start in existing`). The install-evolve-lite marketplace mode documents the literal `# >>>evolve:evolve-lite<<<` in its customInstructions, so the merge thought a block already existed, took the replace branch, found no matching end sentinel, and no-op'd. Detection is now a line-anchored start..end regex. - The inserted block hardcoded 2-space list indentation. A target written with 0-indent sequence items (yaml.safe_dump / marketplace tooling) ended up with mixed indentation = invalid YAML. The block now matches the indentation already used under customModes:. remove_yaml_custom_mode is likewise line-anchored. Adds a regression test reproducing the exact failure (0-indent target + sentinel literal in another mode). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe platform installer now detects existing list-item indentation in custom modes and uses line-anchored regex matching for sentinel blocks to prevent false positives when sentinel text appears inside quoted content. A regression test validates these improvements. ChangesSentinel block robustness improvements
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Follow-up to #258. Running the released installer (
install --platform bob --mode lite --dir "$HOME") reported✓ Merged custom mode 'evolve-lite'but did not actually add the mode to~/.bob/settings/custom_modes.yaml.Root cause — two combined faults in
merge_yaml_custom_modeSentinel substring false-match. Detection used
if start in existing. Theinstall-evolve-litemarketplace mode documents the literal# >>>evolve:evolve-lite<<<inside itscustomInstructions. That substring made the merge think a block already existed → it took the replace branch → found no matching end sentinel → no-op'd, while still printing ✓. Detection is now a line-anchoredstart..endregex, so a sentinel literal quoted inside another mode is ignored.Indentation mismatch. The inserted block hardcoded 2-space list indentation. A target written with 0-indent sequence items (
yaml.safe_dump/ marketplace tooling) became a 0-indent/2-indent mix = invalid YAML. The block now matches the indentation already used undercustomModes:.remove_yaml_custom_modeis likewise line-anchored.Test
Adds
test_install_merges_mode_despite_sentinel_literal_in_another_mode, reproducing the exact failure (0-indent target whose text contains the sentinel literal) and asserting the mode merges, indentation stays consistent, and the pre-existing mode is preserved. Full suite: 213 passed.🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes