Skip to content

test(render): inspect shadow jobs without starting work - #2461

Merged
deniial00 merged 1 commit into
opengeos:mainfrom
choupeanut:codex/2453-deterministic-shadow-test
Nov 19, 2026
Merged

deniial00 merged 1 commit into
opengeos:mainfrom
choupeanut:codex/2453-deterministic-shadow-test

Conversation

@choupeanut

@choupeanut choupeanut commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The scale-limited export test called cast_shadows(false, …) to check that no shadow work had started. That call itself starts work, and a fast worker can finish before the result is inspected, causing a spurious failure.

Inspect the layer's retained light jobs without starting work instead. Both layer and group scale limits must leave the list empty; the existing tilted-export test also checks that completed jobs remain observable.

This changes test observation only. Desktop, browser, CLI, Python, touch, ribbon, shortcuts, command search, Assistant, MCP, plugins, and Undo/Redo retain their existing behavior. No file format, command parameter, dependency, or third-party code is introduced.

Testing

  • cargo xtask ci passed: test hygiene, formatting, workspace clippy with warnings denied, workspace tests, layers, and schema (29 fixtures).
  • RUSTFLAGS='-D warnings' cargo build --locked --target wasm32-unknown-unknown -p rustgis-web passed.
  • Render suite: 606 passed, 1 existing ignored test.
  • Target regression: 100/100 runs passed with four concurrent test processes.
  • Remaining pre-commit checks passed; formatting and clippy were already covered by the full CI run.

UI evidence

No visible UI change.

Related issue

Closes #2453

Summary by CodeRabbit

  • No end-user changes — This update adds internal inspection coverage for shadow-rendering jobs; it does not change user-visible behavior.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

RasterLayer adds a hidden public method that counts retained cast-shadow and sky-light jobs, including completed jobs. Render tests use the count to check retained work after export and confirm that excluded layers start no cast-shadow jobs.

Changes: Cast-shadow job inspection

Layer / File(s) Summary
Expose and verify retained light-job count
crates/map/src/raster.rs, crates/render/src/lib.rs
RasterLayer::cast_shadow_jobs() reports retained light jobs without starting work. Render tests assert that completed jobs remain observable and that layers excluded by scale range or group visibility start zero cast-shadow jobs.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Possibly related PRs

Suggested reviewers: elpidioassinaturas, giswqs

Merge Risk: Minimal · up to c07e5

