Conversation
📝 WalkthroughWalkthroughThis PR refactors path resolution and configuration loading to support centralized directory management across the application. It introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI Parser
participant Main as main()
participant PathResolver as Path Resolver
participant ConfigLoader as Config Loader
participant AppFactory as Application Factory
CLI->>Main: Parsed CliOptions
Main->>PathResolver: resolve_config_dir(overrides)
PathResolver-->>Main: config_dir
Main->>ConfigLoader: load_config_for_cli(cli_opts, bootstrap_dirs)
ConfigLoader-->>Main: Config (with [paths] overrides)
Main->>PathResolver: extract overrides_from_config()
PathResolver-->>Main: PathOverrides
Main->>PathResolver: resolve_app_dirs(context, merged_overrides)
PathResolver-->>Main: AppDirs (resource, config, data, cache, runtime)
Main->>AppFactory: Application::create(config, app_dirs, ...)
AppFactory->>PathResolver: util::resource_path(app_dirs, "shaders")
PathResolver-->>AppFactory: resolved shader path
AppFactory-->>Main: Application instance
Estimated code review effort🎯 4 (Complex) | ⏱️ ~65 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (28)
🧰 Additional context used📓 Path-based instructions (3)openspec/changes/**/specs/**/*.md📄 CodeRabbit inference engine (openspec/AGENTS.md)
Files:
openspec/**/*.md📄 CodeRabbit inference engine (openspec/AGENTS.md)
Files:
openspec/changes/**/proposal.md📄 CodeRabbit inference engine (openspec/AGENTS.md)
Files:
🧠 Learnings (42)📚 Learning: 2025-12-29T15:44:30.520ZApplied to files:
📚 Learning: 2025-12-29T15:44:30.520ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2025-12-19T08:54:18.412ZApplied to files:
📚 Learning: 2025-12-19T08:54:18.412ZApplied to files:
📚 Learning: 2025-12-19T08:54:18.412ZApplied to files:
📚 Learning: 2025-12-19T08:54:18.412ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2025-12-19T08:54:18.412ZApplied to files:
📚 Learning: 2025-12-29T15:44:30.520ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2025-12-29T15:44:30.520ZApplied to files:
📚 Learning: 2025-12-29T15:44:30.520ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2025-12-29T15:44:30.520ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2025-12-29T15:44:30.520ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2025-12-19T08:54:18.412ZApplied to files:
📚 Learning: 2025-12-19T08:54:18.412ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2025-12-29T15:44:30.520ZApplied to files:
📚 Learning: 2025-12-29T15:44:30.520ZApplied to files:
📚 Learning: 2025-12-29T15:44:30.520ZApplied to files:
📚 Learning: 2025-12-29T15:44:30.520ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
📚 Learning: 2026-01-07T07:20:57.073ZApplied to files:
🧬 Code graph analysis (12)src/render/backend/vulkan_backend.hpp (1)
src/app/ui_controller.hpp (1)
tests/render/test_zfast_integration.cpp (2)
src/ui/imgui_layer.hpp (2)
src/render/shader/shader_runtime.cpp (2)
src/app/application.cpp (4)
src/ui/imgui_layer.cpp (3)
src/util/paths.cpp (4)
tests/util/test_paths.cpp (1)
src/app/ui_controller.cpp (3)
src/app/main.cpp (3)
src/util/config.cpp (4)
🪛 Cppcheck (2.19.0)src/render/shader/shader_runtime.cpp[error] 249-249: syntax error (syntaxError) 🪛 LanguageToolopenspec/changes/refactor-path-resolution-and-config-loading/proposal.md[style] ~6-~6: To elevate your writing, try using a synonym here. (HARD_TO) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (69)
✏️ Tip: You can disable this entire section by setting 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 |
- Introduce `goggles::util` path resolver for five core directory roots - Support optional [paths] section in config for root overrides - Add early config resolution and validation with fallback-on-error strategy - Tests cover XDG defaults, TOML overrides, and packaged asset independence
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||||||
User description
Why
Goggles currently resolves filesystem paths (resource/config/data/cache/runtime) in multiple places,
mixing environment variables, XDG defaults, and working-directory-relative fallbacks. This can lead to
inconsistent behavior across Linux systems and packaged runs (AppImage), and makes it hard to
centralize filesystem access.
Config loading also needs a clearly defined, early validation and fallback strategy so that:
docs/project_policies.md)What Changes
goggles::utilpath resolution API that resolves only these directory roots:resource_dir,config_dir,data_dir,cache_dir,runtime_dir.[paths]in the TOML config.the existing
packagingspec requirement “Packaged Assets Are Not CWD-Dependent”.Non-Goals
config load behavior.
Impact
packaging(clarify resource root expectations and CWD independence)config-loading(define requirements for config discovery/validation/fallback andpath overrides)
src/app/main.cpp(bootstrap + config load flow)src/util/config.*(parse[paths]and expose overrides)src/util/for path resolutionsrc/that currently resolve paths ad-hoc (follow-up refactor task)Compatibility Notes
[paths]is optional.warnlogging, including when--configisexplicitly provided (the explicit config is ignored and defaults are used).
PR Type
Enhancement
Description
Centralize filesystem path resolution via new
goggles::util::pathsAPISupport optional
[paths]config overrides for five directory rootsImplement two-phase bootstrap: resolve config early, load with fallback
Remove CWD dependency for packaged assets (AppImage compliance)
Refactor all path resolution call sites to use unified API
Diagram Walkthrough
File Walkthrough
16 files
New path resolution API with XDG complianceImplement centralized path resolver and directory root logicAdd Paths struct for config-driven directory overridesParse [paths] section and refactor config parsing into helpersImplement two-phase bootstrap with early config validationAccept AppDirs parameter and use unified path APIUpdate Application::create signature to accept AppDirsUse AppDirs for font and preset catalog path resolutionUpdate UiController::create to accept AppDirs parameterRemove early config file existence check from CLI parserAdd cache_dir parameter to VulkanBackend::createAccept and use cache_dir for shader compilationUpdate ShaderRuntime::create to accept cache directoryRemove XDG path resolution; use injected cache directoryUpdate ImGuiLayer::create to accept AppDirs parameterUse AppDirs for font and imgui.ini path resolution6 files
Add commented [paths] section with override documentationDocument change rationale and scopeDefine path resolution API and bootstrap flow designAdd config-loading capability specificationUpdate packaging spec for CWD-independent resource rootTrack implementation tasks and completion status4 files
Add comprehensive path resolution unit testsUpdate tests to pass cache directory to ShaderRuntimeUpdate tests to pass cache directory to ShaderRuntimeUpdate tests to pass cache directory to ShaderRuntime2 files
Add paths.cpp to util library buildAdd test_paths.cpp to test suiteSummary by CodeRabbit
Release Notes
New Features
Improvements
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.