Skip to content

feat(docs): an entry in the guide for each loss code, linked from the notices that give it - #3134

Merged
Mavrick-F merged 2 commits into
opengeos:mainfrom
Mavrick-F:feat/loss-code-docs
Nov 27, 2026
Merged

Mavrick-F merged 2 commits into
opengeos:mainfrom
Mavrick-F:feat/loss-code-docs

Conversation

@Mavrick-F

@Mavrick-F Mavrick-F commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Each loss code now has an entry in the guide, and the notices that give a code link to it, the way an error code links to its page elsewhere.

  • A new page, Data loss codes, under the User Guide. It has an entry per code, grouped by kind, each anchored by the code itself (#dropped.ring). Each entry says what happened, where you see it (the readers, writers, tools and commands that say it) and what to do. "What to do" is the code's own action text.
  • The command line guide's table of codes is replaced by a pointer to the page. The MCP and Python guides link to it, and it's in the guide index, the site's navigation and the Assistant's list of guide pages.
  • LossCode::doc_url() gives a code's address (rustgis_data::loss::GUIDE + # + id). The surfaces use it:
Where What it gives
The Messages pane Under a notice with a code: the code, and What this means, which opens its entry
Copy diagnostics A Loss: <code> (<address>) line under the entry
rustgis-cli run --strict The address under each code that stopped the run; --allow with an unknown code names the page
Python DataLossWarning.url
  • MCP results are unchanged: losses already carries each code's action, and an address per entry would spend the output budget. The page says how codes are addressed, and the Assistant can read it.
  • A diagnostic record now keeps the code of the notice it holds (Record::loss), so the pane and the report can give it.

Testing

  • the_guide_lists_every_code now reads the new page. Every code needs its anchored heading, and its "What to do" must match the registry. Every heading must be a code. The test also checks that doc_url points at the anchor.
  • New: a_loss_keeps_its_code_and_the_report_gives_its_guide_entry (diagnostics).
  • The --strict integration test checks the address. The Python test checks url.
  • Each entry's "where you see it" was traced to the code that gives the code. assumed.null-marker and the export case of dropped.zm were checked by hand.
  • On the box: formatting, clippy and the private preflight, and the screenshots below. The fork's CI ran the full gate.

Surfaces

  • The desktop app and the phone: the Messages pane. The browser shares the pane, and the link opens in a new tab.
  • The command line, Python, MCP (through the page) and the Assistant (the page is in its guide list).
  • No command, parameter, ribbon button or shortcut changes. Nothing saved changes.

UI evidence

The Messages pane after Calculate Field writes 1.5 into a whole-number field.

Before After
Messages pane before Messages pane after: the code changed.truncated and a What this means link

Related issue

Part of #2371.

Summary by CodeRabbit

  • New Features
    • Data-loss notices now link directly to documentation for the relevant loss code in CLI reports, Python warnings, and the Messages pane.
    • Added a guide explaining loss codes, where they appear, and suggested responses.
  • Documentation
    • Updated CLI, Python, and MCP documentation to link to the loss-code guide.

… notices that give it

A new guide page, Data loss codes, has an entry for each code, anchored
by its id: what happened, where it is said and what to do. It replaces
the command line guide's table, and a test keeps it in step with the
codes.

The Messages pane shows a notice's code with a link to its entry, and
Copy diagnostics gives both. A strict run gives each code's address,
Python's DataLossWarning has it as `url`, and the Assistant can read
the page.

Part of opengeos#2371.
@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 change adds a user-guide catalog for data-loss codes and a shared URL pattern for code entries. Diagnostic records retain optional loss codes. CLI output, Python warnings, and the Messages pane expose links to the corresponding guide entries.

Changes: Loss code guide and links

Layer / File(s) Summary
Guide and URL contract
crates/data/src/loss.rs, docs/user-guide/loss-codes.md, docs/user-guide/index.md, zensical.toml, crates/assistant/src/docs.rs
A new guide catalogs loss codes. GUIDE and LossCode::doc_url define the guide URL and per-code anchors. Tests compare the guide entries with the registered codes.
Diagnostic code retention and display
crates/data/src/diagnostics.rs, crates/engine/src/lib.rs, crates/ui-egui/src/diagnosticlog.rs
Diagnostic records store optional loss codes. Reports include a code and its guide URL when present. The Messages pane displays the code and a “What this means” link.
CLI and Python links
apps/rustgis-cli/src/main.rs, apps/rustgis-cli/tests/integration/strict.rs, apps/rustgis-python/python/rustgis/__init__.py, apps/rustgis-python/tests/test_session.py, docs/cli.md, docs/mcp.md, docs/python.md
Strict CLI messages and Python data-loss warnings expose code-specific guide URLs. Tests check the URLs, and the CLI, MCP, and Python documentation point to the new guide.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Possibly related issues

  • opengeos/RustGIS#2371 — The PR adds the stable loss-code catalog and strict CLI reporting described by the issue.

Possibly related PRs

  • opengeos/RustGIS#2736 — This PR builds on its loss-code registry and strict-run report by adding guide URLs and moving the code catalog to a user-guide page.
  • opengeos/RustGIS#2467 — This PR uses the typed loss-code contract and action text introduced there.
  • opengeos/RustGIS#2479 — This PR displays codes propagated by that change in diagnostic reports and the Messages pane.

Suggested labels: enhancement

Suggested reviewers: deniial00, giswqs, choupeanut

Merge Risk: Minimal · up to a7cc2

This change adds a guide page for data-loss codes and links to it from diagnostics, the CLI, and Python warnings. No commands or saved data change, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a guide entry for each loss code, linked from the notices that show the code. The changeset adds a Data loss codes guide page with anchored entries, a LossCode::doc_ur…
Description check Passed The description follows the template. It has a Summary, a Testing section, a UI evidence section with before and after screenshots of a visible Messages pane change, and a Related issue section that s…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a guide entry for each loss code, linked from the notices that show the code. The changeset adds a Data loss codes guide page with anchored entries, a LossCode::doc_url helper, and links from the Messages pane, CLI, and Python surfaces. The title uses a conventional feat(docs) prefix and is concise. It omits the link-generation detail, which is acceptable.

Full details: Description check

Explanation

The description follows the template. It has a Summary, a Testing section, a UI evidence section with before and after screenshots of a visible Messages pane change, and a Related issue section that says 'Part of #2371'. The UI evidence section replaces the 'No visible UI change' line correctly, because the Messages pane changes. The description gives concrete surfaces, tests, and file changes.

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 follows each code through the page,
And finds its guide at the end of the trail.
The CLI leaves a link beside the note,
A warning carries one in its coat.
The Messages pane shows where to go,
Then hops away with all it needs to 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: b2401dc9-dc37-4b86-b064-bb4b27cca6c2
Commits

Reviewing files that changed from the base of the PR and between 0f4d10e and a7cc28b.

Files selected for processing: 15

  • apps/rustgis-cli/src/main.rs
  • apps/rustgis-cli/tests/integration/strict.rs
  • apps/rustgis-python/python/rustgis/__init__.py
  • apps/rustgis-python/tests/test_session.py
  • crates/assistant/src/docs.rs
  • crates/data/src/diagnostics.rs
  • crates/data/src/loss.rs
  • crates/engine/src/lib.rs
  • crates/ui-egui/src/diagnosticlog.rs
  • docs/cli.md
  • docs/mcp.md
  • docs/python.md
  • docs/user-guide/index.md
  • docs/user-guide/loss-codes.md
  • zensical.toml

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

# Data loss codes

RustGIS never drops or changes data silently. A notice says what happened, how much and where.
A notice that reports a loss also carries one of the codes on this page. Each notice links to its

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This says every notice that reports a loss carries one of the codes, but lines 12-13 say not every loss has a code yet. Say "with a code" here so the two agree:

Suggested change
A notice that reports a loss also carries one of the codes on this page. Each notice links to its
A notice that reports a loss with a code also carries one of the codes on this page. Each notice links to its

Category: quality

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The page's next paragraph says not every loss has a code yet, so a reader isn't misled; the wording is left for the release quality pass.

Comment thread crates/data/src/loss.rs
for row in rows {
let id = row.trim_start_matches("| `").split('`').next().unwrap_or_default();
assert!(LossCode::from_id(id).is_some(), "docs/cli.md lists `{id}`, which is not a loss code");
for heading in headings {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The per-code check finds each heading by its first match (guide.split(...).nth(1)), so a second ### dropped.ring`` heading would pass silently. Pinning the heading count to the number of codes catches a duplicate. Every heading is already checked to be a code, so equal counts mean one heading per code:

Suggested change
for heading in headings {
assert_eq!(headings.len(), LossCode::ALL.len(), "docs/user-guide/loss-codes.md should have one heading for each code");
for heading in headings {

Category: quality

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

A duplicate heading would need someone to write one by hand, and the anchor would still resolve to the first; pinning the count is left for the release quality pass.



# The guide's page of loss codes (rustgis_data::loss::GUIDE), an entry for each code.
_LOSS_GUIDE = "https://rustgis.app/user-guide/loss-codes/"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The guide's address is written out again here, apart from rustgis_data::loss::GUIDE on the Rust side. The two match today, so this is not a defect. But if the Rust constant moves, Python keeps the old page, and the Python test (test_session.py) pins the same literal, so it would not catch the drift. Consider reading the address from the built package or having a test compare the two.

Category: quality

@Mavrick-F Mavrick-F Nov 27, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The two match today. The Python test checks the address it gives against a literal, not against the Rust constant, so a move on the Rust side alone wouldn't fail it. Deriving the address from the Rust constant is left for the release quality pass.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, crash paths, security problems or silent-loss gaps in this PR. The findings are documentation and test-precision nits. Three of them are posted as inline comments. Nothing was run: this environment has no build or test tooling, so the checks below come from reading the code.

No earlier review threads exist on this PR, so none were left alone.

Bugs

None found.

What I checked:

  • Every loss notice gets its code. All notice paths in crates/engine/src/lib.rs go through publish_notice, which now passes loss to push_redacted. relay_notice keeps notice.loss, and notify_counted and notify_loss pass their codes.
  • Constructors and callers are updated. All five Record { … } literals in diagnostics.rs set loss. The only push_redacted caller outside tests is in the engine, and it is updated.
  • Derives support the new code. LossCode derives Copy, Eq, Hash, so Record's Eq derive holds. Filter is Copy, so the diagnosticlog.rs closure change compiles.
  • Links and anchors resolve. zensical.toml has attr_list enabled, so { #id } headings work. #strict-runs exists in docs/cli.md. ### Loss codes still exists there, so the old cli.md#loss-codes link still lands. GUIDE matches site_url plus directory URLs.
  • Codes have emitters. I spot-checked the emitter for each code the guide describes, including dropped.legend, dropped.over-limit, changed.body, changed.position, approximated.curve, assumed.encoding and dropped.crs-name. The "where you see it" examples I sampled (dropped.value, dropped.zm, approximated.datum) also match emitter code.
  • Python pickling. __reduce__ keeps url through __dict__.
  • Test-list discovery. xtask changed finds include_str! reads automatically, so the new loss-codes read needs no table entry.

Security

None found.

Performance

None of note. doc_url() allocates a String per visible loss entry per frame, which is negligible.

Quality

  • docs/user-guide/loss-codes.md:4 says every loss notice carries a code, which contradicts lines 12-13. (Inline.)
  • crates/data/src/loss.rs:462: the_guide_lists_every_code would pass a duplicated heading for one code. An equal-count assert closes the gap. (Inline.)
  • apps/rustgis-python/python/rustgis/__init__.py:48 repeats the guide URL by hand. The Python test pins the same literal, so drift would go unnoticed. (Inline.)
  • docs/user-guide/loss-codes.md:9: "Python raises it" should say "emits it as a warning", as docs/python.md does.
  • docs/python.md (the url sentence): one line is very long and reads awkwardly.
  • The "Where you see it" lines are hand-written and not tested. They can drift from the emitters without a failing test.

AGENTS.md

No rule breaks found. Checked: the new strings use tl!, no images are committed, the strict and report surfaces are covered, and no command, parameter or saved file changes.

Change size

Compared: the whole PR against main (merge base 006faa2 to PR head a7cc28b).

Measure Value
Files changed 15 (1 added, 14 modified, 0 removed, 0 renamed)
Size before 587.2 KB
Size after 598.3 KB
Total size change +11.0 KB
Path Before After Change
docs/user-guide/loss-codes.md 0 B 9.8 KB +9.8 KB
docs/cli.md 15.6 KB 13.1 KB -2.5 KB
crates/data/src/diagnostics.rs 90.4 KB 91.6 KB +1.2 KB
crates/data/src/loss.rs 15.0 KB 15.8 KB +888 B
crates/ui-egui/src/diagnosticlog.rs 6.3 KB 7.1 KB +807 B
apps/rustgis-python/python/rustgis/init.py 41.4 KB 41.7 KB +282 B
apps/rustgis-python/tests/test_session.py 26.1 KB 26.3 KB +174 B
apps/rustgis-cli/tests/integration/strict.rs 6.3 KB 6.4 KB +126 B
apps/rustgis-cli/src/main.rs 63.4 KB 63.5 KB +117 B
docs/user-guide/index.md 44.9 KB 45.0 KB +112 B
docs/python.md 21.7 KB 21.7 KB +47 B
crates/assistant/src/docs.rs 11.8 KB 11.8 KB +32 B
zensical.toml 3.4 KB 3.4 KB +32 B
docs/mcp.md 30.2 KB 30.2 KB +7 B
crates/engine/src/lib.rs 210.8 KB 210.8 KB +6 B

@Mavrick-F
Mavrick-F enabled auto-merge November 27, 2026 18:31
@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3134/
Web app https://preview.rustgis.app/pr-3134/app/
Commit a7cc28b

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).

@Mavrick-F
Mavrick-F added this pull request to the merge queue Nov 27, 2026
Merged via the queue into opengeos:main with commit b181afe Nov 27, 2026
32 checks passed
@Mavrick-F
Mavrick-F deleted the feat/loss-code-docs branch November 27, 2026 19:08
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.

1 participant