fleetwire: the enrolment opener has no test seam — e2e drives fire a real xdg-open on the host #338

Closed
opened 2026-08-08 15:04:22 +00:00 by ben · 3 comments
Owner

internal/fleetwire/enrolment.go's RegisterPasskey opens the kanidm reset url via cfg.Open (default: the helper's own xdg-open). That is ADR 0051's design (the token never crosses the stdio bridge) — but Open is injectable ONLY in code; production wiring (wiring_prod.go) has no override, so any live drive that reaches enrolPasskey throws a REAL browser tab at the host's desktop (drive 18 did exactly this mid-drive). Phase 1 now avoids clicking the button (ADR 0132 / Finding L), but phase 2's Chromium leg will need to drive this path deliberately, and until then one stray click in a headed drive still fires it.

Fix shape: an env-var-gated override in the helper's wiring (e.g. OURCLOUD_E2E_OPEN_SINK=<file> — append the url instead of opening it), set by the e2e harness only; production default unchanged; unit test at the wiring seam. This also becomes phase 2's hook for reading the reset url. Never a fake in production paths (ADR 0100) — the knob selects a sink, it does not fabricate success.

`internal/fleetwire/enrolment.go`'s `RegisterPasskey` opens the kanidm reset url via `cfg.Open` (default: the helper's own xdg-open). That is ADR 0051's design (the token never crosses the stdio bridge) — but `Open` is injectable ONLY in code; production wiring (`wiring_prod.go`) has no override, so any live drive that reaches `enrolPasskey` throws a REAL browser tab at the host's desktop (drive 18 did exactly this mid-drive). Phase 1 now avoids clicking the button (ADR 0132 / Finding L), but phase 2's Chromium leg will need to drive this path deliberately, and until then one stray click in a headed drive still fires it. Fix shape: an env-var-gated override in the helper's wiring (e.g. `OURCLOUD_E2E_OPEN_SINK=<file>` — append the url instead of opening it), set by the e2e harness only; production default unchanged; unit test at the wiring seam. This also becomes phase 2's hook for reading the reset url. Never a fake in production paths (ADR 0100) — the knob selects a sink, it does not fabricate success.
Author
Owner

Blocked — target code is not on main. This slice cannot be implemented by a main-landing Sandcastle worker as written.

The fix's subject files all live only on origin/private-standup-polish (not merged to main):

  • internal/fleetwire/enrolment.go — the Enrolment opener with the injectable cfg.Open field. On main there is no internal/fleetwire package at all.
  • app/helper/cmd/helper/wiring_prod.go — on the polish branch this wires founding.WithEnrolment(fleetwire.NewEnrolment(...)) (line ~279). On main the same file marks {name: "enrolment", failLoud: "hand-off — its own slice (identity-handoff-scrub)"} — there is no opener to add an override to.
  • The entire e2e/Playwright drive harness that would set OURCLOUD_E2E_OPEN_SINK (app/playwright.config.ts, app/tests/e2e/…, the drive scripts) exists only on the polish branch; main has none of it.

535be44 (the fleetwire enrolment face) is on origin/private-standup-polish and is not an ancestor of main. So OURCLOUD_E2E_OPEN_SINK has nowhere to hook on main, and porting the whole arc to create one is far out of scope for this slice (it is the identity-handoff-scrub slice's own work).

Decision needed (judgement call):

  • A) Implement this directly on private-standup-polish (not a main-landing Sandcastle task), or
  • B) Merge the private-path e2e arc (private-standup-polish) into main first, then re-arm #338 for a Sandcastle worker.

I asked via the Sandcastle human-ask channel; no reply within the window. Moving to ready-for-human. A human re-arms by resolving the above and re-adding ready-for-agent.

**Blocked — target code is not on `main`.** This slice cannot be implemented by a main-landing Sandcastle worker as written. The fix's subject files all live **only on `origin/private-standup-polish`** (not merged to `main`): - `internal/fleetwire/enrolment.go` — the `Enrolment` opener with the injectable `cfg.Open` field. On `main` there is **no `internal/fleetwire` package at all**. - `app/helper/cmd/helper/wiring_prod.go` — on the polish branch this wires `founding.WithEnrolment(fleetwire.NewEnrolment(...))` (line ~279). On `main` the same file marks `{name: "enrolment", failLoud: "hand-off — its own slice (identity-handoff-scrub)"}` — there is **no opener to add an override to**. - The entire e2e/Playwright drive harness that would set `OURCLOUD_E2E_OPEN_SINK` (`app/playwright.config.ts`, `app/tests/e2e/…`, the drive scripts) exists **only on the polish branch**; `main` has none of it. `535be44` (the fleetwire enrolment face) is on `origin/private-standup-polish` and is **not an ancestor of `main`**. So `OURCLOUD_E2E_OPEN_SINK` has nowhere to hook on `main`, and porting the whole arc to create one is far out of scope for this slice (it is the `identity-handoff-scrub` slice's own work). **Decision needed (judgement call):** - **A)** Implement this directly on `private-standup-polish` (not a main-landing Sandcastle task), or - **B)** Merge the private-path e2e arc (`private-standup-polish`) into `main` first, then re-arm #338 for a Sandcastle worker. I asked via the Sandcastle human-ask channel; no reply within the window. Moving to `ready-for-human`. A human re-arms by resolving the above and re-adding `ready-for-agent`.
Author
Owner

Approved by Ben 2026-08-08 (decision sweep) as scoped: an env-gated sink in the helper's production wiring (e.g. OURCLOUD_E2E_OPEN_SINK=<file> — append the url instead of opening), set only by the e2e harness; production default unchanged; unit test at the wiring seam. Doubles as phase 2's hook for reading the reset url. Never a fake in production paths (ADR 0100) — the knob selects a sink. → ready-for-agent.

Approved by Ben 2026-08-08 (decision sweep) as scoped: an env-gated sink in the helper's production wiring (e.g. `OURCLOUD_E2E_OPEN_SINK=<file>` — append the url instead of opening), set only by the e2e harness; production default unchanged; unit test at the wiring seam. Doubles as phase 2's hook for reading the reset url. Never a fake in production paths (ADR 0100) — the knob selects a sink. → `ready-for-agent`.
Author
Owner

Done in 2e41f82 (on origin/main).

Implemented as approved (Ben, 2026-08-08 decision sweep) — the arc is now on main, so the original not-on-main blocker is resolved.

Helper wiring seam (app/helper/cmd/helper/wiring_prod.go): enrolmentOpener() reads OURCLOUD_E2E_OPEN_SINK. Unset → returns nil, so fleetwire.NewEnrolment falls back to its real xdg-open/open (production default unchanged, ADR 0051). Set → appends the kanidm reset URL to that file instead of opening a real browser tab. The knob selects a SINK, never fabricates success — RegisterPasskey still polls the real kanidm credential status (ADR 0100). Wired into the enrolment port's EnrolmentConfig.Open.

Unit tests at the wiring seam (wiring_test.go): TestEnrolmentOpener_ProductionDefaultIsNil (nil with no env → real opener) and TestEnrolmentOpener_SinkAppendsURL (both URLs appended in order to the sink file).

E2E harness hook (app/tests/e2e/fixtures/launch.ts): launchApp sets OURCLOUD_E2E_OPEN_SINK (e2e-only) under the run dir and exposes the diverted URLs via resetUrls() — phase 2's Chromium leg reads the reset URL from here rather than firing a real tab. The stale comment on the shell.openExternal stub (Finding L) was updated to point at the new fix.

Gate green (gofmt/vet/test/golangci-lint, both build tags, broker) via nix develop .#go-ci. STATUS.md updated (header + milestone log).

Note for the harness: the pre-push gate's go test ./... includes internal/vm's payload-assembly test, which shells out to pnpm install and aborts on the no-TTY modules-purge guard unless CI=true is set — pushed with CI=true. Unrelated to this slice, but worth the gate setting CI=true for its pnpm-invoking tests.

Done in `2e41f82` (on `origin/main`). Implemented as approved (Ben, 2026-08-08 decision sweep) — the arc is now on `main`, so the original not-on-main blocker is resolved. **Helper wiring seam** (`app/helper/cmd/helper/wiring_prod.go`): `enrolmentOpener()` reads `OURCLOUD_E2E_OPEN_SINK`. Unset → returns nil, so `fleetwire.NewEnrolment` falls back to its real xdg-open/open (production default unchanged, ADR 0051). Set → appends the kanidm reset URL to that file instead of opening a real browser tab. The knob selects a SINK, never fabricates success — `RegisterPasskey` still polls the real kanidm credential status (ADR 0100). Wired into the `enrolment` port's `EnrolmentConfig.Open`. **Unit tests at the wiring seam** (`wiring_test.go`): `TestEnrolmentOpener_ProductionDefaultIsNil` (nil with no env → real opener) and `TestEnrolmentOpener_SinkAppendsURL` (both URLs appended in order to the sink file). **E2E harness hook** (`app/tests/e2e/fixtures/launch.ts`): `launchApp` sets `OURCLOUD_E2E_OPEN_SINK` (e2e-only) under the run dir and exposes the diverted URLs via `resetUrls()` — phase 2's Chromium leg reads the reset URL from here rather than firing a real tab. The stale comment on the `shell.openExternal` stub (Finding L) was updated to point at the new fix. Gate green (gofmt/vet/test/golangci-lint, both build tags, broker) via `nix develop .#go-ci`. STATUS.md updated (header + milestone log). Note for the harness: the pre-push gate's `go test ./...` includes `internal/vm`'s payload-assembly test, which shells out to `pnpm install` and aborts on the no-TTY modules-purge guard unless `CI=true` is set — pushed with `CI=true`. Unrelated to this slice, but worth the gate setting `CI=true` for its pnpm-invoking tests.
ben closed this issue 2026-08-08 20:02:54 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#338
No description provided.