Skip to content

refactor(loom-ui): move coded Group picker out of the reshape editor (#199) - #207

Draft
matthewpeterkort wants to merge 2 commits into
feature/postgres-backendfrom
ao/repo-simplify/199-coded-group-picker
Draft

matthewpeterkort wants to merge 2 commits into
feature/postgres-backendfrom
ao/repo-simplify/199-coded-group-picker

Conversation

@matthewpeterkort

@matthewpeterkort matthewpeterkort commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

What

Extracts the direct-source coded Group GroupCodedValuePicker (readiness polling, source pagination, saved-value reauthorization, search/paging, picker UI) out of the 5,115-line ConstructionReshapeEditor.tsx into a focused GroupCodedValuePicker.tsx module (534 lines) with an explicit exported props type. Part of the repo-simplification batch; implements #199.

Reduced reasoning burden (not mere line count)

  • One mental model per module. Before, answering "why does the coded picker show this error / when does its polling stop / what reauthorizes a saved value?" required holding the whole multi-operation reshape editor in mind — 5,115 lines covering seven operation kinds — to locate the picker's independent async state machine (4 useState cells, 3 request refs, checkpoint ref, two useQuery workflows with scope-key gating). Now that state machine is the entire file: every top-level declaration in GroupCodedValuePicker.tsx participates in one workflow, and the readiness/scope-key/truncation invariants can be checked without reading pivot, expand, or aggregate code.
  • The editor's invariant surface shrinks. ConstructionReshapeEditor keeps what the ticket defines as its job: form coordination and construction-intent conversion. Its import list lost useQuery, semanticConceptLabel, FrameSourceOption, SemanticInventoryBrowseResponse, SemanticInventoryItem — evidence these concepts are no longer part of the editor's story.
  • Boundary made explicit instead of implicit. The parent/picker seam is now the typed props contract (GroupCodedValuePickerProps: context, form, stage, disabled, onChange) plus six explicitly exported shared helpers. Shared Group form construction and candidate-evaluation logic (codedFamilyKey, codedCategoryKey, createOpaqueId, uniqueName, getUsedGroupNames, ensureGroupCodedPassthroughs) stays in the parent as the ticket prescribes; no logic was rewritten, no behavior, error text, ordering, or cancellation semantics moved location or changed.

Extraction integrity (moved body correspondence)

Applied with a rerunnable checked-extraction tool: the moved slices (helpers 499-571, props fields 3729-3733, component 3735-4163) are asserted byte-identical between before/after, and 88/88 shift-only citations of docs/ui-contract-inventory/relational.fragment.json were verified byte-identical at their mapped offsets. The picker region's 10 citations map into GroupCodedValuePicker.tsx at L-3629; one straddling citation splits. No handwritten code comments were added; the no-comments gate passes.

Verification

Check Result
git diff --check clean
ConstructionReshapeEditor.unit.test.tsx (ticket check, unmodified) 103 matched / 103 passed / 0 skipped
constructionOperations/ directory 18 files, 314/314 passed, 0 skipped
Full src/features/ExplorerBuilder feature suite 79 files, 1,076/1,076 passed, 0 skipped
BuilderWorkspace.operationHistory.formal.test.tsx + reconciliation + suggestions.retry 3 files, 98/98 passed
Operation-history formal journey replay (verify-builder-formal-core.mjs --phase journey --feature operation-history) passed (ui-prepare, go-prepare, ui-capture, go-full, ui-panel, ui-reload; evidence /tmp/opencode/journey-199)
tsc -p tsconfig.test.json, check-boundaries, check_no_code_comments.py clean
Builder browser acceptance INCOMPLETE — not run: no /usr/bin/chromium in this sandbox; the journey's documented boundary already excludes browser evidence

Shared source maps re-pinned in-PR (commit 3f94a4df, coordinator-authorized)

Moving functions means updating explicit source maps, not neutering checks:

  • verification/builder-interactions/reviewed-sources.json: ConstructionReshapeEditor.tsx re-pinned to the digest recomputed from the actual blob at head (067873e6…), verified with the verifier's own digest(); all 29 reviewed entries re-verified, 0 failures.
  • docs/ui-contract-inventory/relational.fragment.json: all 99 distinct ConstructionReshapeEditor.tsx citations re-cited by a rerunnable tool that byte-verifies every mapped slice or refuses to write — 88 in-parent shifts (byte-identical), 10 picker citations moved to GroupCodedValuePicker.tsx (byte-identical at L-3629), and the one straddling reference 554-660 split into GroupCodedValuePicker.tsx:78-95 + ConstructionReshapeEditor.tsx:496-583 (first line carries only the deliberate export prefix on uniqueName).
  • docs/ui-contract-inventory/ui-supported-affordances.json: regenerated by the repo's own canonicalizer — relational fragment sha256, expandedSha256, and sourceCoverage.watchedFiles (parent re-pinned; GroupCodedValuePicker.tsx added at its actual-bytes digest). Pristine-base regeneration was confirmed byte-identical to the previously committed manifest before editing; lane 259's PR refactor(scripts): split UI contract canonicalizer into explicit phases #204 canonicalizer reproduces this exact manifest bytes over the same tree, so the pinned expandedSha256 does not churn under their simplification.

Fixture-gate evidence at this head: verify_ui_contract_inventory.py --source-only PASS (CI gate mode); --self-test both mutation probes PASS (including the builder.reshape.group_coded omission probe, proving the re-cited picker evidence still binds CODED_GROUP); full-mode issue set byte-identical to the pristine 80e88771 baseline (399 pre-existing pending-coverage rows, zero new issues); test_normalize_ui_contract_inventory 5/5 OK. Only ConstructionReshapeEditor/GroupCodedValuePicker entries were touched — no drive-by re-pins, no checks removed or weakened.

Closes #199

ConstructionReshapeEditor coordinated both the selected-operation form and a
distinct asynchronous picker workflow (direct-source coded Group selection)
that owns inventory readiness polling, source pagination, saved-value
reauthorization, search and paging. The picker had one callsite and no
dependency on the parent's mutable request refs; its reasoning burden was
paid by every reader of the 5,115-line multi-operation module.

Move GroupCodedValuePicker, its private readiness/paging state types, the
readiness poll waiter, the initial-choices constant, and the availability
classifier into GroupCodedValuePicker.tsx with an explicit exported props
type. Shared Group form construction and candidate-evaluation helpers
(codedFamilyKey, codedCategoryKey, createOpaqueId, uniqueName,
getUsedGroupNames, ensureGroupCodedPassthroughs) and the form/context types
stay in the parent module and are now imported by the picker; no logic was
rewritten. The parent drops its now-unowned useQuery, semanticConceptLabel,
FrameSourceOption, SemanticInventoryBrowseResponse and SemanticInventoryItem
imports and shrinks to 4,601 lines.

Behavior is byte-exact: the moved bodies were checked-extracted verbatim
(rerunnable tool asserts before/after slice equality), no expectations were
touched, and no comments were added.

Verification:
- ConstructionReshapeEditor.unit.test.tsx: 103/103 passed, 0 skipped
- constructionOperations directory: 18 files, 314/314 passed
- ExplorerBuilder feature suite: 79 files, 1,076/1,076 passed
- BuilderWorkspace operation-history/reconciliation/suggestions: 98/98
- operation-history formal journey replay (UI + Go phases): passed
- typecheck (tsc -p tsconfig.test.json), check-boundaries,
  check_no_code_comments: clean; git diff --check clean
- Builder browser acceptance: not run (no Chromium in this sandbox);
  recorded as incomplete evidence

Closes #199 (source-map re-pin for reviewed-sources.json and the UI
contract inventory citations is handed to the verifier/tooling owner with
the verified line mapping).
…s for the picker extraction

Moving functions means updating explicit source maps, not neutering checks
(repo-simplify-199 follow-up, coordinator-authorized shared-fixture commit).

- verification/builder-interactions/reviewed-sources.json: re-pin the
  ConstructionReshapeEditor.tsx entry to the digest recomputed from the
  actual blob at this head (067873e6...), verified with the same sha256
  digest() the formal verifier uses; all 29 reviewed entries re-verified,
  0 failures.
- docs/ui-contract-inventory/relational.fragment.json: re-cite all 99
  distinct ConstructionReshapeEditor.tsx line references for the picker
  extraction, applied by a rerunnable tool that byte-verifies every mapped
  slice or refuses: 88 in-parent shifts (byte-identical), 10 picker-region
  citations moved to GroupCodedValuePicker.tsx (byte-identical), and the
  single straddling reference 554-660 split into GroupCodedValuePicker.tsx:
  78-95 (helpers) plus ConstructionReshapeEditor.tsx:496-583, whose first
  line carries only the deliberate `export ` prefix added to uniqueName.
- docs/ui-contract-inventory/ui-supported-affordances.json: regenerated by
  the repo's own canonicalizer (scripts/normalize_ui_contract_inventory.py):
  relational fragment sha256, expandedSha256, and sourceCoverage.watchedFiles
  (ConstructionReshapeEditor hash re-pinned, GroupCodedValuePicker.tsx added
  at its actual-bytes digest). Pristine-base regeneration was confirmed
  byte-identical to the previously committed manifest before editing, and
  lane 259's PR 204 canonicalizer reproduces this exact manifest bytes over
  the same tree, so the pinned expandedSha256 does not churn under their
  simplification.

