Skip to content

A List page's linked CardPart FactBox follows the new line as BC does (#8188) - #8190

Merged
StefanMaron merged 6 commits into
mainfrom
flemmingbk-8188-list-host-factbox-new-line
Nov 17, 2026
Merged

StefanMaron merged 6 commits into
mainfrom
flemmingbk-8188-list-host-factbox-new-line

Conversation

@FBakkensen

@FBakkensen FBakkensen commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #8188

A top-level List page with one CardPart FactBox linked to its key now runs the part's triggers around the new line as Business Central does. Every pass is flagged by the new assumption list-factbox-new-line until the probe is pinned.

What changed

  • New module crates/al-vm/src/pages/list_factbox_new_line.rs owns the rule. It admits only the probe's page shapes (factbox_line_pages) and its call sequences (FactboxLine, steps_are). The page shape includes the probe's plain controls and table: field controls with no property but ApplicationArea, a repeater with none, a table with no property but DataClassification, and table fields with none (ListHostFactBoxNewLine.al:14, :18-19, :39-42, :74). In those steps:
    • the open of an empty view runs the part's OnAfterGetCurrRecord on the blank record;
    • New() below the view's one row leaves the part on that row;
    • the key's SetValue on the new line runs OnAfterGetCurrRecord on the blank record, twice after that New();
    • Next back onto the row the line saved runs no OnAfterGetRecord of the host;
    • Next onto the new line runs the part's OnAfterGetCurrRecord.
  • The blank landing reuses card_part_blank_on_new_host.
  • A SetValue that raises an error sets the steps back to Off (factbox_line_after_set_value). The later calls take main's path.
  • After the New() that kept the part:
    • a read of the part shows the row before (measured);
    • the host's reads and property calls (Value, Caption, Editable, ...) and Close keep main's answers;
    • the key's SetValue takes the measured path only for the probe's call: a text that, converted to the Code key field, is not blank and is the key of no stored row, as the next call but Value() reads, with the store unchanged. Any other key SetValue (a duplicate key, also in lower case, a blank key, a key after a property call) lets the part read the new line as main does at New() and goes on as on main;
    • another read or move of the part, an action, another SetValue and a move of the host are refused.
  • The function length cap of test_page_op goes from 276 to 271.

Evidence from real Business Central (required)

Where the behavior is pinned

Not pinned yet. The assumption list-factbox-new-line cites corpus #1426, and docs/probes-needed.md is regenerated.

Cell Outcome
Open of an empty view (OpenEdit) ASSUMED list-factbox-new-line (#1426): part F.AGCR();
New() below the view's one row, as the first call but reads ASSUMED: the part keeps the row
…then a read of the part ASSUMED: the row before
…then the key's SetValue of a new, not blank key ASSUMED: F.AGCR();F.AGCR();
…then a duplicate key (also lower case), a blank key, or a key after a property call main's result (Rust tests)
…then the host's reads and property calls, Close main's result (Rust tests)
…then another read or move of the part, an action, another SetValue, a move of the host REFUSED (new; main answered)
Key SetValue as the first call after an empty open ASSUMED: F.AGCR();
Next back to the saved row (New, key, other field, Previous) ASSUMED: no P.AGR
The Next after it, onto the new line ASSUMED: F.AGCR();
Host: other triggers, trigger bodies beyond a log call, properties, extension, subscriber main (Rust tests)
A property on a field control of the host or the part, or on the repeater main (Rust tests: Editable = false on the key control and on the part's field, FreezeColumn)
A property on a table field main (Rust tests: Caption on Name; TableRelation on the key, whose SetValue then fails)
A SetValue that raises an error inside the steps the steps end; later calls take main's path (Rust test)
Part: ListPart, outside FactBoxes, second or hidden part, a property, other link, other table main (Rust tests: UpdatePropagation, second part)
Key that is not one Code field main (Rust test: Text key)
OpenView, OpenNew, Page.Run, Page.RunModal, Trap main (Rust test: OpenView)
New() from the first of two rows, New() on an empty view main (Rust test: two rows)
The host of #1425 (AutoSplitKey, two parts, two-field key) main

Shapes that keep today's behavior

issue_8188_neighbors_keep_main and issue_8188_unmeasured_open_and_rows_keep_main compare each neighbor's step log with main's (1bd6406; the property cells with 5d12a55). The neighbors are: a host with OnAfterGetCurrRecord, a host trigger that writes Rec, UpdatePropagation, a second part, a Text key, a page extension, Editable = false on the host's key control and on the part's field control, FreezeColumn on the repeater, a Caption on a table field, OpenView, and two rows. issue_8188_key_table_relation_keeps_main shows that with a TableRelation on the key, the failing SetValue after New() and the later calls read main's log. issue_8188_set_value_error_ends_the_steps shows that after a SetValue error on the probe's pages the later calls read main's log. issue_8188_calls_after_the_held_new_line reaches the new refusal (Next, the SetValue of another field) and shows that Close keeps main's result. issue_8188_main_reads_after_the_held_new_line shows main's answers after that New() for a host read and Caption() calls, a duplicate key (also in lower case), a blank key, and a key after a Caption().

Checks

  • A test that failed before this change and passes now: issue_8188_list_factbox_follows_the_new_line (red: open= and partnew= on main; green, flagged)
  • Tests that neighbor shapes keep main's result
  • al-test-cli --root . --baseline-diff: on 27, 28 and 29 the head binary has the same counts as main. BC 27.5: 7 regressions in streams and types (Windows code pages). onprem-dotnet: 4 regressions on each major. Both are host differences that main has too. No stale lines.
  • ./check.sh (not run: Windows machine without bash. Green: fmt, clippy -D warnings, the three ratchets, the al-vm tests, the al-builtins tests and the al-test-cli lib tests, and the 8188 suite tests. al-builtins --test assumption_merge and the suite's script, WSL, python3 and .NET-host tests need Linux and were not run here)
  • I signed the contributor agreement (see CONTRIBUTING.md)
  • No machine names, URLs, credentials, tenant ids or customer code in the change or this text
Needs probe, and decisions taken

This branch starts from main, not from #8187: the FactBox rule does not use #8187's code. The host with CardPart FactBoxes in corpus pull request aldevtools/BusinessCentral.AL.Language.Tests#1425 (the ListNewLine_PartsHost_* tests) needs both changes and stays on main's path in each of them alone; a follow-up joins them once both have landed.

FBakkensen and others added 3 commits November 16, 2026 15:25
… as fixtures

Copies of corpus pull request 1426 (tests/al-language/pages/parts/ListHostFactBoxNewLine.al)
and of the reporter's repro: a List page with one CardPart FactBox linked to the key, around
the new line. The test that runs them comes with the fix.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
On a top-level List page opened with OpenEdit, with OnAfterGetRecord only and one CardPart
FactBox linked to the one-field key, BC runs the part's OnAfterGetCurrRecord on the blank
record at the open of an empty view, at the key's SetValue on the new line and at Next onto
it; keeps the part on the row before after New() until the key's SetValue; and runs no
OnAfterGetRecord of the host on Next back to the row the line saved. The runner ran none of
that. The new module pages/list_factbox_new_line.rs admits only the probe's page shapes and
call sequences, through the assumption list-factbox-new-line (corpus pull request 1426);
every other shape keeps main's path, and after the New() that kept the part, calls other than
a read of the part, the key's SetValue and Close are refused.

test_page_op shrank: its cap goes from 276 to 271.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…probe shows none (#8188)

Review: the host's reads and property calls (Value, Caption, Editable, ...) after that New() were
refused although their answers do not depend on the part; they now run as on main. The key's
SetValue took the measured blank-record read for any text that fit the field, a duplicate key
included; the candidate key is now converted to the field and must be not blank and the key of no
stored row, and the measured call sequence is required. Any other key SetValue lets the part read
the new line as main does at New() and goes on as on main. Rust tests compare a host read, a
Caption, a duplicate key (also lower case), a blank key and a key after a Caption with main's
answers; the refused calls now run in codeunits of their own so a refusal does not hide later
tests. The assumption text says what the code checks.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@StefanMaron

Copy link
Copy Markdown
Collaborator

The corpus check is red on its step time guard only: the step took 208 s against a limit of 188 s (1.5 times main's median of 125 s). The work counts of all three majors stay within 10% of main, and the not-passing lists show no regression. So this does not come from your change. I will start the check again.

The probe this depends on, aldevtools/BusinessCentral.AL.Language.Tests#1426, is not merged yet. I review it next. Until it is pinned, the passes here stay flagged.

Corpus pull requests 1426 and 1425 are merged (not pinned yet); the citations already name their lines. docs/codemap.md: keep main's new go_to_key_read_up.rs entry and this branch's pinned_shape.rs entry.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@StefanMaron

Copy link
Copy Markdown
Collaborator

Thanks, Flemming. Corpus PR 1426 is merged. On the branch merged with today's main, both tests of
ListHostFactBoxNewLine.al pass on BC 27, 28 and 29, the baseline diff is clean on all three, and the Rust tests pass.
The red corpus check was only the step time guard.

The entry condition is strict and cites the probe line for every fact, which made this easy to review. I found two
facts it does not check yet:

  1. Properties on field controls. With Editable = false on the host's "No." control the new path still runs
    (setno=F.AGCR();F.AGCR();). The probe's controls have only ApplicationArea. Please require that for the field
    controls of the host and of the part, as you already do for the part control.
  2. Properties on table fields. With a TableRelation on "No.": New(), then SetValue('B') with a value that is not in the
    related table. The part runs F.AGCR(), then the SetValue fails, and the state stays HeldRead; main logs nothing.
    Please require fields without properties, as in the probe, and set factbox_line back to Off when the SetValue
    raises an error.

Smaller: the texts still say corpus PRs 1425 and 1426 are open. Merging main conflicts in docs/codemap.md. This PR and
#8187 both change docs/probes-needed.md and metrics/fn-lengths.toml, so the second one needs a merge. The new refusals
after the New() that keeps the part are fine with me.

With those two checks added I will merge it.

…-line steps

Review of #8190 found two facts the entry condition did not check. The probe's
field controls carry only ApplicationArea and its table fields no property, yet
Editable = false on the host's key control still took the new path, and with a
TableRelation on the key the part ran OnAfterGetCurrRecord before the SetValue
failed and the steps stayed in HeldRead.

factbox_line_pages now also requires field controls of the host and the part
with no property but ApplicationArea, a repeater with none, a table with no
property but DataClassification and table fields with none
(ListHostFactBoxNewLine.al:14, :18-19, :39-42, :74). A SetValue that raises an
error sets factbox_line back to Off (factbox_line_after_set_value), so the later
calls take main's path. The Rust tests compare each new neighbor with main's
log. The assumption text and docs/probes-needed.md follow the narrower shape.

docs/codemap.md and the assumption entry go back to LF line endings.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@FBakkensen

Copy link
Copy Markdown
Collaborator Author

Thanks. Both points are fixed in d473b10e7.

  1. factbox_line_pages now requires field controls of the host and the part with no property but ApplicationArea (ListHostFactBoxNewLine.al:41-42, :74), and a repeater without properties (:39-40). Editable = false on "No." or on the part's Name now logs exactly what main logs, without the flag (issue_8188_neighbors_keep_main).
  2. The table may have no property but DataClassification (:14), and its fields none (:18-19). A TableRelation on "No." now logs main's text (issue_8188_key_table_relation_keeps_main). A SetValue that raises an error now sets factbox_line back to Off. Inside the measured shape I found no SetValue that fails once the state is HeldRead, so issue_8188_set_value_error_ends_the_steps shows that the calls after an error log what main logs.

The texts say 1425 and 1426 are merged, not pinned yet. The baseline diff on 27, 28 and 29 shows no regression or stale line.

@StefanMaron

Copy link
Copy Markdown
Collaborator

Thanks, Flemming. Both checks are what I asked for. Next I'll check the new commit against my two small apps (Editable = false on "No." and the TableRelation case), and run the baseline diff on the branch merged with main. If both give main's output, I'll land this one.

It is the first of the pair to land, so #8187 takes the main merge for docs/probes-needed.md and metrics/fn-lengths.toml. The docs/codemap.md conflict with main from my review still needs a merge here. If you merge main into the branch, I can start right away. Otherwise I'll do it when I land it.

@FBakkensen

Copy link
Copy Markdown
Collaborator Author

main is merged into the branch, with no conflict left (head 9cc3ab7). On that head the Rust gates are green, and the baseline diff on 27, 28 and 29 shows no regression and no stale line. I'll merge main into #8187 once this one has landed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@StefanMaron

Copy link
Copy Markdown
Collaborator

Thanks, Flemming. Head 9cc3ab7 is the commit I'm landing. It is in a merge train now, together with my checks of your two fixes against my small apps and the baseline diff on 27, 28 and 29. I'll comment here when it is on main.

You don't need to merge main into #8187 afterward. Its review is done, and I'll resolve the merge with main (docs/probes-needed.md, metrics/fn-lengths.toml and the page code) in its own train, right after this one lands.

@StefanMaron
StefanMaron merged commit 0598062 into main Nov 17, 2026
11 checks passed
@StefanMaron
StefanMaron deleted the flemmingbk-8188-list-host-factbox-new-line branch November 17, 2026 16:55
@StefanMaron

Copy link
Copy Markdown
Collaborator

Thanks, @FBakkensen. I checked your new commit. With Editable = false on "No." and in the TableRelation case, the branch now gives the same output as main. The baseline diff on BC 27, 28 and 29 shows no regression and no stale line. It landed on main through merge train #8234.

#8187 is next. I'll merge main into it in its train, so you don't need to do anything there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants