Skip to content

Cover the live feed over a real socket and tighten both complexity ceilings - #61

Merged
botre merged 2 commits into
masterfrom
chore/quality-pass-on-the-last-week
Aug 30, 2026
Merged

Cover the live feed over a real socket and tighten both complexity ceilings#61
botre merged 2 commits into
masterfrom
chore/quality-pass-on-the-last-week

Conversation

@botre

@botre botre commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

The WebSocket routes carried no test. An upgrade needs a real connection, and the Go suite drives an in-memory transport instead. This branch starts a second application on a loopback port and covers registration, fan-out and the drop on close. Both complexity ceilings also drop a level, to gocyclo -over 4 and ESLint complexity 5.

No runtime behaviour changes. Four functions each gained a helper so they could shed a branch. The Playwright suite now reads data-test through getByTestId. The three type assertions in the test harness stay: they sit at JSON.parse and response.json() boundaries, where TypeScript cannot know the shape.

  1. Run go test ./src/....
  2. Run go run github.com/fzipp/gocyclo/cmd/gocyclo@v0.6.0 -over 4 ./src.
  3. Run pnpm run lint.
  4. Run CGO_ENABLED=0 go build -o ./bin/httphq ./src.
  5. Run pnpm --filter httphq-e2e exec playwright test.

botre added 2 commits August 30, 2026 10:38
…ilings

The WebSocket routes were the one surface no test reached: an upgrade needs a
real connection underneath it, and the rest of the Go suite drives an in-memory
transport. A second application on a loopback port now covers registration,
fan-out to a watching page, and the drop on close. registerWebSockets goes from
43% to 93% covered and the package from 89% to 92%.

gocyclo moves to -over 4 and the ESLint complexity cap to 5, each sitting at the
worst score the tree now carries. Four functions lost a branch to get there:
captureHeaders, handleListRequests, sendCustom, and the suite's request driver.
Two more gaps close in Go: a capture whose stored headers will not marshal, and
a client IP no source can parse.

Screens are reached through getByTestId rather than an attribute selector spelled
at every call site, with testIdAttribute pointing it at data-test. Three
behaviours gain a test beside it: a body past the highlight ceiling, an arrival
reaching the live region, and a sub-path sent without its leading slash.
@botre
botre merged commit 7a5f98a into master Aug 30, 2026
6 checks passed
@botre
botre deleted the chore/quality-pass-on-the-last-week branch August 30, 2026 08:44
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.

1 participant