Skip to content

check File for absolute path on construction - #76

Merged
PhilipDeegan merged 3 commits into
masterfrom
next
Aug 8, 2026
Merged

check File for absolute path on construction#76
PhilipDeegan merged 3 commits into
masterfrom
next

Conversation

@PhilipDeegan

@PhilipDeegan PhilipDeegan commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Documentation

    • Added a comprehensive C++20 API reference covering library components, configuration options, and platform-specific headers.
  • Bug Fixes

    • Removed unnecessary source-control trace output from branch detection.
  • Tests

    • Expanded file path coverage, including absolute and relative paths, nested files, canonicalization, working-directory changes, and nonexistent paths.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@PhilipDeegan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 reviews.

How do review 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 refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0e43e530-f31f-42b6-923b-79dd0d0ffbfe

📥 Commits

Reviewing files that changed from the base of the PR and between 03e2061 and 3372a43.

📒 Files selected for processing (1)
  • inc/mkn/kul/os.hpp
📝 Walkthrough

Walkthrough

The change adds an mkn::kul API reference, removes SCM trace output, and adds operating-system tests for file path behavior.

Changes

API documentation

Layer / File(s) Summary
Add API reference
API.md
Documents 34 API areas, core macros, environment variables, and platform-specific headers.

SCM logging cleanup

Layer / File(s) Summary
Remove SCM trace output
inc/mkn/kul/scm.hpp
Removes the review URL comment and Git command trace log. Git execution, exception handling, and branch parsing remain unchanged.

Operating-system path tests

Layer / File(s) Summary
Expand file path validation
tst/test/os.cpp
Adds tests for relative and absolute paths, working-directory changes, canonicalization, nonexistent paths, and default directories.

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

Possibly related PRs

  • mkn/mkn.kul#75: Directly modifies Git::defaultRemoteBranch and relates to the removed SCM logging.
🚥 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 accurately describes the added File path tests, which are a real part of the changeset.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch next

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 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 `@API.md`:
- Line 14: Fix the Table of Contents entry for Type Trait Helpers by either
adding the missing matching heading in API.md or updating the link to the
existing decltype documentation section, ensuring the fragment resolves
correctly.

In `@inc/mkn/kul/os.hpp`:
- Around line 211-224: Update the catch block in the File path-resolution
constructor after Dir::REAL() fails so it applies the same separator-based and
Dir::REAL_OR_NULL fallback resolution as the non-existing-path branch. Ensure
relative names ultimately use env::CWD() when no resolvable parent is found, and
never leave _d empty.
🪄 Autofix

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c48e0718-ddcd-4733-9459-0c4828eb968b

📥 Commits

Reviewing files that changed from the base of the PR and between 9907b51 and 9cd6e4c.

📒 Files selected for processing (3)
  • API.md
  • inc/mkn/kul/os.hpp
  • inc/mkn/kul/scm.hpp

Comment thread API.md
1. [Core Definitions (`defs.hpp`)](#1-core-definitions-defshpp)
2. [Exception Handling (`except.hpp`)](doc/mkn/kul/except.md)
3. [Assertions (`assert.hpp`)](doc/mkn/kul/assert.md)
4. [Type Trait Helpers (`decltype.hpp`)](#4-type-trait-helpers-decltypehpp)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the broken Table of Contents fragment.

Line 14 links to #4-type-trait-helpers-decltypehpp, but API.md has no matching heading. Add the missing section or point this entry to the actual decltype documentation page.

🧰 Tools
🪛 markdownlint-cli2 (0.23.2)

[warning] 14-14: Link fragments should be valid

(MD051, link-fragments)

🤖 Prompt for 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.

In `@API.md` at line 14, Fix the Table of Contents entry for Type Trait Helpers by
either adding the missing matching heading in API.md or updating the link to the
existing decltype documentation section, ensuring the fragment resolves
correctly.

Source: Linters/SAST tools

Comment thread inc/mkn/kul/os.hpp
Comment on lines 211 to +224
if (is()) {
try {
this->_n = Dir::REAL(this->_n);
this->_d = Dir(Dir::PRNT(this->_n), m);
this->_n = this->_n.substr(_d.path().size() + 1);
} catch (mkn::kul::fs::Exception const& e) {
}
} else if (n.find(Dir::SEP()) != std::string::npos) {
this->_d = Dir(n.substr(0, n.rfind(Dir::SEP())));
this->_n = this->_n.substr(n.rfind(Dir::SEP()) + 1);
} else if (auto const& _N = Dir::REAL_OR_NULL(this->_n)) {
this->_d = Dir(Dir::PRNT(*_N), m);
} else {
if (n.find(Dir::SEP()) != std::string::npos) {
this->_d = Dir(n.substr(0, n.rfind(Dir::SEP())));
this->_n = this->_n.substr(n.rfind(Dir::SEP()) + 1);
} else {
if (auto const& _N = Dir::REAL_OR_NULL(this->_n)) this->_d = Dir(Dir::PRNT(*_N), m);
}
this->_d = Dir(env::CWD());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Apply path fallback after Dir::REAL() fails.

If the file is removed or becomes inaccessible between is() and Dir::REAL(), the catch block leaves _d empty. For a relative name, full() then uses Dir::JOIN("", _n), which adds a leading separator instead of using env::CWD().

After the catch, run the same separator and REAL_OR_NULL resolution used by the non-existing-path branch. Do not leave the File object with an empty directory.

🤖 Prompt for 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.

In `@inc/mkn/kul/os.hpp` around lines 211 - 224, Update the catch block in the
File path-resolution constructor after Dir::REAL() fails so it applies the same
separator-based and Dir::REAL_OR_NULL fallback resolution as the
non-existing-path branch. Ensure relative names ultimately use env::CWD() when
no resolvable parent is found, and never leave _d empty.

@PhilipDeegan
PhilipDeegan merged commit 6d90ea3 into master Aug 8, 2026
3 checks passed
@PhilipDeegan
PhilipDeegan deleted the next branch August 8, 2026 19:54
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