Scope discipline: only ConstructionReshapeEditor/GroupCodedValuePicker
entries were touched; no unrelated re-pins. No checks removed or weakened.

Verification:
- verify_ui_contract_inventory.py --source-only: PASS (CI gate mode)
- verify_ui_contract_inventory.py --self-test: both mutation probes PASS,
  including the builder.reshape.group_coded omission probe proving the
  re-cited picker evidence still binds CODED_GROUP
- verify_ui_contract_inventory.py full mode: issue set byte-identical to
  the pristine 80e8877 baseline (399 pre-existing pending-coverage rows,
  zero new issues)
- scripts/tests/test_normalize_ui_contract_inventory.py: 5/5 OK
- reviewed-sources digest loop (formal-tools digest()): 29/29 match
- ConstructionReshapeEditor.unit.test.tsx: 103/103 passed, 0 skipped
- git diff --check: clean

@matthewpeterkort matthewpeterkort left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: extraction is faithful — ready, no changes required

Moved-code correspondence (verified against the base diff). The moved slices are byte-identical: helpers/types/constants (waitForCodedInventoryReadinessPoll, availableGroupCodedEntry, GroupCodedSourceDiscovery/Readiness/Family/Checkpoint/View, INITIAL_VISIBLE_CODED_CHOICES, CODED_INVENTORY_READINESS_POLL_INTERVAL_MS) plus the full component (old ConstructionReshapeEditor.tsx:3728-4163 to GroupCodedValuePicker.tsx:105-534) match the deleted lines exactly, with the inline props type hoisted to the exported GroupCodedValuePickerProps and an explicit import header added. No behavior, error text, ordering, or cancellation semantics changed.

Parent side. The call site is untouched and matches the exported props contract (context, form, stage, disabled, onChange); ConstructionReshapeEditorProps was already exported (line 334), so the type-only picker import is sound. All five removed parent imports (useQuery, semanticConceptLabel, FrameSourceOption, SemanticInventoryBrowseResponse, SemanticInventoryItem) have zero remaining references in the parent, and no orphan references to the moved symbols remain. The six shared helpers and four shared types gained export markers only, with no logic edits, per the ticket.

Re-pins. Citation shifts are arithmetically consistent with the three deletion zones (-4 import lines, net -73 lines in the helper zone above old 497, net -437 picker lines from old 3728, cumulative -514 below it). All 14 picker citations are within the 534-line file and land on the expected code; citation lengths are preserved (byte-identical moves); the straddling 554-660 citation splits into picker 78-95 plus parent 496-583; no citations of unrelated files were touched. Both manifests pin the same parent digest 067873e6…, and ui-supported-affordances.json adds GroupCodedValuePicker.tsx at its own digest in sorted position with the fragment sha and expandedSha256 updated.

Verdict: approved — no changes requested. (Posting as COMMENT because GitHub rejects APPROVE from the PR author account.)

Optional, not blocking: (1) ConstructionReshapeEditor and GroupCodedValuePicker now import runtime values from each other; the cycle is safe today because every cross-module reference sits inside component bodies, but hoisting the six shared helpers into a third module in a follow-up would remove the fragility entirely if top-level evaluation ever needs them. (2) Digests could not be recomputed inside the review sandbox (no hash execution permitted); cross-manifest consistency plus the worker-recorded verifier and fixture-gate runs support them. (3) New module has no dedicated test file; existing picker coverage runs through the unchanged parent unit suite, which is acceptable for a pure extraction.

Review basis: same-model review (qwen3.8-flash-next); tsc/test/fixture-gate results are taken from the worker-reported evidence, not rerun here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant