Skip to content

feat(sync): per-section sync results UI (#26) - #71

Merged
cchacs merged 4 commits into
mainfrom
pullfrog/26-per-section-results-ui
Oct 12, 2026
Merged

cchacs merged 4 commits into
mainfrom
pullfrog/26-per-section-results-ui

Conversation

@pullfrog

@pullfrog pullfrog Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Closes #26 (sub-issue 5/5 of per-section sync #8; builds on #24/#25).

What

Adds the review surface for the per-section alignment engine: a Per-section sync (review sections)… item in the Tempo/Grid menu opens a list with one row per section.

  • Confidence badge per section (high green / low amber / failed red), the scale factor and time shift it would bake, and an Apply/Skip toggle.
  • Low-confidence sections default to skip and are never applied unless the user explicitly selects them — the Per-section sync 1/5: guard the uniform model's do-no-harm behavior on meter-changing songs #22 do-no-harm rule. failed sections (no usable fit) are not selectable at all.
  • Apply all high-confidence re-selects just the trusted sections; Apply commits the current selection through the same applyPerSectionSync path as Per-section sync 4/5: bake the piecewise warp into note timestamps (offline, with round-trip) #25, so the preview and the committed edit are the same map. A conflict (a run pinned to identity at both ends) blocks Apply with a status message instead of silently demoting.
  • A single-section song collapses to the uniform model (one full-domain row).
  • Modal uses the shared _installModalKeyboard trap (Escape closes, Tab wraps, focus restored to the opener); focus is kept inside the modal across the per-toggle re-render so global shortcuts can't leak through the overlay.

Design

  • Pure decision layer in src/section-sync.js: SECTION_SYNC_CONFIDENCE_FLOOR = 0.7, _sectionSyncPlanPure(analysis, decisions, options), and an explicit selected override in _proposalAcceptedPure (false = hard skip, true = force a low-confidence-but-usable section; affine validity is never overridable). Rows expose both the decision intent (wanted) and the conflict-demoted result (accepted) so a pinned run is not toggle-stuck. The map builder now tags intervals with their section index.
  • src/section-sync-ui.js only gathers onsets, renders, and hands the plan to the apply path.
  • main.js wires the window.editor* entry points; screen.html adds the modal; CHANGELOG.md gets an [Unreleased] entry.

Tests

  • tests/section_sync_ui.test.mjs (new): default skips low confidence, explicit overrides both ways, failed sections unselectable, single-section collapse, conflict surfacing, and an integration pass proving the plan drives applyPerSectionSync (skipped notes untouched, selected notes baked).
  • tests/section_sync_ui_dom.test.mjs (new): drives the real module against a DOM stub — Apply disabled + focus inside the modal on an all-skipped plan, focus restored after a toggle re-render, summary skips-count, apply bakes and closes, Escape restores the opener.
npm test        # 414 pass
npm run lint    # 0 errors

Pullfrog  | View workflow run | via Pullfrog | Using big-pickle (free) | 𝕏

Add a Tempo/Grid menu item that opens a review list of the #24
per-section analysis: one row per section with a confidence badge, the
scale factor/shift it would bake, and an Apply/Skip toggle. Low-confidence
sections default to skip and are never applied unless explicitly selected;
failed sections are not selectable. Apply all high-confidence re-selects
just the trusted sections, and Apply bakes the accepted map through the
same applyPerSectionSync path as #25, so preview and commit are one map.
A single-section song collapses to the uniform model.

The pure decision layer (_sectionSyncPlanPure, _proposalAcceptedPure
selected override, SECTION_SYNC_CONFIDENCE_FLOOR) lives in section-sync.js;
section-sync-ui.js only gathers onsets, renders and hands the plan over.
@pullfrog
pullfrog Bot requested a review from cchacs October 12, 2026 16:31
pullfrog Bot added 2 commits October 12, 2026 16:31
Self-review fixes for #26:

- Restore focus inside the modal after a toggle re-renders the rows
  container (previously focus fell to <body>, so Escape/Tab and global
  shortcuts leaked through the overlay), and fall back to the primary
  control / modal root when the disabled Apply button refuses focus.
- Track the decision INTENT (`wanted`) separately from the conflict-demoted
  acceptance so a both-ends-pinned section is not toggle-stuck; show it as
  `conflict` and let the user skip it to clear.
- Count only genuinely-skipped low-confidence sections in the summary
  (a forced-on section no longer reads as skipped).
- Disable 'Apply all high-confidence' when a conflict blocks Apply.
- Preserve the rows scroll position across re-renders; add dialog ARIA.
- Add a DOM-driven suite pinning the focus/summary/apply/Escape behaviour.
Comment thread src/section-sync-ui.js Resolved
@kilo-code-bot

kilo-code-bot Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (8 files)
  • CHANGELOG.md
  • screen.html
  • src/main.js
  • src/menu-bar.js
  • src/section-sync-ui.js
  • src/section-sync.js
  • tests/section_sync_ui.test.mjs
  • tests/section_sync_ui_dom.test.mjs
Previous Review Summary (commit 8423af3)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 8423af3)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src/section-sync-ui.js 226 Apply all high-confidence disabled state is computed from the current-decisions plan, but the action rebuilds the default plan — the button can enable into a guaranteed conflict refusal
Files Reviewed (8 files)
  • CHANGELOG.md - 0 issues
  • screen.html - 0 issues
  • src/main.js - 0 issues
  • src/menu-bar.js - 0 issues
  • src/section-sync-ui.js - 1 issue
  • src/section-sync.js - 0 issues
  • tests/section_sync_ui.test.mjs - 0 issues
  • tests/section_sync_ui_dom.test.mjs - 0 issues

Fix this issue in Kilo Cloud


Reviewed by efficient · Input: 32.2K · Output: 7.9K · Cached: 223.9K

@cchacs
cchacs merged commit 95a0590 into main Oct 12, 2026
6 checks passed
@cchacs
cchacs deleted the pullfrog/26-per-section-results-ui branch October 12, 2026 17:07
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.

Per-section sync 5/5: per-section results UI (confidence badges, apply or skip each section)

1 participant