Repository navigation
feat(builder): keep saved recipes in the user data directory - #203
Merged
Merged
Conversation
Only the Saved recipes dialog read it, for a label that said recipes belong to a workspace. They do not.
…ctory One owner-only JSON file per recipe under recipes/ in the user data directory, written whole and listed latest first. The id is random, so two names never share a file, and names are unique. A save updates the recipe it names by id, which renames it, or else the recipe of the same name. An import adds only names not saved yet: strict, one bad recipe refuses them all, or lenient, the good ones are added and each bad one is returned with its reason. nullius paths lists the directory.
Anyone who can open the builder reads the list. A write needs the form token and a browser on the application host, as Run and Settings do. The builder page greys Save recipe for any other browser, with the reason as its tooltip. An import is strict unless the request asks for the lenient one.
…rver The dialog lists, saves, updates, renames and deletes through /new-run/recipes. The draft keeps the id of the saved recipe the page holds, so a save after a reload still updates it. A browser on another machine sees the list and can load and export a recipe; Delete is greyed with the reason. On the application host the builder moves the list an earlier version kept in the browser to the server once, with the lenient import. It keeps the recipes the server refused under nullius.recipes.v1.rejected, says once how many, and never sends them again. When the move fails, the list stays for the next visit.
The move to the server skipped them, then removed them from the browser. One with the same name but other settings was lost. They are now kept beside the refused ones, and the toast counts both.
This was referenced Nov 18, 2026
harenome
added a commit
that referenced
this pull request
Nov 18, 2026
Closes #204 ## What A new Recipes page (`/recipes`) shows the saved recipes in a table. The sidebar link is in the Manage group, with a new `i-recipe` icon. - Table. The page uses the table toolkit (`_tables.html` `table`, `tables.js`) with search, Columns, Sort by and the pager, as Launches and Workspaces do. The columns are the name, one column for each builder step from 01 to 07 (Benchmark, Runner, Dataset, Agent, Model, Limits, Where), and Saved. A step cell holds the values of that step's Review rows. A long value is cut with an ellipsis, and the tooltip shows the full value. - Check. The page does not add a check. For a Harbor recipe, `recipes.js` calls the recipe core: `fromJSON`, `review`, `validate` and `providerBlocker`. For a standard recipe, the route runs the same compile as the builder's Review step (`/new-run/runner`), now one helper (`_standard_compile`). A row with an error shows "Cannot run here" with an alert icon. The tooltip gives each reason with its step. Info shows the same list. - Actions. Open goes to `/new-run?saved=<id>`, and the builder loads that recipe at Review, as the Saved recipes dialog does. Info shows the recipe step by step and its JSON. Duplicate saves a copy as "<name> (copy)", or the next free number. Export downloads the JSON. Delete asks first, in the same dialog style as Workspaces. Import, on the title line, sends a file to the strict import. A toast shows the reason for a refusal. The writes use the API of #PR_C. - Remote. A browser on another machine sees Import, Duplicate and Delete greyed (`aria-disabled`), with the reason as the tooltip. Open, Info and Export work. - Empty. With no saved recipe, the page shows "No saved recipe yet. Build one →", a link to the run builder, and the Import button. A browser on another machine gets no link, because it cannot save. A notice right under a page title now has the gap that a table's controls row has (`style.css`). - Refactor. `new_run` and the page get the builder data from one helper (`_builder_data`). - New icons in the sprite: `i-recipe` (the page), `i-copy` (Duplicate) and `i-export` (Export). Open uses `i-newrun`, Info uses `i-info` as Settings does, and Import uses `i-import`. ## Touches routes (`app/web/builder.py`) · templates and static (`app/templates/builder/recipes.html`, `app/templates/base.html`, `app/static/builder/recipes.js`, `recipes.css`, `command-builder.js`, `command-builder-core.js`, `style.css`) · docs (`docs/builder.md`) ## Before and after Before: no Recipes page. The Saved recipes dialog in the builder is the only view. After: | | Light | Dark | | --- | --- | --- | | Table, 1280 px | `table-1280-light.png` | `table-1280-dark.png` | | Table, 390 px | `table-390-light.png` | `table-390-dark.png` | | Info, 1280 px | `info-1280-light.png` | `info-1280-dark.png` | | Info, 390 px | `info-390-light-many-agents.png` | `info-390-dark.png` | | Delete confirmation | `delete-ask-1280-light.png` | `delete-ask-390-dark.png` | Other: `search-1280-light.png`, `duplicate-1280-light.png`, `import-bad-1280-light.png`, `open-builder-1280-light.png`, `remote-1280.png`, `remote-actions-1280.png`, `remote-390.png`. ## Verified On a fresh clone of this branch, in a `python:3.12` container with Node and uv: - `python3 app/tests/parallel.py`: 2249 tests in 127 modules, OK. - `python3 app/tests/parallel.py app/ui_tests`: 611 tests in 51 modules, OK. New: `test_recipes_page.py` (4 tests: the sidebar link, the columns and a row for each recipe, the empty state; Import, Duplicate and Delete greyed for a non-local client while Open, Info and Export stay; `/new-run?saved=<id>` loads the recipe, and an unknown id gives 404; under Node, the page script over the page data names a missing agent, a missing standard benchmark and a runner that is not offered, and finds free copy names). Browser check in Chromium (Playwright 1.49.1) with six saved recipes: two Harbor recipes, one with ten agents, one Harbor recipe with an agent that is not offered, two standard recipes, and one standard recipe with a benchmark that is not in the catalogue. - At 1280 px and 390 px, light and dark: the table, the warning on the two bad rows, the cut agent list with its full tooltip, Info and the Delete confirmation. - Search, Export (the file is the recipe), Duplicate, Import of a good file, Import of a file with one bad recipe (toast: "Not imported: recipe 2 of 2: …"), Import of a file that is not JSON, Delete after the confirmation, and Open into the builder at Review. - With `X-Forwarded-For` set: Import, Duplicate and Delete greyed with the reason. Info works. - No page JavaScript errors. The only console error is the 400 answer to the bad import, which the check asks for. ## Risk The page reads the recipes and writes only through the API of #203, so a fault here cannot change a recipe that you do not act on. A check that is wrong shows a wrong warning, and the builder still checks the recipe again at Review and at Run. A host that Settings no longer has is not in the warning, because the builder checks hosts only at Review and Run. A revert removes the page and `?saved=`. The saved recipes stay as they are.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #202
What
Saved recipes move from the browser's
localStorageto the user data directory, one JSON file per recipe inrecipes/<id>.json. All browsers that open the builder see the same list.app/nullius/recipes/store.py). A file holdsid,name,recipeandsaved(UTC, ISO 8601). The id is 16 random hex digits, and the store checks it before it makes a path. Names are unique. A save updates the recipe that its id names, and a new name renames that recipe. Without an id, a save updates the recipe with the same name, or adds a new one. Each write goes to a 0600 temporary file in the same directory, which then replaces the old file.nullius pathsshows the directory.app/web/builder.py).GET /new-run/recipeslists the recipes, latest first.POST /new-run/recipessaves one.DELETE /new-run/recipes/<id>deletes one.POST /new-run/recipes/importadds the recipes whose names are not saved yet. The import is strict: one bad item refuses all items, with its number and the reason, before any write. The builder's one-time move sendslenient: true. Then the server adds the good items, returns each bad one with its reason, and returns each skipped one with its index and name. Any client can read. A write needs the form token and a browser on the application host (_local_client()), or the server answers 403.aria-disabled), and the tooltip gives the reason. A browser on another machine cannot save recipes now. The draft stays in the browser and keeps the id of the saved recipe that the page holds.nullius.recipes.v1and anynullius.recipes.v1.<workspace>list to the lenient import. The server skips names that it has. The builder removes the old keys after the server answers. It keeps the refused recipes, and the recipes whose name is already saved, undernullius.recipes.v1.rejected. One toast counts each kind, and the builder does not send them again. If the move fails, a toast says so, the keys stay, and the next visit tries again.Touches
backend (
app/nullius/recipes/store.py,app/nullius/paths.py,app/nullius/recipes/launch.py) · routes (app/web/builder.py) · templates and static (app/templates/builder/new_run.html,app/static/builder/command-builder.js,command-builder-core.js,command-builder.css) · docs (docs/builder.md,docs/settings/README.md,docs/concepts.md,docs/getting-started.md,AGENTS.md)Before and after
The Saved recipes dialog after the same old browser list loads: two recipes, a copy of one of them under another id, and one malformed recipe.
A browser on another machine, after:
Verified
On a fresh clone of this branch, in a
python:3.12container with Node and uv:python3 app/tests/parallel.py: 2249 tests in 127 modules, OK. New:test_recipe_store.py(9 tests: round trip in an owner-only file, names that slug alike, rename, latest first, id and path checks, a failed write, strict and lenient import, stray files).python3 app/tests/parallel.py app/ui_tests: 607 tests in 50 modules, OK. New:test_recipe_routes.py(7 tests: save, update, rename, list, delete, import, refusal without the token and from a non-local client, Save greyed for a non-local client) andtest_recipe_store_script.py(5 tests: the builder's store code under Node, with the dialog, the one-time move, refused items, a failed move and Delete greyed).Browser check in Chromium (Playwright 1.49.1), with a fresh profile for the base branch and one for this branch. I put the old list in
localStorageand loaded the builder:<data>/recipes/. The malformed recipe is undernullius.recipes.v1.rejected, and a toast says "1 old recipe could not be moved." The page works. A reload moved nothing and showed no toast.X-Forwarded-Forset sees Save recipe and each Delete greyed, with the reason. Load works. Direct save, import and delete requests get 403, and no file changes.Not checked in the browser: a recipe whose name is already saved.
test_recipe_store_script.pychecks that it stays undernullius.recipes.v1.rejectedand that the count reaches the toast.Risk
If the store is wrong, saved recipes can be missing from the dialog, or a save can fail with a message. A run's own recipe does not change. The builder removes the old browser list only after the server answers. Refused recipes, and recipes whose name is already saved, stay in the browser under their own key. A browser on another machine cannot save or delete recipes now, as it cannot change Settings or the catalogue. A revert brings back the browser list for recipes not yet moved. Recipes saved after the merge stay on the server only, as files in
<data>/recipes/.