- Add a 'when to use / when not to use' gate: UI behavior questions default to Vitest/jsdom, E2E only for behavior spanning server + browser; description updated so the skill triggers less eagerly - Pin the browser driver to Chrome DevTools MCP and explain why kimi-webbridge (user's real browser) is not a substitute - Drop generic MCP pattern boilerplate duplicated by references/mcp-cheatsheet.md (SKILL.md 385 -> 145 lines) - Move recipe rematch fixture / fresh-state / cancel-gap notes to references/recipe-rematch-fixtures.md
4.2 KiB
Recipe Rematch/Repair E2E — Fixtures, Fresh State, Known Gaps
Specialized guidance for recipe rematch/repair E2E runs, extracted from the SKILL.md main flow. Read the SKILL.md SANDBOX section first — everything here assumes a sandboxed run.
Fixture Rules (validated by the task-8 E2E)
Seed the sandboxed recipes_path with hand-written fixture recipes:
- Filename constraint: each file MUST be named
f"{id}.recipe.json"and the in-JSONidfield MUST equal the filename. Discovery accepts any*.recipe.json, but persistence resolves the path viaget_recipe_json_pathand_save_recipe_persistentlyreturnsFalseon a mismatch → the fixture would be counted as an error.recipe-a.recipe.json→ in-JSON"id": "recipe-a"
- File format: mirror an existing recipe JSON — top-level
id,file_path,title,loras,fingerprint,gen_params; lora entries per the persistence conventions (hash,file_name,modelVersionId,isDeleted, ...). - Companion image: each recipe needs an image (e.g. a
.webpgenerated with PIL) referenced byfile_path, used for EXIF verification (ExifUtils.append_recipe_metadatawrites a"Recipe metadata: ..."marker; a freshly generated.webpwith no marker is the clean "untouched" control). - autov3 three-state contract: for L3 (autov3-only, renamed-file) fixtures the
local model's
.metadata.jsonsidecar MUST have theautov3key ABSENT (the "unchecked" state), NOT""—""is the TERMINAL "checked but unavailable" state that L3 deliberately skips. The scanner computes + persistsautov3from the file header during the normal library scan (model_scanner.py_process_model_file), so the live L3 match resolves through the local autov3/hash cache; the computed-autov3 branch for unchecked items is covered by the unit suite. - Fixture design for a rematch run (mirrors the task-8 E2E):
recipe-a: lora entryisDeleted=True,hash= 12-char autov3 computed from the local model (calculate_autov3,py/utils/file_utils.py), whose local model file was RENAMED after the recipe was written sofile_namediffers (proves L3 match without filename).recipe-b: parser-convention checkpoint entry (usesid, nomodelVersionId) matching a local checkpoint via L2 — the local checkpoint's.metadata.jsonMUST carry civitai version data with thatidsoversion_indexcontains it (L2 cannot match otherwise).recipe-c: healthy recipe (no deleted entries) → must remain untouched.
The scanner computes and persists model hashes during the library scan, so the sandbox
model dirs just need the model files + .metadata.json sidecars. With
--settings-path, all derived data lands under the sandbox settings dir (cache/,
backups/, logs/, stats/, wildcards/), and NO cache/ appears in the repo root.
Fresh State Between Entry-Point Runs
Each entry point (global / per-recipe / selection-bulk) must start from the same
deleted state. Between runs (keep a pristine copy in <sandbox>/recipes-before/):
# 1. Reset fixtures to the before-state snapshot
cp <sandbox>/recipes-before/*.recipe.json <sandbox>/recipes/
# 2. Clear the recipe/FTS caches (with --settings-path these live under the sandbox
# settings dir, NOT <repo-root>/cache)
rm -f <sandbox>/settings/cache/recipe/*.sqlite
rm -rf <sandbox>/settings/cache/fts/*
# 3. Restart the server (fresh process, fresh scan)
python .agents/skills/lora-manager-e2e/scripts/start_server.py \
--port {PORT} --settings-path <sandbox>/settings --restart --wait --timeout 30 --detach
# 4. Re-verify the server is listening + reload the browser page
Cancellation Testing (KNOWN GAP)
Testing the rematch-cancel path E2E requires a run long enough to cancel mid-flight. A
tiny 3-recipe fixture set completes in seconds — too fast to reliably cancel. The
cancel path is currently unit-covered only (rematch_all_recipes cancellation
tests); do not block an E2E run on cancel-path verification. If you must attempt it,
you would need an artificially large/deferred fixture set to create a cancellable
window — treat this as a research task, not part of the standard E2E.