person API: thin questions keep the old engine's question route
GET /questions/{id} serves thin questions (q_ ids) and hands the old
engine's to its handler until the slice 7 sweep, like the task routes.
The route coverage check lists the thin question routes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+6
−2
internal/equipo/chat/http.go+5 −1internal/plan3test/person_api_contract_test.go+1 −1
CI failed — run details
Intent
diff --git a/internal/equipo/chat/http.go b/internal/equipo/chat/http.go| index 8601a740..108d06f2 100644 |
| --- a/internal/equipo/chat/http.go |
| +++ b/internal/equipo/chat/http.go |
| @@ -50,6 +50,10 @@ func (h *HTTP) thinOr(route string, thin func(*http.Request) bool, next http.Han |
| // thinTask: thin task ids start "tk"; the old engine's are upper case. |
| func thinTask(r *http.Request) bool { return strings.HasPrefix(chi.URLParam(r, "id"), "tk") } |
| +// thinQuestion: thin question ids start "q_"; the old engine's questions |
| +// keep their route until the slice 7 sweep. |
| +func thinQuestion(r *http.Request) bool { return strings.HasPrefix(chi.URLParam(r, "id"), "q_") } |
| + |
| // deviceClient: the task list for a device bearer (native apps, the |
| // headless suite) is the thin one; a browser session reads the old list. |
| func deviceClient(r *http.Request) bool { return len(r.Header.Values("Authorization")) > 0 } |
| @@ -74,7 +78,7 @@ func (h *HTTP) Mount(r chi.Router) { |
| r.Post("/tasks/{id}/thread", h.bearer(h.postThread)) |
| r.Get("/steps/{id}/log", h.bearer(h.stepLog)) |
| r.Post("/tasks/{id}/questions", h.bearer(h.ask)) |
| - r.Get("/questions/{id}", h.bearer(h.question)) |
| + r.Get("/questions/{id}", h.thinOr("GET /questions/{id}", thinQuestion, h.bearer(h.question))) |
| r.Post("/questions/{id}/cancel", h.bearer(h.cancelQuestion)) |
| r.Get("/needs-you", h.thinOr("GET /needs-you", deviceClient, h.bearer(h.needsYou))) |
| r.Get("/events", h.events) |
diff --git a/internal/plan3test/person_api_contract_test.go b/internal/plan3test/person_api_contract_test.go| index b32d672a..72e379ca 100644 |
| --- a/internal/plan3test/person_api_contract_test.go |
| +++ b/internal/plan3test/person_api_contract_test.go |
| @@ -56,7 +56,7 @@ func personAPIContractCoverage(t *testing.T) { |
| f := newFixture(t) |
| registered := map[string]bool{} |
| // Thin v1 conversation routes are contracted by internal/wire fixtures. |
| - thin := map[string]bool{"GET /messages": true, "POST /messages": true, "GET /turns/{id}": true, "POST /turns/{id}/cancel": true, "GET /snapshot": true, "GET /events": true, "DELETE /projects/{id}": true, "POST /cards/{id}/answer": true, "GET /notebook": true, "POST /notebook/reset": true, "POST /tasks/{id}/retry": true, "POST /tasks/{id}/thread": true, "GET /steps/{id}/log": true} |
| + thin := map[string]bool{"GET /messages": true, "POST /messages": true, "GET /turns/{id}": true, "POST /turns/{id}/cancel": true, "GET /snapshot": true, "GET /events": true, "DELETE /projects/{id}": true, "POST /cards/{id}/answer": true, "GET /notebook": true, "POST /notebook/reset": true, "POST /tasks/{id}/retry": true, "POST /tasks/{id}/thread": true, "GET /steps/{id}/log": true, "POST /tasks/{id}/questions": true, "POST /questions/{id}/cancel": true} |
| must(t, chi.Walk(f.Store.PersonAPIHandler().(chi.Routes), func(method, path string, _ http.Handler, _ ...func(http.Handler) http.Handler) error { |
| if thin[method+" "+path] { |
| return nil |