Repo-wide simplification
Status: in progress. Tick an item when applied and building; delete this file once every item is applied or recorded as held back.
Quality only: no behaviour change, no new precondition. Each group ends with cargo clippy and the touched crates’ tests; the whole list ends with scripts/check.sh. Paths are from the repo root; S/ is crates/sharerr/src/.
Held back (changes behaviour; needs a decision)
- notify webhook and heartbeat URL cache (
S/notify.rs:433,:116,S/commands/serve.rs:587): saves about 1,440 Argon2 derivations a day, but a URL written by thevaultCLI from another process would need a restart. light-dark()palette (S/web/assets/style.css:104-176): removes about 60 lines, narrows browser support to May 2024 and later..wide .wide(style.css:895): inert, but its comment defends it as documentation.S/main.rs:50dispatchingpreviewandopenapibefore config load: drops the error log on a bad config.
Testkit, arr, probe, lighthouse
- lighthouse
reportandlookupto plainfn, drop allows and awaits - probe:
.inspect_err(..).ok()?for four matches, inlineopen_logged - arr:
try_join!as tail expression (sonarr:37, readarr:86, lidarr:88) - testkit
net::closed_url(); use at closed-port sites - tests:
mock::base_urlat 31 sites (doctor tests, gluetun, notify, checks, lighthouse_client) - tests:
mount_jsonandmount_textat plain stubs (qbit tests, doctor tests, discovery); gluetun’s stubs all carry a matcher or status - tests:
mock::body_textfive copies inS/sync/tests.rs;QBIT_API_KEYandARR_API_KEYliterals inS/checks.rs, doctor tests - testkit: delete
movie_json;series_json,episode_jsonfree functions; use them andsystem_status_jsonincrates/sharerr-arr/tests/discovery.rs - discovery tests: local
discover,mount_series_files,by_file crates/sharerr/tests/cli.rs:closed_portforfree_port, test callsstop_gracefully, mergeimpl Serving,write_sync_config,MASTER_KEY,malformed_config- secrets:
rpc_credentialscallsfresh_password; sharedtest_key_bytes,random_secret(gossip, lighthouse_client, openapi tests) seed-arr.rs:seed_one,ensure_root, prefix constants;library.rsmedia_file- lighthouse tests call
post_report; drop redundantTcpStreamconnects (tests/binary.rs:95,crates/sharerr/tests/cli.rs:364) - probe test
extension_matching_ignores_caseassertsSomeonFilm.MKV; move stale docs
Core and store
PeerScope::admitsreplacesscope_admits(S/web/items/mod.rs:297);seeding_summariesreads once and filters; test Rust and SQL agreeitem_update!macro for theupdate_itemtail (db.rs:368); returnsResult<()>Store::changed(query) -> Result<bool>at 9 methods- vault:
read_if_present,io_err,locked touch_peerbranches onseen,TOUCH_WINDOW_SECS(peers.rs:418)MIGRATE_LOCKonly inopen; doc names the real racers (db.rs:140,:25)record_peer_endpointone bind chain (endpoints.rs:131)placeholders(n),fetch_by_ids, importHashMap(endpoints.rs:206,db.rs:754)scene_tokentable helper (crates/sharerr-core/src/model.rs:222,:267)query_scalarandquery_asfor single-value reads; notpeer_gossip_recordRetentionCelltoRwLock<Retention>(retention.rs:46)sharerr_core::saturating_i64at 10 sitesStoreError::from_insert;pub(crate) type Result<T>indb.rs- misplaced and stale docs:
config.rs:979,peers.rs:257,:639,db.rs:1284,:372,endpoints.rs:90,:696; one-liners:endpoint.rs:81,db.rs:726,users.rs:290,MAX_SAMPLES,MAX_HISTORY,literal_url - endpoints tests
sight,sightings; db testsseeded;upgrade.rsrun Store::active_peers()for about nine “not revoked” filters;diagnostics::active_friendsbody goes
Torrent and client crates
sharerr_client::RpcConnectionfor transmission, rtorrent, part of deluge- rtorrent
addcallsset_limits; inlinewarn_no_ratio_limit - qbit: delete inherent
login;lifthelper fortranslate sharerr_client::decode_json- drop unused
tokionormal dep (transmission, deluge, qbit) Torrent::content_length,Retargeted::torrent(), droplengthfieldpercent_encodingfor the announce decoder (announce.rs:565-621)- rtorrent
call_batch(method, &[[Param; N]]) -> Result<()> - transmission
ListedTorrent::into_summary sharerr_client::single_tag; delugewrite_trackers- qbit: drop
tagparameter and dead guard (torrents.rs:28,:255) AnnounceSetprivate fields andprimary(); collect attracker.rs:134hash_piecesreadsstreamdirectly (factory.rs:275)- adapter tests:
respond_all, testkit mounts, sharerr-client default-method tests,body_json,callsin testkit,urls - misplaced docs: sharerr-client’s
reportedtest helper,sharerr-qbit/src/adapter.rs:22
Gossip, notify, state
- delete
AlwaysEmptyQbitforStubClient(S/test_support.rs:64,S/state.rs:942) state::fixtures::with_open_vaultbehind the five helpers (metrics, tracker, api, probe, settings tests). Not applied:with_no_master_keyand the inlineJailcopies in peers, notify, gluetun and serve, about 40 closures that each seed and assert differently, so one fixture would not shorten them.- metrics
Familywith.sample,gauge, one run block (S/metrics.rs:169) - gluetun: drop
last_errorcopy,poll_once(state, target, http) - one tracker token cache; delete test-only accessors (
S/state.rs:93,:501) VaultCachesswapped whole ininvalidate(S/state.rs:680)QuietNotifiedlocal toquiet_peers_loop(S/notify.rs:62)MetricsSnapshot::zeroed(), drop deaditems_by_stateinput- notify
stored_urlfor the three vault-url reads; deadsecs.max(1) - gossip
ingestusespeer_gossip_records, localsigned_atmap (S/gossip.rs:275) - lighthouse_client stores
LighthouseSnapshotdirectly (:79,:153) - Not applied:
Identity::from_seed,test_identity.test_key_bytesalready removed the duplication; onlygossip.rsbuilds a testIdentity. - gossip one
filter_map;self_recordclosure (:494,:138) - small:
is_hex_pubkeyshared with lighthousevalid_key_hash; inlineapply_lookup; totpcode_for;SystemStats.disk;AtomicU32counters; dropchainalias
Sync, tracker, torznab
- drop
KnownTorrents,normalize_path; comparePaths (S/sync/seed.rs:632) read_cached,Retargetedaccessors, flattenadopt(seed.rs:236)- jackett
rename_all = "PascalCase", keep exceptions (S/jackett.rs:286) - jackett move fields out of
Matched;QueriedIndexer::sharerr - consts for “Always 200” and the
apikeydescription (S/tracker.rs:204) PassContextholding per-pass values (S/sync/mod.rs:646,:879)- extract
confirm_livefromshare(S/sync/mod.rs:843) - one
SeedOutcomematch; inlinemissing(S/sync/mod.rs:1044) Seeder.seeding: SeedingConfig(S/sync/mod.rs:424)LimitsMemounder one mutex (S/sync/mod.rs:182)- seed tests
built,paths_for,announce; sync tests sharedSeeder - tracker tests
SharedItem { .., ..shared_item() } - torznab
groups.contains,is_illegal_control(S/torznab/mod.rs:141,:169) - small:
library.rs:398,:387,pathsuggest.rs:120,tracker.rs:590,sharerr_torrent::torrent_file_name
Commands, CLI, API
- api handlers return
Result<Json<T>, Response>;with_config(S/api.rs:108,:238) - doctor tests: helpers on top,
qbit_check(the three redundant tests are deleted) - Not applied: doctor natively async. Keeping the 500 on a panic still needs a spawn, so
S/api.rs:289barely shrinks while async spreads through the vault, library and path checks and their tests. check_arr,check_library,fix_missing_tagshape (doctor/mod.rs:513)- doctor gluetun loop, drop the dead arm (
doctor/mod.rs:226,:877) checks(config, error, &DoctorArgs)(doctor/mod.rs:157)check_vaultusescredential; nonouncompare;credential_name(:326,:678)- serve tests
drive_background_until - preview
mockroute helper, keepingpage’s inline error (preview.rs:44) - preview
SETUP_STEPS,title_case,arr_section,scope_options - openapi one
SecuritySchemes, inlinedoc_to_json,random_bytes, doc count - serve mount decision once;
degradedbool (serve.rs:108,:159,:61) PrivateCallerextractor (serve.rs:408,:449,:494)Config::advertised_base(),checks::dial_target
Web auth and peers
ok_or_return!andunavailableacross web handlers (27 sites)- peers
rows, no parallel vectors, tag passed torow(peers.rs:638) own_invite -> String,invite: String, merged tail inpair- drop
build’srevealedparameter internal_docs!macro forS/web/docs.rs, keeping full URL literalsbytes_or_emptyatS/web/mod.rs:409,:475,peers.rs:715password_okinauth.rs, shared; drop form clonesvault_unavailablederived (peers.rs:554)Config::sync_every,with_configinstead of whole-Configclones;glancecomment- drop the outer
directorycheck (S/web/probe.rs:44) mint_peeronerejectedcallpending_cookiebesidePENDING_TTL;base_cookie- auth tests:
location,setup_form,login_form,body_of, closed-store state test_support::peer,test_support::shared_item,seed_sam
Web settings, items, topology
import_configthroughcommit_config(settings/mod.rs:1052)TokenToggleForm,save_token_toggleItemContext::gather,ItemFactsembedded in both page modelsload_itemfor four items handlersEdit::or_unset,Edit::url_or_unset,parse_optional, one seeding parse- drop duplicate filter fields;
FilterState::query,FilterOption::named endpoint_status(&serve, config, target),gluetun_sectionClientCheck::healthy(),DefaultChannel(Option<Seen>), dropEdgeStyle::None- diagnostics
bar_height - composition
&'static strlabels,Bucket Swarms::counts,Swarms::snapshot,Store::share_end, one-item audience read- topology
mask_addressdoc, “three” channels,placedonly
Templates and assets
ui::secret_field(14 sites)- shared
arr_form,path_map_form,qbit_form; lock-key test reads the new file ui::text_field,ui::check_field; widen the lock-key scanner- stroke-glyph selector list;
.bar nav :is(a, button) - dead CSS except
.wide .wideand--sp-12 - pill and status selector lists
- topology
mismatch_table; itemsfilter_select flash_error,token_badge,or_dash,step_mark- one
.hint, one.foot, one32remblock --segfor composition coloursui::test_button; drop defaulthx-swapid_prefix,client_section, deaddescribechecks, thin wrappers, aliases, classes with no reference
CI, scripts, docker, docs
- Not applied:
scripts/lib_docker_tests.sh,poll_until, one clientcase,check_client_announces,check_indexer. Onlyremove_stateis identical across the runners, and nothing here can run them. docker/compose.stack-base.ymlwithextends;validate_compose.shskip- docs: TESTING owns tiers, docker/README owns stacks (the
--test e2ecommands are fixed) check_hadolint;.github/actions/advisory-check- path-filter list once; YAML anchors in
docker.ymlfor DNS step and egress .dockerignoreadds docs, scripts, scratch, local, coverage-html, editor dirs- workflow and Dockerfile headers cut to the why; stale statements fixed
- Not applied: delete
.tool-versions. Nothing in the repo reads it, but mise does, on any machine that uses it. - mesh
x-node,x-lsio-env, each checked with adocker compose configdiff; not applied: one config template, which needs a run of the mesh script _cov_report; not applied:check_coverage-lines,--coverage-floor, which would mean editing two workflows to save oneawkand onesed- docs point at the owner for groups, roster, floor, defaults
- mesh unused-variable line,
docker compose port, integration jq filter