Repository navigation
Require real copy evidence before promoting a control to copy-to-clipboard - #7469
Conversation
…ontrol to copy-to-clipboard
A bare data-copy attribute was copy evidence by itself, but data-copy also
names duplicate and clone commands: a configurator's quantity stepper
(data-copy="block-0", "Add one Cutlery bay") became a copy button that
copied "block-0".
Clipboard contracts are now data-clipboard* and data-copy-{text,target,
selector,value,content}. Any other data-copy* attribute counts only when
a source runtime script writes to the clipboard where it reads that
attribute. Otherwise the control keeps ordinary button lowering.
Fixes #7467
|
Can this PR affect sdnunca at all? No. The frozen capture ( Output diff. I replayed sdnunca with
Visual replay vs baseline (regressed cells):
Trunk "regresses" against its own baseline in 2 of 3 rounds, so the sdnunca cells flip with machine load. The same flakiness shows up on unrelated heads: sdnunca was flagged on #7449, #7456 and #7461, and could not be measured on #7455, #7464 and #7468. The 3 specific cells from the original run aren't recoverable: the No code change is needed for this PR. AI disclosure: investigated by Claude (Opus) as a Franklin/Pi subagent; Chris Huber directed the work. |
Fixes #7467
What
A control now needs real copy evidence before
CopyToClipboardConverterpromotes it to the copy-to-clipboard block:data-clipboard*(clipboard.js) ordata-copy-text/-target/-selector/-value/-content, which name the copied payload.data-copy*: any otherdata-copy*attribute, including a baredata-copy, counts only when a source runtime script (runtime_projection_script_assets) writes to the clipboard (clipboard.writeText/write, orexecCommand('copy')) close to where it reads that attribute (data-copyordataset.copy…).Anything else, such as a quantity stepper
+withdata-copy="block-0"and "Add one Cutlery bay", is not handled by this converter. It falls through to ordinary button lowering, the same path its−sibling already takes. There is no stepper primitive in the engine today.Root cause:
php-transformer/src/HtmlToBlocks/Elements/CopyToClipboardConverter.phphasClipboardContract()matched/^data-(?:clipboard|copy)(?:-[a-z0-9-]+)?$/as copy evidence by itself. That rule was introduced in #2051.Tests
tests/unit/copy-to-clipboard-block.phpadds three cases:dataset.copyis still not a copy block, even though the script callsnavigator.clipboard.writeTextelsewhere for an unrelated share link.data-copythat a script feeds tonavigator.clipboard.writeText(b.dataset.copy)is still a copy block, and the attribute supplies the payload.Verification
tests/unit/copy-to-clipboard-block.php: passes (fails on trunk)php tests/run.php: the only failures are Chrome-dependent contracts that also fail on trunk locally (no Chrome)+steppers arecore/buttons lowered exactly like their−siblings, and editor validation reports 0 invalid blocks site-wide.AI disclosure: implemented by Claude (Opus) as a Franklin/Pi subagent; Chris Huber directed the work.