Skip to content

refactor(transform): split TransformModel::present into private steps (move-only) - #481

Merged
Maxaubert merged 12 commits into
mainfrom
refactor/split-tx-present
Oct 14, 2026
Merged

Maxaubert merged 12 commits into
mainfrom
refactor/split-tx-present

Conversation

@Maxaubert

Copy link
Copy Markdown
Owner

Closes #476

Splits TransformModel::present (src/transform_model.cpp, 562 lines on main, 509-1070) into private member functions declared in src/transform_model.h in call order. present is now 61 lines (1063-1123) and reads as the tick's step sequence.

Extracted functions (line ranges on this branch)

Function Lines Size Was
resolveLevel 509-596 88 step cap (txMaxStepPct), smooth-zoom ladder, RampStepHeld
applySamplingMode 598-639 42 bitmap smoothing apply with bounded retries, DWM-restart reset
writeSiteTransform 641-684 44 edge floor, ComputeMagTransform, 16-bit backstop, tdrTest==2 probe
switchDwmCentre 686-708 23 DWM centring switch
writeAndWarm 710-786 77 change test, click hold, transform write, warm pulse, prime, nudge
publishInputTransform 788-890 103 input-transform publish: decimation, ramp hold, read-back, self-heal, disable edge
guardInputTransformStomp 892-922 31 stomp guard (split out of the publish)
weldPointer 924-942 19 the locked / Inspect weld
presentCursor 944-1010 67 Inspect crosshair, legacy sprite session, native hide/restore
appendTrace 1012-1025 14 txTrace ring row
pinAndGhostUpkeep 1027-1061 35 composition pin and MPO ghost cadence

Move-only

Every block was moved verbatim by a script (cut a contiguous line range, paste it as the body of the new function), with its comments. The only new lines are the function signatures and closing braces, the call sites, the returns (return applyLevel;, return m;, return changed;, return ixForce;), one out-param hand-off (preLadderOut = preLadderLevel;), the header declarations and #include "transform.h" in the header (for MagTransform). Locals the blocks wrote are now reference parameters under the same names (txWroteThisTick, trChanged, trWarm, preLadderOut), so the moved lines did not need edits. Side-effect order, the ensureMag() early return, logging and spans are unchanged.

How I checked:

  • A moved-lines diff: the multiset of lines in transform_model.cpp and .h on origin/main against this branch. Zero lines were removed, and every added line is in the list above.
  • One extraction per commit, so git diff --color-moved per commit shows each block as moved.
  • CRLF kept, no em-dashes.

Left inside present on purpose: the source-rect recompute for a capped level, ClickInProgress/DeliverOwedNudge/ensureMag (the early return has to stay in present), the trace-input capture, the pauseWrites gate and the edge-clip call. Each is a few lines and splitting them out would only scatter the order.

Docs: docs/architecture/05-transform-engine.md gets a short "The tick path" section naming the steps, and the write-clamp reference now points at writeSiteTransform.

Gates

  • build.bat check: pass (only pre-existing C4996 fopen warnings in other files)
  • build.bat test: exit 0, 643/643 test cases, 98940 assertions
  • build.bat: links Wind.exe and WindTray.exe
  • src/config_ui and ui/ untouched, so the config build and Playwright were not needed
  • Not deployed or run (pure refactor)

🤖 Generated with Claude Code

https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH

Maxaubert and others added 12 commits October 14, 2026 01:52
Move-only step of the TransformModel::present split (#476); review with
git diff --color-moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
Move-only step of the TransformModel::present split (#476); review with
git diff --color-moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
Move-only step of the TransformModel::present split (#476); review with
git diff --color-moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
Move-only step of the TransformModel::present split (#476); review with
git diff --color-moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
Move-only step of the TransformModel::present split (#476); review with
git diff --color-moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
Move-only step of the TransformModel::present split (#476); review with
git diff --color-moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
…utTransform (#476)

Move-only step of the TransformModel::present split (#476); review with
git diff --color-moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
Move-only step of the TransformModel::present split (#476); review with
git diff --color-moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
Move-only step of the TransformModel::present split (#476); review with
git diff --color-moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
Move-only step of the TransformModel::present split (#476); review with
git diff --color-moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
Move-only step of the TransformModel::present split (#476); review with
git diff --color-moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
Names the private steps TransformModel::present now runs and points the
write-clamp reference at writeSiteTransform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
@Maxaubert
Maxaubert merged commit 92bcb08 into main Oct 14, 2026
1 check passed
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.

refactor: split TransformModel::present into private helpers (move-only)

1 participant