Skip to content

Task/t 002 remove legacy - #167

Closed
pocikode wants to merge 22 commits into
dstotijn:mainfrom
pocikode:task/T-002-remove-legacy
Closed

pocikode wants to merge 22 commits into
dstotijn:mainfrom
pocikode:task/T-002-remove-legacy

Conversation

@pocikode

Copy link
Copy Markdown

No description provided.

pocikode and others added 22 commits November 17, 2026 16:24
- go.mod: module path, go 1.27, toolchain go1.27.4; tool directives for
  gqlgen and govulncheck replace tools.go.
- gqlgen bumped to v0.17.98 (latest); pkg/api generated code regenerated
  with `go tool gqlgen generate` (hand-written resolvers.go kept).
- Rewrite Hetty import paths in pkg/ and cmd/hetty.
- cmd/hetty gated behind the legacy_hetty build tag: it embeds the Next.js
  admin build that is no longer produced; T-002 deletes it.
- Replace shared math/rand ULID entropy with crypto/rand in pkg/proj,
  pkg/proxy, pkg/sender and their tests: data races under go test -race.
- `go fix ./...` so `go fix -diff ./...` is empty (ioutil, loop vars,
  wg.Go, any, ...).
- pkg/proxy/intercept tests: replace fixed sleeps with polling ItemByID.
  The "done" subtests asserted ErrRequestDone, which is only observable in
  a scheduler-dependent window between cancellation and queue removal
  (~3-10% failure rate upstream). They now wait for the intercept to
  finish and assert the settled state (ErrRequestNotFound).
- pkg/reqlog test: poll for the stored response log instead of sleeping
  (nil dereference when the store goroutine was slow).
chore(T-001): bootstrap fork: module path, Go 1.27, Makefile, lint, CI
admin/ (Next.js/React/MUI/Apollo) is replaced by the Svelte app in web/ (T-003),
so it goes, together with the `//go:build legacy_hetty` package that embedded it.

pkg/db/bolt goes with it: storage moves to SQLite (ADR-0002). The two tests that
only existed to drive the bolt repository (reqlog/reqlog_test.go,
sender/sender_test.go) cannot outlive it; the search tests stay.

`go mod tidy` drops bbolt, go-cmp, ff/v3, go-homedir and truststore.
pkg/proxy, pkg/proxy/intercept, pkg/filter, pkg/scope and pkg/chrome are kept as
reading material for the rewrite (docs/03-architecture.md §3), so they move to
internal/legacy/ instead of being deleted. The rest of pkg/ (api, proj, reqlog,
sender, log) comes along: it imports those five, and nothing outside the legacy
tree may import it (internal/legacy/importguard_test.go).

The code is unchanged apart from the import paths, a package doc and a README
stating "reference only, do not import". golangci-lint excludes ^internal/legacy/
instead of ^pkg/ + ^cmd/hetty/; the stale //nolint:gosec above ulidEntropy (left
over from math/rand) is gone.
`./ratatoskr` now binds 127.0.0.1:8080 and answers GET / with a placeholder page
instead of printing the version; `-version` keeps the old behaviour, and
`--listen`/`--data-dir` are accepted so `make run` and parallel worktrees work
(internal/config wires the data dir in T-004).

The listener is opened before serving so the bound address is logged even for
port 0, the server has a read-header timeout, an idle timeout and a 1 MiB header
cap, and SIGINT/SIGTERM drain in-flight requests with a 5 s grace period.
.goreleaser.yml, Dockerfile and .dockerignore only existed to build cmd/hetty
plus the embedded admin/ bundle, and they published to Hetty's Homebrew tap,
Scoop bucket, Snap Store and ghcr.io images. No release pipeline is specified
yet, so they go rather than being retargeted at a half-built binary.
@pocikode pocikode closed this Nov 17, 2026
@pocikode
pocikode deleted the task/T-002-remove-legacy branch November 19, 2026 07: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.

1 participant