# KRB Image Cluster Replacement v3

## Why v2 still failed

The Weddings Designer API output showed:

- Parent methods: `after`, `append`, `before`, `getChildren`, `prepend`, `remove`, ...
- Anchor methods: `after`, `before`, `remove`

v2 tried `anchor.before(component)` using the component definition directly. That did not succeed. The likely API shape is that `before()` accepts an existing element/instance, not a component definition.

## What changed in v3

v3 keeps all v2 safety defaults and adds an append-then-move transaction:

1. Try direct ordered insert methods as before.
2. If those fail, append the new `Component / Slider Gallery` to create a real instance.
3. Move that inserted instance before the old `Section / Image Cluster` using `anchor.before(inserted)` / related element-instance methods.
4. Verify the new instance is at the expected index.
5. Only then remove the obsolete `Section / Image Cluster`.
6. If the move/verification fails, remove the appended test instance before failing.

So it should not leave a stray appended gallery unless Webflow fails both move and removal.

## Suggested Weddings test

1. Open `/community/weddings`.
2. Run v3 unchanged first (`dryRun: true`) and check prefix:
   `KRB_IMAGE_CLUSTER_REPLACEMENT_V3_RESULT`
3. Set `dryRun: false` and run Weddings.
4. Confirm `replacementMethod` is something like `append then anchor.before(inserted)`.
5. Check `topLevelAfter` shows `Component / Slider Gallery` where `Section / Image Cluster` was.

## Safety defaults

```js
CONFIG.dryRun = true;
CONFIG.runMode = 'current-page';
CONFIG.allowAppendOnlyFallback = false;
```

No publish/site/script/CMS/redirect/style operations are included.
