Skip to content

refactor(hearthtest): serve notelite with hearth's connectserver - #100

Merged
bketelsen merged 2 commits into
mainfrom
irulan/hearthtest-connectserver
Nov 17, 2026
Merged

bketelsen merged 2 commits into
mainfrom
irulan/hearthtest-connectserver

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

hearth v0.2.0 generates the Connect route of its example app notes-lite (notesv1connect), and it adds connectserver, which admits a call on an app's lodge socket (hearth docs/specs/connect.md). lodge's test app internal/hearthtest wrote that route by hand: 4 unary handlers and its own mount of lodge.Handler.

This PR:

  • moves github.com/frostyard/hearth from v0.1.0 to v0.2.0;
  • copies the generated notes.connect.go of hearth v0.2.0 into internal/hearthtest/notelite/notesv1/notesv1connect/, with only its import of the v1 package changed to lodge's path (notelite/README.md records the change and the new tag);
  • serves the generated handler with connectserver.HandlerOptions, behind connectserver.Lodge at /connect/.

The test hold and the app's error mapping (not_found for a missing row, the app failed: … for other errors) move into 1 unary interceptor. Connect decodes the request body before a unary interceptor runs, so a held RPC still waits after the body is read, as before. App.Server, App.Close (immediate) and /health do not change; the app does not use connectserver.Serve, because its stop waits up to 5 s for calls in flight, and the tests that hold a call need Close to be immediate. LastPath still records the path with its /connect prefix.

Behavior

The test app now refuses a call whose Lodge-Caller is not principal, as the app contract requires (docs/specs/app-contract.md). lodge sends Lodge-Caller: principal on every call to an app on hearth (internal/gateway/proxy.go, internal/mcpgw/call.go), so no lodge request changes its answer. No existing test needed a change; TestConnectRefusesOtherCallers is new.

Risk tier

Risk tier: 1. The change is in a test app (internal/hearthtest) and in go.mod/go.sum; no path of .github/risk-paths.json matches. lodge's production packages import no hearth code (internal/repocheck).

Verification

  • make check green (host)
  • make ci green before the push (verify, race, cross, client-check, ui-check, shell-check in the nsl machine)
  • make vulncheck: needs the network; CI's vulncheck job runs it for this go.mod change
  • Revert test: the new TestConnectRefusesOtherCallers guards the caller check. In a scratch worktree at the PR head, with internal/hearthtest/hearthtest.go at origin/main (and the copied notesv1connect removed), go test -count=1 -run TestConnect ./internal/hearthtest/ fails on its assertions: each kind (none, session, agent, device, content) answers 200 instead of 403, and the app records the last caller. The worktree is removed. The other behavior is covered by the existing tests in internal/hearthtest and internal/gateway, including the held calls and the recorded path.

hearth v0.2.0 generates the Connect route of notes-lite and adds
connectserver, which admits a call on an app's lodge socket. The test
app now serves the generated route through connectserver.Lodge, with
its hold and error mapping in 1 unary interceptor. lodge sends
Lodge-Caller: principal on every call to an app on hearth, so the
adapter's caller check refuses nothing that lodge sends.
@github-actions github-actions Bot added the level:L3 Skim label Nov 17, 2026
The adapter of connectserver admits Lodge-Caller: principal only. A
call without it, or with another kind, is 403 with 1 line, and the app
records no caller.
@frostyard-machines

Copy link
Copy Markdown
Contributor Author

Cross-review record

  • Coder: openai/gpt-6.1-sol (code); anthropic/claude-opus-5-5 (1 comment, the README commit id, review fixes). Reviewer: github-copilot/claude-sonnet-5.5, read-only.
  • Base e1838f70e671f13c49c4a5c100250e704675c75d.
  • Initial review at eb041c7d10a130b9e6f496d8852ca3b16c6240be: Ready, Blocking: none. 3 low findings:
    1. No guard for the new 403 of a caller that is not principal: fixed, TestConnectRefusesOtherCallers (it fails on its assertions with hearthtest.go at the base).
    2. The generated route serves no GET for read RPCs, and an unknown method answers the same 404 as before: no change; lodge sends only POST.
    3. The interceptor comment did not say why connectFailure wins: fixed, the comment names the interceptor order of HandlerOptions.
  • Re-review 1 at 52ab48ce14a379565049925bf4162e54df1455f2 (diff since eb041c7): Ready, Blocking: none. 1 new low finding: a line break in the new test's doc comment. No change, because it affects only the layout of the comment.
  • CI at 52ab48c: every check passes (verify, race and cross, Windows kit, client, UI, shell, .deb snapshot, vulncheck, pr-triage). make ci passed locally before the first push.

@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 17, 2026
@bketelsen
bketelsen merged commit 1f7c2c7 into main Nov 17, 2026
11 checks passed
@bketelsen
bketelsen deleted the irulan/hearthtest-connectserver branch November 17, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L3 Skim ready-for-human Reviewed, CI green: ready for Brian to review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants