Skip to main content

Module app

Module app 

Source

Re-exports§

pub use crate::mode_action::Action;
pub use crate::mode_action::ActionFlow;
pub use crate::mode_action::ConfirmKind;
pub use crate::mode_action::ConfirmModal;
pub use crate::mode_action::DryRunInfo;
pub use crate::mode_action::ParameterisedAction;
pub use crate::mode_action::ACTIONS;
pub use crate::mode_detail::config_editable_items;
pub use crate::mode_detail::health_items;
pub use crate::mode_detail::ConfigEdit;
pub use crate::mode_detail::ConfigEditMode;
pub use crate::mode_detail::ConfigItem;
pub use crate::mode_detail::ConfigItemKind;
pub use crate::mode_detail::DetailState;
pub use crate::mode_detail::DetailTab;
pub use crate::mode_detail::EventLevel;
pub use crate::mode_detail::EventWindow;
pub use crate::mode_detail::HealthItem;
pub use crate::mode_detail::LogTail;
pub use crate::mode_detail::LogTailStage;
pub use crate::mode_dlq::DlqState;
pub use crate::mode_dlq::QueueView;

Structs§

App
AppRollup
Rollup of operational signals across every env in an application. Pure — driven entirely by the in-memory env list, so the Apps table can refresh as part of the same view-rebuild that touches the Envs table.
CompletionState
In-progress command-bar Tab-completion cycle.
ConfigDiff
Pure render of the :options overlay body. Groups rows by namespace; within each group, operator-set rows come first (marked ), defaults follow (marked ). Optional filter_ns restricts to one namespace.
EventPanel
State for the bottom Events panel (and the event-timestamp format it shares with the Detail/Events tab).
HelpState
State for the global help overlay.
MultiSelectOptions
Payload for AppMsg::FormMultiSelectLoaded. Carries the full option list, parallel display annotations, and the current EB selection so the form’s MultiSelect field can be populated in one update.
PaletteItem
PendingAction
One in-flight or recently-completed action. label is the human-readable verb (e.g. “Rebuild env”), target the env or instance the action was dispatched against. completed lands when AppMsg::ActionResult arrives; until then the entry counts as in-flight and the user can see it in the :pending overlay + header chip.
PendingDispatch
One action (or batch of actions) queued for dispatch with a brief cancel window. After the operator authorises a confirm (Y on a YesNo modal, typed name on a TypeName modal) or runs a :batch-* command, ebman doesn’t fire the AWS call immediately — it holds the dispatch here, shows a countdown in the header, and fires only when UNDO_WINDOW elapses. U in Normal mode aborts before the deadline.
Picker
Toast

Enums§

AppsActionItem
Items the Apps-scope action overlay (Overlay::AppsActionMenu) offers when the operator presses a from the Apps table. Each dispatches via cmd_batch_* after seeding multi_selected with the envs captured at menu-open time.
DisplayRow
DlqOp
EventTimeFormat
How event timestamps render. Three-state cycle: Utc (default — matches EB / CloudWatch API output) → Local (operator’s wall-clock for cross-referencing with other terminals / Slack threads) → Age (compact 5m / 2h / 3d relative form). Persists in state.toml as event_time_format = "utc"|"local"|"age".
Focus
Which on-screen panel is “focused” — i.e. which one j/k/Enter target. The main table is the default; the user can Ctrl-] over to the events panel (when visible) for cursor navigation + line yank.
HelpTopic
Help overlay scope. Global shows the full keymap; the per-mode topics surface only the keys relevant to where the user just pressed ?, avoiding the “wall of help” problem when the user just needs a reminder about the screen they’re on. Set when entering Mode::Help.
LoadState
Mode
MsgKind
Overlay
A single read-only popup that overlays the main UI. Only one can be open at once: opening another replaces it; Esc / q dismisses it. Replacing the previous six Option<String> fields with this enum eliminates the “did I forget one?” footgun every time a new overlay is added (separate dismiss path, separate draw conditional, separate dismiss-on-context-switch branch, …).
PaletteAction
PendingDispatchKind
The actual work tick_pending_dispatch dispatches when the cancel window elapses. Mirrors the existing dispatch paths: Single re-uses App::spawn_action; the batch variants re-use the per-env spawn_batch_* helpers in a loop.
PickerKind
Scope
SortKey
ToastKind
UpdateKind
Inferred kind of an Updating env’s in-flight operation. EB’s status field is generic (“Updating”) regardless of cause, but the recent events expose what’s actually happening. The Health tab uses this to render Updating: deploying build-142 (or similar) instead of just the generic pill.
ViewMode
WhyItem
One drillable row in the :why triage overlay. The renderer pushes these in lockstep with the lines it emits (events / alarms / instances / deploys / queues / dlq), and writes the list to App.why_items so the key handler can act on items[cursor] when the operator presses Enter.
YankKind

Constants§

APPS_ACTION_ITEMS
Menu order — Drill at the top because it’s the default action operators reach for; OpenInConsole at the bottom so it’s not the thumb-stroke option.
HISTORY_CAP
LOADING_INDICATOR_LINGER
Once the loading indicator becomes visible, keep it visible for at least this long even if the load completes earlier. Smooths over the case where a round-trip is just slow enough to cross the threshold and then finishes ~100 ms later — without the linger, the indicator flashes on and off in a single visible frame which reads as flicker.
LOADING_INDICATOR_THRESHOLD
How long a refresh has to be in flight before the loading… indicator in the header appears. Faster round-trips complete invisibly so the user doesn’t see a quick blip on every cycle.
LOG_TAIL_MAX_LINES
PENDING_CAP
Cap on the in-flight + recently-completed list. Older entries fall off the front when this is reached.
PENDING_COMPLETED_TTL
Completed entries linger for this long so the user has time to see the outcome before the panel clears.
UNDO_WINDOW
Cancel window after a confirm — long enough that an “oops” reflex can recover but short enough that operators don’t notice it on a deliberate action. The UX review flagged the absence of any abort affordance after dispatch as a real safety gap.

Functions§

alarm_kind_to_metric
Map a friendly env-metric “kind” to a (metric_name, default_op, default_stat) triple. The user can override the operator on the CLI but the defaults reflect “what you’d reasonably alarm on for this metric” — e.g. drop in health (LE) vs spike in 5xx (GT). Pure so the unit tests don’t need AWS.
app_rollup
Compute the rollup for one application. Iterates envs once and counts Red / Updating envs (case-insensitive on the health + status columns). Worker-DLQ alerts come from dlq_depths which the App owns globally — passed in so this stays a free fn that test code can call without a full App.
build_health_check_probe_url
Pure: compose a probe URL from a CNAME + a health-check path. EB CNAMEs are bare hostnames (api-prod.eba.amazonaws.com); the path may or may not start with a slash. We always emit a http:// URL because EB envs aren’t HTTPS by default and a missing TLS cert is a separate operator concern (the probe shouldn’t false-positive on that). Operators with custom TLS can put their HTTPS CNAME directly into their LB listener config; the probe is a development-mode best-effort signal.
builtin_commands
Names of all built-in :commands. Used to detect collisions when loading user plugins from commands.toml — plugins that shadow a built-in are dropped with a warning rather than silently masking it.
classify_update_kind
Pure: classify an Updating env’s in-flight op by looking at the most recent event whose message matches a known pattern. Events are expected newest-first (as the EB API returns them); returns the kind from the first matching event. Returns Generic when nothing matches.
collect_saved_configs
Flatten the per-application configuration_templates lists into a single (application, template) vector, sorted by app then by template name so the overlay’s cursor order is stable across refreshes. Pure so the unit tests don’t need an AWS client.
compute_batch_count
Pure helper: resolve BatchSize + BatchSizeType into a concrete instance count, clamped to [1, asg_max]. Percentage rounds UP (a 33% batch on a 4-instance ASG is 2 instances; EB rounds up internally too, per the docs).
compute_loading_linger_target
Exponential back-off horizon: 2× base on the first throttle, doubling each consecutive failure, capped at 5 minutes. The 5 min cap keeps the app responsive when the throttle clears — the user shouldn’t have to wait arbitrarily long after rate limits ease. Pure: given the moment a load started and the display constants, return the instant the loading indicator should remain visible until (if it was visible at all). Returns None when the load completed before the indicator’s display threshold, signalling “no linger needed”.
compute_traffic_warning
Pre-flight signal for the confirm modal: looks at the env’s current state at action-open time and returns a one-line warning when something noteworthy is in progress (mid-deploy, recently updated, currently in Updating / Terminating). None for envs that look quiet. Pure function so the rule set can be pinned down with unit tests.
compute_unavailability_count
Pure: how many instances will be simultaneously unavailable during a deploy with the given EB deployment policy + batch settings + ASG max-size. Returns the worst-case planning number — what the operator sees on the EB dashboard during the rollout. asg_max clamps at 1 to avoid divide-by-zero nonsense on misconfigured envs.
delta_toast_key
Extract a “delta toast key” from text shaped like ▲2 Red / ▼1 Yellow. Returns Some(bucket_name) when the text is a status-delta toast and we want subsequent updates for the same bucket to replace rather than stack. Pure function so it’s easy to pin down in tests.
deploy_settled_green
Pure: “deploy has fully succeeded for this env” predicate. Both conditions matter — UpdateEnvironment momentarily leaves health=Green while status flips to Updating, so a watcher that only checks health would false-positive during that window and disarm a rollback (or report success) before the deploy has actually settled. Single source of truth shared by the rollback-watchdog pass, the wait-for-green pass, and the non-interactive CLI’s decide_poll.
derive_version_label
Derive a version label from a file path + a timestamp. Uses the filename stem (everything before the last .) so ./build.zip becomes build_1684512345. Sanitises any chars EB rejects in version labels (anything outside [A-Za-z0-9_.-]). Pure for testability.
diff_config_options
Pure: option-settings that differ between two envs. Compares the operator-set value per (namespace, name); rows where both sides agree — including both unset — are dropped. EB’s Some("") and None both mean “unset”, so they’re normalised to equal. Result is sorted (namespace, name) for a stable overlay.
encode_filter_only_view
Encode a filter-only saved view — the value :save NAME writes to saved_views. Omits sort=, grouped=, scope= so loading the view doesn’t perturb the operator’s current sort / group / scope state. apply_view ignores missing fields, so a filter-only view is a safe no-touch-other-state operation.
estimate_cost
Sum of hourly prices for a list of instance types, with a “missing” count of instances whose type wasn’t in the table.
expand_command_alias
Pure: expand a typed command line through the operator’s alias map. If the first whitespace-separated token matches a key, swap it for the alias’s expansion and keep any remaining args (appended after the expansion). Single-level only — the expanded line is NOT re-checked for further aliases, so alias.x = "x ..." is safe (degenerates to “x …” dispatched once). Non-alias lines pass through unchanged.
expand_tilde
Expand a leading ~/ to $HOME/. Other tilde forms (e.g. ~user) are left as-is; the operator gets a clear “can’t read” error if they pass something obscure. Pure for ease of testing.
extract_unavailability_inputs
Pure: extract the four option-settings the unavailability estimate needs from the flat (namespace, name, value) shape fetch_env_option_settings returns. Defaults match EB’s own defaults so the math degrades gracefully on partial reads.
format_app_versions
format_deploy_preview
format_env_vars
Render env vars as KEY=VALUE lines, aligned on the = for easy scan. Empty values render as "" so operators can distinguish “explicitly empty” from “not set”. Pure.
format_org_accounts
Render the :versions overlay body. Marks the currently-deployed version with ◀ deployed; trims the redundant “Application version created from “ prefix that every CI-pipeline description tends to carry; shows “showing N of M (newest first)” when the list was truncated. limit caps the visible rows. Pure: render the :deploy LABEL --preview body. Highlights the candidate version (label / age / description), the currently-deployed version’s age for context, and warns if the candidate predates the current one (rolling back is intentional but worth flagging).
format_template_settings
Render a sorted (namespace, option_name, value) list as an aligned text block grouped by namespace. Empty values render as "" so the reader can distinguish “explicitly empty” from “not present”.
format_unavailability_line
Pure: render the modal’s unavailability line. Returns the human-readable text plus a severity flag for colouring (true = caution, false = green/no impact).
humanize_short_age
instance_hourly_usd
Best-effort hourly USD price for an EC2 instance type, on-demand Linux, us-east-1 as the baseline. Returned in USD/hour. Returns None for unknown types — caller should label the estimate as “approximate (us-east-1)”.
is_config_event
Pure: whether an event message looks like a deploy or a configuration change — the rows the :changes timeline keeps, filtering out routine health / scaling / launch noise.
parse_metric_extra_args
Parse the optional trailing args of :metric add LABEL NS NAME .... Args after NAME are either a stat name (Average, Sum, …) or a dimension list (InstanceId=i-abc,Foo=bar). Any token containing = is treated as dims; the other is stat. Returns (stat, dims) with stat defaulting to Average and dims to empty when absent. Pure.
parse_named_arg
Pull a --flag VALUE style named argument out of a :command rest slice and parse it. Returns None if the flag is absent, the value is missing, or parsing fails. Used by commands like :logs-stream that take optional flags alongside their positional args. Pure.
parse_s3_url
Parse an s3://bucket/key/with/slashes URL into a (bucket, key) tuple. Returns None if the input isn’t an s3:// URL or the bucket or key is empty. Pure.
parse_tag_args
Parse a :tag KEY [value tokens…] argument list. Returns Some((key, value)) when there’s at least a key and one value token. Value tokens are joined with a single space — there’s no shell-style quoting, since we trust the operator and want the command bar to stay typeable.
pick_default_log_group
Pick the most useful CloudWatch Logs group for an env’s :logs-tail default. EB streams to a handful of groups per env (web.stdout.log, nginx access, eb-engine.log, …); we prefer the app stdout because that’s where deploy / runtime output lives. Falls back to the first by name. Pure for testability.
previous_version_label
Compact age formatter — “3s”, “12s”, “2m”, “1h”, “4d”. Used for the pending-actions overlay so ages stay short and uniform. Pure: the version label deployed before current, found by scanning events (newest-first, as DescribeEvents returns) for the first version_label that differs from current. EB tags each event with the version current at the time, so walking back, the first label ≠ current is the one the env ran before this deploy. None when no prior version appears in the window.
view_filter_value
Pure: extract the filter portion of an encoded saved view. Returns the empty string when the view doesn’t include a filter= part (which means “no filter” — operator wanted the view to clear whatever filter was set). Used by the chip-bar active-check + the cycle keybind.
wrap_with_hanging_indent
Wrap text at width columns, prefixing the first line with lead and subsequent lines with cont so continuation visually flows under the leader (e.g. "↳ " followed by aligned continuation). Greedy word-wrap; falls back to hard-break inside a word that won’t fit on its own line. Pure for testability.