Tests: Signals' judging, pacing and icons #398

Closed
opened 2026-11-06 19:51:41 -08:00 by rays · 1 comment
Owner

signals.rs is at 45% of its lines: pass (70 lines), ask, judge, pace, back_off, check_key, pick_icon and called never run, and in web.rs the Signal handlers (add_signal, patch_signal, remove_signal, pick_signal_icon, signal_description, signal_entries) are untested; on the page, signals.ts is at 32% (renderSignals, signalAction, keySetting, signalHead, feedRow). The browser Signals tests skip themselves unless the Signals code changed (#271), so a coverage run does not reach them either; the fixture server's /jev stands in for TypeSafe, so they need not spend a key.

Tests to add:

  • cargo, against the fixture-style Jev stub: a pass judges each new item once, stores hits, and moves on; a 429 backs off (rate_limited) and the next call waits for its turn (paced_ms); a refused key stops that person's judging (key_refused) without stopping others'; a malformed request is counted (#257)
  • the server's key and a person's own: whose tokens are counted (ipx_jev_tokens_total{key}, #278)
  • the API: making, renaming, re-wording and deleting a Signal; picking its icon; its entries list; another person's Signal is 404
  • the page: the Signals folder draws, a Signal's actions (edit, delete) work, and the key setting in Settings turns Signals on and off
  • run the browser Signals tests in the coverage run (IPX_SIGNALS_TESTS=1) so the API's numbers include them

Seen with the coverage of both suites merged line by line (cargo: sh scripts/coverage.sh, browser: sh scripts/coverage.sh api; reports in target/coverage/cargo, api and page; #390, #394), as of 2026-11-07. A test added here shows in Grafana's Coverage row at the next run.

signals.rs is at 45% of its lines: `pass` (70 lines), `ask`, `judge`, `pace`, `back_off`, `check_key`, `pick_icon` and `called` never run, and in web.rs the Signal handlers (`add_signal`, `patch_signal`, `remove_signal`, `pick_signal_icon`, `signal_description`, `signal_entries`) are untested; on the page, signals.ts is at 32% (`renderSignals`, `signalAction`, `keySetting`, `signalHead`, `feedRow`). The browser Signals tests skip themselves unless the Signals code changed (#271), so a coverage run does not reach them either; the fixture server's /jev stands in for TypeSafe, so they need not spend a key. Tests to add: - cargo, against the fixture-style Jev stub: a pass judges each new item once, stores hits, and moves on; a 429 backs off (`rate_limited`) and the next call waits for its turn (`paced_ms`); a refused key stops that person's judging (`key_refused`) without stopping others'; a malformed request is counted (#257) - the server's key and a person's own: whose tokens are counted (`ipx_jev_tokens_total{key}`, #278) - the API: making, renaming, re-wording and deleting a Signal; picking its icon; its entries list; another person's Signal is 404 - the page: the Signals folder draws, a Signal's actions (edit, delete) work, and the key setting in Settings turns Signals on and off - run the browser Signals tests in the coverage run (IPX_SIGNALS_TESTS=1) so the API's numbers include them Seen with the coverage of both suites merged line by line (cargo: `sh scripts/coverage.sh`, browser: `sh scripts/coverage.sh api`; reports in target/coverage/cargo, api and page; #390, #394), as of 2026-11-07. A test added here shows in Grafana's Coverage row at the next run.
rays added the enhancement label 2026-11-06 19:51:41 -08:00
Author
Owner

Tests added in 980fbc3. cargo, against a stand-in for Jev (signals.rs tests::jev, answering by key): a pass judges each item once, keeps verdicts and bills the owner's key (ipx_jev_tokens_total's source, STATS.billed); a refused key stops only its owner and is not sent again (key_refused); a 429 stops the pass and the next call waits out Retry-After (rate_limited, paced); a 422 stops the pass (malformed, #257); check_key and pick_icon, the latter refusing an icon it was not offered. web.rs: make, validate, rename, re-word, clear the icon, list entries, delete, and another person's Signal 404. Browser: rename and delete from the Signal's page. scripts/coverage.sh sets IPX_SIGNALS_TESTS=1. Not done: the server-key judging path in cargo (server_key reads TYPESAFE_KEY from the environment, which the browser test 'the server pays for Signals' covers), and POST /api/signals/icon, which needs TYPESAFE_KEY too.

Tests added in 980fbc3. cargo, against a stand-in for Jev (signals.rs tests::jev, answering by key): a pass judges each item once, keeps verdicts and bills the owner's key (ipx_jev_tokens_total's source, STATS.billed); a refused key stops only its owner and is not sent again (key_refused); a 429 stops the pass and the next call waits out Retry-After (rate_limited, paced); a 422 stops the pass (malformed, #257); check_key and pick_icon, the latter refusing an icon it was not offered. web.rs: make, validate, rename, re-word, clear the icon, list entries, delete, and another person's Signal 404. Browser: rename and delete from the Signal's page. scripts/coverage.sh sets IPX_SIGNALS_TESTS=1. Not done: the server-key judging path in cargo (server_key reads TYPESAFE_KEY from the environment, which the browser test 'the server pays for Signals' covers), and POST /api/signals/icon, which needs TYPESAFE_KEY too.
rays closed this issue 2026-11-06 20:15:54 -08:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rays/ipx#398