Skip to content

Probe: what load-once caches hold after the login, in both kinds of session (runner issue 8945) - #1571

Open
StefanMaron wants to merge 7 commits into
masterfrom
probe-login-memo-shapes-8945
Open

StefanMaron wants to merge 7 commits into
masterfrom
probe-login-memo-shapes-8945

Conversation

@StefanMaron

@StefanMaron StefanMaron commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

This probe measures what Business Central keeps in load-once caches after the login, for runner issue 8945.

First part: memo shapes (F cells)

What it measures, in a session that asks for table 9008 first and in one that does not:

  • F1: a wrapper integration event with a fixed list. Same in both kinds of session.
  • F2 and F12: rows loaded into a List and a Dictionary, and rows loaded through a wrapper. Same in both.
  • F3: the table id a load keeps. Differs by session kind (9008 or the first table asked). The test asserts only the relation, not one value.
  • F4: whether 9008 is in the watched list. Differs by session kind. The test asserts the relation.
  • F5: login subscribers that change the rows a load reads. Same values in both.
  • After a test's first writes: every memo notes the two inserts into the watched table and nothing for the other table. Load count stays 1.

Second part: caches that login subscribers fill (L1, G3, E1, M1-M4)

Tests: tests/al-language/events/platform-triggers/LmLoginCacheTests.al (codeunits 75887 and 75888, plain job) and tests/al-language-testlibraries/test-framework/login-caches/LmLoginCacheTlTests.al (81597 and 81598, Tests-TestLibraries job). Both use the same reader and the same expected values. Login subscribers: tests/al-language-xapp-a/LmXaLoginCaches.al.

Measured on a local BC 29.0 with Tests-TestLibraries installed, in both kinds of session, with the hub and the websocket runner:

  • L1 (partner memo, empty setup table): Checked Yes, Activated No, Loaded Yes. The setup copy holds 0 rows, no filter and key 0 after the failed Get. The second temporary record holds 0 rows, keeps the filter Company Name: '' and an empty key. A setup row the test adds is not seen. Same in the second codeunit.
  • G3 (the L1 memo with guards before the load): two copies of the same code. The ask exits on an empty company name and on a missing read permission of the setup table. The write path calls an error-reporting codeunit that writes nothing, raises its own OnBefore event (Disabled and Loaded passed by var), then exits on Handled, on the Disabled flag and on a temporary record. Memo A loads on the login's first write event: the modify of "User Login" 9008 in one kind of session, the insert of 98455 in the other. Before Memo B sees any write event, a login subscriber that writes nothing calls its public entry once into each of the Handled, Disabled and temporary exits. Loaded stays false after each. Memo B then loads on the insert of 98455. Both end states are the same in both kinds of session: Checked Yes, Activated No, Loaded Yes, Disabled No, the setup copy empty with key 0, the second temporary record empty with the filter Company Name: ''. The ask never saw an empty company name. It saw no missing read permission on BC 28.5 and 29.0 in both jobs and on BC 27.5 in the plain job. On BC 27.5 in the Tests-TestLibraries job, at least one ask before the test read took the read-permission exit (CI run 45452409452, both codeunits). The end states were still the same as on 28.5 and 29.0. The Tests-TestLibraries file asserts No under #if BC28PLUS and Yes in the #else branch (BC 27). For the runner this means the read-permission exit is reachable on BC 27 in that job; it is not dead code.
  • E1 (Environment Information): the test's IsSandbox() and IsSaaS() equal what the two login subscribers got.
  • M1 (Application Area Cache): the test reads the login's areas. After the test adds a user row, the read gives the new areas. After the rollback the cache still holds the rolled-back areas, until the next Application Area Setup event clears it.
  • M2 (Conf./Personalization Mgt.): after the test changes its User Personalization row, the read still gives the login's profile.
  • M3 (Change Log Management, loaded at login with the setup inactive): activating the setup with triggers logs 0 entries for a table set up for insertion. Activating it without triggers also logs 0. After InitChangeLog, an insert into a second table logs 2 entries. The setup row is the same after the rollbacks.
  • M4 (API Webhook Notification Mgt.): the test's inserts do not ask for the API subscription setting (0 asks), with a subscriber that answers and with one that only counts. After Reset() the next insert asks once and the one after does not.

M3 change in the last commit: an earlier version had two login subscribers that turned the change log on and back off in every session. They wrote Change Log Setup, which is a Microsoft table, and each session left Change Log Entry rows for table 402. The test now activates the setup itself, inside rolled-back blocks. The test's other writes to Microsoft tables (Application Area Setup, User Personalization, Change Log Setup) are all inside asserterror blocks and rolled back, like FeatureKey_D_ModifyThenRollback in tests/al-language/metadata/platform-tables/AwTests.al.

Expected test count per leg: 10 in the Cloud job (75887 + 75888) and 10 in the Tests-TestLibraries job (81597 + 81598).

CI run 45452409452 measured the plain job (no Backup Management) and BC 27.5 and 28.5. In the plain job all asserted L1 and G3 observations passed on all three versions, with the same expected values as the Tests-TestLibraries job, and 10 of 10 tests passed per leg. The four G3 observations that the tests ignore (A loaded by, A load table, B load table, A loaded before the login subscriber) are not visible in a passing run, so they are not measured in the plain job. The only difference was the G3 read-permission exit on 27.5 in the Tests-TestLibraries job (see G3).

Compile check: BC 29.0 compiles. BC 27.5 and 28.5 show only the known error in pages/statistics-compatibility (the 'Statistics' action), which this branch does not touch. The compile check does not build the Tests-TestLibraries app; its new #if BC28PLUS / #else block holds only Observer.Expect lines.

The same CI run had one failure outside this pull request: MinRowVersion_FunctionIsolation_FirstTest (BC 29.0, shard 3, tests/al-language/metadata/platform-tables/MinimumActiveRowVersionStages.al), observation 1 a first min/last+1 was less, expected same. That observation reads a database-wide value: any open write transaction in any session at that moment gives less. I don't think this pull request caused it: the shard ran the same codeunits in the same order as the earlier green run of this branch (run 45361142509) and as the master nightly run 45383544930, where all 8 MinRowVersion tests passed. In the failing shard, the two first tests of the same file that ran right before it (97987 and 97988) passed, and so did all MinRowVersion tests on BC 27.5 and 28.5. The XApp A code added since the green run writes no database table (only temporary records, and reads of Environment Information, Application Area Setup and the user's profile). I did not find this failure in the 13 other failed runs of the last day. The new CI run on the final commit shows whether it comes back.

Generated by an AI agent (Claude) working for Stefan Maron.

… login in both kinds of session (runner issue 8945)

Cells: a cache reached through a wrapper's integration event, a cache loaded
from the app's own setup rows into a List and a Dictionary, both together, a
load that keeps the asked TableId, a watched list that holds User Login
(9008), and login subscribers that change the rows the load reads.

Claude-Session: https://claude.ai/code/session_01B5GPNVCdMf7ByZez1YeU96
…old whatever Microsoft's login writes first (runner issue 8945)

Claude-Session: https://claude.ai/code/session_01B5GPNVCdMf7ByZez1YeU96
… kinds of session (runner issue 8945)

Adds the cells L1 (partner memo with an empty setup, loaded on the write
event path), E1 (Environment Information filled by two subscribers of one
app), M1 (Application Area Cache), M2 (Conf./Personalization Mgt.), M3
(Change Log Management loaded inactive, then activated at login) and M4
(API Webhook Notification Mgt. cache) in the plain job and in the
Tests-TestLibraries job.

https://claude.ai/code/session_01B5GPNVCdMf7ByZez1YeU96
…ber (runner issue 8945)

The login subscribers 98478 and 98479 wrote Change Log Setup in every client
session. That is a Microsoft table (writer rule 12), and each write left
Change Log Entry rows for table 402 that the put-back did not remove.

The M3 test now activates the setup itself inside rolled-back blocks: first
with triggers (Insert(true)/Modify(true)), on the cache the login loaded,
then without triggers, then after InitChangeLog. It also checks that the
setup row is the same before and after. Measured on a local BC 29.0 with
Tests-TestLibraries: 0 entries with triggers, 0 without, 2 after
InitChangeLog.
…945)

Open corpus pull requests already claim table 97701 and codeunits 97707 and
97708. The new ids are free on master and in every open pull request.

Claude-Session: https://claude.ai/code/session_01PQNbkr8JaH5QubJjYVRG4b
…ssue 8945)

Two copies of the L1 memo with the guards a partner memo has: an empty
company name and the setup table's read permission in the ask; an
error-reporting call, an OnBefore event with Handled (Disabled and Loaded
by var), the Disabled flag and a temporary record in the write path.
Memo B passes each guard exit once before its first write event. Both
end states are the same, whichever table loaded the memo.

Claude-Session: https://claude.ai/code/session_01PQNbkr8JaH5QubJjYVRG4b
…ibraries job (runner issue 8945)

CI run 45452409452: on BC 27.5 in the Tests-TestLibraries job at least one G3 ask before the test read
took the read-permission exit (Yes); on 28.5 and 29.0, and in the plain job on all three, no ask did (No).

Claude-Session: https://claude.ai/code/session_01PQNbkr8JaH5QubJjYVRG4b
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