conductor/SAFETY_TEST_PLAN.md

145 lines
6.0 KiB
Markdown

# Component Deletion Safety Test Plan
## Purpose
Verify that deleting a referenced component is safe, warns before damage, and leaves useful diagnostics when deletion is confirmed.
Use a disposable project. Save it before each deletion test so the working version can be restored without rebuilding it.
## Test 1: Table Referenced by a Response Binding
### Setup
1. Confirm the project contains a Table named `postsTable`.
2. In **Actions & Bindings**, confirm a response binding targets `postsTable (Table.rows)`.
3. Save the project.
Why: deleting `postsTable` would break a real canonical response-binding target.
### Attempt deletion
1. Open **Visual Editor**.
2. Select `postsTable`.
3. Select the Table's red **x**.
Expected warning:
- The UI says `postsTable` is referenced.
- It identifies the affected response binding.
- It offers **Cancel** and **Delete anyway**.
### Stop condition
If the Table disappears immediately without a warning, stop this test and record:
> Referenced Table deleted without a warning.
This confirms the deletion-warning implementation gap. Continue only with **Post-deletion diagnostic** below.
### Cancel path
If a warning appears:
1. Select **Cancel**.
2. Confirm `postsTable` remains on the canvas.
3. Confirm the response binding remains unchanged.
Why: cancellation must not partially modify the component or binding.
### Confirmed deletion path
1. Attempt the deletion again.
2. Select **Delete anyway**.
3. Confirm only `postsTable` was removed.
Why: intentional deletion must remain possible without changing unrelated records.
### Post-deletion diagnostic
1. Open **Actions & Bindings**.
2. Find the binding that targeted `postsTable`.
3. Confirm it reports that target component `postsTable` is missing.
4. Open **JSON Editor** and confirm:
- `postsTable` is absent from `page.components`.
- The binding still targets `components.postsTable.rows`.
- Unrelated actions, bindings, variables, and components are unchanged.
Why: broken references must remain visible and diagnosable rather than being silently removed.
### Restore
1. Do not save the broken project.
2. Use **Load** to reopen the saved project.
3. Confirm `postsTable` and its binding return.
4. Enter **Preview** and confirm page-load population still works.
## Test 2: Text Input Referenced by a Request Template
### Setup
1. Add a Text Input named `itemInput`.
2. In **Actions & Bindings**, edit or create a disposable GET action.
3. Add this query parameter:
- Key: `item`
- Value: `{{components.itemInput.value}}`
4. Save the action and project.
Why: the action now depends on `itemInput` when rendering its request.
### Attempt deletion
1. Open **Visual Editor**.
2. Select `itemInput`.
3. Select its red **x**.
Expected warning:
- The UI says `itemInput` is referenced by an action request template.
- It offers **Cancel** and **Delete anyway**.
If no warning appears, record:
> Referenced Text Input deleted without a warning.
### Diagnostic after confirmed deletion
1. Open **Actions & Bindings**.
2. Inspect the affected action.
3. Confirm it reports that the template references missing component `itemInput`.
4. Confirm unrelated configuration remains unchanged.
5. Reload the saved project to restore the working version.
## Results
- [ ] Referenced Table deletion produced a warning. **Failed: the Table was deleted immediately without a warning.**
- [ ] The Table warning identified the affected binding. **Not applicable: no warning appeared.**
- [ ] Cancel preserved the Table and binding. **Not applicable: no warning appeared.**
- [ ] Delete anyway removed only the Table. **Not applicable: deletion was immediate.**
- [x] The broken binding produced a missing-component diagnostic.
- [ ] Referenced Text Input deletion produced a warning. **Failed: itemInput was deleted immediately without a warning.**
- [ ] The Text Input warning identified the affected request template. **Not applicable: no warning appeared.**
- [x] The broken template produced a missing-component diagnostic.
- [x] Reload restored the saved working project.
Tester/date: User, 2026-07-29 through 2026-07-30
Notes or defects: Deleting postsTable did not show a reference warning even though binding_response_1 targeted components.postsTable.rows. After deletion, Actions & Bindings correctly retained the binding and reported component postsTable not found / Target references component postsTable which does not exist on any page. Deleting itemInput also produced no warning, but the retained action correctly diagnosed the missing component template afterward. After restoration, the query row correctly placed the template in the value field; queryParameters.key identifies the query parameter named key rather than the editor's key field. The separate action-trigger warning remains a false positive because it ignores the valid page onLoad event.
## Implementation Retest
The missing warning is now implemented and automated-tested. Repeat these checks in the rebuilt app:
- [x] Delete referenced `postsTable`; the dialog lists its response binding.
- [x] Choose **Cancel**; the Table and binding remain.
- [x] Try again and choose **Delete anyway**; only the Table is removed, and the retained binding reports the missing component.
- [x] Delete referenced `itemInput`; the dialog lists the action request-template reference.
- [x] Choose **Cancel**; the Text Input and action remain.
- [x] Try again and choose **Delete anyway**; only the Text Input is removed, and the retained action reports the missing component.
- [x] Delete an unreferenced disposable component; it is removed immediately without an unnecessary dialog.
Why: this proves both safe interruption and intentional deletion work, while broken references remain visible instead of being silently erased.
Automated checkpoint on 2026-07-30: focused coverage passed at 4 suites / 12 tests, the full frontend suite passed at 20 suites / 490 tests, and the production build passed. The user manually confirmed every implementation-retest check passed on 2026-07-30.