Skip to content

refactor(config): share path manager join helper - #1547

Merged
skevetter merged 1 commit into
mainfrom
refactor/config-pathmanager-join-helper
Oct 18, 2026
Merged

skevetter merged 1 commit into
mainfrom
refactor/config-pathmanager-join-helper

Conversation

@skevetter

@skevetter skevetter commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Refactor pkg/config/pathmanager.go so every basePathManager sub-path method shares one join helper.

  • Add joinUnder(parent, elems...), which calls parent(), returns its error unchanged, and otherwise joins elems with filepath.Join.
  • Add inContext, which routes the ~17 context-relative methods through joinUnder(ContextDir).
  • Cache, runtime, and state methods call joinUnder with their parent directory directly.
  • Add TestJoinUnderPropagatesParentErrorAndJoinsElems.

Why

Each method repeated the same parent-resolve, error-check, join sequence. One helper removes about 170 lines and keeps the error path in one place.

Behaviour is unchanged: identical paths, identical errors, no public API changes, and all doc comments and the PathManager interface are untouched.

Validation

  • mise run cli:format
  • mise run cli:lint:ci (0 issues)
  • golangci-lint run --new-from-rev=origin/main ./pkg/config/... (0 issues)
  • go test ./pkg/config/... (ok)
  • GOOS=windows go vet ./pkg/config/
  • GOOS=darwin go vet ./pkg/config/

CodeRabbit CLI

coderabbit review --agent --committed --base-commit origin/main merge-base: completed, 0 findings on pkg/config/pathmanager.go and pkg/config/pathmanager_test.go.

Auto-merge

Eligible: yes. The change is behaviour-preserving, touches one source file plus its test, removes no tests, and disables no lint rules.

Summary by CodeRabbit

  • Refactor
    • Improved consistency in how application paths are resolved, while preserving existing paths and error handling. This helps keep cache, runtime, state, and context-relative paths predictable.

@skevetter skevetter added the auto-refactor Automated refactor PR label Oct 18, 2026
@netlify

netlify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit f618510
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ad4d4db06849e348f4b6613

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3d56d17b-8e98-4221-a362-e8e93e0f97f7
📥 Commits

Reviewing files that changed from the base of the PR and between a54cb16 and f618510.

📒 Files selected for processing: 2
  • pkg/config/pathmanager.go
  • pkg/config/pathmanager_test.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📝 Walkthrough

Path manager methods now use shared helpers to join paths beneath parent directories. The refactor preserves existing path layouts and parent-error propagation. Tests cover successful joins and errors returned by the parent callback.

Changes: Path manager

Layer / File(s) Summary
Shared path joining
pkg/config/pathmanager.go, pkg/config/pathmanager_test.go
Added joinUnder and centralized context-relative joining in inContext. Refactored path methods to use these helpers. Tests check joined paths and unchanged propagation of parent errors.

Priority: ⬇️ Low

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

Change: Refactor

Merge Risk: ⚪ Minimal · up to f6185

The refactor preserves path-manager behavior and is ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: refactoring the config path manager to share a join helper.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@netlify

netlify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit f618510
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ad4d4dbb68f0e44a5edf202

@skevetter
skevetter marked this pull request as ready for review October 18, 2026 15:01
@mergify

mergify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@skevetter
skevetter merged commit 5f2e1e2 into main Oct 18, 2026
111 checks passed
@skevetter
skevetter deleted the refactor/config-pathmanager-join-helper branch October 18, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-refactor Automated refactor PR size/l

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant