fix(#1394): recover-token headless — dual path (--email flag + piped stdin) with documented precedence #1423

Merged
ops-deploy-01 merged 2 commits from fix/1394-recover-token-headless into next 2026-08-25 16:14:56 +00:00
2 Commits
Author SHA1 Message Date
ops-deploy-01 4dfbab868d test(#1394): pre-existing recover-token specs follow the new non-TTY path
ci/woodpecker/pr/ci Pipeline was successful
The old specs mocked promptLine/promptSecret and relied on the prompt path
being taken unconditionally — which is precisely the behavior #1394 removes
(non-TTY must NOT sit on prompts). Under vitest stdin is non-TTY, so the
new code correctly routed to piped-stdin credentials and the specs hung on
the unmocked reader (4/7 timeouts). The specs now mock the
piped-credentials seam with the same fixed values and assert that seam (not
the prompts) was consulted; titles state the actual path. All 7 pass; suite
1667/1667 (remaining local failure is the known host pi-invariant, CI pins
pi 0.84.1).
2026-08-25 10:41:14 -05:00
ops-deploy-01 96eb0fb010 fix(#1394): recover-token headless — dual path (flag + piped stdin) with documented precedence
ci/woodpecker/pr/ci Pipeline failed
ensureSession credential resolution when sign-in is needed, in order:
1. explicit --email flag (highest)
2. non-TTY stdin: line 1 email, line 2 password (printf 'email\npassword\n' | …)
   — for headless callers without argv access
3. interactive prompt (TTY only)
Precedence documented on ensureSession and in --help; headless with NO
credentials exits 2 with guidance instead of hanging on prompts.
Password never read from argv (ps-visible); stdin line kept untrimmed.
New piped-credentials.ts module so the reader is testable against real
streams (4 stream specs) while token-ops specs mock the seam (5 specs).
2026-08-25 10:08:14 -05:00