Skip to content

Sync CUI main: voice, creative controls, and hardened bindings - #23

Merged
albertwoo merged 3 commits into
mainfrom
feat/cui-latest
Nov 16, 2026
Merged

albertwoo merged 3 commits into
mainfrom
feat/cui-latest

Conversation

@albertwoo

@albertwoo albertwoo commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Sync

Pin CUI to 6e6b353, 148 commits after v1.4.0. There is no newer tag. Complete header snapshots and the generated IR agree: 36 new functions, 32 new structs, no removed functions, and one new header section (Creative controls). The existing Voice section gains its widgets. cui_spinner remains as a compatibility export alongside cui_spinner_ex.

Coverage: 532 C functions, 0 PENDING, 194 options, 111 records, 302 generated wrappers, 181 manual, 6 excluded, 4 variadic.

Three new gallery pages, light and dark:

  • Creative controls: status tags, ratio/gradient/step sliders, palette, aspect picker, option/action, seed, pattern meter, skeleton group and veil.
  • Collaboration: presence, cursors, selection ring/bar, result card, canvas controls and format bar.
  • Voice: waveform/seek, recorded note, session, typing indicator and spinners.

Review and hardening

  • VoiceNote keeps its caller-owned waveform during write-back. The generator preserves const input arrays when copying scalar state back. Regression tests exercise Play and Speed, replacement/null waveforms, and later frames.
  • Seedless PaletteStrip really passes NULL. Shuffle reports Action without recoloring; a supplied seed recolors only unlocked swatches. Both overloads reject mismatched color/lock lengths instead of silently truncating.
  • StepSlider validates the normalized range. CUI makes reversed/equal bounds into two stops; the wrapper does that before checking labels. Overflowing native stop counts are rejected even without labels.
  • Typed native event words: WellEvents, FormatEvents, CanvasEvents, VoiceSessionEvents, plus VoiceNote's shared PlayerEvents. SelectionBar remains an action index, with -1 = none and -2 = cleared.
  • Optional injections belong to the receiving widget. A matching field name on a different options struct no longer validates a bad override; two generator negative tests pin this.
  • CuiVoice.Resample rejects overlapping spans. Tests check peaks, silence, empty inputs, upsampling and unchanged input on rejection.
  • All three actual gallery pages allocate 0 B/frame in steady state. Tests reference the gallery itself, not a copied approximation. Removed per-frame enum arrays, enum-string ids, string concatenations and dynamic option strings.
  • API-diff reads complete snapshots. Moved declarations and reformatted typedefs no longer masquerade as additions/removals. An isolated Git fixture tests comments, header moves, multiline declarations and parenthesized exports.

Five behavioral regression cases were observed failing before the fixes, then passing afterward. Native/CUI remains pristine; no patches.

Surface

Against main, docs/API-SURFACE.txt set difference has two removals, both constructors gaining upstream fields: GanttTask.State and GaugeBand.Name. Against the first sync commit, 21 signatures change from Int32 to their documented event enums (including extension/static forms); this is deliberate new pre-1.0 surface.

Verification

  • Release build with -warnaserror: 0 warnings/errors.
  • 1,129 tests pass: 1,092 core + 37 template; no skips.
  • Format --verify-no-changes: clean.
  • Regen -NoNative -NoDiff: no diff, 17 contract checks, catalog --check no diff.
  • API surface reviewed by set difference; sync-status exits 0.
  • Template verification: 69.9 s, pack → scaffold → build/test → AOT → installed dotnet cui; full app 2,306,048 B, one-file mini 1,201,664 B.
  • Gallery AOT: 3,177,984 B, zero IL2xxx/IL3xxx warnings.
  • Every shipped app shape passes its existing size budget; combined frame/AOT/shape budget check passes.
  • Six new-page screenshots regenerated and the voice image inspected: the note now retains its waveform.

Performance decision — not noise

An isolated main worktree (5fbab51) with its own freshly built CUI 1.4.0 library measured 0.82, 0.84, 0.82 ms. Alternating new-pin runs measured 0.94, 0.94, 0.94 ms, all at 1280×720 with 0 B/frame. This is a repeatable roughly 14% frame regression across the sync, not proven noise or a consequence established merely by a larger binary.

