Fix lifecycle compatibility guidance (#93)

* Fix lifecycle compatibility guidance

Correct high-confidence Business Central guidance and samples for upgrade tags, collectible errors, trigger semantics, obsoletion, events, interfaces, API contracts, and test transactions.

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

Copilot-Session: e05a43e7-6448-4d67-9c73-798523f5d945

* Address guidance review findings

Gate SecretText guidance to BC23 and clarify that the collectible-error sample intentionally emits a message-only blocking aggregate.

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

Copilot-Session: e05a43e7-6448-4d67-9c73-798523f5d945

---------

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
This commit is contained in:
Jesper Schulz-Wedde 2026-07-14 11:26:16 +02:00 committed by GitHub
parent aca3986fd0
commit 5706959e4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 201 additions and 104 deletions

View file

@ -5,6 +5,23 @@ codeunit 50154 "Test Sample TransModel Bad"
[Test]
[TransactionModel(TransactionModel::AutoRollback)]
procedure TestPostingRoutineAutoRollback()
var
PostingRoutine: Codeunit "Posting Routine Commit Bad";
begin
// Runtime error: AutoRollback forbids the Commit reached below.
PostingRoutine.PostCustomer();
end;
}
codeunit 50156 "Posting Routine Commit Bad"
{
procedure PostCustomer()
var
Customer: Record Customer;
begin
Customer.Init();
Customer."No." := 'T-BADCOMMIT';
Customer.Insert(true);
Commit();
end;
}

View file

@ -16,6 +16,22 @@ codeunit 50153 "Test Sample TransModel Good"
[Test]
[TransactionModel(TransactionModel::AutoCommit)]
procedure TestLogicThatCommitsInternally()
var
PostingRoutine: Codeunit "Posting Routine With Commit";
begin
PostingRoutine.PostCustomer();
end;
}
codeunit 50155 "Posting Routine With Commit"
{
procedure PostCustomer()
var
Customer: Record Customer;
begin
Customer.Init();
Customer."No." := 'T-COMMIT';
Customer.Insert(true);
Commit();
end;
}

View file

@ -15,7 +15,7 @@ application-area: [all]
## Best Practice
Default to `AutoRollback`: it opens a write transaction at the start of the test, runs the test body, and rolls back at the end, leaving the database in its original state. Pick `AutoCommit` only when the code under test genuinely calls `Commit` — posting routines, job-queue handlers, integration flows — and pair that test's codeunit with a `TestIsolation`-enabled test runner so committed changes are reverted at a higher scope. Pick `None` only for read-only tests or tests that drive UI code without writing from the test method itself, for example tests that validate calculation formulas or read-only projections.
Default to `AutoRollback`: it opens a write transaction at the start of the test, runs the test body, and rolls back at the end, leaving the database in its original state. Pick `AutoCommit` only when the code under test genuinely calls `Commit` — posting routines, job-queue handlers, integration flows — and make the test exercise that commit path. Pair the test codeunit with a `TestIsolation`-enabled test runner so committed changes are reverted at a higher scope. Pick `None` only for read-only tests or tests that drive UI code without writing from the test method itself.
See sample: `transactionmodel-attribute-governs-test-transactions.good.al`.