forge: add optional Forge integration#75
Conversation
|
Warning Review limit reached
More reviews will be available in 15 minutes and 18 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 credits. 🚦 How do rate 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 see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughAdds ChangesMajutsu–Forge Integration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 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 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 |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 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 `@majutsu-forge.el`:
- Around line 403-417: The enable path in majutsu-forge-mode only resets the
mode flag on failure, leaving partial setup from
majutsu-forge--add-section-hooks, majutsu-log-mode-hook additions,
majutsu-forge--add-mode-bindings, and majutsu-forge--add-advices behind. Update
the error branch in the condition-case around the enable sequence to undo any
installed hooks, bindings, and advices before re-signaling the error, so a
failed enable leaves majutsu-forge in a clean disabled state.
- Around line 169-183: The majutsu-forge--with-section-errors macro currently
suppresses errors but leaves any partially inserted section text behind when a
Forge renderer fails. Update the error-handling flow around
majutsu-forge--ensure-buffer and the body evaluation to capture the insertion
start before rendering, then on error remove the inserted range before calling
majutsu-forge--record-section-error and returning nil. Use
majutsu-forge--with-section-errors and majutsu-forge--record-section-error as
the key places to adjust so failed section inserts are fully rolled back.
- Around line 346-349: Guard majutsu-forge--same-root-p against stale or
inaccessible paths by wrapping the file-truename/file-equal-p comparison in
error handling so refresh advice cannot abort on a bad buffer, deleted
directory, or remote path. Keep the existing root/other nil checks, but ensure
any signaling from file-truename or file-equal-p falls back to a safe non-match
result so the refresh flow continues for the remaining buffers.
In `@test/majutsu-forge-test.el`:
- Around line 148-155: The test
`majutsu-forge-with-section-errors/suppresses-by-default` is asserting exact
equality on `majutsu-forge-section-errors` without isolating that variable, so
state from earlier tests can leak in and make the result order-dependent. Update
this test to bind or reset `majutsu-forge-section-errors` within the same `let`
that already controls `majutsu-forge-show-section-errors`, so the check around
`majutsu-forge--with-section-errors` always starts from a clean state.
- Around line 157-173: The cleanup in
majutsu-forge-section-errors/clears-stale-errors-on-render only restores
majutsu-log-sections-hook, but majutsu-forge--add-section-hooks also mutates
majutsu-forge--sections-installed. Update the unwind-protect cleanup to save and
restore that state as well so the test leaves the section-hook install state
unchanged for later tests. Use the existing test body and
majutsu-forge--add-section-hooks as the anchor points for the fix.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 57ea5a49-d514-4429-b393-d364fdaeef5a
📒 Files selected for processing (3)
README.orgmajutsu-forge.eltest/majutsu-forge-test.el
Add `majutsu-forge-mode' as an opt-in bridge that reuses Forge's local database, topic renderers, and commands inside Majutsu log buffers. It inserts pull request, issue, and discussion sections into `majutsu-log-sections-hook', initializes Forge buffer state, and refreshes Majutsu buffers when the mode changes or Forge refreshes a repository. Bind `N' and `'` in Majutsu buffers to `forge-dispatch' through a Majutsu wrapper, and remap Forge topic section keymaps so `majutsu-visit-thing' opens topic lists, topics, and repositories. Save and restore all modified bindings when the mode is disabled. Keep the integration defensive: hide Forge's Git-log based pull-request commit body in Majutsu buffers, tolerate repositories that Forge cannot identify or has not tracked, roll back partial Forge section output on renderer failures, and clean up hooks, bindings, and advices if enabling the mode fails. Document setup and limitations for colocated jj/Git repositories. Add tests for hook installation, mode enable/disable refreshes, failed-enable cleanup, key binding restoration, section remaps, pull-request commit suppression, and section error clearing.
Add
majutsu-forge-mode' as an opt-in bridge that reuses Forge's local database, topic renderers, and commands inside Majutsu log buffers. It inserts pull request, issue, and discussion sections intomajutsu-log-sections-hook', initializes Forge buffer state, and refreshesMajutsu buffers when the mode changes or Forge refreshes a repository.
Bind
N' and'in Majutsu buffers toforge-dispatch' through a Majutsuwrapper, and remap Forge topic section keymaps so `majutsu-visit-thing'
opens topic lists, topics, and repositories. Save and restore all modified
bindings when the mode is disabled.
Keep the integration defensive: hide Forge's Git-log based pull-request
commit body in Majutsu buffers, tolerate repositories that Forge cannot
identify or has not tracked, and record suppressed section errors in
`majutsu-forge-section-errors' for optional inspection.
Document setup and limitations for colocated jj/Git repositories. Add tests
for hook installation, mode enable/disable refreshes, key binding restoration,
section remaps, pull-request commit suppression, and section error clearing.
Summary by CodeRabbit
New Features
Bug Fixes