Repository navigation
A list's new line that the table field's OnValidate inserted lands on the row at CurrPage.Update (#8186) - #8187
Conversation
… the row at CurrPage.Update (#8186) A List page without parts on the line New() started: the table field's OnValidate inserts Rec itself (an AutoIncrement key) and the control's OnValidate calls CurrPage.Update() or Update(false). Main refused it. BC (corpus pull request 1425, open, measured on BC 29.1) leaves the line for the stored row: Update() modifies it, Update(false) saves nothing, the refresh reads the view from its first row, and Previous on the view's only row answers false without a save. New assumption list-new-line-code-insert-update; pages with parts, DelayedInsert, a temporary source, Update(true) written out and other trigger sets keep the refusal. The refresh that reads the view from its first row moves out of refresh_after_validate_filter into refresh_new_line.rs (reread_view_from_row), shared by both paths. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… its probe text The probe ran green on every supported major in corpus CI; name issue 8188 for the FactBox host it leaves refused. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…issue An entry that names an al-runner issue must await it; the FactBox host it leaves refused is described without the number. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
The The probe this depends on, aldevtools/BusinessCentral.AL.Language.Tests#1425, is not merged yet. I review it next. Until it is pinned, the passes here stay flagged. |
Corpus pull request 1425 is merged (not pinned yet): the assumption entry, the module comments and the fixture now cite tests/al-language/pages/currpage/ListNewLineCodeInsertUpdate.al by line. metrics/file-sizes.toml: main dropped rows.rs (now under the limit); actions.rs keeps this branch's lower cap. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Thanks for this, Flemming. Corpus PR 1425 is merged. I ran the branch merged with today's main: the 10 measured cells Before I merge, the entry condition has to be narrower. It also answers shapes the probe did not measure. I tested each
Small things: docs/codemap.md names update_code_inserted_new_line, the function is land_on_code_inserted_line. The I can attach my probe app and its output if that helps. |
Review of #8187: the path answered shapes the probe of corpus PR 1425 did not measure. The entry is now one predicate, code_inserted_cell: the page declares only the probe's properties and triggers (no part, extension or subscriber), it was opened with OpenEdit on an unfiltered view or by a Page.RunModal statement (unfiltered, or one SetRange on the key's Code field for the reporter's repro), the test called only New() and the SetValue, the key is a Code field and an AutoIncrement Integer field, the table field inserted the row before the control's OnValidate began (a write mark taken when that trigger starts), and the view holds the row last, alone or after one row of the same Code. Each cell of the probe is listed with its lines. A validation that ends with an error after the move onto the row is refused. The landing marks are forgotten when the page opens and closes. Neighbor tests (Issue8186Neighbors.al) show each shape of the review keeps main's outcome or is refused. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The entry was named update_code_inserted_new_line; the function is land_on_code_inserted_line. Also list the validation hooks and the refresh check. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Thanks for the review and the small apps. All six points are fixed in
codemap.md and the texts are fixed, and the probes-needed table is regenerated. The baseline diff on 27, 28 and 29 shows no regression or stale line. Whichever of this PR and #8190 lands second needs a main merge for docs/probes-needed.md and metrics/fn-lengths.toml. |
|
Thanks, Flemming. That covers all six points. I'll review the new commits ( About point 1: you are right that undoing the move can't give main's result once On landing order: I'll land #8190 first, so this one needs the main merge for |
metrics/file-sizes.toml: keep the lower cap of each side (actions.rs from this branch, reports.rs from main). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Thanks, Flemming. I checked the six points from the first review against your new head, and all are fixed:
I ran your neighbor fixtures on BC 27, 28 and 29 against main and your branch, and the results are as your tests say. Three small things for a later PR, they do not block this one:
#8190 lands first. After that I'll land this one through the merge train and resolve the three conflicts with main there myself (parts.rs, docs/probes-needed.md and metrics/fn-lengths.toml), so you don't need to do anything. |
Fixes #8186
A List page stands on the line
New()started. ASetValueruns the table field's OnValidate, which inserts Rec itself (if "Entry No." = 0 then Insert(true), an AutoIncrement key), and then the control's OnValidate callsCurrPage.Update(). Main refuses the test: "CurrPage.Update on a page that shows no row (empty view or new line) while its view has rows". Business Central leaves the line for the stored row. This branch does the same in exactly the cells the probe and the reporter's repro measured, behind the new assumptionlist-new-line-code-insert-update. Every other shape keeps main's outcome.What changed
pages/code_inserted_new_line.rs(new) owns the rule:land_on_code_inserted_line, asked byCurrPage.Update()andCurrPage.Update(false): in a measured cell the page leaves the new line for the stored row before the call goes on.Update()then saves it through the usual save path, as a modify (P.MOD(X/);T.M(X/);before the OnValidate ends; OnInsertRecord never runs, nothing is inserted twice).Update(false)saves nothing.code_inserted_refresh_due) reads the view from its first row, the row again, then OnAfterGetCurrRecord (P.AGR(X);P.AGR(A);P.AGR(X);P.AGR(X);P.AGCR(X);with a row before,P.AGR(X);P.AGR(X);P.AGCR(X);on an empty view).previous_on_code_inserted_row, asked byend_move_without_read:Previous()on that row, when it is the view's only row and the test only read and wrote controls since, answers false, runs nothing and keeps the edit unsaved;Next()then saves it.refuse_error_after_landing, asked byvalidate_step_close: a validation that ends with an AL error after the move is refused.code_inserted_cell. Each fact citesListNewLineCodeInsertUpdate.al:Page.RunModal(Id, Rec)statement in Edit mode. The record has no filter, or (the reporter's repro) oneSetRangein group 0 on the key's Code field to the line's value. The view is in ascending primary key order, without MarkedOnly.New()and then the SetValue that runs now, nothing else.run_control_onvalidate,PageState::control_onvalidate_writes) decides this.Update(),Update(false)) and under an unfiltered RunModal (Update()); the five triggers without AutoSplitKey under OpenEdit (Update()); no trigger with AutoSplitKey under OpenEdit (Update()) and under the RunModal filtered to one group (Update(), the repro).Update(true)written out is left to main.PageStatehas three fields of the rule:refresh_from_code_inserted_line(taken by every refresh),code_inserted_row(taken by every move), andcontrol_onvalidate_writes(set only while the control's OnValidate runs).forget_code_inserted_lineclears the first two when the page opens or closes, and after a refused validation.reread_view_from_rowmoves out ofrefresh_after_validate_filter(actions.rs) intorefresh_new_line.rs, together withfinish_validate_refresh, and both paths use it.refresh_after_validate_filterdoes what it did before.stale_rename::row_versionis nowpub(crate)(the one reader of SystemRowVersion in a row buffer).actions.rsis now 3391 lines (cap lowered from 3413),pageops.rs::test_page_op_inner531 (from 535; the refresh request ofCurrPage.Updatemoved intoask_update_refresh).controls.rs::control_set_value_nowstays at its cap of 770.Evidence from real Business Central (required)
tests/al-language/pages/currpage/ListNewLineCodeInsertUpdate.al, 14 tests. The reporter's repro is in CurrPage.Update in a control's OnValidate, on a list's new line that the table field's OnValidate inserted with Insert(true): BC stays on the inserted row; al-runner refuses the test as not pinned #8186 (green on BC, 2/2).Where the behavior is pinned
list-new-line-code-insert-update(crates/al-builtins/src/assumptions/list-new-line-code-insert-update.rs) awaits the probe file above.docs/probes-needed.mdhas its row.ListNewLine_FieldValidateInserts_*andListNewLine_RunModal_*(page 97032,:515-617),ListNewLine_NoAutoSplitKey_*(page 97033,:539-560),ListNewLine_NoPageTriggers_*(page 97039,:783-810), and the reporter's two tests.Shapes that keep today's behavior
CurrPage.Update()orUpdate(false)moved the page onto the row (asserterroraround the SetValue; the error rolls the insert back). Main fails the test there, and BC is not measured. Undoing the move would not give main's result:Update()has already run OnModifyRecord and the table's OnModify on the row. So the validation is refused.Issue8186Neighbors.al):Filter.SetFilter(Name, 'A'), or a RunModal record filtered on Name.Rec.Insert(true); CurrPage.Update();).Page.Run, a primary key of the AutoIncrement field alone.New()and the SetValue.Update(false)on the page without AutoSplitKey (not measured) keeps main's result (the close inserts the line a second time).Close()and a secondOpenEditon the same TestPage variable,Previous()on the only row saves the Value typed, as on a plain list.F.AGCR();at the open of an empty view, no relink atNew()(the parts keep showing the row before) andF.AGCR();at the start of the next SetValue, a re-read of the parts after the SetValue on Value under OpenEdit,P.AGR(X);before Previous saves, andF.AGCR();when Next starts a new line. The runner already fails these four cells at the open or atNew()onmain, and still does. They are a FactBox gap of their own, outside this change: A List page's linked CardPart FactBox on the new line: BC keeps the part on the row before after New() and runs its OnAfterGetCurrRecord on the blank line; al-runner blanks the part at New() and runs no part trigger #8188.Update(true)written out,SaveRecord, OpenNew, OpenView, a temporary source, a line not started byNew(), and a row the validation did not insert.Checks
issue_8186_code_inserted_new_line_lands_on_the_rowruns the probe file (fixtureIssue8186Probe.al) and the reporter's repro (Issue8186.al). Red on main: every cell not run with the refusal above. Green here: each passes, flagged.issue_8186_error_after_the_landing_is_refused: the error shapes are refused.issue_8186_unmeasured_views_and_opens_keep_main_refusal: the filter, row-count, control-insert, open and call neighbors keep main's refusal without the mark;Update(false)without AutoSplitKey keeps main's answer.issue_8186_unmeasured_page_and_key_keep_main_refusal: ModifyAllowed, SourceTableView and the AutoIncrement-only key.issue_8186_reopen_forgets_the_landing: the marks are cleared at close and open.issue_8186_unmeasured_neighbors_stay_refused: DelayedInsert, Worksheet,Update(true)and a CardPart keep main's refusal.al-test-cli --root . --baseline-diff, run on BC 27, 28 and 29 with the head binary: no stale lines, and no regression in pages or any other area this touches. On this Windows machine the same 7 cases ofstreamsandtypes(Windows code pages, BC 27.5 only) and 4 ofdotnet(CRLF and .NET texts) fail on every major. They come from the host and read no page../check.sh: not run, per the PR CI rule. Run locally:cargo test -p al-test-cli --test suite outside_fb_repros,--test fn_length_ratchet --test file_size_ratchet --test os_access_ratchet,cargo test -p al-test-cli --lib assumption,cargo test -p al-builtins --lib,cargo test -p al-version --test no_version_literals,cargo clippy -p al-vm -p al-builtins -- -D warnings,cargo clippy -p al-test-cli --test suite -- -D warnings,cargo fmt --all. The assumption merge check needs bash, which this machine lacks.The partner test behind #8186 runs on a page with CardPart FactBoxes, so it stays refused until the FactBox gap above (#8188) is closed.