Skip to content

chore(lane): daily maintenance 2026-11-11 - #148

Merged
kirillDevPro merged 4 commits into
masterfrom
lane/daily-2026-11-11
Nov 11, 2026
Merged

kirillDevPro merged 4 commits into
masterfrom
lane/daily-2026-11-11

Conversation

@kirillDevPro

Copy link
Copy Markdown
Collaborator

Fix

Filed by the fix lane.

Fixes #127

TreeMap::remove_range(start, end) with end before start re-seeked the
cursor from the tree's first item (Cursor::seek resets), so the suffix from
end was appended after the slice up to start and every key in between was
duplicated. Per the owner decision on #127, a reversed range is empty: the
cursor now only seeks forward when end is at or past its position, otherwise
the map stays as it was, with no panic. Non-reversed ranges take the same path
as before (seek_forward from the slice end lands where a fresh seek did).
The only callers are the crate's own tests; nothing outside moon-sum-tree
calls remove_range.

Test: remove_range_with_end_before_start_leaves_the_map_unchanged in
crates/moon-sum-tree/tests/tree_map.rs failed before (left
[0, 1, 2, 1, 2, 3, 4], right [0, 1, 2, 3, 4]) and passes now.
Re-run: cargo test -p moon-sum-tree --test tree_map remove_range.

Reviewed by Codex: no concrete defects found.

Filed by the fix lane.

Fixes #129

When a GPU canvas's prepare_text() failed, the fallback in
Window::frame_gpu_canvases checked cached_env() instead of reusable_env(),
so a cached text frame holding polychrome (emoji/image) sprites was
replayed even though Window::drop_image may have freed those atlas tiles.
The fallback now applies the same rule as the reuse path; cached_env() is
left test-only since nothing else calls it. The issue's code path and
recommended fix were confirmed against current master as written.

Test: window::tests::err_never_replays_polychrome_text
(crates/moon-gpui/src/window/tests.rs) failed before (a polychrome sprite
reached the scene after the failed prepare: left 1, right 0) and passes now.
Re-run: cargo test -p moon-gpui --lib err_never_replays_polychrome_text

Reviewed by Codex.

Docs

What was stale: GPU_CANVAS_TEXT_API.md said every UI redraw prepares the
text of all canvases and that prepare_text() runs only for a frame that
will actually be shown. Since #146, Window::frame_gpu_canvases prepares no
canvas text at all while PlatformWindow::can_present() is false, even on a
UI redraw, and Window::present keeps needs_present armed when the backend
rejects the present (e.g. DXGI reports the window occluded).

What the code does now: while the window cannot present, no canvas runs
prepare_text(); the owed frame stays owed, and the first tick that can
present again passes that debt as force_present, so text_action prepares
every canvas's text. Invariants 2 and 3 and the upgrade checklist now say so.

How verified: read Window::frame_gpu_canvases (presentable && gpu_canvas_prepare_text(..)), the frame callback, Window::present
(needs_present.set(!accepted)), text_action in window/gpu_canvas_text.rs,
DirectXRenderer::present, and the regression test
deferred_present_skips_text_while_unpresentable_and_finishes_on_restore.

Reviewer: Codex. It confirmed the added sentences and pointed out that the
existing "a frame that will actually be shown" overstated the guarantee,
since the backend can still reject the present; that sentence now says so.

No issue opened.

Hunt

Input: a public builder that ignores its argument and says so in a
whole-line comment:

pub fn tone(self, _tone: MoonTone) -> Self {
    // `_tone` is accepted for API parity and ignored for now.
    self
}

Wrong output: function_body_uses_param returned true (the comment line
contains _tone), so scan_noop_markers did not count the builder and
noop_public_api_markers stayed flat; the audit passed on a builder that
leaves the component unchanged.

