Skip to content

test: share the terminal ID rejection fixture - #14770

Merged
rjwalters merged 1 commit into
mainfrom
feature/issue-14768
Nov 20, 2026
Merged

rjwalters merged 1 commit into
mainfrom
feature/issue-14768

Conversation

@rjwalters

@rjwalters rjwalters commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Run all 20 existing rejection inputs through one daemon and client fixture. Preserve the valid-ID, two-client and malformed-message tests.
  • Require the daemon's empty or invalid ID diagnostic for each row. A connection, I/O or JSON parse failure now fails the row.
  • Remove seven daemon starts and teardowns, seven client connections and seven setup calls per full run. The binary has four integration scenarios and retains the shared guard self-tests.

Verification

  • Compared the before and after input inventory. All 20 original inputs are distinct and appear once in the consolidated table.
  • cargo nextest run --locked --profile ci -j 1 --no-fail-fast --status-level pass -p loom-daemon --test integration_security passed on macOS with an isolated Cargo target and tmux socket. Nine tests passed and one guard self-test was skipped by the CI profile. All four integration scenarios ran. The initial two-thread run hit a failure in the unchanged valid-ID test, which passed in the single-thread run.
  • rustfmt --edition 2021 --check --config skip_children=true loom-daemon/tests/integration_security.rs and git diff --check passed.

Ordinary hosted CI remains pending.

Closes #14768

loom dashboard

@rjwalters rjwalters added the loom:review-requested PR ready for Judge to review. Applied by: Builder when opening PR. label Nov 20, 2026
@loom-fleet-dispatch

loom-fleet-dispatch Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

PR #14770's loom:reviewing claim is held by the judge of sweep step-judge-14770-1795164302 on host host-d0749b00. This comment is a PR lease record (#9401): its liveness signal is its own forge-assigned updated_at, renewed while the judge works and released when it is done. Another judge that finds this lease live stands down before touching a worktree. See defaults/docs/lease-record.md § "PR-phase leases".

@loom-fleet-dispatch loom-fleet-dispatch Bot added the loom:reviewing Judge is reviewing this PR. Applied by: Judge only. Stale after LOOM_STALE_REVIEWING_MINUTES (30m). label Nov 20, 2026
@loom-fleet-dispatch

Copy link
Copy Markdown
Contributor

Judge: code review of c495ea33 complete (diff, input inventory, error-string match, rustfmt all verified). Waiting in the foreground for the pending CI checks (Rust Unit Tests 1-5/5, Native Port Suites, OTLP Collector Test) before issuing a verdict.

@loom-fleet-dispatch

Copy link
Copy Markdown
Contributor

✅ Approved!

Test-only consolidation of loom-daemon/tests/integration_security.rs. Every acceptance criterion re-derived independently against the PR head c495ea33, reviewed in .loom/worktrees/pr-14770 (HEAD matched the PR head, worktree clean).

Spec reconciliation

spec=28df6f3a05bbcf3f comments=7034316499@2026-11-20T08:26:35Z,7034404811@2026-11-20T08:29:12Z,7034413208@2026-11-20T08:29:08Z,7034447847@2026-11-20T08:30:59Z,7034452145@2026-11-20T08:31:13Z,7034463520@2026-11-20T08:31:49Z,7034516551@2026-11-20T08:34:38Z,7034629173@2026-11-20T08:40:18Z
baseline: none - no earlier spec baseline available; reviewed against current requirements

No material difference between #14768's current requirements and this PR's scope. The eight trusted comments on the issue are all lease/Champion-promotion records — none revises the spec. Closes #14768 present; #14768 is not loom:epic/loom:epic-phase, so the closing keyword is correct and is the body's only closing reference.

Acceptance criteria — measured

AC1 — 20 distinct literals, each once, same request shape. Verified against merge-base 8e1a924e: the old table held 13 literals and the seven standalone tests held 7 (the semicolon-chained destructive command, $(whoami), the pipe-to-netcat payload, the backtick substitution, the ampersand background payload, the newline-chained payload, and the empty string). The new invalid_ids array holds exactly those 20, in order, no additions, no duplicates. All still go through client.create_terminal(id, None) — unchanged request shape.

AC2 — every row observes the daemon's terminal-ID validation; connection/I/O/parse errors fail. This is the criterion that mattered for sharing one daemon, and it holds. Traced the whole path rather than trusting the assertion text:

  • terminal.rs:33-48 validate_terminal_id emits exactly Terminal ID cannot be empty and Invalid terminal ID: '{id}'. … — both substrings the test asserts, including the trailing colon.
  • ipc.rs:2406-2410 maps the failure to Response::StructuredError(DaemonError::from(e)); errors.rs:384 preserves the original message verbatim (TERMINAL_INVALID_ID is categorised with message, not replaced).
  • types.rs tags Response #[serde(tag="type", content="payload")], and DaemonError.message (errors.rs:131) is serialised unconditionally, so the message reaches the wire.
  • tests/common/mod.rs create_terminal_with_config finds a payload without id and bails Unexpected response: {response:?}, whose Debug rendering contains the daemon's message — hence the contains() assertion matches.
  • A broken connection, read timeout or parse failure propagates from send_request via ? with Failed to write request / Timeout reading response / Failed to parse response JSON — none of which contains either expected substring, so such a row fails rather than passing silently. That closes the Curator's stated risk ("a shared daemon test that accepts any error could pass later rows after losing the connection"), and the new assertion is strictly stronger than the result.is_err() it replaces.
  • Validation runs before any tmux allocation (terminal.rs create_terminal calls validate_terminal_id(config_id)? first), so all 20 rejected calls legitimately share one daemon and leak no sessions.
  • Per-row diagnostics name the offending input ({id:?}), so a failing row is identifiable.

AC3 — one setup/harness; other tests unchanged. Binary now lists 4 #[tokio::test] functions: test_accept_valid_ids, test_reject_invalid_terminal_ids, test_terminal_isolation_between_clients, test_reject_malicious_json. The valid-ID, two-client isolation and malformed-JSON tests are byte-identical in the diff. Production validator and its terminal.rs unit tests untouched.

AC4 — scope. The paginated files API returns exactly one file: loom-daemon/tests/integration_security.rs (374 to 239 lines, 135 removed). No dependency, workflow, .config/nextest.toml group or cleanup change. Repo-wide grep for the renamed test_reject_various_shell_chars and all seven removed test names returns zero references outside the file itself, so the rename breaks no workflow filter, nextest selector or doc.

Checks run here

  • rustfmt --edition 2021 --check --config-path . --config skip_children=true loom-daemon/tests/integration_security.rs — clean (exit 0).
  • CI: LOOM-CHECKS-GREEN c495ea33ede132497239159cf3ac94ec4e1aa543 — all checks green at the exact reviewed head, waited in-turn until they settled. mergeStateStatus=CLEAN. I did not re-run the test suite locally: CI is the test gate (Host-side test burden to a bare minimum: CI is the test gate, Builders don't run the suite (operator direction 2026-10-13) #11690), and cargo clippy … -- -D warnings in ci.yml:495 enables no pedantic group, so the match/panic! form raises no lint.
  • Formal reviews / inline threads: check-review-feedback.sh gave REVIEW_FEEDBACK_STATE=CLEAR (0 reviews, 0 inline comments, resolution read via GraphQL).

One non-blocking note

The PR's Verification section says "Nine tests passed and one guard self-test was skipped by the CI profile". I could not reproduce that count: this binary defines 4 test functions, loom-daemon/tests/common/ defines none (grep -nE '#\[test\]|#\[tokio::test\]|fn test_' loom-daemon/tests/common/ returned no matches), and the guard self-tests live in defaults/scripts/tests/nextest-daemon-guard.sh, outside this target. So a -p loom-daemon --test integration_security run should list 4, not 9+1. The file-level facts the PR claims (20 cases, 4 scenarios, inventory preserved) all check out, so this looks like a stray count from a wider invocation rather than anything wrong with the change — worth tightening in future verification prose, not worth a round-trip.

Live-verification triggers do not fire: the diff drives no browser/scraper/DOM parser, and #14768's body contains none of the silent-omission fragments (scanned). No TDD: line, which is advisory and expected for a test-only consolidation.

loom dashboard

@loom-fleet-dispatch loom-fleet-dispatch Bot added loom:pr PR approved by Judge, ready for Champion auto-merge. Applied by: Judge. and removed loom:review-requested PR ready for Judge to review. Applied by: Builder when opening PR. loom:reviewing Judge is reviewing this PR. Applied by: Judge only. Stale after LOOM_STALE_REVIEWING_MINUTES (30m). labels Nov 20, 2026
@rjwalters

rjwalters commented Nov 20, 2026 •

Copy link
Copy Markdown
Member Author

PR #14770's (no label: the lease is the claim) claim is held by the champion of sweep sweep-insession-s38728-ThuNov191721502026 on host host-d9142cf3. This comment is a PR lease record (#9401): its liveness signal is its own forge-assigned updated_at, renewed while the champion works and released when it is done. Another champion that finds this lease live stands down before touching a worktree. See defaults/docs/lease-record.md § "PR-phase leases".

@rjwalters

Copy link
Copy Markdown
Member Author

Champion Auto-Merge

  • Fleet Judge approval matches the signed and GitHub-verified head c495ea33ede132497239159cf3ac94ec4e1aa543. Hosted CI succeeded on that head.
  • One integration test file changes. Independent source comparison found all 20 existing rejection inputs exactly once and byte-identical bodies for the three control tests. Each rejection now requires its corresponding daemon validation diagnostic. Test setup and daemon starts decrease from 11 to 4, and client connections decrease from 12 to 5. The changes preserve production code and the test runner's existing isolation configuration.
  • The Builder's serial log records all four integration scenarios and five imported live_gh_guard self-tests passing, with one guard self-test skipped. This explains the nine-test count raised in review. The earlier two-thread run failed in the unchanged valid-ID case. The CI profile continues to serialize daemon integration tests.
  • The one-file diff clears the critical-path check and exact ratification and hold reads. It combines cleanly with current main. The approved change is recent.

Proceeding with the repository's merge-commit path.

Automated by Champion role

loom dashboard

@rjwalters
rjwalters merged commit d78abff into main Nov 20, 2026
24 checks passed
@rjwalters
rjwalters deleted the feature/issue-14768 branch November 20, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

loom:pr PR approved by Judge, ready for Champion auto-merge. Applied by: Judge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collapse seven copy-pasted injection tests in integration_security.rs into the table-driven test

1 participant