Skip to content

fix(layout): say a publication's scale bar fit loss as a notice (#3111) - #3113

Merged
jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:fix/3111-scale-bar-notice
Nov 27, 2026
Merged

jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:fix/3111-scale-bar-notice

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When layout.publication is given a "scaleBar" whose text doesn't fit, the loss is now said as a session notice, as layout.addElement and layout.update say it, through the same say_text_fit helper. Before, it was only an entry in the answer's warnings, so a front end reading the session's notices (the command line, the Assistant, MCP) did not see it among them. The answer's warnings no longer carries this entry.

The change is in the engine command, so it reaches every front end that runs it; the ribbon, undo and the project file are unchanged.

Testing

  • cargo nextest run -p rustgis-engine -E 'test(publication_parts)': the tests of the scale bar's fit loss now read the notices. The one for a bar too large for the sheet fails without the change and passes with it; the one for a larger text that fits checks that no scale bar notice is said.
  • fmt, clippy, nextest, doctests, the layer check and the schema check pass.

UI evidence

The Messages pane after layout.publication {"scaleBar": {"textSize": 100}}, before and after:

3111-messages.png

Related issue

Closes #3111

Summary by CodeRabbit

  • Bug Fixes
    • Scale-bar text-fit notices now appear in the session notices. Oversized scale bars emit a single “box is too small” notice.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

When publication receives an explicitly configured scale bar, it now reports text-fit results through say_text_fit. The tests check session notices for larger text and an oversized scale-bar box.

Changes: Scale-Bar Fit Notices

Layer / File(s) Summary
Report and test scale-bar fit notices
crates/engine/src/cmd/layout/publication/mod.rs, crates/engine/src/tests/layout_publication_parts.rs
Publication calls say_text_fit for an explicitly configured scale bar. The tests check session notices and verify that an oversized scale-bar box produces exactly one matching notice.

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

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

Suggested reviewers: giswqs, bearinmindcat

Merge Risk: Minimal · up to 557c7