This is a test-observation change with no user-visible behavior change. It is expected to remove a flaky render test, and no merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the render tests now inspect shadow jobs without starting work. It matches the raw summary, which adds a non-starting job count method and updates two render tests to …
Description check Passed The description follows the template. It has a Summary that explains the flaky test cause and the fix. It has a Testing section with specific commands and results. The UI evidence section states 'No v…
Linked Issues check Passed Directly linked issue [#2453] asks to remove the timing-dependent check that a scale-limited relief layer does not start shadow work. The reviewed head changes that check. Per the change summary, `Ras…
Out of Scope Changes check Passed The changes are limited to the test observation path: one hidden public inspection method cast_shadow_jobs on RasterLayer (+7 lines in crates/map/src/raster.rs) and two render test assertions (+2/…
Full details: Title check

Explanation

The title names the main change: the render tests now inspect shadow jobs without starting work. It matches the raw summary, which adds a non-starting job count method and updates two render tests to assert on it. The title uses the conventional test(render) prefix and stays concise.

Full details: Description check

Explanation

The description follows the template. It has a Summary that explains the flaky test cause and the fix. It has a Testing section with specific commands and results. The UI evidence section states 'No visible UI change.', which the template allows. The Related issue section links #2453 with a closing keyword. The description is complete and specific.

Full details: Linked Issues check

Explanation

Directly linked issue [#2453] asks to remove the timing-dependent check that a scale-limited relief layer does not start shadow work. The reviewed head changes that check. Per the change summary, RasterLayer::cast_shadow_jobs (crates/map/src/raster.rs) returns the retained cast-shadow and sky-light job count without starting work. The scale-limited test in crates/render/src/lib.rs now asserts zero shadow jobs after rendering, instead of calling cast_shadows(false, …), which can start work. The tilted-export test now asserts at least one job remains observable and still checks that shadows are ready. This addresses the issue's stated observation problem. The repository diff could not be read (changed blobs missing from checkout), so this verdict rests on the supplied PR summary and description. The PR summary reports the test passing 100/100 runs under concurrent load, which is consistent with the fix but is not independently verified here.

Full details: Out of Scope Changes check

Explanation

The changes are limited to the test observation path: one hidden public inspection method cast_shadow_jobs on RasterLayer (+7 lines in crates/map/src/raster.rs) and two render test assertions (+2/-4 in crates/render/src/lib.rs). The method exists only to support the revised tests. The PR description states no change to file formats, command parameters, dependencies, or user-visible behavior. No unrelated change is described in the summary. The repository diff could not be read, so this verdict relies on the change summary and PR description.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit counts the shadows that remain,
And finds the finished jobs still in the frame.
The tilted map keeps proof of work in sight,
Excluded layers start no jobs that night.
One hop, one count, the tests now know.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: eda8dbcb-13ef-4ad9-8380-ada9473aedfb
Commits

Reviewing files that changed from the base of the PR and between eac275f and c07e5b0.

Files selected for processing: 2

  • crates/map/src/raster.rs
  • crates/render/src/lib.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, security issues, or performance problems in this PR. No inline comments were warranted, so I posted none.

Bugs

  • None found. cast_shadow_jobs locks the same Arc<Mutex<Vec<LightJob>>> that cast_shadow_waiters uses and only reads its length. Copies of a layer share that Arc, which matches the doc comment. The export test now asserts zero jobs, which is stronger than the old Pending check: it fails if drawing starts any light work. (Confidence: high.)

Security

  • None found. The change is test observation with no new input handling.

Performance

  • None found. The new method is O(1) and only runs in tests.

Quality

  • Low-severity inconsistency: cast_shadow_jobs recovers from a poisoned lock with unwrap_or_else(|e| e.into_inner()), while the sibling cast_shadow_waiters returns 0 on poison. Either behaviour is harmless here. Per the release quality pass, I'd leave it unless a maintainer wants them aligned. (Confidence: high that it exists; low that it matters.)
  • Low-severity: the first test (crates/render/src/lib.rs, around line 9593) still ends with cast_shadows(false, …), the same work-starting call the PR description names as the root cause. It is safe in practice: the export only returns after the far band's grid has landed, so the call finds a finished job and does not start new work. Replacing it with an inspection would make the test match its stated intent. (Confidence: medium.)

AGENTS.md

  • Compliant. No unwrap, expect, or unsafe is added to non-test code, and the unwrap_or_else is allowed by the crate's deny block. The new helper is #[doc(hidden)], matching cast_shadow_waiters, and its doc comment says it is for tests. No new command, tool, or export is added, so the long_commands lists and the wasm build are unaffected. The PR body states that no visible UI changed.

Earlier review threads: none exist on this PR, so no earlier concerns were left alone.

Change size

Compared with main (merge base 89385f6 to PR head c07e5b0); whole PR.

Measure Value
Files changed 2 (0 added, 2 modified, 0 removed, 0 renamed)
Size before 847.35 KB
Size after 847.64 KB
Total size change +299 B
Path Before After Change
crates/map/src/raster.rs 158.72 KB 159.04 KB +325 B
crates/render/src/lib.rs 688.63 KB 688.61 KB -26 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-2461/
Web app https://preview.rustgis.app/pr-2461/app/
Commit c07e5b0

GitHub Pages takes a minute or two to publish a new commit.

@deniial00
deniial00 added this pull request to the merge queue Nov 19, 2026
Merged via the queue into opengeos:main with commit 7cc20ff Nov 19, 2026
24 checks 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.

Flaky test: an_export_waits_only_for_the_cast_shadows_it_draws

2 participants