Skip to content

docs(manual): document the mock provider wiring for setup mode A - #4137

Merged
yannickmonney merged 3 commits into
mainfrom
docs/manual-setup-mode-a-mock-provider
Oct 3, 2026
Merged

yannickmonney merged 3 commits into
mainfrom
docs/manual-setup-mode-a-mock-provider

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What changed

services/platform/tests/manual/setup.md mode A couldn't be followed to a working chat. It said to add the mock provider under Settings → AI providers "or mint the org via save-auth-state.ts, which seeds it". Neither works:

  • E2E Mock Gateway is offered only once providers/e2e-mock.yml sits in the org's config dir.
  • The script seeds no provider.

This PR documents the wiring and corrects the fixture descriptions (#4105).

setup.md §1.A

  • New "Wire the mock provider" block. These are the two moves ensureMockProvider in tests/docs-screenshots/seed-demo-org.ts makes, plus the two facts a tester needs to make them:

    1. Wait until Projects lists Getting started. The org-create scaffold (cleanFirst: true) empties <slug>/ before it seeds, so a file copied earlier is lost.
    2. Read the slug from Manage account → Organization, which lists each org as @<slug> · <role>.
    3. Copy the file: cp default/providers/e2e-mock.yml into tests/e2e/fixtures/config/<slug>/providers/.
    4. Add the credential: Settings → AI providers → Add credential → E2E Mock Gateway, method Environment variable, keep the suggested Provider name, env name E2E_MOCK. Each control names its i18n key.
  • Catalog caching. The backend re-reads the provider file on every request, but the page keeps the vendor list it first loaded. If AI providers was open before the copy, reload it or press Refresh catalogs first.

  • What a mode-A org really scaffolds. Only the registry's scaffold domains (governance/, skills/, both empty in the fixture). No provider, and no agent file: the chat assistant is built in (lib/chat/assistant.ts). The wrong "E2E Assistant" and "the e2e-mock provider" claims are gone.

  • Real catalog source. Connectors and AI-provider vendors come from configs/platform/system/. This replaces "a symlink to the real builtin-configs/connectors".

  • Fixture file name. The sync note now names e2e-mock.yml; the retired e2e-mock.json is gone.

  • Mode C. The bullet linked the deleted builtin-configs/providers/openrouter.json and said to export the key in the invoking shell. That env reaches only the web-tier platform container (scripts/docker-dev-env-override.ts), not the backend-api/backend-worker services that resolve credentials. It now says:

    • add an API key credential;
    • or put TALE_PROVIDER_KEY_OPENROUTER in the repo-root .env (their env_file) and add the env credential OPENROUTER.

    The seed creates none. Mode B's page name is now AI providers.

  • §2. save-auth-state.ts waits for the starter project and wires no provider; in mode A, run steps 2–4 next.

Same advice elsewhere

  • reference/not-a-finding.md: same wrong advice, fixed.

  • suites/chat.md and suites/governance.md now point at the setup steps.

  • Stale mock-provider comments fixed:

    • save-auth-state.ts;
    • playwright.config.ts (the port note's e2e-mock.json, "seeds every new org with … the mock provider", secretsEnv/Convex);
    • tests/e2e/specs/onboarding.spec.ts (a "seeded mock provider");
    • tests/e2e/specs/search.spec.ts (an "https-only" provider schema).

    All are comment-only edits.

Dangling links (separate commit)

  • Removed tests/e2e/fixtures/config/default/connectors and default/token-sources; both point into the deleted builtin-configs/. Nothing reads either path.
  • Removed the .gitattributes export-ignore block that existed only to keep them out of source archives.
  • tools/cli/scripts/action-archive.test.ts now holds the plain invariant: the source ZIP carries every tracked file and every link resolves. The two-path exclusion list is gone.

No product strings, no migrations, no secrets. The TALE_PROVIDER_KEY_E2E_MOCK value in the docs is the existing fixed test key.

How I verified it

  • bun run lint:manual: ok (layout, suites, runs, references; 1432 boxes).

  • check-guide.ts on setup.md, suites/chat.md, suites/governance.md and reference/not-a-finding.md: all OK.

    • Negative control: a copy of setup.md with a bogus key (navigation.orgSwitcher.nopeLabel) fails with MISSING i18n, so the gate does read the new keys.
  • Every relative link in the touched guides resolves.

  • Source-archive invariant, from a streamed git archive --worktree-attributes --format=tar HEAD (piped, so no file is written):

    • 8537 archive entries = 8537 tracked files.
    • The three remaining links (docs-demo/{agents,automations,skills}) resolve; find -xtype l finds 0 dangling.
    • A dereferencing cp -rL of the extracted tree succeeds.
    • Control on 2bd3905f0: both removed links are DANGLING.
  • Not run locally: bun test tools/cli/scripts/action-archive.test.ts. This sandbox's hard RLIMIT_FSIZE is 512 MiB, and git archive is killed with SIGXFSZ writing the ~539 MB archive, for any head. CI's CLI job runs it.

  • oxfmt --check and oxlint on the five changed TypeScript files: clean.

  • Read-only adversarial review of the first round (a subagent, source reading only). It found:

    • 2 MEDIUM: the mode-C env path, and the cached vendor list.
    • 1 LOW: the field label.
    • Stale comments.

    I checked each in source and fixed it in a0b5c48a0. The same review confirmed the step-1 ordering, the registry/scaffold facts, the slug menu, the i18n keys, the TALE_PROVIDER_KEY_ prefix field, and that nothing else is needed for a reply: the first credential becomes the default, Auto picks a model, and no access policy applies.

  • Read from source, not from a running app. The steps and the mode-C bullet were checked against source and en.yml. This sandbox runs no stack, browser or Docker.

  • What the reporting run observed live: steps 3–4 and the chat that follows (TALE-358 run 820db997: mockOffered 0 → 1, then CHAT-F57/F19 in EN/DE/FR).

Left open

  • Acceptance check 5 ("a fresh tester, following only the setup file, reaches a mock reply and can run CHAT-F57") needs a running mode-A stack. It is handed to TALE-358 QA as a verification, hence Refs, not Closes.
  • Mode B/C weren't run. The mode-C bullet is source-derived.
  • Outside this card; candidates for their own issue (static reading, not run):
    • scripts/docker-dev-env-override.ts forwards the invoker's env to platform only. Its header still describes the deleted Convex sync.
    • compose.dev.yml sets TALE_DEV_SEED_USER / TALE_ALLOW_OPEN_SIGN_UP only on the web-tier platform service, while the backend reads them. Mode C's seeded login may depend on .env.
    • playwright.config.ts still cites the deleted scripts/sync-convex-env-from-dotenv.ts for ENCRYPTION_SECRET_HEX.

Refs #4105

The mode-A fixture's default/connectors and default/token-sources links
have dangled since #2857 deleted builtin-configs/. Nothing reads either
of them. Connectors and AI-provider vendors come from
configs/platform/system/, and the org scaffold seeds only the registry's
domains. The links survived only behind an export-ignore pair in
.gitattributes, which the setup-cli archive test pinned as the one
allowed exclusion.

Drop both links and the export-ignore block, and let the archive test hold
the plain invariant: the source ZIP carries every tracked file, and every
link in it resolves inside the snapshot.
Mode A told testers to add the mock provider under Settings > AI providers,
or to mint the org with save-auth-state.ts, "which seeds it". Neither
works. The vendor catalog offers E2E Mock Gateway only once
providers/e2e-mock.yml sits in the org's config dir, and the script seeds
no provider, so every mode-A chat box was blocked for a tester following
the setup file (TALE-358 local QA, 2026-10-03).

setup.md now spells out the two moves the docs-screenshot seed makes. Wait
for the starter project, because the org-create scaffold empties the config
dir first. Read the slug from the organization switcher, copy the provider
file, then add an Environment variable credential named E2E_MOCK. It also
says what a mode-A org really scaffolds (governance and skills from the
fixture, no provider, no agent file; the chat assistant is built in) and
that save-auth-state.ts waits for "Getting started" and wires nothing. The
connector and provider catalogs come from configs/platform/system/, the
fixture definition is e2e-mock.yml, and mode C names the env credential and
the current OpenRouter definition instead of the deleted builtin-configs
file.

The same wrong advice goes from not-a-finding.md, chat and governance
point at the setup steps, and the stale comments in save-auth-state.ts and
playwright.config.ts now match.
A read-only review of the first round found the following, each checked
in source before this change:

- Mode C's exported key never reached the credential reader. The
  docker:dev override forwards the shell env to the web-tier platform
  container only, while backend-api and backend-worker resolve credentials
  and read the repo-root .env. The bullet now says to add an API key
  credential, or to put the variable in .env and add the env credential.
- "No restart, just reopen Add credential" missed the browser cache. The
  page keeps the vendor list it first loaded (staleTime Infinity), so a
  page opened before the copy needs a reload or Refresh catalogs.
- An org-defined provider's credential field reads Provider name, prefilled
  with the provider's display name, not Name.
- A colliding wizard org deletes the tracked fixture dir rather than
  overwriting files, and docs-demo is tracked too. Mode B names the page
  AI providers.
- Stale mock-provider comments remained in playwright.config.ts (the port
  note named e2e-mock.json, "loaded verbatim"), onboarding.spec.ts (a
  seeded mock provider) and search.spec.ts (an https-only schema).
@yannickmonney

Copy link
Copy Markdown
Contributor Author

Independent review of PR #4137 at a0b5c48a05ab1262c726eda4c5567b46f7caae78: accepted, with LOW follow-ups.

  • Reviewer: Tale agent add --chat-max-width CSS variable #3 4aec6e61-0328-4213-9719-02d387dee65d, TALE-358 local-qa run aff6b6f2-be6f-47c0-8830-60238b0f8b43, following manager note 9923eacb.
  • Implementation: agent update dashboard ui (#508) #2 3f9fdcee, TALE-488 (request 894dc294). I filed docs(manual): setup.md mode A can't wire the mock provider it tells testers to use #4105, which this PR fixes, but I wrote none of the PR. The runs are distinct.
  • Method:
    • Stack: a fresh native mode-A stack at the exact head: its own bun install --frozen-lockfile, and its own PostgreSQL 16 + pg_search on loopback.
    • Terminal 1: run verbatim.
    • Terminal 2: run verbatim, so TALE_CONFIG_DIR is the worktree's own tests/e2e/fixtures/config. Only host substitutions were added: database, object store (an S3 double), private ports, and egress to a dead proxy.
    • Browser: Chromium (Playwright 1.58.2) driven by role and the labels the doc cites.
    • Step 3: its fenced block was read out of setup.md and run as written.
    • CI: traced at the exact head.

Your item 1: the four Wire-the-mock-provider steps are accurate and complete.

  • The walkthrough, following only §1.A and §2:
    1. The sign-up endpoint, then the create-org wizard (Step 1 of 2: Workspace → Step 2 of 2: Finish → Go to Home).
    2. Before any wiring, chat shows No AI provider connected yet.
    3. Step 1: Projects listed Getting started on the first load.
    4. Step 2: Manage account → Organization showed @qa-p1-w-mushr98u · owner, which equals the API's slug.
    5. Step 3: the org dir didn't exist yet, so mkdir -p is needed, and it is there. The file landed.
    6. Step 4: Settings → AI providers through the nav, then Add credential, which offered E2E Mock Gateway. Method Environment variable; the suggested Provider name was "E2E Mock Gateway"; TALE_PROVIDER_KEY_ was shown beside the field; I entered E2E_MOCK and clicked Add credential. The new row reads E2E Mock Gateway · Default · E2E Mock Gateway (Custom) · Environment variable.
    7. A prompt with no trigger in a new chat returned the canned reply byte for byte.
    8. CHAT-F57 in a new chat:
      • e2e:empty settled with its notice, no dots, no live Thinking, and the toolbar;
      • e2e:length settled under Thought for 1s with its notice and Try again (on the last reply only);
      • after a reload, the same;
      • 0 console errors.
  • Step 1's claim, adversarially:
    • The claim holds. A file placed in <slug>/providers/ before the org existed was deleted by the create-time scaffold, with no <slug>/ left. org.scaffold completed with retry_count 0, and the catalog didn't offer the mock.
    • The gate is sound. The job cleans before seedStarterContent (backend/jobs/task-list.ts:545-566), so Getting started is a valid signal.
    • INFO: on an idle stack the window is about 150 ms (the job ran 14:33:51.864 → 52.009). A copy made about 60 ms after the job was queued, while it was already active, landed after the clean and survived. The wait is a correct precaution that a human rarely needs.
  • The caching note, checked with AI providers open before the copy:
    • without a reload, the mock was not offered (the catalogs query has staleTime: Infinity);
    • after Refresh catalogs finished, it was offered (a POST to /providers/catalogs/refresh, then a refetch);
    • after a reload, it was offered.

Your item 2: the mode-C bullet is correct. I checked it against source only, because there is no Docker here.

  • .env reaches the backends: compose.yml gives backend-api and backend-worker env_file: .env.
  • Shell exports reach only the web tier:
    • docker:dev pipes scripts/docker-dev-env-override.ts into compose (package.json:38);
    • the override writes services: platform: environment: only (:94-96);
    • platform is the web role, proxying to backend-api through TALE_BACKEND_URL. The backends (TALE_ROLE api and worker) resolve credentials.
  • OpenRouter supports both methods: its provider.yml declares api-key and env (:26-28).
  • The seed creates no provider: dev-seed.ts creates the user and org through Better Auth only.
  • INFO, not from this PR: the override's header still says the platform pushes forwarded TALE_PROVIDER_KEY_* into Convex through sync-convex-env-from-dotenv.ts, which no longer exists. Your bullet describes the current behaviour.

Your item 3: the simplified archive test is still a meaningful guard.

  • I couldn't run the test file itself. It writes a ~539 MB stored ZIP, which this sandbox's 512 MiB RLIMIT_FSIZE kills, as you found.
  • So I ran a streamed replica of its two assertions: git archive --worktree-attributes --format=tar piped into a reader, with the same inventory equality and the same link checks.
    • H, the head: PASS. 8537/8537 files; the 3 docs-demo links resolve.
    • N1, the head with the deleted default/connectors link put back in a temporary tree: FAIL, link dangling (builtin-configs/integrations).
    • N2, the head with one export-ignore line in the worktree attributes: FAIL, inventory (tests/manual/template.md missing).
  • What that means: it catches both regressions, and it is stricter than before. With no allowlist left, any future export-ignore fails it, which looks deliberate.
  • CI at the exact head: CLI run 37123821285, job Build (linux) 111205348435. Both tests (pass), in 4159 ms and 5761 ms.

LOW

  1. Refresh catalogs needs its finish. On this offline stack it took 12.4 s (Refreshing…), because it re-fetches the shipped vendors' live listings. Opening Add credential 4 s after the click still showed no mock. Suggested wording: "press Refresh catalogs and wait for Catalogs refreshed".
  2. Product, not this PR, filed as bug(platform): Add credential says the deployment ships no provider files while the catalog is still loading #4146. On a cold backend cache (every 300 s) the first GET /providers/catalogs took 12 s. For all of it, Add credential said "This deployment ships no provider files. Check that the config root is mounted and readable." Then the vendors, including the mock, replaced it. A tester at step 4 can read that as broken wiring. An optional hedge in step 4: "offline, the vendor list can take several seconds".
  3. A follow-up, not from this PR: the guard's trigger. It runs only in the CLI workflow. Its pull_request and push paths (.github/workflows/cli.yml:14-39) cover neither .gitattributes nor where links live, such as services/platform/tests/e2e/fixtures/**. A PR adding a dangling link there wouldn't run it until a release-candidate dispatch, which is the original breakage class. This PR ran it only because it touches tools/cli/**.

INFO

  • Not from this PR: §1.A's Terminal 2 assumes the Docker backing services are up. With TALE_DEV_SKIP_DOCKER=1, dev.ts derives DATABASE_URL from .env's DB_PASSWORD for localhost:5432 and the object store at 127.0.0.1:59000 (scripts/dev-secrets.ts:183-212). A fresh clone stops at "cannot derive DATABASE_URL". A one-line prerequisite would help.

Verified correct

  • playwright.config.ts comments: e2e-mock.yml is copied verbatim; the variable is read at call time through resolve_credential.ts.
  • onboarding.spec.ts: providerConnected = false (onboarding-wizard.tsx:64).
  • search.spec.ts: the comment is accurate.
  • save-auth-state.ts: the comments match waitForSeededOrg (tests/e2e/helpers/auth.ts:196-222).
  • not-a-finding.md: the entry reproduced today.
  • The scaffold sentence: governance (flat) and skills (bundle) are the only scaffolded domains, and both fixture dirs hold only .gitkeep.
  • Step 4's i18n keys: all resolve in en.yml.
  • Links: the chat.md and governance.md links point at §1.A.

Environment. Everything was local:

  • Source: a0b5c48a0.
  • Services: PostgreSQL 127.0.0.1:55374, the S3 double on :59074, the gateway on :4141, the app on :3691 → :3696.
  • Accounts: synthetic @example.test.
  • Evidence: in TALE-358's r20261003T1615 delivery.

Merge: accepted at exact head a0b5c48a05ab1262c726eda4c5567b46f7caae78, through TALE-359's gate. LOW 1 and the INFOs are optional doc polish, LOW 2 is #4146, and LOW 3 is a CI follow-up.

@yannickmonney
yannickmonney merged commit 9fa2bf2 into main Oct 3, 2026
@yannickmonney
yannickmonney deleted the docs/manual-setup-mode-a-mock-provider branch October 3, 2026 17:02
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