Skip to content

fix(paths): resolve project directories from the working directory 🤖🤖🤖 - #283

Open
Sampoornnagpal wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
Sampoornnagpal:fix/project-root-from-cwd
Open

fix(paths): resolve project directories from the working directory 🤖🤖🤖#283
Sampoornnagpal wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
Sampoornnagpal:fix/project-root-from-cwd

Conversation

@Sampoornnagpal

@Sampoornnagpal Sampoornnagpal commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

In an editable install, get_project_dir() resolves .nooa under the framework checkout even when called from another project. Project configuration, sessions, and generated libraries can therefore use the wrong project's directory.

Search upward from the working directory, including that directory, for the nearest pyproject.toml. This matches the existing implementation and rationale in nooa_cli._common.find_project_root(). Preserve the working-directory fallback and NEMO_OO_PROJECT_DIR override; no import dependency on the optional CLI is added.

Validation

Four regression cases fail before the fix. Afterward all 6 path tests pass. The related config-chain suite has 15 passing tests and one existing Windows failure because this host cannot create the symlink required by test_symlink_dedup.

Command: uv run pytest -q tests/test_paths.py tests/test_llm_config_chain.py — 21 passed, 1 platform-dependent failure as above.

Windows/Python 3.12 with external import-only helpers for #84/#85 (fcntl/SIGUSR2). Helpers are not included and do not validate POSIX locks/signals.

Related issues

No matching open issue found.

Checklist

  • Ruff lint and formatting pass.
  • Path regressions pass; related Windows test limitation disclosed.
  • Root-discovery docstring updated.
  • Existing SPDX headers retained.

Summary by CodeRabbit

  • Bug Fixes

    • Project root detection now starts from the current working directory and correctly selects the nearest project marker.
    • When no project marker is found, the current directory is used as the fallback.
    • Project-directory overrides and user-directory behavior now work as expected, including from nested working directories.
  • Tests

    • Expanded coverage for nested directories, project root discovery, fallback behavior, nearest-marker selection, directory overrides, and user-directory handling.

Signed-off-by: Sampoorn Nagpal <nagpalsampoorn@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: df89f2d0-de27-4e9b-a49e-8e3b28f20d4a

📥 Commits

Reviewing files that changed from the base of the PR and between 04a649d and aacc89a.

📒 Files selected for processing (1)
  • tests/test_paths.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/test_paths.py

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


📝 Walkthrough

Walkthrough

find_project_root now searches from the current working directory, includes that directory, selects the nearest pyproject.toml, and falls back to the current directory. Tests cover nested directories, overrides, fallback behavior, and XDG user-directory handling.

Changes

Project root discovery

Layer / File(s) Summary
Working-directory root lookup and validation
src/nooa/paths.py, tests/test_paths.py
find_project_root searches from the current working directory through its ancestors and falls back to that directory when no pyproject.toml exists. Tests cover nested directories, nearest markers, overrides, and user-directory behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to aacc8

Project-directory discovery now selects the nearest pyproject.toml from the working directory upward while retaining the override and fallback behavior. No merge-blocking risk remains.

🚥 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 describes the main change: resolving project directories from the current working directory. The emojis add noise but do not make the title misleading or unclear.
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 7 functions across 2 files.
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)
  • Create PR with unit tests

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

Signed-off-by: Sampoorn Nagpal <nagpalsampoorn@gmail.com>
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