mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-21 18:47:02 +03:00
bake: the anchor must have matched one element on the page
The lasting rules a bake appends apply to every element the anchor matches, so a `tag.class` anchor shared by siblings (three cards from one JSX element, say) restyled all of them, not the element the user picked. The overlay now journals, with the generate event, the anchor it would bake on (`element.anchor`: the id, else the tag with its classes) and how many elements matched it when Go fired (`element.anchorMatches`). The planner bakes only when the source anchor is that same selector and the count is one; otherwise it leaves the carbonize block with the count in `bakeSkipped`, and the agent integrates the variant by hand. Written with AI assistance (Claude). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
committed by
Abdul Wahab
co-authored by
Claude Fable 5.1
parent
0166cbb870
commit
71a3341289
@@ -17,6 +17,13 @@ describe('live-browser source contracts', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('describes the picked element with the anchor a bake would use and its match count', () => {
|
||||
const body = SOURCE.match(/function extractContext\(el\) \{[\s\S]*?\n \}/)?.[0];
|
||||
assert.ok(body);
|
||||
assert.match(body, /anchorMatches = document\.querySelectorAll\(anchor\)\.length/);
|
||||
assert.match(body, /anchor, anchorMatches,/);
|
||||
});
|
||||
|
||||
for (const annotated of [false, true]) {
|
||||
for (const outcome of ['created', 'failed', 'superseded']) {
|
||||
it(`${annotated ? 'annotated' : 'plain'} generation checkpoints only its acknowledged current session (${outcome})`, async () => {
|
||||
|
||||
Reference in New Issue
Block a user