refactor(form-builder): drop legacy snapshot 'binding' (singular) key (WS-6)

Session 2 wrote both 'binding' (singular) and 'bindings' (plural)
in form_submissions.schema_snapshot for backward compatibility. With
no production data yet and dev seeders re-running every cycle, dual-
key state has no upside. Snapshots now write 'bindings' only;
all readers updated to match.

FormFieldBindingService::snapshotShapesFor() simplified to return
only ['bindings' => $all]. Pre-existing
SchemaSnapshotEmbedsBindingFromRelationalTableTest updated to assert
the applicator shape (with id, merge_strategy, trust_level,
is_identity_key) on bindings[0]; new
SnapshotOnlyContainsBindingsKeyTest enforces the no-legacy-key
contract going forward.

FormBuilderDevSeeder template snapshot embeds 'bindings' => [] for
form-owned fields (Pattern B) instead of 'binding' => null.

Other 'binding' string occurrences in the codebase (FormFieldResource,
FormFieldService, request validation rules, BindingConflictResolver
internal helper key) are unrelated to snapshot dual-state and remain
untouched.

Refs: WS-6 session 2 deviation #9 cleanup

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-28 00:11:20 +02:00
parent d2059e3cff
commit 6dace312b4
4 changed files with 104 additions and 31 deletions

View File

@@ -97,7 +97,7 @@ final class FormBuilderDevSeeder
'is_required' => $field['is_required'] ?? false,
'is_filterable' => $field['is_filterable'] ?? false,
'is_pii' => $field['is_pii'] ?? false,
'binding' => null, // Pattern B — snapshot embeds null for form-owned fields.
'bindings' => [], // Pattern B — snapshot embeds an empty array for form-owned fields.
'conditional_logic' => null, // snapshot shape: null for fields without conditional logic
'translations' => null,
'value_storage_hint' => $field['type']->recommendedValueStorageHint()->value,