Commit Graph

7 Commits

Author SHA1 Message Date
-Puter
4fa4a8bbd1 test: remove tautological service token assertion 2026-07-13 20:12:59 +05:30
-Puter
fc06317832 fix(auth): remove compose service token fallback 2026-07-13 20:12:59 +05:30
-Puter
70c3634178 Remove backend dev A2A auth fallback 2026-07-13 20:12:59 +05:30
-Puter
b93cc81d93 fix curator sprint to use canonical onboarding 2026-07-13 04:28:27 +05:30
-Puter
982942fa6e fix onboarding GET service auth seam 2026-07-13 04:15:01 +05:30
-Puter
c54e12972c fix(onboarding): synthetic PATCH /me stale content-length socket close
patchPreferencesRequest forwarded inbound headers (including
content-length from the browser PATCH body) but set a DIFFERENT body
({ preferences }). The Request constructor does NOT recompute
content-length when an explicit body is provided alongside forwarded
headers, so user-service waited for bytes that never arrived and closed
the socket (~2.8s 'other side closed') → uncaught → 500.

Delete content-length and transfer-encoding before constructing the
synthetic request so undici recomputes them from the actual body. Apply
the same defensive deletes in fetchUserProfile.

Extract patchPreferencesRequest into the DB-free
src/services/user-profile.ts module (alongside fetchUserProfile) so the
regression test imports the REAL function and asserts content-length /
transfer-encoding / host / cookie are stripped and the body is the
synthetic { preferences } blob. tsc clean; existing onboarding tests
pass.
2026-07-12 20:29:40 +05:30
-Puter
ad1318424b fix(onboarding): PATCH /onboarding 500 — fetchUserProfile must GET /me
PATCH /onboarding read its JSON body via c.req.json() (consuming
c.req.raw), then passed c.req.raw to fetchUserProfile → fetchUserService,
which called req.arrayBuffer() on the already-consumed body:
TypeError: Body is unusable. The global onError caught it as a 500
{"error":"internal"}, so every access-choice save failed. GET
/onboarding worked only because it never reads a body.

fetchUserProfile is a read; it must never replay the inbound method or
body. Extract it (+ userServiceTarget) into a DB-free module that issues
an explicit GET /me with forwarded headers, sidestepping body reuse
entirely and fixing a latent wrong-method bug (PATCH /onboarding would
have issued a PATCH /me write for a read).

Verified against staging logs (TypeError stack at fetchUserService →
fetchUserProfile → PATCH handler). Focused regression test consumes the
body first and asserts GET + no body re-read + profile parse; tsc clean.
2026-07-12 20:14:22 +05:30