Skip to content

Skip JJ-INSTRUCTIONS detection if directory#68

Open
darkfeline wants to merge 1 commit into
0WD0:mainfrom
darkfeline:fix
Open

Skip JJ-INSTRUCTIONS detection if directory#68
darkfeline wants to merge 1 commit into
0WD0:mainfrom
darkfeline:fix

Conversation

@darkfeline

@darkfeline darkfeline commented Jun 18, 2026

Copy link
Copy Markdown

The JJ-INSTRUCTIONS file is documented to be a file, so ignore directories with matching names.

The context for this is that we use a FUSE workspace manager for development. I can't share all the details, but basically the FUSE mount automagically generates workspace directories like:

.../mount/workspace1
.../mount/workspace2
.../mount/JJ-INSTRUCTIONS

While this use case is a bit specific, I don't see any harm tightening the check here in majutsu.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed diffedit root directory detection to properly validate that JJ-INSTRUCTIONS is a regular file, preventing incorrect root detection when a directory with the same name exists.

The JJ-INSTRUCTIONS file is documented to be a file, so ignore
directories with matching names.

The context for this is that we use a FUSE workspace manager for
development.  I can't share all the details, but basically the FUSE
mount automagically generates workspace directories like:

.../mount/workspace1
.../mount/workspace2
.../mount/JJ-INSTRUCTIONS

While this use case is a bit specific, I don't see any harm tightening
the check here in majutsu.
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

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: 4bc8b1b8-3b6c-4ce3-be3e-41771362212d

📥 Commits

Reviewing files that changed from the base of the PR and between 97169be and 2e4c45b.

📒 Files selected for processing (2)
  • majutsu-edit.el
  • test/majutsu-edit-test.el

Walkthrough

majutsu-edit--diffedit-root is updated to use a predicate lambda with file-regular-p when calling locate-dominating-file, ensuring JJ-INSTRUCTIONS must be a regular file to qualify as a root marker. A new ERT test covers the case where JJ-INSTRUCTIONS is a directory.

Changes

Diffedit root regular-file predicate

Layer / File(s) Summary
Root detection predicate and regression test
majutsu-edit.el, test/majutsu-edit-test.el
majutsu-edit--diffedit-root switches from a bare sentinel name to a lambda that checks file-regular-p on JJ-INSTRUCTIONS; the accompanying ERT test constructs a JJ-INSTRUCTIONS directory and asserts the function returns nil for a nested path.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A sentinel once walked without a care,
"Is it a file?" asked the rabbit with flair.
file-regular-p sniffs the trail,
Directories? No — those shall fail!
🐇 Only true files mark the root with style.

🚥 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 directly and concisely summarizes the main change: skipping JJ-INSTRUCTIONS when it's a directory rather than a file.
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

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