#22178: test(web): allow fixture roots in media local file tests
channel: discord
channel: msteams
channel: whatsapp-web
size: S
Cluster:
Media File Management Fixes
## Summary
- Problem: `src/web/media.test.ts` local-file fixtures are created under OS temp directories, but stricter local media root checks now reject those paths in CI.
- Why it matters: unit test jobs fail across node/bun/windows with `LocalMediaAccessError` before unrelated PRs can merge.
- What changed: updated fixture-based local media tests to pass explicit `localRoots: [fixtureRoot]` for fixture reads.
- Scope boundary: test-only change; runtime media loading behavior is unchanged.
## Change Type (select all)
- [x] Bug fix
- [ ] Feature
- [ ] Refactor
- [x] Docs
- [ ] Security hardening
- [x] Chore/infra
## Scope (select all touched areas)
- [ ] Gateway / orchestration
- [ ] Skills / tool execution
- [ ] Auth / tokens
- [ ] Memory / storage
- [ ] Integrations
- [ ] API / contracts
- [x] UI / DX
- [x] CI/CD / infra
## Linked Issue/PR
- Closes #
- Related #22154
## Repro + Verification
- Repro: run `pnpm test` on current main baseline and observe failures in `src/web/media.test.ts` with `LocalMediaAccessError`.
- Verified: `pnpm exec vitest run src/web/media.test.ts --config vitest.unit.config.ts` passes after this change.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixed test failures in `src/web/media.test.ts` by adding explicit `localRoots: [fixtureRoot]` to fixture-based tests. Tests were failing because stricter local media root checks (introduced in related work) now reject OS temp directory paths by default, but test fixtures are created under `os.tmpdir()`. The helper function `fixtureMediaOptions()` encapsulates this pattern cleanly.
Also includes three unrelated changes bundled in this PR:
- **Gateway refactor**: Extracted startup config bootstrap logic from `server.impl.ts` into a new `startup-config.ts` module with `prepareGatewayStartupConfig()` function
- **Gateway test**: Added `server-methods-consistency.test.ts` to verify gateway method catalog consistency between `CORE_GATEWAY_METHODS` list and actual handlers
- **Windows dev workflow**: Added `gateway-watch.mjs` script to provide portable watch mode for Windows developers (includes best-effort daemon stop to avoid port conflicts)
- **Docs updates**: Updated README with mermaid architecture diagram (replacing ASCII), added Windows watch mode notes to debugging/setup docs
All changes are test-only or dev-workflow improvements with no runtime behavior changes to production code.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with no concerns
- All changes are test-only fixes and developer workflow improvements. The core fix properly addresses test failures by passing explicit `localRoots` to match the fixture location. Gateway refactoring is a clean extraction with no logic changes. New consistency test adds valuable guardrails. Windows watch script improves cross-platform dev experience. No production code behavior is modified.
- No files require special attention
<sub>Last reviewed commit: a454f89</sub>
<!-- greptile_other_comments_section -->
<sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#22356: test(web): fix media test fixture local root handling
by AIflow-Labs · 2026-02-21
89.5%
#17456: fix(test): stabilize media root guard test against tmpdir HOME overlap
by widingmarcus-cyber · 2026-02-15
82.0%
#9817: fix(media): resolve relative paths before reading local files (#8759)
by lailoo · 2026-02-05
80.5%
#23627: fix(telegram,feishu): pass mediaLocalRoots through channel action a...
by rockkoca · 2026-02-22
79.3%
#22401: fix: resolve relative media paths against workspace and fix /tmp on...
by derrickburns · 2026-02-21
79.0%
#23142: fix(test): Windows CI — use path.join for XDG path assertions in qm...
by ihsanmokhlisse · 2026-02-22
78.7%
#18811: fix(media): require file extension for ambiguous MEDIA: path detection
by aldoeliacim · 2026-02-17
78.4%
#22348: fix(tests): pass localRoots to media test fixtures (#22191)
by VikrantSingh01 · 2026-02-21
78.3%
#16658: test: isolate env-dependent gateway/auth fixtures
by sauerdaniel · 2026-02-15
77.4%
#20186: fix(discord): thread mediaLocalRoots through reply delivery path
by pvoo · 2026-02-18
77.2%