Public: anyone can read this; the crew can change it.

A page control for the `app_data_import` door, through the function the tool calls #18672

opened this

Merged 57m ago, live in production

The data-move page now has a Load SQL text control for appdataimport. It posts through importAppData, the function the MCP tool and POST …/data-import call. My new tests and the touched suites pass (test/pageless-doors.test.ts, mcp-size, data-move, dataimport-doors), and tsc --noEmit and design-lint are clean.

Notes

opened this

The data-move page now has a Load SQL text control for app_data_import. It posts through importAppData, the function the MCP tool and POST …/data-import call. My new tests and the touched suites pass (test/pageless-doors.test.ts, mcp-size, data-move, dataimport-doors), and tsc --noEmit and design-lint are clean. I did not run the rest of the suite or try the page on a preview.

What changed

  • The control: on /:owner/:name/data-move there is a textarea, a Replace checkbox and Load the dump.
  • Who can use it: the same-origin check and admin scope come from adminForm, and importAppData does the repository-admin check. No new grant. A non-admin gets a 404 and nothing changes.
  • Results: a success or a refusal comes back as a flash message in the same words as the tool (importDataMessage).
  • Pageless list: app_data_import is out of scripts/pageless-allow.json, and CEILING is 27 in test/pageless-doors.test.ts.
  • Tests: test/data-import-page.test.ts covers these cases:
    • A person presses the control and the rows land in the store.
    • A second load is refused with "already exists" until Replace is ticked.
    • A refused dump changes nothing.
    • A non-admin and a foreign origin change nothing.
    • An agent calls the tool and gets the same result.
  • Tool text and docs: the tool's where text and docs/features/data-move.md now mention the page.

Left out

  • Dump size: a pasted dump is capped by the form body limit (BODY_MAX), not the 16 MB the tool allows. The page tells people to use the drop for bigger ones.
  • Terminal: I added no new terminal screen, because src/tui/screens/dataimport.ts already covers it. The commit says No door: for that.
  • Reuse: the new test file repeats a few small helpers (signin, make, rows) from other tests, and the gate noted it. I didn't factor them out.

Try it: open /<owner>/<repo>/data-move as the repository's admin and paste a sqlite3 .dump under Load SQL text.

[
  {"go": "/<owner>/<repo>/data-move", "look": "A \"Load SQL text\" section with a textarea, a Replace checkbox and a Load the dump button, between Import and the receipt", "expect": "Shown only to the repository's admin; anyone else gets a 404"},
  {"go": "/<owner>/<repo>/data-move", "look": "Paste `CREATE TABLE t(a); INSERT INTO t VALUES (1),(2);` and press Load the dump", "expect": "A flash says it loaded 1 table with rows and checksums matching; pressing it again says app.db already exists until Replace is ticked", "ask": "Is the flash wording clear enough without a receipt table?"}
]

🤖 Generated with Claude Code

Closes #18585

4 earlier comments
commented

The data-move page now has a Load SQL text control for app_data_import. It posts through importAppData, the function the MCP tool and POST …/data-import call. My new tests and the touched suites pass (test/pageless-doors.test.ts, mcp-size, data-move, dataimport-doors), and tsc --noEmit and design-lint are clean. I did not run the rest of the suite or try the page on a preview.

What changed

  • The control: on /:owner/:name/data-move there is a textarea, a Replace checkbox and Load the dump.
  • Who can use it: the same-origin check and admin scope come from adminForm, and importAppData does the repository-admin check. No new grant. A non-admin gets a 404 and nothing changes.
  • Results: a success or a refusal comes back as a flash message in the same words as the tool (importDataMessage).
  • Pageless list: app_data_import is out of scripts/pageless-allow.json, and CEILING is 27 in test/pageless-doors.test.ts.
  • Tests: test/data-import-page.test.ts covers these cases:
    • A person presses the control and the rows land in the store.
    • A second load is refused with "already exists" until Replace is ticked.
    • A refused dump changes nothing.
    • A non-admin and a foreign origin change nothing.
    • An agent calls the tool and gets the same result.
  • Tool text and docs: the tool's where text and docs/features/data-move.md now mention the page.

Left out

  • Dump size: a pasted dump is capped by the form body limit (BODY_MAX), not the 16 MB the tool allows. The page tells people to use the drop for bigger ones.
  • Terminal: I added no new terminal screen, because src/tui/screens/dataimport.ts already covers it. The commit says No door: for that.
  • Reuse: the new test file repeats a few small helpers (signin, make, rows) from other tests, and the gate noted it. I didn't factor them out.

Try it: open /<owner>/<repo>/data-move as the repository's admin and paste a sqlite3 .dump under Load SQL text.

[
  {"go": "/<owner>/<repo>/data-move", "look": "A \"Load SQL text\" section with a textarea, a Replace checkbox and a Load the dump button, between Import and the receipt", "expect": "Shown only to the repository's admin; anyone else gets a 404"},
  {"go": "/<owner>/<repo>/data-move", "look": "Paste `CREATE TABLE t(a); INSERT INTO t VALUES (1),(2);` and press Load the dump", "expect": "A flash says it loaded 1 table with rows and checksums matching; pressing it again says app.db already exists until Replace is ticked", "ask": "Is the flash wording clear enough without a receipt table?"}
]

🤖 Generated with Claude Code

commented

<!-- look-pages 4db7c1145177 --> Look pages for 4db7c11, from the gate:

  • look pages (none): "Looks: /cy/shop/data-move" is not a page of app.looks in forge.json; this pull changes src/web/studio/data_move.ts but the forge could not trace the route of /, /admin/telemetry, /explore and 28 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

The look-pages feedback is fixed: a new empty commit, pushed as b31e25144, carries a Looks: /preview-admin/sample/data-move line. The gate now reports "look pages (named)" for it. I didn't re-run bun test, tsc or the design lint for this push.

The earlier line, Looks: /cy/shop/data-move, wasn't a page listed in app.looks in forge.json. /preview-admin/sample/data-move is listed, and it is the same data-move page. I tried amending the old commit first, but the push was rejected because it rewrote history, so I added a new commit.

I didn't act on the four most-refused checks you listed, because this pull doesn't change them:

  • Audit entry, dead exports, first-view budget: I changed no page route or export, so they don't apply.
  • Duplicate import: the check named in the feedback is a repository-wide import rule that I didn't run.

The gate also prints a non-blocking note that rows in test/data-import-page.test.ts (line 35) looks like items in test/data-move.test.ts. I left it as is.

commented

<!-- look-pages b31e25144170 --> Look pages for b31e251, from the gate:

  • look pages (named): this pull changes src/web/studio/data_move.ts; a commit names /preview-admin/sample/data-move
commented

The look-pages note on b31e251 is a pass: "look pages (named)" accepts /preview-admin/sample/data-move. It asked for no change, so I pushed nothing.

I checked the four checks the note lists against the branch as it stands:

  • Audit, duplicate import and dead exports: test/design-audit.test.ts, test/dup-imports.test.ts and test/unused-exports.test.ts pass.
  • First-view budget: I didn't run it. The test helper is test/helpers/first-views.ts, and I only ran the other tests that cover this change, test/data-import-page.test.ts and test/data-move.test.ts. They pass too.
  • Type check and design lint: bun x tsc --noEmit is clean, and bun scripts/design-lint.ts reports nothing added outside the design system.

The pull is unchanged: the data-move page loads SQL text into an app's store through importAppData. Open /<owner>/<repo>/data-move as the repository's admin and paste a sqlite3 .dump under "Load SQL text".

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs