Skip to content

fix(workflows): keep Use this on a preset with a live copy - #1515

Merged
Birfy merged 3 commits into
mainfrom
dev/1396-workflows-use-this
Oct 28, 2026
Merged

Birfy merged 3 commits into
mainfrom
dev/1396-workflows-use-this

Conversation

@Birfy

@Birfy Birfy commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1396

Owner: Chief
Written-by: Dev
Reviewer: Reviewer
Tip SHA: 0341982b441bc6a5d5f38fc00664f3b5547a6c3c
Base: 92a6aabd0e4bbe679476cd62438ed5bae13405fd (main)
Tree: cbfb2bc8fdfa0b1bd5844e8f510ac00474a6fa57 at the tip (0341982b441bc6a5d5f38fc00664f3b5547a6c3c is a merge commit whose parents are c3d71c61978ffbc95182db077bd45e86f43af5e2 and main 92a6aabd0e4bbe679476cd62438ed5bae13405fd; Rework rebuilt it there and all seven changed blobs are byte-identical to c3d71c61978ffbc95182db077bd45e86f43af5e2)

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 / Edit only.

  • core/src/client/workflows.js:267: the showUse guard read opened?.fromFactory === true, while open() (:363) stores the factory id string in fromFactory for a live-copy preset. It now reads opened?.fromFactory !== undefined, which agrees with the payload onUse already sends at :296 (opened.source === 'factory' ? opened.id : opened.fromFactory).
  • core/client.js regenerated (fromFactory !== void 0); patches/ds-bot/0008-client-bundle.patch carries the bundled line and patches/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 hands onUse the 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: 0341982b441bc6a5d5f38fc00664f3b5547a6c3c
Ran (at 0341982b441bc6a5d5f38fc00664f3b5547a6c3c, the rebuilt tree):

  • Rebuild check (Rework): compare 92a6aabd0e4bbe679476cd62438ed5bae13405fd...0341982b441bc6a5d5f38fc00664f3b5547a6c3c lists only these seven files and every blob equals c3d71c61978ffbc95182db077bd45e86f43af5e2's, so the PASS at c3d71c61978ffbc95182db077bd45e86f43af5e2 still 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...0341982b441bc6a5d5f38fc00664f3b5547a6c3c lists only the five files main gained.
  • node --import ./test/harness-resolve.mjs --test test/workflows-page.test.js → 11/11 pass. On the unpatched workflows.js the 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 real git repo ("cannot diff against HEAD"), and test/usage-fields.test.js "fixture usage.sqlite…" shells out to python3, absent on this machine — neither file nor path is touched here
  • node 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 no git.
  • node scripts/build-client.mjs --check → exit 0 (client.js is the build of src/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:
  • Root npm run verify: its arch-docs step shells out to git log/git diff and this machine has no git binary (the tarball has no .git either), 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 with workflow/create, and that copy opens in Edit"); no architecture change.

Risk

T1 by .github/agent/risk-rules.json (changed paths are core/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"
}

Birfy added 2 commits October 28, 2026 09:11
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.
@Birfy Birfy added the agent-pr Pull request opened by an agent label Oct 28, 2026
@Birfy Birfy self-assigned this Oct 28, 2026
@Birfy

Birfy commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

Handoff

Written-by: Dev

Tip c3d71c61978ffbc95182db077bd45e86f43af5e2 (base 5ae9a503a75a0c0a9c4c2d632eda4f311c42b13b, rebuilt by update-branch; tree 62f2f742c16c34b12d74ed54427775f9fb540317).

CI at this tip: tests-ok green (plugins (tree), plugins (social), package, Node 24 · DSH 0.2.0-rc.2 all green), merge-gate green, computed tier T1 (no PASS needed).

enqueue-guard is red for one reason only — missing line: Reviewer:. This role does not write that line; the Reviewer adds it (and its conclusion) when it takes the tip. Nothing else stands in the way: the diff is 7 files, +65/−4, and only this change set.

@Birfy

Birfy commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

Verdict: PASS at c3d71c6
Written-by: Reviewer
Attestation: c3d71c6 role=Reviewer

Ran at this tip (2026-10-28T01:40Z):

$ node --import ./test/harness-resolve.mjs --test test/workflows-page.test.js   # core/, tree a304e1ed = tip
# tests 11
# pass 11
# fail 0
$ sed -i 's/opened?.fromFactory !== undefined/opened?.fromFactory === true/' src/client/workflows.js && node --import ./test/harness-resolve.mjs --test test/workflows-page.test.js
not ok 9 - a factory preset with a live copy keeps the Use this entry (#1396)
not ok 10 - Use this on a preset with a live copy hands the factory id to onUse (#1396)
# pass 9
# fail 2   (guard reverted for the check, then restored)
$ node scripts/ds-bot-patches.mjs check
skipped pin (no git): the tree hash cannot be computed here
ok   10 patches apply cleanly in order
ok   core/ equals ds-bot/ + patches/ds-bot/
$ node scripts/build-client.mjs --check   # core/, exit 0
$ node .github/scripts/changelog.mjs check
changelog: 47 fragment(s) in changelog.d/ are well formed

审查要点:

  • 根因对得上:open()(core/src/client/workflows.js:363)在有 live copy 时写 fromFactory: item.id(字符串),旧守卫 === true 恒假;改为 !== undefined 后与 onUse 的 opened.fromFactory 取值一致,按钮恢复,点击提交的是工厂 id。
  • 测试是实打实的:3 例都走真实 WorkflowsView 渲染;tip 上 11/11,把守卫改回 === true 后新增的两例转红(9/11),其余用例不动。
  • 生成物同步:core/client.js 与 patches/ds-bot/0008-client-bundle.patch、patches/ds-bot/files/ 三处一致;ds-bot-patches check、build-client --check、changelog check 全过。
  • 范围 7 文件 +65/−4,只此变更集;列表行按 triage 结论保持 chevron-only,没有顺手改别的。
  • tip 上 16 个 check 全终态,除 enqueue-guard(仅 missing line: Reviewer:,即缺本 tip PASS 的头部那一行)外无 failure;tier T1。

@github-actions github-actions Bot added the pass label Oct 28, 2026
Rebuilt on main 92a6aab by Rework: same seven changed files, byte-identical blobs to c3d71c6.
Written-by: Rework
@Birfy

Birfy commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

Rebuilt on main

Written-by: Rework

main moved to 92a6aabd (workflow-node-bot-baseline-tools, five files) after the PASS at c3d71c61, so I rebuilt the branch on it instead of leaving the body naming a stale base.

Local at the rebuilt tree (main 92a6aab + the seven reviewed files): node --import ./test/harness-resolve.mjs --test test/workflows-page.test.js → 11/11; with the guard put back to === true → 9/11 (the two #1396 cases red), guard restored → 11/11. scripts/ds-bot-patches.mjs check → 10 patches apply, core/ equals; core/scripts/build-client.mjs --check → 0; .github/scripts/changelog.mjs check → 48 fragments well formed.

Labels unchanged (agent-pr was already there; pass untouched — verdicts are the Reviewer's).

@Birfy
Birfy added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 2fb70d6 Oct 28, 2026
14 checks passed
@Birfy
Birfy deleted the dev/1396-workflows-use-this branch October 28, 2026 02:34
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settings → Workflows: a factory preset with a live copy loses its "Use this" button (fromFactory is a string, compared to true)

1 participant