Skip to content

feat(dev): minimal dev path and a prefixed test sub-space test_agents_ - #104

Open
albanm wants to merge 18 commits into
mainfrom
phase-3
Open

albanm wants to merge 18 commits into
mainfrom
phase-3

Conversation

@albanm

@albanm albanm commented Nov 24, 2026

Copy link
Copy Markdown
Member

Make agents developable on its own minimal dev path, and let its tests share a database with other services' data.

  • Dev path: fixed default ports in dev/default.env (5700-5710, copied to .env when absent); npm run dev-deps, dev-setup, dev and one dev:<process> script per process (dev:api, dev:ui, dev:mcp, dev:bridge), each configurable through the production environment variable names. CI runs the same scripts. The df-dev setup (dev/dev.json, .zellij.kdl, @data-fair/lib-dev) is gone; privateEventsUrl may be null when events does not run.
  • Test sub-space: simple-directory runs on mongo with its test API. The test accounts all start with test_agents_ (tests/support/sd-fixtures.ts), seeded by a playwright global setup and cleaned under the stateful lock. DELETE /api/test-env now requires ?prefix=test_<suite>_ and removes only what that sub-space owns. A dev world (test_demo_, dev/resources/demo-world.json) is seeded by npm run dev-world and never cleaned by the tests. Commit 04892ba is a mechanical rename of fixture ids.
  • Test seams for MCP servers: specs name the dev MCP servers and stand-ins they rely on instead of the deployment's wiring, so they pass alongside a real MCP server too. POST /api/test-env/personal-assistants chooses the assistants' servers per account; the enrol seams take a platformMcpUrl and give no built-in server otherwise. Both are in-memory, development only, and empty in production (api/src/agent-session/personal-servers.ts, api/src/mcp-servers/platform-url.ts).
  • Test fixes found running next to other services: site URLs and e2e cookies on DEV_HOST, API logs read from DEV_LOG_DIR/DEV_LOG_PREFIX, database from MONGO_URL, waiting for an anonymous action token's not-before, creating the stateful lock's folder.
  • Cleanup: the old docs/superpowers/ design docs are removed (code comments now point at docs/architecture/), and the prompt-cache bench takes its endpoint from the environment.

Why: run agents on its own with no extra tooling, and keep its tests isolated when the database holds other services' data or the MCP server is the real one.

Heads-up:

  • DELETE /api/test-env without a valid prefix now answers 400 (was: wipe every test* owner), and it answers 204 instead of 200.
  • The dev simple-directory needs a recent master image with the prefixed test API (docker compose pull simple-directory); it now stores accounts in mongo instead of mounted JSON files.
  • Production paths now resolve the personal assistants' servers and privateMcpUrl through the two seam modules: with no seam choice (always the case outside development) they return the configured values unchanged.

🤖 Generated with Claude Code

albanm and others added 17 commits November 23, 2026 15:47
…per dev process

npm ci && npm run dev starts the containers, the api, the ui and the dev MCP
server with the fixed ports of dev/default.env (5700-5711), copied to .env
when there is none. Each dev process has its own npm script (dev:api, dev:ui,
dev:mcp, dev:bridge) reading its settings from environment variables;
privateEventsUrl is null when EVENTS_PORT is empty. CI runs on the same path.
simple-directory no longer needs a maildev port: its mails go to a port that
refuses the connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The committed validator still typed privateEventsUrl as a string and coerced
null to an empty string. optionalUrl gets a typed parameter for tsc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
simple-directory runs on mongo with its prefixed test API: the test accounts
(tests/support/sd-fixtures.ts) are cleaned and seeded by a playwright global
setup, and DELETE /api/test-env takes a prefix and removes only what that
sub-space owns. The dev world test_demo_ (dev/resources/demo-world.json) is
seeded by npm run dev-world, and dev/fixtures.ts runs as its accounts, enrolling
its agent's identity through simple-directory's NHI API. The rendered users file
and its template are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The global setup only upserts the test accounts, and not at all for a
unit-only run: a run started while another one is going no longer deletes
its accounts. tests/state-setup.ts cleans and seeds them after taking the lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lock lives in dev/logs, which only exists once a dev process logged there: with the dev
processes logging elsewhere (DEV_LOG_DIR), the state-setup project failed with ENOENT and no
stateful test ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tests that inspect the API output fell back to the zellij pane when dev/logs/api.log was
missing: with the dev processes logging under DEV_LOG_DIR and DEV_LOG_PREFIX, they read nothing.
They now read <DEV_LOG_PREFIX>api.log in DEV_LOG_DIR (default dev/logs), the file npm run dev and
CI write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tests and dev scripts reached the site as localhost:NGINX_PORT, which matched simple-directory's
main site only when DEV_HOST is localhost. With another DEV_HOST, simple-directory rejected the
login redirects as off-site and answered 404 to the NHI token requests of the specs' sites. The
site URLs (directory, nginx clients, NHI sites and issuers, portal hosts, the e2e base URL) now
use DEV_HOST, as the NHI fixtures already did; the API is still called directly on localhost, so
the test sessions send the site's cookies there (globalCookies).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
simple-directory may issue anonymous action tokens with a not-before delay
(ANONYMOUS_ACTION_NOT_BEFORE, against bots); the specs assumed none, and a directory configured
with one refused their tokens ("anonymous action token not yet valid"). getAnonymousActionToken
waits until the token's nbf has passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The specs and dev scripts that query mongo directly named the database of
api/config/development.js; an API given MONGO_URL writes elsewhere, and they asserted against an
empty database. tests/support/mongo-url.ts gives MONGO_URL when set, the development one otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The e2e specs set their language and consent cookies on the domain localhost; with another
DEV_HOST the browser did not send them, the login page came up in French and the warm-up timed out
on the English login button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n this repository

- delete dev/dev.json and .zellij.kdl, drop @data-fair/lib-dev and the dev-zellij script
  (stop-dev-deps stays: it stops the containers of the minimal path)
- AGENTS.md "Dev environment" and CONTRIBUTING describe the minimal path only (npm run dev,
  dev-deps, dev-setup, one dev:<process> script per process); the bridge, the api's watch list,
  the troubleshooting and testing notes no longer name panes or df-dev commands
- code comments, error messages, the agents-sim skill (and its lib-sim template), lib-sim's
  README and the architecture docs point at npm scripts and dev/default.env instead of df-dev
- design specs and plans are not kept here: docs/superpowers goes, the references to it point at
  docs/architecture, the plugin entry of .claude/settings.json goes, .superpowers/ is ignored

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…caller names one

An autonomous agent with an identity gathers data-fair's built-in server (privateMcpUrl) on every
turn. The agents the test seams enrol (a placeholder identity no server accepts, or a fixture
identity) got whatever server the deployment wired: the dev stand-in accepts anonymous calls, a
real data-fair MCP refuses them, so with a real one wired every turn of a placeholder agent failed
("MCP server data-fair failed") and the specs asserting the stand-in's platform_* tools could not
pass.

The seams now choose the built-in server per agent (api/src/mcp-servers/platform-url.ts, empty in
production): none by default, or the platformMcpUrl the caller passes
(tests/support/platform-mcp.ts). createEnrolledAgent and the specs that assert the built-in
server's tools name the dev stand-in, so the suite gathers the same tools whatever privateMcpUrl
the API runs with; the dev fixtures and the simulation runner name the server the API wires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The development config gives both personal assistants the four dev MCP
servers, and some specs relied on it: a deployment that gives the
assistants production's servers (none) failed them. A test seam,
POST /api/test-env/personal-assistants, now chooses the assistants'
servers for one account (in memory, reachable in development only,
forgotten by the reset), and the specs whose assistant turns call the
dev fixtures name them after their reset:

- personal-approvals (api and e2e)
- tool-images
- tool-listing-cache
- approval-gate, "Deciding over the socket"
- file-arguments

The configuration doc says how a dev environment sets production's
assistants: node-config merges PERSONAL_ASSISTANTS over the development
config, so '{}' keeps the dev servers and empty server lists are needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tripwire spec's notification test (run only with the events service)
has the portal assistant call list_road_closures, and the mid-run quota
test's `loop forever` makes the assistant call get_schema: both are dev
fixture tools. Under assistants configured like production's, the first
would not trip and the second would repeat unknown-tool errors instead
of a read. Both now name the dev servers after their reset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, no local path in comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GITHUB_ENV accepts only NAME=value lines, and dev/default.env starts with
comments: the export step filters out the comments and blank lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant