Skip to content

Use the config validators in doctor, and join service directories once - #32

Merged
anurag merged 1 commit into
mainfrom
ag/small-cleanups
Sep 24, 2026
Merged

anurag merged 1 commit into
mainfrom
ag/small-cleanups

Conversation

@anurag

@anurag anurag commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Stacked on #31, which is stacked on #30. Merge those first; GitHub then moves this PR to main.

Changes

  • Doctor uses the config validators. scripts/doctor.ts checked APPS_REPO, FACTORY_API_KEY, UI_USERNAME, and UI_PASSWORD with code of its own, including a third copy of the slug regex. Now it runs appsRepo(), apiKey(), and uiCredentials(), the validators that each process runs when it starts, and prints their errors. So doctor cannot pass a value that the gateway refuses.
  • One slug. config.ts checks UI_USERNAME with the slug schema of contracts.ts. The gateway gives that name to each run of the UI as its user, and the request schema checks user with the same slug. Before, two copies of the regex had to agree.
  • One join of service directories. verify-app joined the rootDir of a service onto the app directory with resolveServiceDir(), and the Blueprint with joinServiceDir(), with slightly different rules. Now both use joinServiceDir() in blueprint.ts, so they agree on each directory. It also accepts a path that is the full base, which gave a doubled path in verify-app.

Not changed

  • The copies of sleep(). I proposed setTimeout from node:timers/promises, but vitest's fake timers do not control it: a probe test timed out. The render, teardown, and workflow tests skip their poll intervals with fake timers, so they would really wait. The copies stay.

Verification

  • npm run check passes: 372 tests. tests/blueprint.test.ts tests joinServiceDir() with relative and absolute bases.
  • Doctor, run locally with no values, with a bad UI_USERNAME, and with good values, prints the error of each validator, or its OK message.

🤖 Generated with Claude Code

@anurag
anurag added this pull request to stack #33 September 24, 2026 05:07
Base automatically changed from ag/split-workflow to main September 24, 2026 05:07
- scripts/doctor.ts checked APPS_REPO, FACTORY_API_KEY, UI_USERNAME,
  and UI_PASSWORD with code of its own, with a third copy of the slug
  regex. Now it runs appsRepo(), apiKey(), and uiCredentials(), the
  validators that each process runs when it starts, and prints their
  errors. So doctor cannot pass a value that the gateway refuses.
- config.ts checks UI_USERNAME with the slug schema of contracts.ts.
  The gateway gives that name to each run of the UI as its user, and
  the request schema checks the user with the same slug. Before, two
  copies of the regex had to agree.
- verify-app joined the rootDir of a service onto the app directory
  with resolveServiceDir(), and the Blueprint with joinServiceDir(),
  with slightly different rules. Now both use joinServiceDir() in
  blueprint.ts, so they agree on each directory. It also accepts a path
  that is the full base, which gave a doubled path in verify-app.

Tests: tests/blueprint.test.ts tests joinServiceDir() with relative
and absolute bases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anurag
anurag merged commit 6a87146 into main Sep 24, 2026
3 checks passed
@anurag
anurag deleted the ag/small-cleanups branch September 24, 2026 05:08
@anurag anurag mentioned this pull request Sep 24, 2026
2 of 3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant