Skip to content

refactor(config): split settings.toml + dashboard.toml (#82) - #85

Merged
unhappychoice merged 1 commit into
mainfrom
feat/split-settings-dashboard
Apr 22, 2026
Merged

unhappychoice merged 1 commit into
mainfrom
feat/split-settings-dashboard

Conversation

@unhappychoice

@unhappychoice unhappychoice commented Apr 22, 2026 •

Copy link
Copy Markdown
Owner

Closes #82.

Summary

  • Retires $HOME/.splashboard/config.toml. [general] + [theme] now live in settings.toml; widgets + rows in sibling home.dashboard.toml / project.dashboard.toml. Per-dir configs move to ./.splashboard/dashboard.toml (or ./.splashboard.toml).
  • Adds CWD-aware dashboard resolution: direct-local → CWD == git repo root → $HOME fallback, with CWD == $HOME short-circuiting the git check so dotfile repos don't trigger project mode.
  • Simplifies the trust model: HOME-backed sources are implicitly trusted (callers pass ident = None), so the decide_with_global carve-out and symlink-canonicalize guard go away. Only Local dashboards in a user-owned CWD need splashboard trust.
  • Updates the fetch-only daemon to take --kind home|project|local [--path X] so the child loads the same resolved source instead of rediscovering via CWD.

On-cd semantics

--on-cd uses the same resolver but drops the home-fallback so subdirectories exit silently. The result:

CWD startup --on-cd
has .splashboard.toml / .splashboard/dashboard.toml local local
== git repo root, no per-dir project project
== $HOME home silent
subdir of a repo / random dir home silent

Breaking change

Per-issue guidance (マイグレーションとかは不要。破壊的にやっておk): no compatibility layer, old config.toml is 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

Test plan

  • cargo test — 354 lib tests + 12 bin tests pass
  • cargo clippy --all-targets -- -D warnings clean
  • cargo fmt --all -- --check clean
  • splashboard fetch-only --kind home runs to completion with baked default
  • splashboard fetch-only --kind local without --path returns a clear error
  • manual: splashboard at repo root (project source), in subdir (home source), in $HOME (home source); splashboard --on-cd silent in subdir, fires at repo root

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Configuration now organized into separate user settings and dashboard files for clarity.
    • Local per-directory dashboards now supported with built-in trust verification.
    • Dedicated home and project dashboard configurations with smart fallback resolution.
  • Refactor

    • Dashboard loading and resolution reworked for improved flexibility and reliability.

@coderabbitai

coderabbitai Bot commented Apr 22, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The pull request refactors the configuration architecture from a monolithic config.toml into separate concerns: user preferences (settings.toml) and dashboard definitions (dashboard.toml/home.dashboard.toml/project.dashboard.toml). New dashboard resolution logic determines which dashboard to display based on local directory presence, git repository root detection, or home fallback. The system is composed via Config::from_parts(settings, dashboard) at runtime.

Changes

Cohort / File(s) Summary
Core Config Refactoring
src/config.rs
Split monolithic Config into SettingsConfig and DashboardConfig. Replaced Config::parse with Config::from_parts(settings, dashboard). Introduced DashboardSource enum and new resolution logic: walk-up local (direct only) → git repo root match → HOME fallback. Added baked defaults for settings and two dashboard variants.
Path Helpers & Config Files
src/paths.rs, src/default_*.toml files
Replaced config_path() with settings_path(), home_dashboard_path(), project_dashboard_path(). Created new default baked files: default_settings.toml, default_home_dashboard.toml, default_project_dashboard.toml. Cleared default_config.toml to comments-only.
CLI & Main Entry
src/main.rs, .splashboard/dashboard.toml
Refactored splash rendering to compute DashboardSource, pass into load_full_config(), call runtime::run() with source parameter. Changed FetchOnly subcommand from config path to DashboardKind + optional path. Updated trust messaging from "config" to "dashboard". Updated dashboard.toml documentation to separate user preferences from widget definitions.
Daemon & Subprocess
src/daemon.rs
Changed interface from config path to DashboardKind + optional path. Updated run_fetch_only to load settings and dashboard separately via new helpers, composing runtime Config via from_parts(). Modified subprocess spawning to pass --kind and conditional --path instead of --config.
Trust Layer
src/trust.rs
Renamed load_config_and_hash to load_dashboard_and_hash, switching parsed type from Config to DashboardConfig. Removed decide_with_global helper and path-based implicit-trust logic. Updated contract to treat ident = None (HOME-backed sources) as implicitly trusted, making trust decisions caller-driven.
Runtime Integration
src/runtime.rs
Updated run() signature to accept DashboardSource reference. Passed source directly into daemon spawning in both one-shot and looping paths, replacing previous path-derived argument.

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • PR #30: Modifies trust subsystem (trust.rs) and runtime/daemon spawning logic to gate project-local dashboards via file-hash-based trust decisions, directly complementing this config split and source-driven architecture.
  • PR #28: Rewires runtime entry points and daemon subprocess interfaces for fetching/caching, directly affected by the refactored daemon signature and config composition pattern.

Poem

🐰 A rabbit hops through tangled configs deep,
Now settings sleep where preferences keep,
And dashboards dance by source design—
Home, project, local paths align!
Thump-thump goes our refactor's beat,
The architecture's now complete! ✨

🚥 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 pull request title clearly summarizes the main change: splitting the monolithic config.toml into separate settings.toml and dashboard.toml files, which is the primary objective of this refactoring.
Linked Issues check ✅ Passed The pull request successfully implements all major coding objectives from issue #82: splits SettingsConfig and DashboardConfig, implements dashboard resolution logic (local → git-root → home fallback), adds path helpers, removes old config.toml support, and creates separate baked defaults.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the stated objectives. The PR respects the defined out-of-scope boundaries: no per-dir settings override, no hot reload, no non-git project detection, and no multiple named dashboards.
Docstring Coverage ✅ Passed Docstring coverage is 94.25% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feat/split-settings-dashboard

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 and usage tips.

…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]>
@unhappychoice
unhappychoice force-pushed the feat/split-settings-dashboard branch from 814391b to 7c75e69 Compare April 22, 2026 20:48

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

🧹 Nitpick comments (2)
src/trust.rs (1)

282-340: Duplicate test: decide_none_ident_is_implicitly_trusted and home_backed_source_is_implicitly_trusted_via_none_ident exercise the same codepath.

Both construct TrustStore::default() and assert store.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 with SettingsConfig::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 bare io::Error with no path. SettingsConfig::load_or_default includes 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

📥 Commits

Reviewing files that changed from the base of the PR and between e4f632c and 7c75e69.

📒 Files selected for processing (11)
  • .splashboard/dashboard.toml
  • src/config.rs
  • src/daemon.rs
  • src/default_config.toml
  • src/default_home_dashboard.toml
  • src/default_project_dashboard.toml
  • src/default_settings.toml
  • src/main.rs
  • src/paths.rs
  • src/runtime.rs
  • src/trust.rs
💤 Files with no reviewable changes (1)
  • src/default_config.toml

@unhappychoice
unhappychoice merged commit afb68ba into main Apr 22, 2026
5 checks passed
@unhappychoice
unhappychoice deleted the feat/split-settings-dashboard branch April 22, 2026 21:04
unhappychoice added a commit that referenced this pull request Apr 23, 2026
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]>
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.

refactor(config): split settings.toml + dashboard.toml, rename from config.toml

1 participant