verify-timely
Launch an isolated Timely stack (Go API on :8081 in its own Postgres schema, Next.js web on :4002) from a scratch worktree of the current checkout, drive the web app in headless Chromium the way a user does (sign up, capture to the Inbox, create tasks, events and docs), and save screenshots, ARIA snapshots and API reads as proof. Use when you need to prove a Timely web/API change works in the real app, reproduce a UI bug, or check a feature end to end. Never touches the user's :8080 API or :4001 web server.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- verify-timely
- description
- Launch an isolated Timely stack (Go API on :8081 in its own Postgres schema, Next.js web on :4002) from a scratch worktree of the current checkout, drive the web app in headless Chromium the way a user does (sign up, capture to the Inbox, create tasks, events and docs), and save screenshots, ARIA snapshots and API reads as proof. Use when you need to prove a Timely web/API change works in the real app, reproduce a UI bug, or check a feature end to end. Never touches the user's :8080 API or :4001 web server.
02 资源文件 10
- 其他evidence/.gitignore14 B
- 参考文档features/account-onboarding.md4.7 KB
- 参考文档features/agent-question-cards.md6.8 KB
- 参考文档features/calendar-events.md3.6 KB
- 参考文档features/files-docs.md2.9 KB
- 参考文档features/inbox-capture.md6.4 KB
- 参考文档features/README.md5.0 KB
- 参考文档features/tasks.md3.2 KB
- 脚本scripts/browser.mjs9.2 KB
- 脚本scripts/verify-timely.sh13.1 KB
03 SKILL.md 正文
Verify Timely (web + API)
The primary surface is the desktop web app (apps/web, Next.js 16) backed by the Go API (apps/api). This skill runs both on the worktree ports from AGENTS.md and drives them through a headless Playwright Chromium that keeps its pages between commands. Secondary surfaces (Electron, mobile) are at the end; this skill does not prove them.
Everything here is run from the root of the checkout under test. Set these once per shell:
V=.agents/skills/verify-timely/scripts/verify-timely.sh
B="node .agents/skills/verify-timely/scripts/browser.mjs"
Hard rules
- Never stop, restart or send requests that change data to
:8080or:4001. Those are the user's ownmake devservers. The script refuses those ports. - The verify instance is API
:8081and web:4002only. If something you did not start holds either port,upstops it (the listener, plus itsairornext devparent), asAGENTS.mdsays. - The API always runs with
DB_SCHEMA=verify_timely(VERIFY_TIMELY_SCHEMAoverrides it), so it never claims the main checkout's chat runs or jobs. It also runs withALLOW_REGISTRATION=true, so every run can sign up a fresh account. - Configuration comes from the root
.env. The scratch worktree gets a copy of the source checkout's root.env, which is whatmake setup-envdoes. Never create a per-app.env. - Kill only what this skill started.
downkills the sessions it recorded. Neverpkill -fonapps/api/tmp/main, because that pattern also matches the user's API. - Don't run the Android emulator, Gradle or
expo run:androidfor this skill. - Only one verify stack can run per machine, because the ports are fixed and all checkouts share the default state dir
~/.cache/verify-timely. Runningupfrom another checkout or worktree replaces the stack that is running. When teammates share the machine, only one of them runsupat a time.
Launch
$V up
What up does, in order:
- Stops a previous verify stack. Frees
:8081,:4002and the browser port:9339. - Creates or refreshes a detached git worktree at
~/.cache/verify-timely/wt(VERIFY_TIMELY_STATEmoves it). The worktree is set to the source checkout'sHEAD, the source's uncommitted diff is applied, and its untracked files are copied in. A separate tree is needed becausenext devholds a lock onapps/web/.next/dev, so a second dev server can't run from the checkout that serves:4001. The worktree lives on disk, not on/tmp(tmpfs), becausenode_modulesis about 3.7 GB. - Runs
pnpm install --frozen-lockfile --prefer-offlinein the worktree. This takes a few seconds once the store is warm, and about 45 s cold. - In the worktree, runs
make dev-worktree-api DB_SCHEMA=verify_timely ALLOW_REGISTRATION=true(air,API_PORT=8081) in its own session. Goose migrations run on start into the empty schema. - Waits until
GET http://127.0.0.1:8081/healthreturns"status":"ok"(db ok, migrations read). - In the worktree, runs
make dev-worktree-web(next dev -p 4002,API_ORIGIN=http://localhost:8081) in its own session. Then waits until/signupreturns 200 and/api-proxy/healthreturns ok through the proxy. Without that second check, Next can answer while the proxy is still broken. - Starts headless Playwright Chromium with CDP on
127.0.0.1:9339and a fresh profile, so the browser is signed out. - Runs
doctor.
Ready means up ends with doctor: OK - drive http://127.0.0.1:4002. A cold start takes about 1 to 2 minutes, and the first visit to each route compiles it (5 to 20 s). Logs are in ~/.cache/verify-timely/logs/{install,api,web,browser}.log. Read them with $V logs api|web|browser [lines].
If the code under test changes after up, run $V up again. doctor fails the "worktree matches the source checkout" check until you do. Inside the worktree, air and Next reload edits, but the source checkout's edits are not synced live.
Doctor
$V doctor # read-only; exit 1 means do not drive this instance
Doctor checks each of these:
:8081and:4002listeners exist and are in the sessionsuprecorded.- Each listener's cwd is the scratch worktree.
- The API process env has
DB_SCHEMA=verify_timelyandAPI_PORT=8081. /healthreports status and db ok andregistrationOpen:true.- The Next server env has
API_ORIGIN=http://localhost:8081. /api-proxy/healthis ok.- The worktree fingerprint (HEAD, diff and untracked list, excluding this skill's dir) matches the source.
- The CDP browser is ours.
- Nothing of ours listens on
:8080or:4001.
Run doctor first whenever anything looks off. $V status prints sessions, port owners and paths.
Drive
browser.mjs runs one action per call against the persistent headless Chromium, then disconnects and leaves the page open. A journey is therefore a sequence of shell commands. Each command prints one JSON line {"ok":true,...,"url":...}, or prints {"ok":false,"error":...} and exits 1. open only accepts the verify origin http://127.0.0.1:4002.
Locators, from most to least preferred:
--role R --name N [--exact]: accessible role and name. This is the default choice.--label L,--placeholder P,--text T,--testid ID: other ways to find an element.--css S: last resort only. The doc body (.ProseMirror) is the one place that needs it.- Scope a locator with
--in-role R --in-name N(a dialog, a region) or--in-testid ID. - Pick one of several matches with
--nth Kor--first.
Commands:
| Command | Effect |
|---|---|
$B open /inbox |
Navigate to a path (waits for DOMContentLoaded, 120 s budget for first compile). |
$B click <locator> |
Click. |
$B fill <locator> --value "text" |
Replace the field's text (also works on contenteditable). |
$B press --key Enter [<locator>] |
Key press on the locator or the page. |
$B wait <locator> [--state hidden] [--timeout ms] / $B wait --url-includes /onboarding |
Wait for an element state or URL. |
$B expect <locator> [--count N] [--absent] |
Assert; exits 1 when it does not hold. |
$B text [<locator>] |
Print innerText (whole page when no locator). |
$B snapshot [<locator>] [--path f.aria.yml] |
ARIA snapshot (YAML). Print it to discover roles and names. |
$B screenshot --path f.png [--full] [<locator>] |
Screenshot. |
$B url |
Current URL. |
$B api GET "/tasks?inbox=true" [--body JSON] [--path f.json] |
Same-origin fetch to /api-proxy<path> with the page's session (cookie plus bearer token). Use it for read-only second views, and for fixture cleanup only. |
$B signup-onboard [--email E] [--password P] [--workspace W] |
Baseline account through the real UI: /signup, then onboarding "Skip for now", then name the workspace, then skip the tour. Prints the credentials. It is the same UI path as account-onboarding. |
Set VERIFY_TIMELY_EVIDENCE=<dir> and every command, passed or failed, is appended to <dir>/actions.jsonl with its locator and result. That file is the action log for the proof.
Feature recipes, with exact handles, are in features/README.md. Read the index, then follow the feature's file.
Example (a slice of inbox-capture):
$B signup-onboard
$B open /inbox
$B fill --role textbox --name "What's on your mind?" --value "Book the dentist"
$B press --role textbox --name "What's on your mind?" --key Enter
$B wait --text "Captured. Add the next one."
$B expect --in-testid inbox-up-next --text "Book the dentist"
Evidence
Put each run's proof in .agents/skills/verify-timely/evidence/<UTC timestamp>-<feature-id>/. That directory is git-ignored by its own .gitignore, and down never touches it.
RUN=.agents/skills/verify-timely/evidence/$(date -u +%Y%m%dT%H%M%SZ)-inbox-capture
mkdir -p "$RUN" && export VERIFY_TIMELY_EVIDENCE="$RUN"
$V doctor > "$RUN/doctor.txt"
Proof standards:
- Drive the real user path: visible controls, keyboard and routes.
$B apiis for reading state back and for cleanup. Never use it to perform the action under test. - Capture the action and the state it produces. Take a snapshot or screenshot before and after, and keep
actions.jsonl. A final screen alone is not proof. - Check side effects in a second view: reload the page, open another screen that shows the same data (the Tasks list, the Calendar), and read it back with
$B api GET ...into a.jsonfile. - Make screenshots show the app identity: the sidebar or page heading must be visible.
- There are no mocks. The API talks to the real Postgres schema
verify_timely. External AI providers are not configured on a fresh account (see the chat gotcha in the feature map). - When a journey cannot run, record the attempted command and the unmet precondition. Never report an entry point you did not drive as verified.
Cleanup
$B api DELETE /me --body '{"password":"<the run password>"}' # optional fixture cleanup: drops the run's account
$V down # stop browser, web, API sessions; remove the scratch worktree; keep evidence
$V down --keep-worktree # same, but keep ~/.cache/verify-timely/wt (and its node_modules) for a faster next `up`
down kills only the sessions it recorded and their descendants. That covers air's tmp/main.exe and the Next workers, which run in their own process groups. It then reports any port still held by someone else, and runs git worktree remove --force plus prune on the scratch tree. The verify_timely schema stays in timely_db as disposable scratch data, and every run signs up a fresh account in it. To start the schema from empty, use a new VERIFY_TIMELY_SCHEMA=verify_timely_2. The host has no psql to drop the old one. After down, check the proof survived: ls "$RUN".
Run $V down after every failed attempt too, so broken attempts don't strand ports.
Helpers
scripts/verify-timely.sh up|doctor|status|browser|logs [api|web|browser|install] [N]|down [--keep-worktree].browserrestarts only Chromium with a fresh, signed-out profile.scripts/browser.mjs <command> ...is described in the Drive section. It loads@playwright/testfrom the source checkout's rootnode_modules. If Chromium is missing, runmake install-browser.- Environment overrides:
VERIFY_TIMELY_STATE: state dir, default~/.cache/verify-timely.VERIFY_TIMELY_SCHEMA: API schema.VERIFY_TIMELY_CDP_PORT: browser CDP port, default 9339.VERIFY_TIMELY_TIMEOUT: action timeout in ms, default 20000.VERIFY_TIMELY_EVIDENCE: action log dir.
Agent engine runs (stub model, fixture pages, fake CLIs)
Chats on the New engine need a model, and a fresh account has none. To verify them without a live provider, keep the stack from up (web, browser, scratch worktree) and replace its API:
- Start the stub model:
python3 -I apps/api/scripts/agentqa/ollama_shim.py 11435 apps/agent/tests <dir>/phrases.json. SetTIMELY_SHIM_LOG=<file>to log what the model saw. The phrase table maps the person's words to a stub directive. Seeapps/api/scripts/agentqa/README.md. - Kill the session in
~/.cache/verify-timely/api.sid. Startmake dev-worktree-api DB_SCHEMA=<schema> ALLOW_REGISTRATION=truein the scratch worktree, in a new session that writesapi.sid, with these variables:OLLAMA_BASE_URL=http://127.0.0.1:11435.TIMELY_AGENT_RUNTIME=<this checkout>/apps/agent. The scratch worktree has no.venv.TIMELY_DATA_DIR=<scratch>.TIMELY_AGENT_WEB_FIXTURES=<dir>:https://<name>.fixture.invalid/is served from<dir>/<name>/index.html.TIMELY_AGENT_CLARIFY_TIMEOUT_S=90.CORS_ORIGINS=http://localhost:8082for the phone.- For Claude Code and Codex without a live model:
CLAUDE_BINandCODEX_BINpointing at wrappers ofapps/api/internal/features/provider/testdata/fakecli/*. Each wrapper reports signed in and sets its ownFAKECLI_DIR. - The test switches (
TIMELY_AGENT_CLARIFY_TIMEOUT_S,TIMELY_AGENT_SENSITIVE_NO_PERSIST, the fixtures) work only withDB_SCHEMAset.
- For fixture pages, run the API under
unshare -rmwithmount --bind <hosts> /etc/hosts, mapping the fixture names to93.184.216.34. Hermes' SSRF floor resolves everyweb_extracthost in the worker and fails closed. Nothing connects to that address, because Go'sFixtureFetcheranswers. A live Claude Code check needs an API outside the namespace, which runs as uid 0. - Phone:
make dev-mobile-webin the scratch worktree, which serves Expo web on:8082against:8081.
doctor accepts this API when it runs in the recorded api session. The API marks itself non-dumpable (internal/procguard), so doctor reads the environment and working directory of air instead of the API binary's. The recipe is features/agent-question-cards.md.
Secondary surfaces (not proved by this skill)
- Electron shell (
apps/web/electron).make audit-desktop AUDIT_PORT=4002runs Electron under Xvfb against this skill's:4002web, with CDP on127.0.0.1:4061. It lists a page only once the web answers below 500. Stop it withpkill -f "[t]imely-design-audit-electron". Hosted mode, with its own Postgres and API, ismake dev-desktop-hosted. Desktop-only UI, such as Settings → Account → Delete account and Settings → Server, appears only inside Electron. - Mobile (
apps/mobile, Expo SDK 57). RunCI=1 make dev-mobile EXPO_PUBLIC_API_URL=http://10.0.2.2:8081, passing the URL as a make argument because the.envinclude otherwise wins. Metro runs on:8082. It needs the capped emulator (make emu-start/make emu-stop) or a USB phone, and APKs only throughmake build-apk. See.agents/skills/android-emulatorand.agents/skills/build-mobile-apk.
04 同仓库更多 Skills
timely
Test fixture standing in for the Timely skill (IDs, markdown dialect, workspace rule).
product-price-monitor
Test fixture override of the upstream product-price-monitor skill.
blocked-page-recovery
Use when a fetch fails: 403/429, paywall, WAF, bot wall.
test-driven-development
TDD: enforce RED-GREEN-REFACTOR, tests before code.
systematic-debugging
4-phase root cause debugging: understand bugs before fixing.
spike
Throwaway experiments to validate an idea before build.