Skip to content

test(detect-view): pin the card clamps and the feed flag - #693

Merged
kirillDevPro merged 1 commit into
mainfrom
test/detect-view-clamps
Sep 22, 2026
Merged

kirillDevPro merged 1 commit into
mainfrom
test/detect-view-clamps

Conversation

@kirillDevPro

Copy link
Copy Markdown
Collaborator

What & why

crates/moon-core/src/config/detect_view.rs decides how a detection card is drawn and whether chart-routed detects join a group's feed. The round-trip tests never called the clamps or the per-group flag, so a cap that moved by one pixel or one size would stay green.

Tests, and the mutation that proved each one

All six went red on an assertion, then green again after the production file was restored. git diff on detect_view.rs was empty.

  • slot_count_follows_the_card_grid — medium's slot count changed from 6 to 5. The test reported left: 5, right: 6.
  • rail_width_clamps_to_five_pixelsrail_w_clamped returned the stored width. A stored 6 came back as 6, not 5.
  • rail_gradient_clamps_to_the_card_width — the gradient clamp was removed. A stored 101 on a card 100 wide came back as 101.
  • card_size_clamps_to_largesize_clamped returned the stored size. Size 3 came back as 3, not large (2).
  • delta_decimals_clamp_to_two_places — the cap moved from 2 places to 3. A stored 3 came back as 3.
  • add_to_chart_follows_only_the_named_group — the flag was read from any group, not the named one. "beta" came back true after only "alpha" had opted in.

Review

One clean-context pass asked whether the tests check behaviour or are shaped to pass. It kept all six. Nothing was dropped.

Still untested in this file

size_cfg, size_cfg_mut, active, load, and save. The first three are pure routing; load and save are file I/O. The existing round-trip tests already exercise Default, to_share_string, parse_share, group, and set_group.

How to verify

cargo test -p moon-core --lib detect_view

cargo fmt --all, cargo clippy --workspace --all-targets, and cargo test --workspace were green locally before push. Clippy still warns in other crates; this diff adds none.

A stored rail, gradient, size, or delta precision past its cap was
unchecked, and so was which group actually asked for chart-routed
detects. Each new test fails when that one boundary moves.
@kirillDevPro
kirillDevPro merged commit dd93eff into main Sep 22, 2026
8 checks passed
@kirillDevPro
kirillDevPro deleted the test/detect-view-clamps branch September 22, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant