copy deck and gate for tunnel WebSockets (#471 Task 0)
TWS-C01..C03 approved unchanged by Paul 2026-10-30. The gate mirrors the fleet public routes gate; the built list is empty until Task 5.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
approved_tunnel_websockets_copy_test.go+107 −0docs/superpowers/plans/2026-10-30-tunnel-websockets-copy.md+36 −0
Intent
<task-notification> <task-id>aed943213b25f3692</task-id> <tool-use-id>toolu_019F1teaWZXUDFE5YwdhWncP</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/aed943213b25f3692.output</output-file> <status>completed</status> <summary>Agent "Plan 6 Task 3: record marker" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>**Status: DONE_WITH_CONCERNS.** Task 3 is built and committed. Its census overlay still needs Astra's approval on #280 before merge. **Commit:** f49c43b1 on rootfs-apps-6-interactive (base de4246b9). Not pushed. **Tests:** I wrote the 7 Task 3 tests first and they failed to build (`undefined: SetRecordInteractive`). They now pass, along with the Step 4 census and writer tests and a wider regex run over `internal/provision`. Vet, gofmt and `go build ./...` are clean. The test binaries compile for every package that builds `Record` or `ReconcileConfig` literals, and the darwin, windows and linux/arm64 cross-builds pass. 10 mutations, all caught. One (storing PickupBy without converting to UTC) slipped through at first, so I changed the fixture to a +01:00 time and it is now caught. **What changed:** - **New file `internal/provision/interactive.go`:** everything the brief specifies. `SetRecordInteractive` is a single `updateRecord` call, as `SetRecordRun` is. `TestSetRecordInteractiveIsJudged` shows a stale record is refused with `os.ErrNotExist` and its bytes are unchanged. A vouched record under the judge and an unjudged context both write normally, which are the positive controls. - **`Record.Interactive`:** added beside `ActiveRun`. - **`ReconcileConfig.InteractiveSeen`:** added beside `RunSeen`, and called right after RunSeen's call. That is at `reconcile.go:1662` per the preflight table, not the plan's `:1177`. - **Move transitions:** untouched. - **Callers:** no existing function's signature changed, so there were no callers to migrate. The two structs only gained fields. **Census:** I followed the 2026-10-26 recipe. The card shows one unit, `Reconcile`, with a body change and no new read sites (still 178), and the `internal/provision` envelope re-pinned. That produced: - the overlay `plan14-root-reads-rootfs-apps-6.tsv` and its line in the chain file - the card at `docs/superpowers/notes/census-proposal-rootfs-apps-6.md` **Concerns:** 1. The root-read overlay needs Astra's approval on #280. I did not post or request it. 2. The brief didn't mention the record-write census, but `TestPlan9B8RecordWriteCensus` failed on the new writer. I added `rootfs_apps_6_census_test.go`, which lists `SetRecordInteractive` as a typed writer and re-pins `Reconcile`. I also added `"setrecordinteractive"` to `censusKeyExact` so the callers Tasks 10–12 add will show up in the census. A reviewer should confirm that addition. 3. A malformed admission means an empty ID, Console or PickupBy. The ID's format is not checked here, because `provision` doesn't import `internal/interactive`. 4. I did not add a test that only the Interactive* transitions write the field (like `TestOnlyRunAdmitWritesRunKeys`); the brief didn't ask for one. The full report (results before and after, the mutation table, the census card) is in `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/rootfs-apps-6/.superpowers/sdd/2026-10-24-rootfs-apps-6-interactive/task-3-report.md`.</result> <usage><subagent_tokens>126125</subagent_tokens><tool_uses>44</tool_uses><duration_ms>652211</duration_ms></usage> </task-notification>
Attributed to this commit: 14.2 g CO₂e (1,842,689 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-tunnel-websockets-471, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/approved_tunnel_websockets_copy_test.go b/approved_tunnel_websockets_copy_test.go| new file mode 100644 |
| index 000000000..ca4e39166 |
| --- /dev/null |
| +++ b/approved_tunnel_websockets_copy_test.go |
| @@ -0,0 +1,107 @@ |
| +// approved_tunnel_websockets_copy_test.go |
| +package main |
| + |
| +import ( |
| + "os" |
| + "regexp" |
| + "strings" |
| + "testing" |
| +) |
| + |
| +// The copy gate of the tunnel WebSockets feature (plan |
| +// 2026-10-30-tunnel-websockets.md Task 0), over its one deck. It is |
| +// approved_fleet_routes_copy_test.go's gate with this deck's path and id |
| +// prefix, and no const-floor rows (no TWS row has a placeholder): |
| +// |
| +// - TestTunnelWebSocketsCopyRecordIsComplete: the deck names exactly |
| +// tunnelWebSocketsCopyIDs; |
| +// - TestTunnelWebSocketsCopyHasNoEmDash: no em dash and no en dash in a text; |
| +// - TestTunnelWebSocketsCopyBuiltIsApproved: an id in |
| +// tunnelWebSocketsCopyBuilt is an approved row, so no pending string |
| +// reaches code or docs; |
| +// - TestTunnelWebSocketsCopyBuiltIsApplied: a built row's text is in the |
| +// file it names. |
| +const tunnelWebSocketsCopyRecordPath = "docs/superpowers/plans/2026-10-30-tunnel-websockets-copy.md" |
| + |
| +// Canonical ids only: two digits from C01 to C99, three digits from C100. No |
| +// leading zero on a three-digit id, no C00. |
| +var tunnelWebSocketsCopyIDPattern = regexp.MustCompile(`^TWS-C(0[1-9]|[1-9][0-9]{1,2})$`) |
| + |
| +// tunnelWebSocketsCopyIDs is the deck's inventory, pinned as a literal list in |
| +// the deck's order. A struck row stays in it: the deck keeps the row for |
| +// history. |
| +var tunnelWebSocketsCopyIDs = []string{"TWS-C01", "TWS-C02", "TWS-C03"} |
| + |
| +// tunnelWebSocketsCopyStatuses are the statuses the deck may carry: the |
| +// rootfs deck's three, so a superseded row can be struck rather than deleted. |
| +var tunnelWebSocketsCopyStatuses = []string{"pending", "approved", "struck"} |
| + |
| +// tunnelWebSocketsCopyBuilt is every id whose text the code or docs carry. |
| +// The task that writes a row's text adds its id here in the same commit, once |
| +// the row is approved. Task 5 builds all three (TWS-C01 to TWS-C03). |
| +var tunnelWebSocketsCopyBuilt = []string{} |
| + |
| +func mustParseTunnelWebSocketsRecord(t *testing.T) []copyRow { |
| + t.Helper() |
| + raw, err := os.ReadFile(tunnelWebSocketsCopyRecordPath) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + rows, err := parseCopyTableStatuses(string(raw), tunnelWebSocketsCopyRecordPath, tunnelWebSocketsCopyIDPattern, "a TWS-C<nn>", tunnelWebSocketsCopyStatuses...) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + return rows |
| +} |
| + |
| +func TestTunnelWebSocketsCopyIDPattern(t *testing.T) { |
| + for _, ok := range []string{"TWS-C01", "TWS-C99", "TWS-C100"} { |
| + if !tunnelWebSocketsCopyIDPattern.MatchString(ok) { |
| + t.Errorf("%s refused", ok) |
| + } |
| + } |
| + for _, bad := range []string{"TWS-C1", "TWS-C00", "TWS-C001", "TWS-C1000", "TWS-1-C01", "FPR-C01", "tws-c01"} { |
| + if tunnelWebSocketsCopyIDPattern.MatchString(bad) { |
| + t.Errorf("%s accepted", bad) |
| + } |
| + } |
| +} |
| + |
| +func TestTunnelWebSocketsCopyRecordIsComplete(t *testing.T) { |
| + reportAll(t, checkMovesInventory(mustParseTunnelWebSocketsRecord(t), tunnelWebSocketsCopyIDs)) |
| +} |
| + |
| +func TestTunnelWebSocketsCopyHasNoEmDash(t *testing.T) { |
| + rows := mustParseTunnelWebSocketsRecord(t) |
| + reportAll(t, checkMovesNoEmDash(rows)) |
| + for _, r := range rows { |
| + if strings.ContainsRune(r.Text, '–') { |
| + t.Errorf("%s: the text holds an en dash", r.ID) |
| + } |
| + } |
| +} |
| + |
| +func TestTunnelWebSocketsCopyBuiltIsApproved(t *testing.T) { |
| + reportAll(t, checkRunBuilt(mustParseTunnelWebSocketsRecord(t), tunnelWebSocketsCopyBuilt)) |
| +} |
| + |
| +// tunnelWebSocketsAppliedText is a row's text as the code prints it: the deck |
| +// writes a newline as a literal backslash-n, and Markdown needs a backslash |
| +// before a pipe inside a table cell, which Go must not print. |
| +func tunnelWebSocketsAppliedText(s string) string { |
| + return strings.NewReplacer(`\n`, "\n", `\|`, "|").Replace(s) |
| +} |
| + |
| +func TestTunnelWebSocketsCopyAppliedTextUnescapes(t *testing.T) { |
| + if got, want := tunnelWebSocketsAppliedText(`a \| b\nc`), "a | b\nc"; got != want { |
| + t.Errorf("tunnelWebSocketsAppliedText = %q, want %q", got, want) |
| + } |
| +} |
| + |
| +func TestTunnelWebSocketsCopyBuiltIsApplied(t *testing.T) { |
| + rows := builtRows(mustParseTunnelWebSocketsRecord(t), tunnelWebSocketsCopyBuilt) |
| + for i := range rows { |
| + rows[i].Text = tunnelWebSocketsAppliedText(rows[i].Text) |
| + } |
| + reportAll(t, checkRunApplied(rows, ".")) |
| +} |
diff --git a/docs/superpowers/plans/2026-10-30-tunnel-websockets-copy.md b/docs/superpowers/plans/2026-10-30-tunnel-websockets-copy.md| new file mode 100644 |
| index 000000000..a5d6edfa7 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-10-30-tunnel-websockets-copy.md |
| @@ -0,0 +1,36 @@ |
| +# Tunnel WebSockets: copy deck |
| + |
| +Every user-facing string of the tunnel WebSockets feature (spec |
| +`docs/superpowers/specs/2026-10-30-tunnel-websockets-design.md` rev 4, plan |
| +`docs/superpowers/plans/2026-10-30-tunnel-websockets.md`). The gate is |
| +`approved_tunnel_websockets_copy_test.go` at the repo root, which reads this |
| +deck in the format of `2026-10-30-fleet-public-routes-copy.md`: columns id, |
| +file, text, status. Ids are `TWS-C01` upward, never renumbered. |
| + |
| +Every row was a `pending` draft until copy review settled the words. Paul |
| +approved all three unchanged on 2026-10-30 |
| +(`.superpowers/sdd/2026-10-30-tunnel-websockets/copy-approved.json`). A row |
| +comes back `approved` with its final text. No later task writes a row that is |
| +not `approved`, and each adds its ids to `tunnelWebSocketsCopyBuilt` in the |
| +commit that writes them. |
| + |
| +The rules: |
| + |
| +- The file cell is the exact repo-relative file the owning task writes the |
| + string into. The parenthesis after it names where in that file the string |
| + goes. |
| +- A `\n` in a text is a line break inside one literal. A pipe inside a text is |
| + written `\|`, because Markdown needs it escaped in a table cell and Go must |
| + not print the backslash. |
| +- No em dashes and no en dashes. A pause is a full stop and a new sentence. |
| +- Console and CLI output is lower case after a full stop. TWS-C03 is a page |
| + body a visitor reads, so it is a sentence. |
| +- No row has a placeholder. |
| + |
| +## Task 5: the tunnel WebSockets strings |
| + |
| +| id | file | text | status | |
| +|---|---|---|---| |
| +| TWS-C01 | internal/apperr/availability.go (`causeText[CauseTunnelBusy]`) | the fleet box has too many open connections | approved | |
| +| TWS-C02 | internal/apperr/availability.go (`causeText[CauseTunnelUpgradeUnsupported]`) | the fleet box runs a release that cannot carry WebSockets | approved | |
| +| TWS-C03 | internal/edge/tunnel.go (503 body when a box is at its cap) | Too many open connections to this app's box. Try again shortly. | approved | |