Repository navigation
feat(ui): Calculate Field previews what it would write in the first rows as the expression is typed (#2817) - #2822
Conversation
…ows as the expression is typed (opengeos#2817)
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Code reviewI found no bugs, crash paths, silent losses or AGENTS.md breaks. The preview reads each row through the same Bugs
Security
Performance
Quality
AGENTS.md
Prior reviews
Change sizeCompared with the base branch (merge base 06657ca to PR head f22fa03).
|
📖 Docs preview
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 |
… rows the layer lacks (opengeos#2817) A line break or tab in a text value reads as a space, and a long value stops being written past the cut. A selected row the layer no longer has takes no place among the three. The coercion step returns a named Held struct instead of a positional pair.
Code reviewBugs
Security
Performance
Quality
AGENTS.md
Prior concerns
Change sizeCompared with the base branch,
|
…d preview, and the guide says the layer's checks still run (opengeos#2817) The preview's value is what the expression gives for the row as the field holds it; domains, allowed combinations, constraint rules and calculation rules still run when Calculate is clicked.
Code reviewBugs: None found on the changed lines. I checked the shared Security: None found. Performance:
Quality:
AGENTS.md: No breaks found. Strings go through Already raised, left alone (2):
The Change sizeCompared with
|
Code reviewI found no bugs in this diff. I checked the preview against the run it claims to mirror: Bugs
Security
Performance
Quality
AGENTS.md
Earlier review threads: I left 6 concerns across 5 threads alone, because each is answered or fixed. The domain-check mismatch was answered by correcting the claim in the PR body and the guide. The row-cap concern was answered. U+2028/2029, the tuple-to-struct change, and the import placement were fixed. Change sizeCompared: the whole PR against main (merge base 06657ca to PR head b76f23d).
|
Summary
Calculate Field shows what the expression would write before it is run. Once the expression reads and no suggestion is open (when the
Invalid:line would otherwise show), a line under the box gives the first three rows Calculate would write (the first three of the selection, or the first three rows when none is selected; a standalone table: its first three rows), as the chosen field would hold them and the attribute table shows them, each value cut at forty characters, a line break in it (Unicode's line and paragraph separators too) read as a space, with what writing them loses:Preview: 2 (fraction dropped) · <Null> (a division by zero) · 6preview_calculationinengine/src/cmd/edit.rsparses the expression once, ascheck_calculationdid, and passes each row throughheld, the stepWriteLosses::writenow shares: the coercion to the field's type and the loss it causes. Each value is what the run computes for that row and the field holds, and each reason (PreviewLoss) is a kind the run's notices count: a cut, a result the field can't hold, an expression error. The preview doesn't run the layer's checks (domains, allowed combinations of values, constraint rules) or its calculation rules: those still run when Calculate is clicked and can refuse the edit, as the guide now says.$areaexpression also checks the layer's areas then).edit.calculateFieldor anything saved. With no valid field chosen, the box is checked as before, with no preview.WriteLosses::writekeeps its counting;calculate_field_notices_count_what_the_preview_readspins it.Preview: {values}, the loss reasons intl_raw!) wait for the release translation pass.Surfaces: the preview is a dialog aid, so it is in the desktop and browser apps (
ui-egui). The CLI, Python, the Assistant and MCP runedit.calculateFielddirectly and show its notices; they have no dialog to preview in. The phone interface (ui-touch) has no Calculate Field dialog.Not in this PR: the same line in other expression boxes (label text, symbols by expression), and filters.
Testing
cargo fmt --all --check,cargo clippy -p rustgis-engine -p rustgis-ui-egui --all-targets -- -D warnings,cargo nextest run --workspace(9216 passed), doctests,cargo xtask layersandcargo xtask schema --check: all pass.a_calculation_preview_is_what_the_run_writes(clean values, fraction, past the 64-bit range, text a whole-number field can't hold, division by zero, date-time into a date, asked null, no rows, rows past the end, the check's error) andcalculate_field_notices_count_what_the_preview_reads.calculate_field_previews_the_first_rows_of_a_table(values, losses, an error row, no preview of an invalid expression or while a suggestion is offered),calculate_field_previews_the_selected_rows_of_a_layer(first three selected, a selected row the layer doesn't have, first three rows, empty layer) anda_calculation_preview_stays_on_one_line(a line break or tab in text reads as a space, a long value is cut at forty characters).ui_shotbefore and after on the World Atlas sample: Countries with South America selected, fieldpop_est,pop_est / 7.UI evidence
Before / after (Countries, 13 selected,
pop_est = pop_est / 7):Related issue
Closes #2817
Summary by CodeRabbit