Skip to content

test(studio): integration suite over the real SDK against mecated --mock - #1767

Merged
samuv merged 1 commit into
studio/user-docsfrom
studio/integration-tests
Sep 23, 2026
Merged

samuv merged 1 commit into
studio/user-docsfrom
studio/integration-tests

Conversation

@samuv

@samuv samuv commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Codifies the manual smokes that accompanied each Studio layer as a Vitest integration suite that boots the BFF in mock mode, lets the real SDK spawn bin/mecated --mock, and drives every product surface through the Hono app exactly as the browser would: runtime negotiation, session create / list / run-as-SSE / transcript / rename / delete, stale run controls (409), honest scheduling capability, knowledge inventories and consolidation plan generation, the settings allowlist and storage health, and the CSRF and CORS posture. No fakes below the BFF.

  • apps/server/test/integration/mecated-mock.test.ts (7 tests) with its own vitest.integration.config.ts; the offline pnpm test excludes it via vitest.config.ts, and it skips loudly when the binary is absent.
  • task studio:test:integration builds the daemon first (task build) and runs the suite, mirroring the Slack bot example's test task.
  • The studio CI job gains a Go toolchain step and runs it after the pure-Node gates.

It also proves the bounded, resumable activity replay end to end against real durable history: a tiny replay bound truncates after exactly its quota and names the last cursor, resuming from that cursor returns only events not already delivered, walking the cursors to the run's terminal result never duplicates one and never exceeds the bound in a single request, and an unusable cursor is refused rather than replaying everything. This is the acceptance test the review finding asked for, above the unit proofs that use SDK fakes.

Verification

Locally: 7/7 pass against a spawned mecated --mock in about a second; the offline suite is unchanged at 89 tests; task lint:actions, task docs, Biome, and typecheck pass.

Further amendments

  • task studio:test:integration sets STUDIO_REQUIRE_MECATED=1, so a missing daemon binary fails there and in CI; a direct run still skips loudly.

  • The spawned daemon gets a test-owned HOME and XDG directories plus DO_NOT_TRACK=1, so operator settings never leak in.

  • The unusable-cursor assertion is strict (400 invalid_cursor).

  • The studio CI job now also runs on Go changes, because the suite tests the current mecated. The workflow wiring test pins the new gate, and the stale "pure Node" comment is gone.

  • The README's trailing blank lines are removed.

  • Cursor walk. The walk now asserts that it ended because the stream closed at the run's end and that the terminal result event was delivered. It also asserts that a resumed stream's first frame is a durable event.

Re-verified locally: 8/8 pass against a freshly built mecated --mock.

Development stage

  • Plan / Interface
  • Implementation
  • Combined
  • Spike / Routine / Cleanup

Contract linkage

  • Work classification: Routine
  • Classification rationale: tests and a CI step only; no behavior, contract, or interface change.
  • Decision record: None — no decision
  • Human waiver of spine: No
  • Acceptance plan: N/A — Routine
  • Human decisions resolved and recorded: N/A — Routine
  • Plan / Interface PR: N/A
  • Approved commit baseline: N/A
  • Combined/exemption rationale: N/A

Interface conformance

  • N/A — no interface change.

Issue relationship

Relates to #1736 (stack #1766). Non-closing.

Type of change

  • Behavioral/interface plan
  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation/process
  • Other (describe): tests and CI

Test plan

Baseline checks

  • Acceptance-plan checker
  • Linting (task lint)
  • Offline test suite (task test)
  • Offline demo (go run ./cmd/mecademo)
  • Markdown changed: docs generation/link checks (task docs)

Studio gates: task studio:check and task studio:test:integration pass; task lint:actions passes for the CI change.

User-facing change

None.

Special notes for reviewers

Top layer of the Studio stack. The suite reads the daemon's capabilities and asserts the supported or degraded path accordingly, so it stays truthful if the mock gains scheduling later.

@samuv
samuv added this pull request to stack #1766 September 22, 2026 08:14
@samuv samuv self-assigned this Sep 22, 2026
@samuv
samuv force-pushed the studio/integration-tests branch from b2907d1 to 3a382d8 Compare September 22, 2026 09:04
@samuv samuv mentioned this pull request Sep 22, 2026
4 of 15 tasks
@samuv
samuv force-pushed the studio/integration-tests branch from 3a382d8 to b124580 Compare September 22, 2026 09:14
@samuv
samuv force-pushed the studio/integration-tests branch from b124580 to 54d3285 Compare September 22, 2026 09:23
@samuv
samuv force-pushed the studio/integration-tests branch from 54d3285 to c56d7c6 Compare September 22, 2026 09:59
@samuv
samuv force-pushed the studio/integration-tests branch from c56d7c6 to 5a0cf04 Compare September 23, 2026 08:56
@samuv
samuv force-pushed the studio/integration-tests branch from 5a0cf04 to 6d22db8 Compare September 23, 2026 09:41
@samuv
samuv force-pushed the studio/integration-tests branch from 6d22db8 to 0ce1339 Compare September 23, 2026 10:47
@samuv
samuv force-pushed the studio/integration-tests branch from 0ce1339 to bd31006 Compare September 23, 2026 11:54
Codifies the manual smokes that accompanied each Studio layer: a Vitest
suite that boots the BFF in mock mode, lets the SDK spawn bin/mecated
--mock, and drives every product surface through the Hono app exactly
as the browser would — runtime negotiation, session create / list /
run-as-SSE / transcript / rename / delete, stale run controls, honest
scheduling capability, knowledge inventories and consolidation plan
generation, the settings allowlist and storage health, and the CSRF and
CORS posture. No fakes below the BFF.

It also proves the bounded, resumable activity replay end to end against
real durable history: a tiny replay bound truncates after exactly its
quota and names the last cursor, resuming from that cursor returns only
events not already delivered, walking the cursors to the run's terminal
result never duplicates one and never exceeds the bound in a request,
and an unusable cursor is refused rather than replaying everything.

The suite is a separate Vitest entry point, excluded from the offline pnpm
test. task studio:test:integration builds the daemon first and requires it,
so a missing binary fails there; a direct run skips loudly instead. The
spawned daemon gets a test-owned HOME and XDG directories and DO_NOT_TRACK,
so no operator settings leak in. The studio CI job gains a Go toolchain step
to run it, mirroring the Slack bot example job, and now also runs on Go
changes, since a daemon change can break Studio.

Tracking: #1736

Signed-off-by: Samuele Verzi <[email protected]>
@samuv
samuv force-pushed the studio/integration-tests branch from bd31006 to 5dac601 Compare September 23, 2026 12:54
@samuv
samuv merged commit 773c6c4 into main Sep 23, 2026
37 checks passed
@samuv
samuv deleted the studio/integration-tests branch September 23, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant