Skip to content

view shell live code: a patch carries new Swift files - #35705

Merged
teamleaderleo merged 4 commits into
feat-cmux-nextfrom
lane/live-code-new-files
Nov 4, 2026
Merged

teamleaderleo merged 4 commits into
feat-cmux-nextfrom
lane/live-code-new-files

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Leo (2026-11-04): "Couldn't we architect stuff to make everything more amenable to hot swappage? Bridge better api better thin the layer nicer / Idk how well we can pre prepare stored properties/function signatures/deal with files"

This is the "new files" piece of that: a new Swift file no longer forces a rebuild of the view shell. In the 8,315-PR sample, 41% of the PRs that needed a rebuild added a file.

What changes

  • Prototypes/ViewShell/inject.sh: besides the files named, the patch now links two kinds of file:

    • every Swift file of the module that the running Debug build never compiled (it has no object in ViewShell.build): a new file;
    • every file newer than that build's executable.

    It prints also X.swift (new since the build | changed since the build) for each one. So a new view in a new file, used from an edited file, links inside the patch. Each repeat patch holds all of the new code, so callers never keep an earlier patch's copy of the new file. main.swift and LiveCode.swift still refuse. With no Debug build at .build/debug (or CMUX_VIEW_SHELL_BUILD), the patch holds only the files named, as before, and the script says so.

  • scripts/cmux-next/live_apply.py (try-pr's classifier): an added Swift file no longer counts as a rebuild. An added main.swift or @main is the exception and counts as new entry point. New types in existing files keep their rebuild reason.

  • scripts/measure/live-code-shell.sh: a new step 3 writes LiveCodeProbeDot.swift, has Badge.swift use it, and injects naming only Badge.swift. The stored-property step becomes step 4. result.json gains new_file_edit and new_file_edit_to_pixels_s.

  • Docs: the view shell README ("Live code") and docs/cmux-next/hot-reload.md.

Verification

step base this PR
0, the build 135 px 135 px
1, padding 24, red 199 px 199 px
2, padding 40 263 px 263 px
3, a new file LiveCodeProbeDot.swift used by Badge.swift; only Badge.swift named refused: dlopen … symbol not found … LiveCodeProbeDot… also LiveCodeProbeDot.swift (new since the build), 283 px with the dot, 1.26 s from edit to pixels
4, a new @State refused refused by the layout check
  • A file counts as new when the Debug build has no object for it (ViewShell.build/<name>.swift.o). An earlier version read SwiftPM's sources list, but that list quotes a path with a space, which made every file look new.

Part of manaflow-ai/cmuxterm-hq#7066.

🤖 Generated with Claude Code
Agent session: agent session

@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Nov 4, 2026
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex, router-review): SHIP at 31046ce

Reviewer: codex gpt-6-astra high, fast tier.

Follow-ups: 1. They land as checklist items in this PR's one follow-up tracking issue in this repo (Follow-ups: #N ..., label follow-up; add to an open one before filing, never one issue per finding), linking this receipt; the lane that opened the PR fixes them forward.

SHIP at 31046ce

Visual verdict: no images; Leo tries the build

Checked the focused unit tests: 12 pass.

Follow-ups:

  • [P2] [follow-up] [category:correctness] [finding:F1] [outcome:pending] [Prototypes/ViewShell/inject.sh:41] The source glob only includes direct children of Sources/ViewShell. SwiftPM targets recurse into subdirectories, so a new Sources/ViewShell/Subdir/NewView.swift is neither compiled nor auto-added; an edited file referring to it fails injection. Use a recursive source enumeration.

@blacksmith-sh

blacksmith-sh Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
test_every_listed_hook_is_one_glaeda_released_with_the_check (main.SigningHooksInSt
epWithGlaedaTests.test_every_listed_hook_is_one_glaeda_released_with_the_check)/
test_every_listed_hook_is_one_glaeda_released_with_the_check (main.SigningHooksInSt
epWithGlaedaTests.test_every_listed_hook_is_one_glaeda_released_with_the_check)
View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

teamleaderleo and others added 4 commits November 4, 2026 19:59
…changed since the build

inject.sh links, besides the files named, every Swift file the running Debug build never compiled
and every file newer than that build, so a new view in a new file applies live and a repeat patch
holds all of the new code. live_apply.py no longer counts a new Swift file as a rebuild (an entry
point still is). The live-code-shell measurement adds a new-file step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-45fddab7397278d38551
…try-pr names new files as live

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-45fddab7397278d38551
…eckout path with a space works

SwiftPM quotes or escapes such a path in ViewShell.build/sources; the exact-path match then took
every file, main.swift included, for a new one (a fleet Mac under /Library/Application Support).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-45fddab7397278d38551
SwiftPM's sources list quotes paths its own way (single quotes for a path with a space); the
object file per source in ViewShell.build needs no parsing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-45fddab7397278d38551
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex, router-review): SHIP at 476a2ad

Reviewer: codex gpt-6-astra high, fast tier.

Follow-ups: 2. They land as checklist items in this PR's one follow-up tracking issue in this repo (Follow-ups: #N ..., label follow-up; add to an open one before filing, never one issue per finding), linking this receipt; the lane that opened the PR fixes them forward.

SHIP at 476a2ad

Visual verdict: no images; Leo tries the build

  • [P2] [follow-up] [category:correctness] [finding:F1] [outcome:pending] live_apply.py:42,56 only detects @main at the start of a line. A new file using valid combined attributes such as @MainActor @main is classified swift-live instead of rebuild.

  • [P2] [follow-up] [category:ux] [finding:F2] [outcome:pending] No after screenshots were supplied, so the visual result remains unverified.

Focused live_apply tests pass.

Follow-ups:

  • F1: broaden entry-point detection to recognize @main anywhere in the attribute sequence.
  • F2: provide after-build screenshots.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Pictures of the new-file step (generation 3, the green dot from LiveCodeProbeDot.swift, 283 px) and the steps before it are on #35850: #35850 (comment). That run used this PR plus #35850.

Agent session: agent session

@teamleaderleo
teamleaderleo marked this pull request as ready for review November 4, 2026 20:11
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 476a2ad: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr35705 -f ref=lane/live-code-new-files -f platform=macos -f backend_mode=local

Shipped in:

@cmux-bot cmux-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

cmux-bot approves 476a2ad: an independent review passed this exact head (router-review receipt by teamleaderleo). A push needs a new review; a later BLOCK at this head dismisses this approval.

@teamleaderleo
teamleaderleo merged commit 52878bd into feat-cmux-next Nov 4, 2026
221 of 224 checks passed
@teamleaderleo
teamleaderleo deleted the lane/live-code-new-files branch November 4, 2026 20:16
cmux-bot Bot pushed a commit that referenced this pull request Nov 4, 2026
…ve_apply finds @main among other attributes (#35861)

Review follow-ups of #35850 (rebind ignored a refused mprotect) and #35705 (`@MainActor @main`
was counted live).


Agent-Session: https://cmux.com/deeplink/agent?id=aid-45fddab7397278d38551

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 476a2ad2 Deployed Nov 4, 2026 by teamleaderleo via wait for same-key tree publisher #112948
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant