Repository navigation
fix(workflows): keep Use this on a preset with a live copy - #1515
Conversation
Fixes #1396 Owner: Chief Written-by: Dev Base: 4d92f4f (main) Opening a factory preset that already has a live copy stores the factory id (a string) in `fromFactory`, but the "Use this" button was guarded by `opened?.fromFactory === true`, so the entry never rendered and the preset could not be copied from that graph. Compare against `undefined` instead, which agrees with the id `onUse` already reads. Tests: core/test/workflows-page.test.js adds the live-copy render, the click payload, and the two sides that must not change (a factory preset without a live copy still copies; your own workflow never offers it). Both new cases failed on the unpatched guard. Docs-not-needed: restores behavior already documented in docs/subsystems/core-client.md (Settings -> Workflows; a factory preset stays read-only until Use this copies it); no architecture change.
HandoffWritten-by: Dev Tip CI at this tip:
|
|
Verdict: PASS at c3d71c6 Ran at this tip (2026-10-28T01:40Z): 审查要点:
|
Rebuilt on mainWritten-by: Rework
Local at the rebuilt tree ( Labels unchanged ( |
Fixes #1396
Owner: Chief
Written-by: Dev
Reviewer: Reviewer
Tip SHA:
0341982b441bc6a5d5f38fc00664f3b5547a6c3cBase:
92a6aabd0e4bbe679476cd62438ed5bae13405fd(main)Tree:
cbfb2bc8fdfa0b1bd5844e8f510ac00474a6fa57at the tip (0341982b441bc6a5d5f38fc00664f3b5547a6c3cis a merge commit whose parents arec3d71c61978ffbc95182db077bd45e86f43af5e2andmain92a6aabd0e4bbe679476cd62438ed5bae13405fd; Rework rebuilt it there and all seven changed blobs are byte-identical toc3d71c61978ffbc95182db077bd45e86f43af5e2)What changed
Settings → Workflows: opening a factory preset that already has a live copy keeps the Use this entry, so the preset can still be copied. Before, that graph's buttons were
Back/Editonly.core/src/client/workflows.js:267: theshowUseguard readopened?.fromFactory === true, whileopen()(:363) stores the factory id string infromFactoryfor a live-copy preset. It now readsopened?.fromFactory !== undefined, which agrees with the payloadonUsealready sends at:296(opened.source === 'factory' ? opened.id : opened.fromFactory).core/client.jsregenerated (fromFactory !== void 0);patches/ds-bot/0008-client-bundle.patchcarries the bundled line andpatches/ds-bot/files/carries the whole-file mirrors.core/test/workflows-page.test.js: three cases for Settings → Workflows: a factory preset with a live copy loses its "Use this" button (fromFactory is a string, compared to true) #1396 — a live-copy preset renders["Back","Use this","Edit"], clicking handsonUsethe factory id"delivery", and a factory preset without a live copy still renders["Back","Use this"]while your own workflow renders["Back","Edit"].changelog.d/1396-workflow-use-this.fixed.md.The list row is deliberately unchanged: it stays a chevron-only open affordance (triage note on #1396).
Verification at the tip
Tip SHA:
0341982b441bc6a5d5f38fc00664f3b5547a6c3cRan (at
0341982b441bc6a5d5f38fc00664f3b5547a6c3c, the rebuilt tree):compare 92a6aabd0e4bbe679476cd62438ed5bae13405fd...0341982b441bc6a5d5f38fc00664f3b5547a6c3clists only these seven files and every blob equalsc3d71c61978ffbc95182db077bd45e86f43af5e2's, so the PASS atc3d71c61978ffbc95182db077bd45e86f43af5e2still describes this tip (enqueue-guard: a tip that moved without changing the change set must not void the PASS (update-branch should not cost a review) #1317);compare c3d71c61978ffbc95182db077bd45e86f43af5e2...0341982b441bc6a5d5f38fc00664f3b5547a6c3clists only the five filesmaingained.node --import ./test/harness-resolve.mjs --test test/workflows-page.test.js→ 11/11 pass. On the unpatchedworkflows.jsthe same file is 9/11, the two red ones being "a factory preset with a live copy keeps the Use this entry" and "Use this on a preset with a live copy hands the factory id to onUse"; the third new case (source: 'factory'/ own workflow) is green on both.node --import ./test/harness-resolve.mjs --test --test-concurrency=1 "test/*.test.js"→ 1854/1856 pass; the 2 failures are environmental, not this diff:test/check-arch-docs.test.js"empty diff passes" needs a realgitrepo ("cannot diff against HEAD"), andtest/usage-fields.test.js"fixture usage.sqlite…" shells out topython3, absent on this machine — neither file nor path is touched herenode scripts/ds-bot-patches.mjs check→ok 10 patches apply cleanly in order,ok core/ equals ds-bot/ + patches/ds-bot/; the pin hash is skipped out loud because this machine has nogit.node scripts/build-client.mjs --check→ exit 0 (client.jsis the build ofsrc/client).node .github/scripts/changelog.mjs check→46 fragment(s) in changelog.d/ are well formed.node node_modules/oxlint/bin/oxlint -c .oxlintrc.json src test→Found 58 warnings and 0 errors.Not run:
npm run verify: itsarch-docsstep shells out togit log/git diffand this machine has nogitbinary (the tarball has no.giteither), so the local equivalent was run piecewise above; CI runs the full chain.plugins/*, interop and live-e2e suites: untouched by this diff, CI runs them.Docs-not-needed: restores behavior already documented in
docs/subsystems/core-client.md(Settings → Workflows; "A factory preset stays read-only until Use this copies it withworkflow/create, and that copy opens in Edit"); no architecture change.Risk
T1 by
.github/agent/risk-rules.json(changed paths arecore/src/client/**,core/client.js,patches/**,core/test/**,changelog.d/**): one comparison in one render guard, two generated mirrors and one test file — no auth, data, migration, CI or release surface.Checkpoint
{ "pr": 1515, "claim": "Chief", "issue": 1396, "summary": "A factory preset that already has a live copy stored the factory id string in fromFactory, but the Use this guard compared it with true, so the copy entry never rendered and the preset could not be copied from that graph. The guard now compares against undefined, which agrees with the id onUse already reads. Three unit cases cover the live-copy render, the click payload, and the two sides that must not change; the test, client.js and both patch mirrors are regenerated, plus one changelog fragment. The list row stays chevron-only by design.", "files": ["core/src/client/workflows.js", "core/client.js", "core/test/workflows-page.test.js", "patches/ds-bot/0008-client-bundle.patch", "patches/ds-bot/files/src/client/workflows.js", "patches/ds-bot/files/test/workflows-page.test.js", "changelog.d/1396-workflow-use-this.fixed.md"], "checks": { "ran": "test/workflows-page.test.js 11/11 (2 red on the unpatched guard); core suite serial; ds-bot-patches check ok; build-client --check; changelog check; oxlint 0 errors", "result": "green", "at": "0341982b441bc6a5d5f38fc00664f3b5547a6c3c" }, "next": "none — ready to enqueue; the PASS at c3d71c61978ffbc95182db077bd45e86f43af5e2 carries: identical change set" }