Skip to content

test(ui): the figure's reference step refusal test reads the slot the step has (#3162) - #3165

Merged
jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:fix/3162-figure-limit-test
Nov 28, 2026
Merged

jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:fix/3162-figure-limit-test

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

a_figures_step_says_its_limits_only passed with or without the check it names: it set a refused statistic on the sources step's slot, while a figure's reference step reads the texts step's. The test now refuses both slots, and the comments on Step::slot and in limit_note say what the check does. No behaviour change.

Testing

  • With d.step != Step::Reference && removed from limit_note, a_figures_step_says_its_limits_only fails; with it, it passes.
  • Full checks on this commit: fmt, clippy, nextest (10194 passed, 29 skipped), doctests, layer check and schema check.

UI evidence

No visible UI change.

Related issue

Closes #3162

Summary by CodeRabbit

  • Documentation

    • Clarified how reference steps relate to text-field slots and statistic refusals.
  • Tests

    • Updated figure-step limit coverage to check both statistic slots and existing line and character limit behavior.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The publication wizard comments now clarify slot behavior for the reference step. The figure-step limits test now sets both refusal flags.

Changes: Reference-step limit test

Layer / File(s) Summary
Slot comments and limit test
crates/ui-egui/src/publicationwizard/mod.rs, crates/ui-egui/src/publicationwizard/sources.rs
Comments clarify the reference step’s slot and refusal-note behavior. The figure-step limits test now sets both refusal flags; its existing assertions are unchanged.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Possibly related PRs

  • opengeos/RustGIS#3157: Added the figure’s Reference step, whose slot behavior this test and comments describe.
  • opengeos/RustGIS#3112: Added the Sources and reference steps, text-step slots, and limit notes referenced by these changes.

Suggested reviewers: deniial00

Merge Risk: Minimal · up to 827a1

This change clarifies comments and tightens a unit test for the publication wizard. It does not change app behavior, and no merge-blocking risk is visible.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title describes a test change: the figure's reference step refusal test now reads the slot that step actually uses. This matches the changeset, which updates the figure-step limits test to refuse …
Description check Passed The description follows the template. It has a Summary that explains the test gap and the fix, a Testing section with a mutation check and full CI results, a UI evidence section that correctly states …
Linked Issues check Passed Issue #3162 has one coding requirement: the test a_figures_step_says_its_limits_only must fail when d.step != Step::Reference && is removed from limit_note, and the comments must name the slot t…
Out of Scope Changes check Passed The PR changes only test code in sources.rs (the figure-step limits test) and doc or line comments in mod.rs (Step::slot and limit_note). The raw summary reports no declaration or behaviour ch…
Full details: Title check

Explanation

The title describes a test change: the figure's reference step refusal test now reads the slot that step actually uses. This matches the changeset, which updates the figure-step limits test to refuse both slots and clarifies comments on Step::slot and limit_note. The title is specific and accurate, though it names a test rather than the comment clarifications.

Full details: Description check

Explanation

The description follows the template. It has a Summary that explains the test gap and the fix, a Testing section with a mutation check and full CI results, a UI evidence section that correctly states no visible UI change, and a Related issue that closes #3162. The template's HTML comments are removed, which is expected.

Full details: Linked Issues check

Explanation

Issue #3162 has one coding requirement: the test a_figures_step_says_its_limits_only must fail when d.step != Step::Reference && is removed from limit_note, and the comments must name the slot the figure's reference step reads.

Evidence at head (crates/ui-egui/src/publicationwizard/sources.rs and mod.rs):

  • The test now sets d.refused = [true, true] on a figure's reference step. The previous version refused only the sources slot.
  • Step::slot() returns 0 for Step::Reference, which is the texts slot. The doc comment says the reference step has no slot of its own and reads as 0.
  • limit_note checks d.step != Step::Reference && d.refused[d.step.slot()]. With the guard in place, the refusal message is skipped on a figure's reference step, so the test's assertion that no refusal message is shown passes.
  • Without the guard, refused[0] is true, so the refusal message is shown and the test's assertion fails. The test therefore detects the removal.
  • The limit_note comment and the Step::slot comment state that a figure's reference step adds no statistic and reads slot 0.

Limits: the repository diff tool was unavailable, so the base-to-head diff was not read. The head file contents were read directly. The test was not run. The failure-without-guard result is established by reading the code, not by execution.

Full details: Out of Scope Changes check

Explanation

The PR changes only test code in sources.rs (the figure-step limits test) and doc or line comments in mod.rs (Step::slot and limit_note). The raw summary reports no declaration or behaviour change, and the head code is consistent with that. Each change directly supports the issue #3162 objective of making the test detect the guard and making the comments name the slot the figure's reference step reads. No unrelated production logic changes were identified.

Limits: the base-to-head diff was not available, so this check relies on the PR summary and the head file contents.

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 checks the slots at night
Two flags are set to test them right
The comments name the steps with care
No extra note belongs elsewhere
Then hops away with code review done

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: 7e1cb40e-7302-4953-a69e-c1203dcb9e3d
Commits

Reviewing files that changed from the base of the PR and between 3e977ea and 827a192.

Files selected for processing: 2

  • crates/ui-egui/src/publicationwizard/mod.rs
  • crates/ui-egui/src/publicationwizard/sources.rs

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

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Scope: 2 files, comment and test-fixture changes only, in crates/ui-egui/src/publicationwizard/. No production logic changes.

Bugs

None found.

Security

None found.

Performance

None found.

Quality

  • Shared slot for the reference step (publicationwizard/mod.rs:49, inline, confidence high): Step::Reference now reads slot 0, the texts step's slot. Correctness depends on a Step::Reference guard at each call site. The current call sites (limit_note, edited) are guarded, so this is not a bug today. Filed as a non-blocking nit with a possible Option<usize> design.

AGENTS.md

None found. No unwrap/expect, all user-visible text goes through i18n::fmt, and the change is test and comment only.

What I checked

  • Fix correctness: slot() for Reference returns usize::from(false) == 0, as the new comment says. edited() and add_statistic only receive field steps (Texts or Sources), never Reference, so the aliasing does not leak into them.
  • Test fix: The old fixture refused = [false, true] was vacuous. The reference step reads slot 0, which was false, so removing the d.step != Step::Reference guard would not have failed it. The new [true, true] fixture makes the guard load-bearing: without it, limit_note shows the refusal and a_figures_step_says_its_limits_only fails. The PR's claim holds.
  • Twins: The change touches no reader, overlay tool, add or open command, or cfg(wasm32) branch, so none of the listed families apply.
  • Prior reviews: The thread list is empty, so there were no earlier concerns to skip.

Change size

Compared: the whole PR against main (merge base 3e977ea to PR head 827a192).

Measure Value
Files changed 2 (added 0, modified 2, removed 0, renamed 0)
Size before 63.7 KB (65,279 B)
Size after 63.8 KB (65,355 B)
Total size change +76 B
File Before After Change
crates/ui-egui/src/publicationwizard/mod.rs 40.5 KB 40.5 KB +87 B
crates/ui-egui/src/publicationwizard/sources.rs 23.3 KB 23.3 KB -11 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3165/
Web app https://preview.rustgis.app/pr-3165/app/
Commit 827a192

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 28, 2026
Merged via the queue into opengeos:main with commit a152f8d Nov 28, 2026
28 checks passed
@jgregoriorincon
jgregoriorincon deleted the fix/3162-figure-limit-test branch November 28, 2026 00:56
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.

[Bug]: The Publication Layout Wizard's test of a figure's reference step passes without the guard it names

1 participant