Repository navigation
refactor(config): split settings.toml + dashboard.toml (#82) - #85
Conversation
📝 WalkthroughWalkthroughThe pull request refactors the configuration architecture from a monolithic Changes
Sequence Diagram(s)sequenceDiagram
participant Main as Main Entry
participant DashRes as Dashboard Resolver
participant Settings as Settings Loader
participant Dashboard as Dashboard Loader
participant Config as Config Composer
participant Runtime as Runtime
Main->>DashRes: Compute DashboardSource<br/>(from CWD)
alt Local Found
DashRes->>DashRes: Walk-up finds<br/>.splashboard/dashboard.toml
DashRes-->>DashRes: Load + Hash for trust
else Git Root Match
DashRes->>DashRes: CWD == git root
DashRes-->>DashRes: Return ProjectDefault
else Fallback
DashRes-->>DashRes: Return Home
end
Main->>Settings: Load SettingsConfig<br/>from $HOME/.splashboard/
Settings-->>Settings: Use default if missing
Settings-->>Main: SettingsConfig
Main->>Dashboard: Load DashboardConfig<br/>from resolved source
Dashboard-->>Dashboard: Use baked default if missing
Dashboard-->>Main: DashboardConfig
Main->>Config: Config::from_parts<br/>(settings, dashboard)
Config-->>Main: Config
Main->>Runtime: run(&config, &source, ...)
Runtime->>Runtime: Spawn daemon with source
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
…D context Closes #82. `$HOME/.splashboard/config.toml` is gone. Settings (`[general]` + `[theme]`) now live in `settings.toml`, dashboards (widgets + rows) in sibling `home.dashboard.toml` / `project.dashboard.toml`. Per-dir configs move to `./.splashboard/dashboard.toml` (or `./.splashboard.toml`). Breaking change as requested on the issue — no migration layer. Dashboard resolution (startup and --on-cd) picks the first match: 1. `./.splashboard/dashboard.toml` or `./.splashboard.toml` directly under CWD → local dashboard (trust-gated). 2. CWD == git repo root (`.git` sibling) → project dashboard. 3. CWD == $HOME → home dashboard (skips the git check so dotfile repos don't trigger the project path). 4. Fallback → home dashboard on startup, silent exit on --on-cd. Subdirectories of a repo fall through every step on --on-cd, which is what keeps `cd src/` from re-firing the project splash. Trust model simplifies: HOME-backed sources are implicitly trusted (caller passes `ident = None`), so `decide_with_global` and the global-path carve-out go away. Only per-dir `Local` dashboards need explicit `splashboard trust`. The fetch-only daemon now takes `--kind home|project|local [--path X]` so the child process loads the same source the parent resolved, rather than re-discovering via CWD. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
814391b to
7c75e69
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/trust.rs (1)
282-340: Duplicate test:decide_none_ident_is_implicitly_trustedandhome_backed_source_is_implicitly_trusted_via_none_identexercise the same codepath.Both construct
TrustStore::default()and assertstore.decide(None) == TrustDecision::ImplicitlyTrusted. The explanatory comment on the second test is the only differentiator. Consider folding the comment into the first test and dropping the second — otherwise the suite has two tests that will always pass/fail together for the same reason.♻️ Proposed fix
#[test] fn decide_none_ident_is_implicitly_trusted() { + // HOME-backed sources (settings.toml, home.dashboard.toml, project.dashboard.toml) are + // implicitly trusted by the caller passing `ident = None`. A local dashboard with the + // same on-disk bytes is NOT auto-trusted — the gate is caller-driven, not path-driven. let store = TrustStore::default(); assert_eq!(store.decide(None), TrustDecision::ImplicitlyTrusted); } @@ - #[test] - fn home_backed_source_is_implicitly_trusted_via_none_ident() { - // HOME-backed sources (settings.toml, home.dashboard.toml, project.dashboard.toml) are - // implicitly trusted by the caller passing `ident = None`. A local dashboard with the - // same on-disk bytes is NOT auto-trusted — the gate is caller-driven, not path-driven. - let store = TrustStore::default(); - assert_eq!(store.decide(None), TrustDecision::ImplicitlyTrusted); - }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/trust.rs` around lines 282 - 340, Remove the duplicate test by deleting either decide_none_ident_is_implicitly_trusted or home_backed_source_is_implicitly_trusted_via_none_ident; preferably keep decide_none_ident_is_implicitly_trusted, move the explanatory comment from home_backed_source_is_implicitly_trusted_via_none_ident into that test (near the TrustStore::default() / store.decide(None) assertion) so the intent is documented, and ensure only one test asserts store.decide(None) == TrustDecision::ImplicitlyTrusted.src/main.rs (1)
198-211: Include the path in the raw I/O error branch for parity withSettingsConfig::load_or_default.The parse-error arm annotates with
path.display(), but a plain read failure (e.g., permission denied on the dashboard file) returns a bareio::Errorwith no path.SettingsConfig::load_or_defaultincludes the path in both branches — worth matching here so users get the same "which file broke" signal for dashboards.♻️ Proposed tweak
match std::fs::read_to_string(&path) { Ok(s) => DashboardConfig::parse(&s) .map_err(|e| io::Error::other(format!("{}: {e}", path.display()))), Err(e) if e.kind() == io::ErrorKind::NotFound => Ok(baked()), - Err(e) => Err(e), + Err(e) => Err(io::Error::new( + e.kind(), + format!("{}: {e}", path.display()), + )), }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main.rs` around lines 198 - 211, In load_dashboard_file_or, the Err(e) read-failure branch currently returns the raw io::Error without the file path; change that branch to wrap/replace the error with one that includes path.display() (similar to the parse-error arm). For example, convert Err(e) => Err(io::Error::new(e.kind(), format!("{}: {e}", path.display()))) so permission/other I/O errors show which dashboard file failed; update the Err(e) arm in load_dashboard_file_or accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/main.rs`:
- Around line 198-211: In load_dashboard_file_or, the Err(e) read-failure branch
currently returns the raw io::Error without the file path; change that branch to
wrap/replace the error with one that includes path.display() (similar to the
parse-error arm). For example, convert Err(e) => Err(io::Error::new(e.kind(),
format!("{}: {e}", path.display()))) so permission/other I/O errors show which
dashboard file failed; update the Err(e) arm in load_dashboard_file_or
accordingly.
In `@src/trust.rs`:
- Around line 282-340: Remove the duplicate test by deleting either
decide_none_ident_is_implicitly_trusted or
home_backed_source_is_implicitly_trusted_via_none_ident; preferably keep
decide_none_ident_is_implicitly_trusted, move the explanatory comment from
home_backed_source_is_implicitly_trusted_via_none_ident into that test (near the
TrustStore::default() / store.decide(None) assertion) so the intent is
documented, and ensure only one test asserts store.decide(None) ==
TrustDecision::ImplicitlyTrusted.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 26d41056-db83-4846-b1ca-1ac6805c9d1d
📒 Files selected for processing (11)
.splashboard/dashboard.tomlsrc/config.rssrc/daemon.rssrc/default_config.tomlsrc/default_home_dashboard.tomlsrc/default_project_dashboard.tomlsrc/default_settings.tomlsrc/main.rssrc/paths.rssrc/runtime.rssrc/trust.rs
💤 Files with no reviewable changes (1)
- src/default_config.toml
Rewrites `.splashboard/dashboard.toml` to lean on the #79 / new fetchers instead of static-divider hacks: - Header band (full-width `bg = "subtle"`): • hero via `project_name` → text_ascii figlet banner, coral via `color = "panel_title"`, animated_postfx coalesce. • subtitle via `project` TextBlock → text_plain centered; slug / description / license each on their own line. • `github_repo_stars` inline stats row. - Body, three 2-column rows with `border = "top"` + `title` per child so the divider rule spans exactly the widget's own width: • languages (horizontal chart_bar) | releases (list_timeline). • PRs (list_plain) | issues (list_plain). • commits heatmap (git_commits_activity) | top contributors (chart_bar capped at 5). A 2-cell `gap` static widget between 34-wide siblings stops the sibling rules from touching in the middle. No `[general]` section — padding / viewport / theme preferences now live in `$HOME/.splashboard/settings.toml` per the #85 split. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Closes #82.
Summary
$HOME/.splashboard/config.toml.[general]+[theme]now live insettings.toml; widgets + rows in siblinghome.dashboard.toml/project.dashboard.toml. Per-dir configs move to./.splashboard/dashboard.toml(or./.splashboard.toml).direct-local → CWD == git repo root → $HOME fallback, withCWD == $HOMEshort-circuiting the git check so dotfile repos don't trigger project mode.ident = None), so thedecide_with_globalcarve-out and symlink-canonicalize guard go away. OnlyLocaldashboards in a user-owned CWD needsplashboard trust.--kind home|project|local [--path X]so the child loads the same resolved source instead of rediscovering via CWD.On-cd semantics
--on-cduses the same resolver but drops the home-fallback so subdirectories exit silently. The result:.splashboard.toml/.splashboard/dashboard.tomlBreaking change
Per-issue guidance (
マイグレーションとかは不要。破壊的にやっておk): no compatibility layer, oldconfig.tomlis simply no longer read. Users need to split their existing config by hand — trivial cut/paste ([general]/[theme]→~/.splashboard/settings.toml;[[widget]]/[[row]]→~/.splashboard/home.dashboard.toml) — and rename per-dir.splashboard/config.toml→.splashboard/dashboard.toml.Scope kept to the issue
splashboard install --templaterewrite,splashboard theme <name>.config.tomlmigration + deprecation warning (breaking, per user).Test plan
cargo test— 354 lib tests + 12 bin tests passcargo clippy --all-targets -- -D warningscleancargo fmt --all -- --checkcleansplashboard fetch-only --kind homeruns to completion with baked defaultsplashboard fetch-only --kind localwithout--pathreturns a clear errorsplashboardat repo root (project source), in subdir (home source), in $HOME (home source);splashboard --on-cdsilent in subdir, fires at repo root🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Refactor