Layout publication now reports an oversized scale bar's text-fit loss as a session notice instead of in the answer's warnings, which is what the linked issue requested. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a publication's scale bar text-fit loss is now reported as a session notice instead of only in the answer's warnings. It uses the fix(layout) prefix and references the…
Description check Passed The description follows the template. It has Summary, Testing, UI evidence, and Related issue sections. The Summary explains the change and why it is made. Testing lists the targeted nextest command, …
Linked Issues check Passed [#3111] The issue requires that the scale bar fit loss of layout.publication be reported as a session notice, one per kind, as for a scale bar added or changed by hand. The change summary states that,…
Out of Scope Changes check Passed The change set, per the change summary, touches only crates/engine/src/cmd/layout/publication/mod.rs (+1/-2, scale bar branch of publication) and crates/engine/src/tests/layout_publication_parts.rs (+…
Full details: Title check

Explanation

The title names the main change: a publication's scale bar text-fit loss is now reported as a session notice instead of only in the answer's warnings. It uses the fix(layout) prefix and references the related issue. It is specific and matches the raw summary and objectives.

Full details: Description check

Explanation

The description follows the template. It has Summary, Testing, UI evidence, and Related issue sections. The Summary explains the change and why it is made. Testing lists the targeted nextest command, the new test expectations, and the passing checks. The UI evidence section includes a before-and-after Messages pane image, which fits a visible notice change even though the template line says no visible UI change. Related issue links #3111.

Full details: Linked Issues check

Explanation

[#3111] The issue requires that the scale bar fit loss of layout.publication be reported as a session notice, one per kind, as for a scale bar added or changed by hand. The change summary states that, for an explicitly configured scale bar, publication now calls say_text_fit (the helper used by layout.addElement and layout.update) instead of collecting text_fit_loss results for the answer's warnings. The PR description and the test change match this. The test for an oversized bar checks for exactly one 'box is too small' notice. The test for a larger text that still fits checks that no scale bar notice is said. The requirement is a Rust engine behavior and is covered by automated tests, so it is a coding requirement. Limit: the changed hunk in crates/engine/src/cmd/layout/publication/mod.rs could not be read as a diff (changed blobs unavailable), and the file read at head was truncated before the scale bar section. The verdict rests on the change summary and the PR description, not on a直接 read of the hunk.

Full details: Out of Scope Changes check

Explanation

The change set, per the change summary, touches only crates/engine/src/cmd/layout/publication/mod.rs (+1/-2, scale bar branch of publication) and crates/engine/src/tests/layout_publication_parts.rs (+8/-4, scale bar tests now read session notices). Both files connect directly to the issue's objective. The PR states that the ribbon, undo and project file are unchanged. No unrelated change is described. Limit: the diff could not be read directly, so this verdict relies on the change summary.

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 scale-bar text,
And finds the notice in its place.
No warning hides inside the answer;
The session shows the fit result.
Then hops away with tidy tests.

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: 5210bc1a-7639-4b8e-a7e6-a3fd35668842
Commits

Reviewing files that changed from the base of the PR and between 418008d and 557c751.

Files selected for processing: 2

  • crates/engine/src/cmd/layout/publication/mod.rs
  • crates/engine/src/tests/layout_publication_parts.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

The PR is small: it moves the publication's scale bar fit loss from the answer's warnings to a session notice, through the same say_text_fit helper that layout.addElement and layout.update already use. I found no bugs, crash paths, or AGENTS.md breaks. I could not build or run the tests here (no shell), so this rests on reading the code.

Bugs: None found.

Security: None found.

Performance: None found.

Quality:

  • The fit loss is no longer in the publication answer's warnings (crates/engine/src/cmd/layout/publication/mod.rs:1908, inline comment posted). The Assistant still sees it through command_result → notices_since, so the change is coherent. Scripts, MCP clients and the Python API that read warnings will miss it. Confidence: medium that this matters; the PR says the change is intended.
  • crates/assistant/skills/print-layout/SKILL.md step 2 still says to read "warnings", and docs/user-guide/layouts.md describes the publication answer's warnings. Neither mentions the notice. Low severity, confidence high.
  • Nit: the true argument to say_text_fit is ignored for a scale bar (lines only matters for text). Same pattern as the existing call in update.rs:741, so harmless.
  • Nit: the "larger text" test reads notices with notices_since(0), while the other test uses notice_mark(). Equivalent on a fresh session, but less consistent. Confidence high.

AGENTS.md: No breaks found. Checked:

  • Never silent: the notice is one per bar with the same text as before.
  • Test both ways: the lossy case (textSize: 100) asserts one notice, and the clean case (textSize: 14) asserts none.
  • No change to what a project saves, so no schema or fixture update is needed.
  • No change to the command surface.

Twins checked:

  • elements.rs:620 (layout.addElement) and update.rs:741/745 (layout.update) already use say_text_fit, so they match.
  • frame.rs:290–291 (frame_view_changed) already uses s.warn for scale bar notices.
  • Nothing in the PR touches a #[cfg(target_arch = "wasm32")] branch, a read route, an overlay tool or a project-open path.

Prior reviews: None on this PR, so nothing was left out as already raised.

Not verified: build, clippy, and the test run. Test code was read against Notice (derives Debug), notices_since, notice_mark, publish and world, and all exist with the signatures used.

Change size

Compared: the whole PR against main (merge base 418008d to PR head 557c751).

Measure Value
Files changed 2 (0 added, 2 modified, 0 removed, 0 renamed)
Size before 135.4 KB (138,637 B)
Size after 135.4 KB (138,681 B)
Total size change +44 B
Path Before After Change
crates/engine/src/tests/layout_publication_parts.rs 12.7 KB (13,023 B) 12.9 KB (13,186 B) +163 B
crates/engine/src/cmd/layout/publication/mod.rs 122.7 KB (125,614 B) 122.6 KB (125,495 B) −119 B

@jgregoriorincon

Copy link
Copy Markdown
Contributor Author

No code change for the four quality points:

  • warnings: saying the fit loss as a notice is what [Bug]: layout.publication says a scale bar's fit loss only in its answer, not as a notice #3111 asks, as layout.addElement and layout.update already do.
  • The print-layout skill and the user guide mention warnings for what stays there (arrangement, moves, locator, element IDs); neither says the scale bar's fit is listed there, and the Assistant's command results carry the notices.
  • The true argument: lines only applies to a text, as you note; same as update.rs:741.
  • notices_since(0): on a fresh world() it reads the same as a mark taken before the call.

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3113/
Web app https://preview.rustgis.app/pr-3113/app/
Commit 557c751

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 27, 2026
Merged via the queue into opengeos:main with commit d2ad1ed Nov 27, 2026
28 checks passed
@jgregoriorincon
jgregoriorincon deleted the fix/3111-scale-bar-notice branch November 27, 2026 13:36
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]: layout.publication says a scale bar's fit loss only in its answer, not as a notice

1 participant