feat(ui): proxy legacy /print to backend (restores First-Print smoke curl)#84
Conversation
Phase 4 First-Print test uses POST http://hhdocker02:8000/print directly
against the backend. Phase 7 moved the backend behind a Frontend Go
proxy that mounts /api/*, /docs, /openapi.json, /redoc, /readiness,
/healthz — but missed /print and /jobs/{id}. Container port 8000 is no
longer published either, so the curl-based smoke from inside Tailscale
404'd post-Phase-7.
Add both routes to the proxy so the ad-hoc smoke workflow works again
via https://labels.strausmann.cloud/print with the claude-automation
Basic-Auth header. /jobs uses the chi regex wildcard {rest:.*} that
has higher route priority than the plain {id} param, preserving the
job-id path component end-to-end to the backend.
Refs #22
Commit 805fdcd added r.Handle("/jobs/{rest:.*}", prx) which had higher chi route priority than the existing r.Get("/jobs/{id}", ph.JobDetail) page route. Browsers visiting labels.strausmann.cloud/jobs/<id> got the backend JSON instead of the rendered HTML page — UI regression that was not asked for. Keep only /print proxied (the actual user request — Phase 4 First-Print smoke curl). /jobs/{id} stays as the frontend-rendered HTML page; if automated scripts need JSON, they can rely on the upcoming Phase 7d /api/print + /api/jobs endpoints, or use Accept: application/json sniffing in a future PR. Refs #22
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request restores the legacy /print endpoint functionality that was lost following recent infrastructure changes. By updating the frontend proxy configuration, it ensures that automated smoke tests can successfully reach the backend while maintaining the integrity of existing browser-based routes. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request restores the legacy /print endpoint in the Go frontend proxy to support existing smoke tests and adds a corresponding integration test. Feedback includes a high-priority security concern regarding the use of a real internal hostname in test comments, which violates the repository's privacy guidelines. Additionally, it is recommended to use the existing testRouterWithBackend helper function in the new test to reduce code duplication and redundant initialization.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #84 +/- ##
=======================================
Coverage 91.98% 91.98%
=======================================
Files 70 70
Lines 3055 3055
Branches 261 261
=======================================
Hits 2810 2810
Misses 181 181
Partials 64 64
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Restores the legacy First-Print smoke path by routing /print through the Go frontend reverse proxy to the backend.
Changes:
- Adds
/printto frontend proxy mounts. - Adds a Go router test verifying
POST /printreturns the backend202response. - Documents that
/jobs/{id}remains served by the frontend HTML handler.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
frontend/cmd/server/main.go |
Registers /print with the backend reverse proxy. |
frontend/cmd/server/main_test.go |
Adds coverage for the legacy /print proxy route. |
Bot reviews on PR #84 flagged: - HIGH: hhdocker02 in a test comment tripped the Privacy / secret scan CI job. Replaced with a generic "backend container" reference. - MEDIUM: the new TestProxyMountsLegacyFirstPrintRoutes built its own mock backend + router init inline. Refactored to use the existing testRouterWithBackend helper for parity with the surrounding tests. Refs #22
## 0.6.0 (2026-05-18) * docs(api): address PR #79 bot-review — privacy sanitise + protocol self + consistency fixes ([61602d0](61602d0)), closes [#79](#79) [#22](#22) * docs(api): pure-vector SVG samples for all 12 seed templates (#83) ([a066dde](a066dde)), closes [#83](#83) [#81](#81) [#22](#22) * docs(phase-7b): foundation design spec — init-robustness + health-split + pangolin-bypass (#74) ([c5a7964](c5a7964)), closes [#74](#74) [fosrl/pangolin#3099](fosrl/pangolin#3099) [#22](#22) [#22](#22) * docs(phase-7d): foundation design — print API + QR tab + hangar plugin (#79) ([cdaedeb](cdaedeb)), closes [#79](#79) [strausmann/hangar#63](https://github.com/strausmann/hangar/issues/63) [#22](#22) * fix: 3 production bugs from local smoke-test + dev/ folder ([c0fc903](c0fc903)), closes [#67](#67) [#67](#67) [#67](#67) [#67](#67) [#67](#67) [#67](#67) [#67](#67) [#67](#67) * fix: Phase 6b code-cleanup — 6 audit findings + plugin pattern wired ([f77aa44](f77aa44)), closes [#67](#67) [#67](#67) [#67](#67) [#67](#67) [#67](#67) [#67](#67) [#67](#67) [#67](#67) * fix(api): Phase 7b.1 — upsert name-collision + /readiness proxy gap (#77) ([4e74a03](4e74a03)), closes [#77](#77) [#76](#76) [#22](#22) [#76](#76) [#22](#22) [#77](#77) [#1](#1) [#76](#76) [#22](#22) * fix(ui): printer detail metadata + template preview + paused-bool gap (#82) ([52bab83](52bab83)), closes [#82](#82) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) * feat(api): Phase 7b foundation — init, datetime-TZ, /readiness, status cache, proxy widening (#75) ([784decc](784decc)), closes [#75](#75) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [#22](#22) [HI#priority](https://github.com/HI/issues/priority) [#75](#75) [#22](#22) * feat(ui): proxy legacy /print to backend (restores First-Print smoke curl) (#84) ([8ef36ed](8ef36ed)), closes [#84](#84) [#22](#22) [#22](#22) [#84](#84) [#22](#22) [skip ci]
Summary
Restores the Phase 4 First-Print ad-hoc smoke-test workflow via Pangolin.
Before Phase 7, `curl -X POST http://hhdocker02:8000/print -d '...'` worked from inside the Tailscale network because the backend container exposed port 8000. After Phase 7 placed the Frontend Go proxy in front of the backend AND stopped publishing port 8000, that direct curl 404'd. The Frontend proxy mounts `/api/*`, `/docs`, `/openapi.json`, `/redoc`, `/readiness`, `/healthz` — but the legacy Phase-4 `/print` route was missed.
Adds `r.Handle("/print", prx)` so `POST https://labels.strausmann.cloud/print\` reaches the backend with the Pangolin Basic-Auth bypass.
Round 2 in this PR
Commit `805fdcd` initially also added `r.Handle("/jobs/{rest:.*}", prx)` to enable JSON-based job-status checks. This had higher chi route priority than the existing `r.Get("/jobs/{id}", ph.JobDetail)` frontend HTML page — browsers visiting `labels.strausmann.cloud/jobs/` got the backend JSON instead of the rendered page. Commit `0d06e74` reverts that `/jobs` catch-all — only `/print` is added in net.
If automated scripts later need JSON-based job status access, the upcoming Phase 7d `/api/jobs` endpoint (#80) will cover that path cleanly, or a follow-up PR could add Accept-header sniffing for `/jobs/{id}`.
Test plan
Commits
Refs #22