Expected output: false, i.e. the builder is counted. Source: the
scan's own contract ("builder methods that accept parameters but leave
the component unchanged") - a comment changes nothing - and the comment
rule the raw-hex scans in the same file already apply (a trimmed line
starting with // is skipped).

Test: function_body_usage_ignores_line_comments_naming_the_param in
xtask/src/component_audit/source_metrics/tests.rs failed before with
assertion failed: !function_body_uses_param(&unused, 0, "_tone") and
passes now. Re-run: cargo test -p xtask function_body_usage
cargo xtask component-audit --check-baseline still passes (no builder
newly counted).

Reviewer: Codex (PASS, no objections).

Leftovers: quiet (no open lane pull requests).
Trusted pull requests: quiet (none open).

Filed by the fix lane.

Fixes #127

`TreeMap::remove_range(start, end)` with `end` before `start` re-seeked the
cursor from the tree's first item (`Cursor::seek` resets), so the suffix from
`end` was appended after the slice up to `start` and every key in between was
duplicated. Per the owner decision on #127, a reversed range is empty: the
cursor now only seeks forward when `end` is at or past its position, otherwise
the map stays as it was, with no panic. Non-reversed ranges take the same path
as before (`seek_forward` from the slice end lands where a fresh `seek` did).
The only callers are the crate's own tests; nothing outside `moon-sum-tree`
calls `remove_range`.

Test: `remove_range_with_end_before_start_leaves_the_map_unchanged` in
`crates/moon-sum-tree/tests/tree_map.rs` failed before (left
`[0, 1, 2, 1, 2, 3, 4]`, right `[0, 1, 2, 3, 4]`) and passes now.
Re-run: `cargo test -p moon-sum-tree --test tree_map remove_range`.

Reviewed by Codex: no concrete defects found.
Filed by the fix lane.

Fixes #129

When a GPU canvas's prepare_text() failed, the fallback in
Window::frame_gpu_canvases checked cached_env() instead of reusable_env(),
so a cached text frame holding polychrome (emoji/image) sprites was
replayed even though Window::drop_image may have freed those atlas tiles.
The fallback now applies the same rule as the reuse path; cached_env() is
left test-only since nothing else calls it. The issue's code path and
recommended fix were confirmed against current master as written.

Test: window::tests::err_never_replays_polychrome_text
(crates/moon-gpui/src/window/tests.rs) failed before (a polychrome sprite
reached the scene after the failed prepare: left 1, right 0) and passes now.
Re-run: cargo test -p moon-gpui --lib err_never_replays_polychrome_text

Reviewed by Codex.
…ot present

What was stale: GPU_CANVAS_TEXT_API.md said every UI redraw prepares the
text of all canvases and that prepare_text() runs only for a frame that
will actually be shown. Since #146, Window::frame_gpu_canvases prepares no
canvas text at all while PlatformWindow::can_present() is false, even on a
UI redraw, and Window::present keeps needs_present armed when the backend
rejects the present (e.g. DXGI reports the window occluded).

What the code does now: while the window cannot present, no canvas runs
prepare_text(); the owed frame stays owed, and the first tick that can
present again passes that debt as force_present, so text_action prepares
every canvas's text. Invariants 2 and 3 and the upgrade checklist now say so.

How verified: read Window::frame_gpu_canvases (`presentable &&
gpu_canvas_prepare_text(..)`), the frame callback, Window::present
(`needs_present.set(!accepted)`), text_action in window/gpu_canvas_text.rs,
DirectXRenderer::present, and the regression test
deferred_present_skips_text_while_unpresentable_and_finishes_on_restore.

Reviewer: Codex. It confirmed the added sentences and pointed out that the
existing "a frame that will actually be shown" overstated the guarantee,
since the backend can still reject the present; that sentence now says so.

No issue opened.
Input: a public builder that ignores its argument and says so in a
whole-line comment:

    pub fn tone(self, _tone: MoonTone) -> Self {
        // `_tone` is accepted for API parity and ignored for now.
        self
    }

Wrong output: function_body_uses_param returned true (the comment line
contains `_tone`), so scan_noop_markers did not count the builder and
noop_public_api_markers stayed flat; the audit passed on a builder that
leaves the component unchanged.

Expected output: false, i.e. the builder is counted. Source: the
scan's own contract ("builder methods that accept parameters but leave
the component unchanged") - a comment changes nothing - and the comment
rule the raw-hex scans in the same file already apply (a trimmed line
starting with `//` is skipped).

Test: function_body_usage_ignores_line_comments_naming_the_param in
xtask/src/component_audit/source_metrics/tests.rs failed before with
`assertion failed: !function_body_uses_param(&unused, 0, "_tone")` and
passes now. Re-run: cargo test -p xtask function_body_usage
cargo xtask component-audit --check-baseline still passes (no builder
newly counted).

Reviewer: Codex (PASS, no objections).
@kirillDevPro
kirillDevPro merged commit 6f3ca7f into master Nov 11, 2026
4 checks passed
@kirillDevPro
kirillDevPro deleted the lane/daily-2026-11-11 branch November 11, 2026 09:12
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.

GPU canvas text error fallback replays a cached frame with polychrome sprites TreeMap::remove_range duplicates entries when end precedes start

1 participant