Skip to content

feat(cli): record evidence for every desktop input command - #440

Merged
ElbertePlinio merged 8 commits into
mainfrom
feat/409-cli-input-evidence
Oct 29, 2026
Merged

ElbertePlinio merged 8 commits into
mainfrom
feat/409-cli-input-evidence

Conversation

@ElbertePlinio

@ElbertePlinio ElbertePlinio commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

desktop move, scroll, double-click, key and type in the CLI now record one evidence action each, as desktop click and desktop drag already did and as the MCP tools do. pointerWithEvidence became inputWithEvidence, one helper for all seven commands, with the same action names, target fields and input states as the MCP tools. A refusal before dispatch (human control, a missing permit, an unverified display, text preparation) records not-attempted, a failure after dispatch records attempted, and success records completed. Evidence stays best effort: its failures never block the input or change the command result.

Typed text never enters evidence: type and key keep only the length and input type. Review found that a failed xdotool key call echoed its argv, so the key reached evidence through the error text, on the MCP path as well. pressKey now throws "Desktop key dispatch failed" with only the exit reason for any dispatch error other than a display refusal, and refuses a key with a NUL character before the permit. The MCP schema refuses a NUL key too.

Closes #409

Requirement Verified by Scenario and edge cases Result Evidence
Record move, scroll, double-click, key and type actions desktop-input-evidence.test.ts (35 tests), CLI QA on a private session Each command with evidence on and off; scroll with and without a point; one action per command One action each with the MCP tool's fields; 34 of 35 tests fail on the old source (the evidence-off case behaves the same) 409/before-old-source.log, 409/qa.sh, 409/qa.log
Tests for success, refusal (not-attempted) and failure (attempted) Same file Human control, missing permit, unverified display, text preparation failure, dispatch failure, timeout States and statuses match the MCP tools 409/after-focused.log
Typed text never enters evidence QA marker search, pointer-target.test.ts, live MCP desktop.test.ts Typed marker; failed key with an unknown key name; key with a NUL; any other dispatch error Marker absent from evidence, stdout and stderr; key errors carry no key; NUL refused before dispatch with no action; tests fail on the old code 409/round2/, 409/round3/before.log

Evidence paths are under ~/.pickforge/investigations/ on the review host.

Sol review, round 1: 7/10, a failed key dispatch stored the key in evidence; fixed in 79d3bdf. Round 2: 5/10, a NUL key's spawn error still carried the key and recorded attempted; fixed in 8997260. Declined from round 2: on success the CLI prints the key and returns it as data.key. That output goes to the caller who passed the key, the MCP tool returns the same field, and the issue covers evidence only. Round 3: 9/10, no findings. 8997260 also drops a parameter from recordInputAction for PickCheck.

Checks on 0b5e6ac: oxlint, typecheck, build; full vitest coverage run with the desktop, window, wait, browser and viewer requirements on (192 files, 3466 passed, 4 skipped); PICKFORGE_REQUIRE_XVFB=1 cargo test --workspace --locked (328 passed). PickCheck 0.4.0 against main is clean.

8f6c769 adds the test marker pf409-private-key-marker to the .gitleaks.toml fixture allowlist by its exact value: the generic-api-key rule read const key = "…" in pointer-target.test.ts as a key. A local gitleaks scan of main and of this branch with the new config is clean.

Move, scroll, double-click, key and type now record one evidence action
with its input state, the same names, targets and states the MCP tools
record. Typed text keeps only its length and input type. Refusals before
dispatch record not-attempted, and failures after dispatch record
attempted.

Closes #409
A failed xdotool key call echoed its argv, so the CLI and MCP evidence stored the key that evidence keeps only as a length.
…ent-free

A NUL in a key made the spawn error echo the key into the MCP response and evidence. The MCP schema now refuses it, pressKey checks it before the permit, and any dispatch error other than a target refusal loses its detail.
…idence

# Conflicts:
#	packages/desktop-linux/test/pointer-target.test.ts
@ElbertePlinio
ElbertePlinio merged commit 567632a into main Oct 29, 2026
14 of 15 checks passed
@ElbertePlinio
ElbertePlinio deleted the feat/409-cli-input-evidence branch October 29, 2026 15:15
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.

cli: record evidence for every desktop input command

1 participant