Skip to content

Hardening: preview toggle, init timeout, read-only UX, status classification #64

@syedazeez337

Description

@syedazeez337

Summary

Consolidation of minor/medium hardening items surfaced during a code review. None are critical bugs, but each improves robustness.

1. Preview toggle uses external shell script

install_preview_toggle() writes a shell script to the runtime directory for ctrl-p preview cycling. This works but is fragile — if the runtime dir is cleaned up mid-session, the feature breaks silently.

Improvement: Investigate whether skim exposes a mechanism to pass custom state from keybindings back into the Rust process, eliminating the need for the filesystem middleman.

2. Init coordinator drops slow-watcher items

The 8-second tokio::select! timeout in watch_resources drains global_init. If a watcher finishes its InitDone after the coordinator has drained, its initial items are pushed to global_init but never read — the coordinator task has already exited. Those items are lost until a subsequent Apply event re-introduces them.

Fix: Either extend the coordinator to keep reading, or have late-finishing watchers send their items directly to skim (like the reconnect path does).

3. Read-only mode still shows write keybindings

When --read-only is active, the help header still shows ctrl-d delete, ctrl-e exec, etc. The skim bindings are still active — pressing them exits skim, only for the dispatch function to print "disabled" and restart the loop.

Fix: In read-only mode, strip write-action bindings from skim and omit them from the header string. This avoids the jarring exit-and-restart UX.

4. Unknown status strings default to Healthy (green)

StatusHealth::classify() has a catch-all _ => Self::Healthy. If Kubernetes introduces a new failure reason not in the hardcoded list, it would display as green/healthy.

Fix: Change the default to Self::Warning (yellow) or Self::Unknown, so unrecognized statuses are visually flagged rather than blending in with healthy resources. Also consider expanding the known status strings to cover more kubectl edge cases.

Priority

Low-medium — none of these block normal usage, but each improves the experience for edge cases and production environments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions