Cleanup: dead code, competing impls, and refactor debris audit #36
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_os#36
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Audit of the hero_os codebase for cruft accumulated from parallel AI-assisted development. Grouped by priority. Use this issue as a punch list — will work on it incrementally.
Dead code (low-risk removal)
Leftovers from the hero_auth removal (commits
2c98634→6354b25, Apr 14):crates/hero_os_app/src/storage.rs:172-197—save_jwt/load_jwt/clear_jwtforhero_auth_token(kept "in case hero_proxy brings it back")crates/hero_os_app/src/services/env_service.rs:105-108—http_get()still readshero_auth_tokenas Bearer, butconfig::auth_url()is gone, so the path is unreachablecrates/hero_os_web/src/components/island_frame.rs:30— hardcoded route"auth" => "/hero_auth/ui/"crates/hero_os_app/src/generated_profile.rs—COMPILED_ISLANDSstill lists"auth"; drop fromconfig.toml[profiles.default]crates/hero_os_app/src/components/login_screen.rs(654 LOC) —on_authcallback never fires; decide: delete or gate behind feature flagcrates/hero_os_app/src/components/setup_wizard.rs(312 LOC) — same as abovecrates/hero_os_app/src/storage.rs:115—clear_desktop_state()marked dead, unusedOther dead-code hygiene:
#![allow(dead_code)]atcrates/hero_os_app/src/main.rs:6— it masks everything. Fix real warnings instead.crates/hero_os_client/— empty stub directory, never committed (onlytarget/+ schema). Delete or populate.// TODO: Navigate to section view within focused appstubs atmain.rs:1666andmain.rs:1698— unreachable, from incomplete Phase 5 deeplink work.Competing / unfinished implementations (deliberate before touching)
WindowStatetypes: OSchema-generated canonical incrates/hero_os/src/desktop/types_generated.rs+ app-local extension incrates/hero_os_app/src/islands.rs:25-172addingroute/route_stack/route_forward/nav_stack. Intentional split (ephemeral UI state) but unobvious — either unify or document the split.crates/hero_os_app/src/routing.rs(URL→context/apps, 323 LOC) and the newcrates/hero_os_app/src/window_route.rs(island→header, 166 LOC, from49bde9a). Phase 5 is supposed to unify them. Confirm plan is tracked.hero_os_uicrate mid-deprecation —710e98ddropped 255 LOC of RPC proxying now owned byhero_os_server. Inventory what's left and finish the deprecation.Architectural debt / workarounds
Cargo.toml.fff3609("drop unbuildable islands") proves some combos don't build. Add a feature-matrix CI check or prune unused flags.557a06d. Confirm stabilized; document the final convention.hero_proxyauth injection (home#118) isn't landed. Current state is auth-neutral in a way nothing downstream handles. Track the proxy integration.1df8806, Apr 14, +3544 Cargo.lock) — 20 sibling-repo path deps became git deps to make fresh checkouts build. Revisit after sibling repos stabilize.Generated artifacts — regeneration story unclear
types_generated.rs,types_wasm_generated.rs,osis_*_generated.rs,osis_client_generated.rs— no visiblebuild.rshooks. Regeneration appears manual. Document the command(s) and add amake regentarget or build.rs. Risk of drift.generated_profile.rsis built fromconfig.tomlviabuild.rs— fine as-is, just audit theCOMPILED_ISLANDSlist.Suspicious large commits (reference)
1df8806(Apr 14, +3544) — path deps → git depsf6024f1(Apr 12, +1082/−3451) — "sessions 17-18", 18 new island crates + socket migration + OSIS auth fix; grab-bagf393c8f(Mar 17) — cleaned up 14 non-existent_ui_wasmpath deps + duplicate functions (confirms speculative AI-generated additions)Suggested order of attack
allow(dead_code), fix resulting warnings.Update after #35 merged
Issue #35 (unified window chrome, phases 1–5 + cleanup:
49bde9a,58eba9b,ba3643c,dff7ef9,fdd7286,161224e,95a3e03,94cec21) and concurrent merges (ea295e4,382d2bf,fe880f2) resolved or changed several audit items. Re-scoping.Resolved by #35 / concurrent merges
crates/hero_os_app/src/window_route.rsis deleted (ba3643crelocated the types tohero_archipelagos_core). Phase 5 (fdd7286) wiredWindowRoute.url_segmentinto the existing path-based URL writer as a per-approutequery param. The two systems are now unified. Drop from the audit.WindowStatetypes —ba3643cremoved theroute/route_stack/route_forwardfields from the app-localWindowState; theWindowRouteContextsignal is now the single source of truth. The residualWindowStateinislands.rsis a thin per-window holder, no longer overlapping with generated types. Drop from the audit.contacts | filesystemheaderless list atmain.rs:1973— removed by58eba9balong with the entire dual-header branch inwindow.rs.ea295e4droppedhero_biz_app,hero_browser_app,hero_indexer_appcrate deps and theirisland-*-nativefeatures. Partial progress on the feature-flag sprawl item.Re-verified still present
#![allow(dead_code)]atcrates/hero_os_app/src/main.rs:6— still there."auth"still listed ingenerated_profile.rs:67COMPILED_ISLANDS(source:config.toml[profiles.default])."auth" => Some("/hero_auth/ui/".to_string())still incrates/hero_os_web/src/components/island_frame.rs:30.env_service.rs:105Bearer-token path still there and unreachable (config::auth_url()is gone).save_jwt/load_jwtinstorage.rs:175,188— confirmed dead (no callers).clear_jwtatstorage.rs:202is NOT dead — still called from the logout handler atmain.rs:1434. Revised item: remove onlysave_jwt/load_jwt, keepclear_jwt.clear_desktop_stateatstorage.rs:116— still dead.LoginScreen(654 LOC) andSetupWizard(312 LOC) — still present;on_authcallback still never fires. Logout handler atmain.rs:1427-1444now falls back to the in-tree login screen in guest mode — so the login screen UI path is reachable again, but its auth callback remains stubbed. Needs a product decision.crates/hero_os_client/— still an empty stub (onlytarget/).New cleanup candidates introduced by recent merges
382d2bfdisabledisland-intelligenceandisland-knowledge(hero_osis dropped the embedder domain);fe880f2further disabled a brokenisland-knowledgebuild. Check that no orphaned references remain in Cargo.toml,config.tomlprofiles, island_content.rs conditional renders, and the web island_frame routes.generated_profile.rsis build-artifact noise on checkout (first line is a developer-local absolute path, e.g./Users/mahmoud/...vs/Users/timurgordon/...). Either strip the path from the header or.gitignorethe file entirely — right now every developer's commits have a spurious diff on this file.Starting work now
Beginning with the auth-orphan sweep (checkboxes above under Re-verified still present, excluding the LoginScreen/SetupWizard decision which needs product input). Will also delete
hero_os_client/and drop"auth"from the default profile. PR to follow.Slice 1 landed via #37 (squash-merged into
development). Checked off:"auth"removed fromconfig.tomlprofiles"auth" => "/hero_auth/ui/"route removed inisland_frame.rsenv_service.rssave_jwt/load_jwt/clear_desktop_stateremoved instorage.rs(keptclear_jwt— still called by logout handler)crates/hero_os_client/stub deletedStill open (see original body for full punch list):
LoginScreen(654 LOC) /SetupWizard(312 LOC) — product decision needed#![allow(dead_code)]atmain.rs:6generated_profile.rsdeveloper-path noise (build.rs header fix)*_generated.rsregeneration story (OSchema/OpenRPC)island-intelligence/island-knowledgerefsPre-existing issue spotted (unrelated, should be its own ticket):
cargo test --workspace --no-runfails withunresolved import super::serverincrates/hero_os_server/src/desktop/tests.rs:12. Present ondevelopmentprior to #37.Fixed the
cargo test --workspaceblocker via #38 (merged):crates/hero_os_server/src/desktop/tests.rs:12importedsuper::server::*(no such module); corrected touse super::*;. All 3 desktop CRUD tests now pass.Remaining
cargo test --workspacefailures are incrates/hero_os_examples/tests/integration.rsand requirehero_procrunning with binaries in~/hero/bin/(documented at file top). Not a regression — environment-gated, expected.legacy-auth-ui(#36) #54Closing — enough ground covered for one pass
Shipped today via #37, #38, #54, #55, #64, #65:
desktop/tests.rscompile fix (super::server→super::*)LoginScreen+SetupWizardgated behindlegacy-auth-uifeature (off by default)island-intelligence/island-knowledge/island-indexer-nativerefs removedgenerated_profile.rsheader path stabilized (no more per-developer diff)#![allow(dead_code)]removed + -1712 LOC of real dead code swept (commands.rs, dom_automation.rs, Groq client, MCP schema types, scattered unused helpers)Net:
hero_os_appwarning count 22 → 13, zerodead_codewarnings.Deferred to follow-up issues as needed
*_generated.rs) regeneration story — no build.rs hooks for OSchema/OpenRPC artifactsunused_variables/unexpected_cfgswarnings (smaller scope)hero_os_uicrate deprecation finishClosing — open a new focused issue for any of the above as they come up.