cloudaxe-opencode/packages/opencode/test
Kit Langton da5e29b320 fix(server): read auth Config from Flag for HttpApi/Hono parity
HttpApi auth middleware was reading ServerAuth.Config via Effect's generated
defaultLayer, which resolves Config.string('OPENCODE_SERVER_PASSWORD') once
and is memoized by Layer identity. Subsequent runtime mutation of process.env
(or Flag.OPENCODE_SERVER_PASSWORD) was never observed, so the middleware kept
serving 401 even when auth was disabled at runtime.

Hono's AuthMiddleware reads Flag.OPENCODE_SERVER_PASSWORD per request, so it
picks up mutations immediately. With Hono still the production default and
HttpApi gated by OPENCODE_EXPERIMENTAL_HTTPAPI, the gap was masked by tests
that flipped the flag back to Hono for no-auth scenarios.

Override ServerAuth.Config.defaultLayer to read Flag.* via Layer.sync at
layer-build time. Each fresh listener (memoMap) picks up current Flag values.
This matches Hono behavior across listeners; per-request mutation within a
single listener is not preserved (would require reading Flag in the middleware
itself, which is a separate concern).

Tests:
- httpapi-listen: parameterize 'tickets optional when auth disabled' across
  both backends to lock in parity.
- httpapi-raw-route-auth + httpapi-ui: switch from ConfigProvider injection
  (which is now a no-op since defaultLayer is Flag-backed, not Config-backed)
  to ServerAuth.Config.layer({...}) for explicit overrides, or Flag mutation
  for tests that exercise the production read path.

46/46 auth + PTY tests pass.
2026-05-04 00:13:02 -04:00
..
account refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
acp Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00
agent Effectify plugin agent regression test (#25646) 2026-05-03 22:07:10 +00:00
auth core: move cross-spawn-spawner to root and remove unused types 2026-04-25 14:30:16 -04:00
bus Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
cli fix(cli): bridge Instance.current ALS in effectCmd handlers (regression from #25522) (#25546) 2026-05-03 04:24:33 +00:00
config refactor(config+core): drop ConfigPaths.readFile, add AppFileSystem.readFileStringSafe, flatten TuiConfig.loadState (#25602) 2026-05-03 15:21:34 +00:00
control-plane Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
effect fix(instance): run bootstrap from instance store (#25475) 2026-05-02 19:33:38 -04:00
fake refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
file Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
filesystem refactor: rename shared package to core (#24309) 2026-04-25 10:59:17 -04:00
fixture Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
format core: move cross-spawn-spawner to root and remove unused types 2026-04-25 14:30:16 -04:00
git fix(vcs): avoid unbounded diff memory usage (#25581) 2026-05-03 17:49:46 +05:30
ide fix(test): replace structuredClone with spread for process.env (#14908) 2026-02-24 23:16:24 +10:00
installation Refactor npm config handling (#24565) 2026-04-27 03:54:59 +00:00
lib chore: generate 2026-05-03 00:32:24 +00:00
lsp Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
mcp Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
memory feat: enable type-aware no-floating-promises rule, fix all 177 violations (#22741) 2026-04-15 23:27:32 -04:00
patch big format 2025-11-06 13:03:12 -05:00
permission Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
plugin fix(instance): run bootstrap from instance store (#25475) 2026-05-02 19:33:38 -04:00
project fix(vcs): avoid unbounded diff memory usage (#25581) 2026-05-03 17:49:46 +05:30
provider Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
pty chore: generate 2026-05-04 02:57:18 +00:00
question Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
server fix(server): read auth Config from Flag for HttpApi/Hono parity 2026-05-04 00:13:02 -04:00
session Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00
share refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
shell refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
skill refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
snapshot Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
storage refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
sync Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00
tool Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
util fix(sdk+cli): surface real errors instead of bare {} when server returns empty body (#25592) 2026-05-03 13:17:06 +00:00
v2 Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00
AGENTS.md test(httpapi): add route exerciser 2026-05-02 20:31:21 -04:00
keybind.test.ts refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
permission-task.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
preload.ts Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00