The frame ceiling moves explicitly from 0.90 to 1.00 ms; the AOT ceiling from 2.95 to 3.20 MB. PERFORMANCE.md records the comparison, SIZE.md separates historical profile measurements from current sizes, and PLAN.md tracks profiling the regression. Native fixes still belong upstream.

binwenw added 2 commits November 16, 2026 09:22
CUI's main is 148 commits past the 1.4.0 tag: forty new functions, thirty-six
new structs, and two header sections the binding had never seen (Voice and
Creative controls). Every one of those functions now has a decided status.
532 C functions, 0 pending.

Three quarters of the work was deciding, not generating. The generator learned
four things the new headers need:

- an array whose length is one of the widget's own parameters is checked before
  the call, so a short span cannot be over-read (ToolbarRadio's labels, the
  step slider's stop names, the voice owners, the sankey node colors);
- a `const uint8_t *` is a byte per item, not a string;
- a `const cui_color *` converts element by element into the arena, because
  `Color` and `cui_color` are different structs;
- a pointer to a const enum is an array of that enum.

And one thing the wrappers needed: a scalar the widget writes through, like a
treemap's selected tile or a clip's played fraction, becomes a `ref` parameter
with an overload that passes null for the callers who do not want it. That is
what keeps `ui.Treemap(id, items, opts)` compiling when the widget gains a
selection.

Three widgets are hand-written, because a generated record cannot own a pointer
per item: `ui.CanvasControls` (every toggle carries its own `bool *`),
`ui.PaletteStrip` (colors and lock flags, both edited in place, counted once)
and `ui.SelectionBar` (the flags native clears itself). Each owns those flags
in the frame arena and copies them back into the caller's span. `CuiVoice`
resamples a clip without a frame, the way `CuiCron` parses a schedule.

Two functions came out of a section exclusion that was no longer true:
`ui.SetClipboard` and `ui.GetClipboard` are what CUI added for a "Copy path"
menu item, not platform input.

The gallery has three new pages — Creative controls, Collaboration and Voice —
because a component nobody can see is a component nobody trusts.

Two records gained a field upstream (GanttTask.State, GaugeBand.Name) and
cui_spinner became cui_spinner_ex; `ui.Spinner(size)` still compiles.

Gates: build -warnaserror, 1108 tests, format clean, regen -NoDiff with 15
contract checks and no catalog drift, api-surface reviewed by set difference
(two constructor signatures, both the gain of a field), templates verified in
85 s, AOT 3 180 544 B (0 IL warnings), frames 0.92 ms mean with 0 B allocated,
every app shape inside its budget. The AOT budget moved with the executable and
both are recorded in PERFORMANCE.md with the cause.
Preserve caller-owned const arrays in record write-back, pass null for seedless palettes, reject mismatched palette buffers and overflowing step ranges, and reject overlapping voice resampling buffers. Promote native event flags to typed results and validate optional injections against their own function. Test native play/speed, shuffle, toggle, selection clear and short-array behavior; measure the actual new gallery pages at zero steady-state allocation.

Compare complete header declaration sets: upstream added 36 functions and 32 structs, not the moved/reformatted declarations counted before. Keep spinner compatibility visible. Correct the release notes, authoring guide and size history. Alternating isolated baseline/new-pin runs confirm 0.82-0.84 versus 0.94 ms; track profiling that regression instead of claiming noise.

Verified: warn-as-error build; 1129 tests; format clean; regen no diff with 17 contract checks and catalog freshness; template verification 69.9 s; AOT 3177984 B with no IL warnings; combined frame/AOT/all-shape budgets pass; sync status consistent; refreshed light/dark screenshots.
@albertwoo albertwoo changed the title Sync to CUI's latest main: forty functions, two new sections, three gallery pages Sync CUI main: voice, creative controls, and hardened bindings Nov 16, 2026
Move the version knob, the template default, the gallery's embedded version, the changelog section and the prose that names the release, then regenerate the API catalog so its version agrees. AOT stays 3 177 984 B with no IL warnings; frame budget unchanged.
@albertwoo
albertwoo merged commit 6364878 into main Nov 16, 2026
24 checks passed
@albertwoo
albertwoo deleted the feat/cui-latest branch November 16, 2026 02:30
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