Skip to content

refactor: codebase cleanup — dead accessors, unused strings, stale docs - #1517

Merged
GT-610 merged 4 commits into
mainfrom
chore/code-health-followup
Sep 19, 2026
Merged

GT-610 merged 4 commits into
mainfrom
chore/code-health-followup

Conversation

@GT-610

@GT-610 GT-610 commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

A code-health pass over the first-party tree (Dart app, Rust workspace, monitor agent, docs). It removes the dead code and stale documentation the sweep could prove, and leaves everything where the evidence was not conclusive.

Nothing here changes behaviour, storage, schema, protocols, FFI contracts or platform configuration.

What changed

Commit Change
refactor: remove unused Dart accessors Swap.freePercent, ServersNotifier.isAutoRefreshOn, TerminalSession.isBackendClosed and Battery.isLiPoly are referenced nowhere in lib, test or integration_test. Battery.isLiPoly lost its last Dart reader when battery parsing moved to sbm_parser, so the Rust method's doc comment no longer points at it.
refactor(monitor): remove unused fs_roots::is_within No caller inside or outside the crate; FsRoots::check_within already answers the same question for the only place that needs it. The now-unused Path import goes with it.
chore(l10n): drop twelve unused strings benchmarkBlockSize, benchmarkCompare, benchmarkCompareEmpty, benchmarkDiedUnreported, benchmarkLinuxOnly, dockerImagesFmt, monitorNoAgent, scheduledTaskScheduleHint, serverDetailOrder, serviceEnabled, serviceSelectHint, trayTitle had no reference in any Dart source. Removed from all 16 locales and regenerated with flutter gen-l10n. This follows the precedent already recorded in RETIREMENT.md.
docs: correct drifted structure and retirement references RETIREMENT.md addressed every shim by file:line, and every one of those line numbers had drifted since it was written. It now names the file and symbol instead. structure.md (en and zh) listed a model/sftp/ directory that does not exist, and omitted model/ai/ and data/service/.

What the audit checked and left alone

  • Test-only production code: every remaining @visibleForTesting symbol is also called from production (parsers, command builders, payload builders, seam interfaces). No test-only hook was found to delete, so no test exposure needed to change.
  • Dead files / public types / top-level API: none. Every lib/** file is imported, every public type is referenced, and the only unreferenced declarations were the four accessors above.
  • Other dead public members: scan surfaced a set of candidates that turned out to be framework overrides (updateShouldNotify, didChangeLocales, onWindowClose, updateByte, saveToFile, saveSyncCheckpoint) or enum constants reached through .values — all kept.
  • Tests: no tautological assertions, assertion-free tests, permanently-skipped tests (the one skip: true is the project's opt-in e2e gate), duplicated helpers or unused helpers.
  • Logic / performance / security: dart analyze, cargo clippy --workspace --all-targets, the panel's eslint --max-warnings 0 and svelte-check are all clean. Reviewed the TLS opt-ins (badCertificateCallback is gated behind the per-server allowInsecure/ignoreCert), shell quoting/injection boundaries, the memory/swap zero-total paths (all call sites guard total > 0) and the AI command-fencing path. No change was warranted.

Validation

  • dart analyze lib test integration_test — no issues.
  • cargo check -p server_box_monitor --locked --offline and cargo test -p server_box_monitor --test fs_roots — 12 passed.
  • cargo test -p sbm_parser --locked --offline — passes (e2e cases remain opt-in and ignored).
  • flutter test --no-pub --timeout 30s on the suites covering the touched files (terminal_session, server detail metrics, server status update, server save/selection, server edit logic, l10n_fr, app_locale) — 63 passed.
  • flutter gen-l10n and node docs/scripts/check-locale-parity.mjs — OK, 32/32 pages.

Summary by CodeRabbit

  • Documentation

    • Updated retirement guidance to use stable file-and-symbol references instead of line numbers.
    • Expanded project structure documentation to cover service management, remote file, and AI-related areas in English and Chinese.
  • Maintenance

    • Removed obsolete localization strings across supported languages.
    • Removed unused battery technology, swap percentage, auto-refresh, terminal status, and filesystem helper interfaces.
    • Clarified battery technology documentation without changing runtime behavior.

Swap.freePercent, ServersNotifier.isAutoRefreshOn,
TerminalSession.isBackendClosed and Battery.isLiPoly are referenced
nowhere in lib, test or integration_test. Battery.isLiPoly lost its
last reader when battery parsing moved into sbm_parser, so its Rust
counterpart's doc no longer points at a Dart method.
No caller inside or outside the crate; FsRoots::check_within already
answers the same question for the only place that needs it.
benchmarkBlockSize, benchmarkCompare, benchmarkCompareEmpty,
benchmarkDiedUnreported, benchmarkLinuxOnly, dockerImagesFmt,
monitorNoAgent, scheduledTaskScheduleHint, serverDetailOrder,
serviceEnabled, serviceSelectHint and trayTitle are referenced
nowhere in lib, test or integration_test. Removed from every locale
and regenerated; nothing looks them up by name.
RETIREMENT.md addressed every shim by file and line number, and every
one of those line numbers had drifted since it was written, so none of
them resolved to the code it described. Name the file and symbol
instead, which cannot go stale.

structure.md listed a model/sftp/ directory that does not exist (the
models live under file/) and omitted model/ai/ and data/service/.
@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Essentials

Run ID: 08f1e7e9-d740-475c-8688-66b7fd11f870

📥 Commits

Reviewing files that changed from the base of the PR and between 0f6e0ba and cdf4c91.

⛔ Files ignored due to path filters (16)
  • lib/generated/l10n/l10n.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_az.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_de.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_en.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_es.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_fr.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_id.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_it.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_ja.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_ko.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_nl.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_pt.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_ru.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_tr.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_uk.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_zh.dart is excluded by !**/generated/**
📒 Files selected for processing (25)
  • RETIREMENT.md
  • crates/sbm_parser/src/types.rs
  • docs/src/content/docs/development/structure.md
  • docs/src/content/docs/zh/development/structure.md
  • lib/data/model/server/battery.dart
  • lib/data/model/server/memory.dart
  • lib/data/provider/server/all.dart
  • lib/data/ssh/terminal_session.dart
  • lib/l10n/app_az.arb
  • lib/l10n/app_de.arb
  • lib/l10n/app_en.arb
  • lib/l10n/app_es.arb
  • lib/l10n/app_fr.arb
  • lib/l10n/app_id.arb
  • lib/l10n/app_it.arb
  • lib/l10n/app_ja.arb
  • lib/l10n/app_ko.arb
  • lib/l10n/app_nl.arb
  • lib/l10n/app_pt.arb
  • lib/l10n/app_ru.arb
  • lib/l10n/app_tr.arb
  • lib/l10n/app_uk.arb
  • lib/l10n/app_zh.arb
  • lib/l10n/app_zh_tw.arb
  • monitor/src/core/fs_roots.rs
💤 Files with no reviewable changes (6)
  • lib/data/model/server/memory.dart
  • lib/data/provider/server/all.dart
  • lib/data/model/server/battery.dart
  • lib/l10n/app_zh_tw.arb
  • lib/l10n/app_zh.arb
  • lib/data/ssh/terminal_session.dart

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change replaces retirement references with stable file-and-symbol locations. It updates English and Chinese structure documentation. It removes unused public getters and a Rust path helper. It removes obsolete localization entries across supported locale files. It also updates battery parser documentation without changing runtime behavior.

Suggested reviewers: lollipopkit

Priority: ⬇️ Low

Change: Refactor

🚥 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 summarizes the main changes: removal of dead accessors and unused strings, plus cleanup of stale documentation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (17 skipped: 1…
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
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying serverbox with  Cloudflare Pages  Cloudflare Pages

Latest commit: cdf4c91
Status: ✅  Deploy successful!
Preview URL: https://23cdcf1b.serverbox.pages.dev
Branch Preview URL: https://chore-code-health-followup.serverbox.pages.dev

View logs

@coderabbitai
coderabbitai Bot requested a review from lollipopkit September 19, 2026 03:05
@GT-610
GT-610 merged commit 63fe8f5 into main Sep 19, 2026
16 checks passed
@GT-610
GT-610 deleted the chore/code-health-followup branch September 19, 2026 04:05
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