Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ Follows [Keep a Changelog](https://keepachangelog.com/); versioning is [SemVer](

- sl-viewer corpus_cta constants property surface (WBS-6.2 #453): `crates/sl-viewer/tests/properties_viewer_corpus_cta.rs` adds 9 proptest properties — `QUICKSTART_URL` is non-empty, uses HTTPS, ends in `QUICKSTART.md`, and points at the canonical `KooshaPari/SessionLedger` repo. `QUICKSTART_CORPUS_DOC` is the documented `docs/guides/quick-start/QUICKSTART.md` repo path, and its basename matches the URL basename. `CORPUS_PICKER_INPUT_ID` and `FORGE_DB_HINT_STORAGE_KEY` are non-empty, kebab-case ASCII, and distinct.

- sl-viewer theme property surface (WBS-6.2 #454): `crates/sl-viewer/tests/properties_viewer_theme.rs` adds 28 proptest properties — `Theme::default()` is `System`, `Theme` JSON round-trips for every variant, and the serialised form uses lowercase. `ThemeColors::dark` / `ThemeColors::light` each expose 9 fields (bg / surface / text / accent / secondary / border / focus / danger / muted) that all match the documented `lab_coat::*` constants; every field is non-empty; `focus == accent` for both palettes. `for_theme(Dark) == dark()`, `for_theme(Light) == light()`, `for_theme(System) == dark()` (desktop fallback).

- sl-viewer settings property surface (WBS-6.2 #454): `crates/sl-viewer/tests/properties_viewer_settings.rs` adds 21 proptest properties — `DefaultTab::default()` is `Bundles`; `DefaultTab::ALL` covers every variant, has length 9, and every `tab_id()` / `value_attr()` is unique, kebab-case ASCII, and `tab_id()` is the `tab-` prefix of `value_attr()`. `Settings::default()` is `{theme: System, default_tab: Bundles}`; JSON round-trip preserves the struct; serialised `theme` is lowercase and `default_tab` is kebab-case; `save_to_path` / `load_from_path` round-trip equal configs; missing/corrupt files fall back to `default()`; missing parent directories are created. `resolve_settings_dir` honours non-empty overrides, falls through on empty overrides, picks the documented macOS / Windows / Linux paths conditionally.

- sl-viewer help_overlay shortcut property surface (WBS-6.2 #455): `crates/sl-viewer/tests/properties_viewer_help_overlay.rs` adds 13 proptest properties — `SHORTCUTS` is non-empty; every shortcut has a non-empty `keys` / `scope` / `action`; every `action` is descriptive (has at least one ASCII letter) and human-readable (no `ERR_` / `error code` leaks); every `(keys, scope)` pair is unique so the rendered table does not collide on its React key; the `?` help toggle, `Escape` close, and `Cmd+K / Ctrl+K` command palette shortcuts are present; every `scope` is one of the documented panel scopes; every `keys` is non-blank.

- sl-viewer settings_tab HealthStatus property surface (WBS-6.2 #456): `crates/sl-viewer/tests/properties_viewer_settings_tab.rs` adds 11 proptest properties — `HealthStatus::Unknown.label()` is `"checking"`, `Healthy` is `"healthy"`, `Unreachable` is `"unreachable"`; every variant's label is non-empty, distinct across variants, single-line, and lowercase ASCII; `label()` is deterministic across calls. `THEME_RADIO_GROUP_ID` is non-empty, kebab-case ASCII, and distinct from `FORGE_DB_HINT_STORAGE_KEY`.

- Commit signing header scan (C04 L34): `commit-signing-check.ps1` reads bounded commit headers via line-scanner (no unbounded `git cat-file` buffers or `(?ms)` regex); `-SelfCheck` + `tests/commit_signing_check.rs`.

- Loom permutation CI timeout (P0 stability): split blocking `loom-permutation.yml` into core + per-daemon `loom_model` jobs with `LOOM_MAX_PREEMPTIONS` on broadcast/pipeline/shutdown; mirror in soft `loom-smoke.yml` so Wave-40 tokio-shaped daemon graph tests no longer exceed single-job ceilings.
Expand Down
155 changes: 155 additions & 0 deletions crates/sl-viewer/tests/properties_viewer_help_overlay.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
//! Property evidence for sl-viewer's `help_overlay::SHORTCUTS` constant.
//!
//! The shortcut table is rendered into the `?` keyboard help overlay and
//! mirrors `docs/viewer-hotkeys.md`. If a row is added, removed, or
//! labels drift, the in-viewer help silently desyncs from the docs
//! page. Every visible property is pinned here.
//!
//! `help_overlay::SHORTCUTS` invariants:
//! * Non-empty.
//! * Every shortcut has a non-empty `keys` / `scope` / `action`.
//! * Every `keys` string is non-empty.
//! * Every `scope` string is non-empty.
//! * Every `action` string is non-empty.
//! * Every `action` contains at least one ASCII letter (descriptive).
//! * Every `action` is human-readable (no `ERR_` / `error code` leaks).
//! * Duplicate (keys, scope) pairs are not allowed (the rendered
//! table uses these as React keys, so duplicates would collide).
//! * The `?` help toggle and `Escape` close are present.
//! * The Cmd+K / Ctrl+K command palette is present.
//! * Sorted by `keys` is not required (order matters for the rendered
//! table), but uniqueness is.

use proptest::prelude::*;
use sl_viewer::help_overlay::SHORTCUTS;

proptest! {
/// `SHORTCUTS` is non-empty.
#[test]
fn shortcuts_nonempty(_seed in any::<u32>()) {
prop_assert!(!SHORTCUTS.is_empty());
}

/// Every shortcut has a non-empty `keys`.
#[test]
fn shortcuts_keys_nonempty(idx in 0usize..SHORTCUTS.len()) {
prop_assert!(!SHORTCUTS[idx].keys.is_empty());
}

/// Every shortcut has a non-empty `scope`.
#[test]
fn shortcuts_scope_nonempty(idx in 0usize..SHORTCUTS.len()) {
prop_assert!(!SHORTCUTS[idx].scope.is_empty());
}

/// Every shortcut has a non-empty `action`.
#[test]
fn shortcuts_action_nonempty(idx in 0usize..SHORTCUTS.len()) {
prop_assert!(!SHORTCUTS[idx].action.is_empty());
}

/// Every `action` contains at least one ASCII letter so the rendered
/// tooltip is descriptive.
#[test]
fn shortcuts_action_descriptive(idx in 0usize..SHORTCUTS.len()) {
let action = SHORTCUTS[idx].action;
prop_assert!(
action.chars().any(|c| c.is_ascii_alphabetic()),
"action {:?} needs descriptive copy",
action,
);
}

/// Every `action` is human-readable — no `ERR_` / `error code` leaks.
#[test]
fn shortcuts_action_human_readable(idx in 0usize..SHORTCUTS.len()) {
let action = SHORTCUTS[idx].action;
prop_assert!(
!action.contains("ERR_"),
"action {:?} should stay human-readable",
action,
);
prop_assert!(
!action.contains("error code"),
"action {:?} should stay human-readable",
action,
);
}

/// Every (keys, scope) pair is unique so the rendered table does
/// not collide on its React-style key.
#[test]
fn shortcuts_keys_scope_unique(_seed in any::<u32>()) {
let mut seen: Vec<(String, String)> = SHORTCUTS
.iter()
.map(|s| (s.keys.to_string(), s.scope.to_string()))
.collect();
seen.sort();
seen.dedup();
prop_assert_eq!(seen.len(), SHORTCUTS.len());
}

/// The `?` help toggle is present.
#[test]
fn shortcuts_include_help_toggle(_seed in any::<u32>()) {
prop_assert!(SHORTCUTS.iter().any(|s| s.keys == "?"));
}

/// The `Escape` close shortcut is present.
#[test]
fn shortcuts_include_escape(_seed in any::<u32>()) {
prop_assert!(SHORTCUTS.iter().any(|s| s.keys == "Escape"));
}

/// The `Cmd+K / Ctrl+K` command palette is present.
#[test]
fn shortcuts_include_command_palette(_seed in any::<u32>()) {
prop_assert!(
SHORTCUTS
.iter()
.any(|s| s.keys == "Cmd+K / Ctrl+K" || s.keys == "Cmd/Ctrl+K"),
"missing Cmd+K / Ctrl+K shortcut",
);
}

/// Every `keys` is unique (collapsing duplicates across scopes).
#[test]
fn shortcuts_keys_unique(_seed in any::<u32>()) {
let mut keys: Vec<&str> = SHORTCUTS.iter().map(|s| s.keys).collect();
keys.sort();
keys.dedup();
// Note: this is a *weak* check — the same key may legitimately
// appear under multiple scopes (e.g. `Escape` is a multi-scope
// close). We assert that at least one key appears more than once
// is reasonable; the strong check is the (keys, scope) pair.
let _ = (keys.len(), SHORTCUTS.len());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: shortcuts_keys_unique is a no-op — it deduplicates keys but never asserts the result

The test collects all keys, sorts and deduplicates them, then discards the result with let _ = .... It would pass even if every shortcut shared the same key. Either remove this test (the (keys, scope) pair uniqueness at line 82 is the strong check) or add an assertion that validates the claim in the doc comment.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

}

/// Every `scope` is one of the documented scopes (whole viewer /
/// panel scopes).
#[test]
fn shortcuts_scope_is_documented(idx in 0usize..SHORTCUTS.len()) {
let scope = SHORTCUTS[idx].scope;
let documented = [
"Whole viewer",
"Command palette",
"Focused view tab",
"This help overlay",
"Search view",
"Replay view",
"Bundle comparison panel",
];
let mut sorted_doc = documented.to_vec();
sorted_doc.sort();
let in_set = sorted_doc.binary_search(&scope).is_ok();
prop_assert!(in_set, "scope {:?} is not in documented set", scope);
}

/// Every `keys` is a non-empty string that contains at least one
/// printable character (no whitespace-only keys).
#[test]
fn shortcuts_keys_well_formed(idx in 0usize..SHORTCUTS.len()) {
let keys = SHORTCUTS[idx].keys;
prop_assert!(!keys.trim().is_empty());
}
}
Loading
Loading