refactor(auth): gate LoginScreen/SetupWizard behind legacy-auth-ui (#36) #54

Merged
timur merged 1 commit from 36-gate-legacy-auth-ui into development 2026-04-15 13:04:51 +00:00
Owner

Second slice on #36. LoginScreen (654 LOC) and SetupWizard (312 LOC) are dead in the default build (hero_os boots in guest mode), but potentially useful as a styling/layout reference for future local-auth fallbacks. Rather than delete them outright, gate them behind an off-by-default feature so the source survives without compiling into the shipping binary.

Changes

  • Cargo.toml — new feature legacy-auth-ui = [] (off by default). Not in the web or core bundles.
  • components/mod.rsmod login_screen, mod setup_wizard, and both pub uses gated on #[cfg(feature = "legacy-auth-ui")].
  • main.rs
    • use components::{LoginScreen, SetupWizard} gated.
    • Both rsx branches restructured to produce rsx! {} when the feature is off. Conditions are intentionally left as-is — guest-mode boot leaves authenticated = true, so the branches never match in default builds anyway.
    • Logout handler's desktop_visible.set(false) + authenticated.set(false) fade-to-login flow gated. With no login screen to fall back to, default-build logout becomes a token-clear chime that stays on the desktop. --features legacy-auth-ui restores the original logout→login behavior.

Verification

cargo check -p hero_os_app                             # default (feature off) — OK
cargo check -p hero_os_app --features legacy-auth-ui   # feature on — OK
cargo check --workspace                                 # OK

Test plan

  • Default build: app boots to desktop, Logout button clears tokens + plays chime, desktop stays visible.
  • --features legacy-auth-ui: Logout fades desktop, LoginScreen re-renders.
  • No references to LoginScreen / SetupWizard in the default-build binary (confirmed by compile-time gating).

Refs #36.

🤖 Generated with Claude Code

Second slice on #36. `LoginScreen` (654 LOC) and `SetupWizard` (312 LOC) are dead in the default build (hero_os boots in guest mode), but potentially useful as a styling/layout reference for future local-auth fallbacks. Rather than delete them outright, gate them behind an off-by-default feature so the source survives without compiling into the shipping binary. ## Changes - **`Cargo.toml`** — new feature `legacy-auth-ui = []` (off by default). Not in the `web` or `core` bundles. - **`components/mod.rs`** — `mod login_screen`, `mod setup_wizard`, and both `pub use`s gated on `#[cfg(feature = "legacy-auth-ui")]`. - **`main.rs`** — - `use components::{LoginScreen, SetupWizard}` gated. - Both rsx branches restructured to produce `rsx! {}` when the feature is off. Conditions are intentionally left as-is — guest-mode boot leaves `authenticated = true`, so the branches never match in default builds anyway. - Logout handler's `desktop_visible.set(false)` + `authenticated.set(false)` fade-to-login flow gated. With no login screen to fall back to, default-build logout becomes a token-clear chime that stays on the desktop. `--features legacy-auth-ui` restores the original logout→login behavior. ## Verification ``` cargo check -p hero_os_app # default (feature off) — OK cargo check -p hero_os_app --features legacy-auth-ui # feature on — OK cargo check --workspace # OK ``` ## Test plan - [ ] Default build: app boots to desktop, Logout button clears tokens + plays chime, desktop stays visible. - [ ] `--features legacy-auth-ui`: Logout fades desktop, LoginScreen re-renders. - [ ] No references to `LoginScreen` / `SetupWizard` in the default-build binary (confirmed by compile-time gating). Refs #36. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
refactor(auth): gate LoginScreen/SetupWizard behind legacy-auth-ui feature (#36)
Some checks failed
Build and Test / test (pull_request) Failing after 34s
8d55483ee9
hero_os boots in guest mode and these components are never rendered in
the default build. Keep the source as a styling/layout reference for
future local-auth fallbacks or native builds, but compile them out by
default.

- Cargo.toml: add `legacy-auth-ui` feature (off by default)
- components/mod.rs: gate `login_screen` / `setup_wizard` module decls
  and re-exports on the feature
- main.rs:
  - gate the `LoginScreen` / `SetupWizard` import
  - gate both rsx branches (wrapped so `rsx!{}` is used when feature is
    off; conditions still trigger only when the feature is on because
    guest-mode boot leaves `authenticated = true`)
  - gate the logout flow's `authenticated.set(false)` + `desktop_visible`
    fade — with no login screen to fall back to, logout becomes a
    token-clear chime and stays on the desktop. `legacy-auth-ui` restores
    the original logout→login behavior.

Refs #36.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
timur merged commit 807645da60 into development 2026-04-15 13:04:51 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_os!54
No description provided.