Public: anyone can read this; the crew can change it.
Adapter app shape: sync an external system into the forge, with a contract the forge can audit #459
This adds the adapter app shape: an optional adapter block in forge.json, a forge-scheduled idempotent POST /pull that is recorded as a run, a template adapter to copy, and the adapter state on the app page. Everything is pushed. I did not get a full bun test result.
stopped closed without shipping deploy 48d3f0b
4 earlier comments · 1 event
The check failed because check.run in forge.json had grown to 1035 characters, over the 1000 limit. I shortened it to 962 and pushed. I haven't seen the forge's check go green on the new push yet.
The only change is in forge.json. Three groups of test files are now named with shell globs that match exactly the same files as before:
test/studio*.test.tstest/fork*.test.tstest/adapter*.test.ts
bun x tsc --noEmit passes locally. I didn't re-run the full check here, because test/apps.test.ts hangs in this sandbox, as it did on the parent commit. The new adapter tests pass on their own.
The rest of the pull description is unchanged. It adds an optional adapter block to forge.json. The forge calls /pull on the schedule and records each pull as a run. Outbound hosts are limited to the declared source. A copyable template adapter and docs/ADAPTERS.md are included. The app page shows last pull, next pull and cursor.
🤖 Generated with Claude Code
I merged main into the branch and pushed it. The only conflict was in forge.json, in check.run. The forge.json check ran clean locally: tsc, 614 tests across 43 files in the sharded run, and the 10 adapter-template tests.
- Conflict:
mainaddedtest/spawn.test.tsto the check list. This branch had turned the list into globs (test/studio*.test.ts,test/fork*.test.ts) and addedtest/adapter*.test.ts,test/pull.test.tsand the adapter-template run. - Resolution: I kept this branch's glob form and added
test/spawn.test.tsnext totest/spawn-plan.test.ts. Thecheck.runstring is 981 characters, under the 1000 limit.
The adapter app shape from #437 is unchanged by the merge.
🤖 Generated with Claude Code
Fix first, both doors: the adapter card (last pull, next pull, cursor) is drawn only by the web app page (src/web/studio/adapter.ts). Nothing in the diff adds it to the TUI, so someone on SSH cannot see an adapter state. Add it to the TUI app screen, reading the same lastPull and nextPullAt, gated as the page is, with a test, and a README line.
Clean: hostAllowed in src/apps/adapter.ts is not called by the forge code in the diff (the template has its own copy), and its doc comment is cut off mid-sentence. Remove it, or make it the one tested copy.
Also the preview root answered 404 for me, so I could not see the card working; please confirm it boots and answers. Last, the new pull kind adds a run every interval to run lists (board, feed, usage); add a test that they do not crowd out deploys and agent runs.
I merged main into the branch and pushed. The only conflict was forge.json, in the check.run list.
- Resolution: I kept this branch's globs and the adapter tests. I added
test/web-apps.test.ts, whichmainbrought in. The adapter template's ownbun teststill runs after the shards. - Length: That combined command came to 1003 characters, over the forge's 1000 limit. I replaced
test/pulls.test.ts test/pull.test.tswithtest/pull*.test.ts, which matches exactly those two files. The command is now 985 characters. - Checks run:
tsc --noEmitis clean. The adapter, pull andweb-appstests pass (38 tests, 0 failures). I did not run the full check command or the whole suite to completion:bun testover everything hit the shell timeout and I moved on to the targeted run.
main is merged into the branch and pushed, and the branch now merges cleanly. The full check passed except two tests, and I fixed one of them and reran it green. The other passed when I reran it alone.
- Conflicts:
mainbrought fleet operations, which also took migration 40, so the pull migration is now 41 insrc/core/schema.ts. Inforge.jsonthe check list keeps the adapter and pull test globs,test/fleet-ops.test.tsand the adapter-template step. - Test fixed: the migration test in
test/adapter.test.tswas asserting the old number. It now builds the schema up to migration 40, applies 41 and checks the rebuild. The test was wrong, not the code. - Flaky test:
test/apps-busy.test.ts("child still working survives the sweep") failed once under three-shard load but passed alone, so I left it. It looks timing-sensitive; I did not rerun the full check after the merge push.
To try it, run the command in the forge.json check, or run bun test test/adapter.test.ts.
This adds the adapter app shape: an optional
adapterblock inforge.json, a forge-scheduled idempotentPOST /pullthat is recorded as a run, a template adapter to copy, and the adapter state on the app page. Everything is pushed.I did not get a full
bun testresult. In this sandboxtest/apps.test.tshangs, and it hangs the same way on the parent commit, so the change didn't cause it. The new test files pass on their own, and so do the template's own tests. The adapter test files aretest/adapter.test.ts(9),test/pull.test.ts(8),test/adapter-page.test.ts(3) andexamples/adapter-template/test/adapter.test.ts(10). The one edit I made toapps.test.tsisadapter: nulladded to a fixture; I couldn't run that file here.What changed
src/apps/adapter.tsvalidates the block at the boundary. It coverssource(name and host allowlist),schedule(interval), andconfig(named, typed fields). A secret is a reference only, so a value is rejected. The manifest carries it asadapter, null when absent.src/apps/pull.tscalls the adapter's/pullon its interval and checks the{pulled, skipped, cursor, errors}response. Each pull is stored as a run with counts, cursor and duration. Failed and repeated pulls are recorded as runs too. The run and schema changes are insrc/core/runs.tsandsrc/core/schema.ts.examples/adapter-templateholds the cursor and records in bun:sqlite underFORGE_APP_DATA, so a replay of the same cursor writes nothing. Its fetch refuses any host outside the declared source. Its README says how to use it.docs/ADAPTERS.mdstates the contract (docs/APPS.mdanddocs/CONTRACT.mdlink to it). The tests prove a repeated pull doesn't double-write, a failing pull is recorded, and another host is refused.src/web/studio/adapter.tsshows last pull, next pull and cursor.Left out
To try it
bun test test/adapter.test.ts test/pull.test.ts test/adapter-page.test.ts.examples/adapter-template, runbun test.forge.jsonadapterblock, and open the app page.🤖 Generated with Claude Code
Closes #437