Skip to content

3 AL/BC testing patterns from an external BC testing expert's blog (Luc van Vugt, fluxxus.nl) - #159

Merged
Jesper Schulz-Wedde (JesperSchulz) merged 9 commits into
microsoft:mainfrom
Curabis:community-contribution/vanvugt-blog-patterns
Sep 29, 2026
Merged

Jesper Schulz-Wedde (JesperSchulz) merged 9 commits into
microsoft:mainfrom
Curabis:community-contribution/vanvugt-blog-patterns

Conversation

@MichaelDieringer

@MichaelDieringer Michael Dieringer (MichaelDieringer) commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fourth batch from CURABIS ApS, this time mined from a source outside CURABIS itself: Luc van Vugt's fluxxus.nl, a long-running blog by a BC/NAV developer who authored a book on automated testing and ATDD in Business Central. The blog runs 2009–2023 and is mostly legacy classic-client/C-AL content; these 3 are the patterns that survived review, are still current in modern AL, and cleared BCQuality's admission test.

  • Table Relation Test's OnAfterRemoveTableRelation exclusion hook — verified directly against BCApps source (codeunit 134926 "Table Relation Test", src/Layers/W1/Tests/Misc/TableRelationTest.Codeunit.al) rather than taken on the blog's word alone.
  • Shared/lazy Initialize() fixture data needs an explicit Commit(), or it rolls back with the first test that creates it and silently vanishes for every test after.
  • Assert.IsFalse for a boolean check, not asserterror wrapped around Assert.IsTrue — asserterror verifies that an error was raised, not the value under test.

A fourth candidate — Confirm() + StrSubstNo substitution timing — was removed during review: the underlying platform issue (microsoft/ALAppExtensions#23935) is closed as completed and could not be reproduced or pinned to any currently supported version, so an unconditional [all] workaround wasn't defensible.

Two other candidates found during mining were rejected: a TestPermissions::InheritFromTestCodeunit enum-value restriction (too thin/overlapping the existing permission-tests rule) and a suite-wide fixture-injection event pattern from 2018/2020 NAV content that no longer exists anywhere in current BCApps source (verified absent, not proposed).

Test plan

  • CI frontmatter/format validation passes
  • Domain-owning reviewers confirm placement and accuracy per file

🤖 Generated with Claude Code

@JesperSchulz Jesper Schulz-Wedde (JesperSchulz) left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this — the mining quality is high. Verifying the Table Relation Test pattern against BCApps source instead of taking the blog's word for it is exactly the right instinct, and rejecting two candidates (one for no longer existing in current source) is the kind of restraint this corpus needs.

I re-verified all four claims independently. All four are factually correct.

Claim Verified against
ConfirmHandler receives the raw template Reproduced in the source blog; corroborated by microsoft/ALAppExtensions#23935
Table Relation Test exclusion hook codeunit 134926, exact path; OnAfterRemoveTableRelation is an [IntegrationEvent] and RemoveTableRelation is public with the exact 5-arg signature
Commit() in a lazy Initialize() 778 BCApps test files use this exact pattern
Assert.IsFalse over asserterror IsFalse exists in both Assert and Library Assert (130002)

The table-relation article is the strongest of the four: the pattern only works because RemoveTableRelation is public rather than local, and the bad sample's claim that passing 0 widens the delete is correct — RemoveTableRelation skips SetRange for any zero argument. Samples are independently written rather than copied, and each good/bad pair differs in exactly one thing.

Validation is green locally: frontmatter 0 errors, knowledge index deterministic at 304 articles, 34 review fixtures across 17 domains.

Requesting changes on the following.


1. CLA (blocking)

license/cla is still pending. Please sign it — but note this isn't purely procedural here. The CLA's Originality of Work clause asks that contributions derived from a third party be accompanied by the phrase "Submission containing materials of a third party:" followed by the third-party name and any known licenses. Since this batch is explicitly derived from a named author's blog, that clause is genuinely engaged rather than boilerplate. Please include it when you sign.

2. commit-shared-test-fixture-inside-lazy-initialize.md contradicts existing guidance

This is the one substantive issue. The existing microsoft/knowledge/testing/transactionmodel-attribute-governs-test-transactions.md states that applying AutoRollback to a test whose code calls Commit "produces a runtime error on the first Commit... the test does not complete." Your new article instructs the reader to call Commit() inside Initialize() under exactly that default.

Both files are domain: testing, bc-version: [all], countries: [w1], application-area: [all] — identical applicability with incompatible normative guidance, which is precisely the shape READ's conflict detection is meant to catch. It also has a live consequence: al-testing-review.md already tells agents to flag code that "calls Commit under AutoRollback", so as things stand an agent would flag the canonical BCApps fixture pattern.

The evidence says your article is right and the existing one overstates. src/Layers/W1/Tests/ERM/ERMOnlineMappingSetup.Codeunit.al commits inside Initialize(), declares no TransactionModel attribute at all, and passes — along with 777 other test files.

Since this PR is what surfaces the conflict, please correct the overstatement in transactionmodel-attribute-governs-test-transactions.md as part of this change, so the two articles agree.

3. confirm-needs-strsubstno... presents a platform bug as designed behavior

The article explains that substitution happens "only for the dialog a real user sees," which reads as intended platform behavior. It isn't — it's a reported defect (microsoft/ALAppExtensions#23935), raised by Luc van Vugt himself, with an internal bug filed at the time by Nikola Kukrika (@nikolakukrika).

That issue was closed as COMPLETED in February 2024, but the thread contains no fix confirmation and I found no public release-note evidence either way, so the current status is genuinely unclear. With bc-version: [all] and a Best Practice that tells agents to restructure production code, a silent platform fix would turn this into agents rewriting correct code for no reason.

Please reframe it as a known platform defect with the issue linked. Nikola Kukrika (@nikolakukrika) — since you filed the internal bug and own this folder, could you confirm its disposition before we ship this as unbounded guidance?

Worth adding while you're in there: per the source blog, Message/MessageHandler substitutes correctly and only Confirm is affected. That asymmetry is both good evidence it's a bug and useful protection against an agent over-generalizing the rule to MessageHandler.

4. Minor — table-relation-test-exclude-known-invalid-relations-via-event.md

  • Codeunit 134926 ships in BCApps' test app, so only consumers depending on the BC test libraries can subscribe. Worth stating explicitly.
  • "walks every TableRelation field property in the app" is slightly off — it reads Table Relations Metadata filtered to 1..1999999999, i.e. tenant-wide across installed apps, not just the current app.
  • No token in al-testing-review.md covers TableRelation or OnAfterRemoveTableRelation, so this article may never surface in review. The other three are already reachable via ConfirmHandler, asserterror, Commit, and Library Assert. Happy to add the tokens separately if you'd rather keep this PR scoped to knowledge.

Note that /microsoft/knowledge/testing/ is owned by Nikola Kukrika (@nikolakukrika), ventselartur and Bugsy (@pchriste-microsoft-com), so this needs one of them to approve regardless of my review. Only flag and guard have run so far — the frontmatter and index workflows still need to go green in CI once a maintainer approves the run.

Nice work overall. Item 1 is quick; 2 and 3 are the ones that need real attention.

@MichaelDieringer

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree [company="CURABIS ApS"]

Submission containing materials of a third party: Luc van Vugt (fluxxus.nl) - blog content, no explicit license found.

@MichaelDieringer

Copy link
Copy Markdown
Contributor Author

Point 1: the fast one... done...

Point 2: Verified directly in ERMOnlineMappingSetup.Codeunit.al (codeunit 134915). No TransactionModel attribute at all, Commit() inside Initialize(), and manual cleanup via asserterror Error(...) at the end rather than relying on automatic rollback.
That's the actual mechanism: the "Commit causes an error" behavior is specific to the explicit AutoRollback attribute, not the undeclared default.
We'll correct transactionmodel-attribute-governs-test-transactions.md's "Best Practice: Default to AutoRollback" wording so it stops conflating "no attribute" with "AutoRollback enforced," since that's what would make an agent flag this exact canonical pattern.

Point 3: Checked the issue directly. No fix confirmation visible in the thread either, just closed as completed with no comment. Will reframe as a known, unconfirmed platform defect with the issue linked, and add the Message/MessageHandler asymmetry as supporting evidence per your note.

Point 4: Fair, will note the test-app dependency explicitly, correct the "every TableRelation field property" wording to the actual tenant-wide Table Relations Metadata scope, and add the missing al-testing-review.md tokens in this PR rather than leaving it unreachable.

@MichaelDieringer

Michael Dieringer (MichaelDieringer) commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree company="CURABIS ApS"

Submission containing materials of a third party: Luc van Vugt (fluxxus.nl) - blog content, no explicit license found.

Michael Dieringer (MichaelDieringer) added a commit to Curabis/BCQuality that referenced this pull request Sep 7, 2026
- transactionmodel-attribute-governs-test-transactions.md: the "Commit
  causes an error" behavior is specific to an explicitly declared
  AutoRollback attribute. A test method with no TransactionModel
  attribute at all is a distinct, valid shape — BCApps' own
  codeunit 134915 "ERM Online Mapping Setup" commits inside a lazy
  Initialize() with no attribute declared, cleaning up via a manual
  asserterror at the end. Evidence for commit-shared-test-fixture-
  inside-lazy-initialize.md (this PR), which is correct as submitted.
- confirm-needs-strsubstno-before-confirmhandler-sees-substituted-text.md:
  reframe as a known, unconfirmed-fix platform defect
  (microsoft/ALAppExtensions#23935) rather than designed behavior; add
  the Message/MessageHandler asymmetry as supporting evidence.
- table-relation-test-exclude-known-invalid-relations-via-event.md:
  note the test-app-only consumer dependency; correct "walks every
  TableRelation field property in the app" to the actual tenant-wide
  Table Relations Metadata scope across installed apps.
- Wire confirm-needs-strsubstno, commit-shared-test-fixture-inside-
  lazy-initialize, and table-relation-test-exclude-known-invalid-
  relations-via-event into al-testing-review.md's candidate-selection
  cues.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up after 1e22b51: CLA/disclosure now pass, and the Table Relation dependency and tenant-wide metadata wording are improved. The remaining transaction, applicability, fixture, and routing issues are inline.

Please also preserve durable provenance in the knowledge files themselves: each externally inspired article should identify its specific source and what was derived from it. A PR-level disclosure is useful for CLA review but will not accompany the rule when an agent consumes it later.

Comment thread microsoft/knowledge/testing/commit-shared-test-fixture-inside-lazy-initialize.md Outdated
Comment thread microsoft/skills/review/al-testing-review.md Outdated
@JesperSchulz

Copy link
Copy Markdown
Contributor

Correction to my own review. The transaction analysis in my first round was wrong, and I would rather retract it explicitly than leave it standing next to a follow-up that contradicts it.

What I got wrong

In the first round I wrote that "the evidence says your article is right and the existing one overstates", and asked you to correct transactionmodel-attribute-governs-test-transactions.md as part of this PR. That was backwards. You should not have been asked to make that edit.

The fact

AutoCommit is the documented default transaction model for a test method — TransactionModel Property: "AutoCommit is the default value."

Worth noting for anyone following this thread: the TransactionModel attribute page — the one you naturally reach for — never names a default at all. That is probably how this got past both of us.

Why my evidence never supported my conclusion

codeunit 134915 "ERM Online Mapping Setup" declares no TransactionModel attribute, so it runs under AutoCommit. It is not an AutoRollback test. The existing article's claim is explicitly scoped to applying AutoRollback, so an attribute-less codeunit cannot show that it overstates.

I counted 778 files sharing the pattern and treated that as confirming the article's stated mechanism. Prevalence of a practice is not evidence for the reason given for it — and that distinction is most of what this corpus is for.

The giveaway was in the file I quoted. It ends with a deliberate asserterror Error(RollBackMessage), which only makes sense if the Commit() is establishing a rollback baseline — the reading in my follow-up — rather than protecting a shared fixture from a per-test rollback that never happens.

What this means for the PR

  1. Please treat my first-round request to edit transactionmodel-attribute-governs-test-transactions.md as withdrawn. Your edit is not wrong as far as it goes — absence of the attribute genuinely is not equivalent to AutoRollback — but it was made on a bad instruction from me, it dropped the article's default recommendation, and it still never says what an attribute-less method actually does.
  2. As it stands this PR ships two domain: testing articles that disagree. The new one says test methods run "under AutoRollback by default"; the edited one says absence is not AutoRollback; neither names AutoCommit. Whatever survives the rewrite, please make both agree and state the default explicitly.

One more from my first round

I wrote that the ConfirmHandler issue was "raised by Luc van Vugt himself". microsoft/ALAppExtensions#23935 was opened by Matjaž Šega; Luc blogged it and credited Malcolm Gray. My follow-up corrected that inline, but the error originated in the round that presented a table asserting I had independently verified all four claims and that all four were factually correct.

That table was overconfident. One of the four has since been ruled incorrect, and one of its supporting attributions was wrong. I would rather say so plainly, since "verified against source" is the bar this repository asks contributors to meet.

Unaffected

Nothing here touches the other three articles, and the table-relation facts I checked in the first round all hold: codeunit 134926, RemoveTableRelation public with the five-argument signature, zero arguments widening the delete, and the tenant-wide 1..1999999999 filter.

Sorry for the churn. This one was my error, not yours.

@MichaelDieringer

Copy link
Copy Markdown
Contributor Author

Appreciate the correction — no worries on the churn. 0b08c2f reflects it: the transactionmodel-attribute-governs-test-transactions.md edit from round 1 is superseded, both testing articles now state the AutoCommit default explicitly and agree with each other, and neither treats an attribute-less method as equivalent to AutoRollback. Also resolved the Matjaž Šega/Malcolm Gray attribution issue by deleting the article that had it (see the thread above) — the underlying platform bug is reported closed and I couldn't reproduce it on a current version, so there's no longer an unconditional workaround making that claim.

@MichaelDieringer

Copy link
Copy Markdown
Contributor Author

Jesper Schulz-Wedde (@JesperSchulz) Addressed this round in 0b08c2f (pushed 2026-09-08): the 6 inline issues above, the transaction-model contradiction from your retraction (both articles now state and agree on the AutoCommit default), and the in-file Source provenance you asked for — each surviving externally-inspired article now names its specific fluxxus.nl post and states what was independently verified vs. taken from it, not just disclosed at the PR level. Ready for another look whenever you have time.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the substantial rewrite. The Confirm rule removal, TransactionModel correction, OnPrem scope, Boolean-rule precedence, routing, and per-article attribution address most of the previous feedback.

The remaining transaction concerns are tracked in the existing conversation, so I am not opening duplicate threads for them. One additional factual qualification is needed below because it changes which table relations the article tells agents to reject. We recognize the extra round is inconvenient; this is limited to behavior that materially affects the rule's correctness. The branch also currently conflicts with main in the TransactionModel article and testing review skill and will need to be updated before merge.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the full latest diff and every prior thread. The deleted Confirm rule, provenance/CLA attribution, OnPrem boundary, narrow exclusion API, Boolean article scope, and candidate cues are otherwise sound. The exact-head frontmatter, index determinism (303 articles), and 34 fixtures/17 domains all pass locally; flag, guard, and CLA pass.

Changes still needed:

  1. Shared fixture: resolve the three items left in the existing thread—recommend TestIsolation = Codeunit (not bare Disabled), exclude the deliberate rollback sentinel from the generic ExpectedError rule, and replace the non-demonstrating fixtures with persisted data + a later test + explicit runner/isolation context.
  2. Table Relation Test: document both conditional-only exceptions from codeunit 134926: source length may exceed the maximum related length, and a required Code relation accepts a Code or Text source. Unconditional relations remain exact-length/exact-type.
  3. Deterministic routing: al-testing-review.md currently excludes every asserterror Assert.IsTrue/IsFalse Boolean-returning shape from the generic rule, while the new article's Scope says the generic rule still owns cases where the guarded call itself is expected to error. Qualify the cue so the specialized rule wins only when the construct solely inverts the returned Boolean.
  4. Resolve the current conflict with main in transactionmodel-attribute-governs-test-transactions.md, and update the stale PR title/summary from four patterns to the three surviving ones (remove the deleted Confirm claim).

These are the remaining correctness/mergeability issues; no additional round is intended beyond verifying those exact fixes.

Comment thread microsoft/knowledge/testing/commit-shared-test-fixture-inside-lazy-initialize.md Outdated
Fourth batch from CURABIS ApS, mined from an external BC/NAV testing expert's blog archive (fluxxus.nl). Confirm+StrSubstNo interaction with ConfirmHandler, Table Relation Test's OnAfterRemoveTableRelation exclusion hook (verified against BCApps source, codeunit 134926), committing shared lazy-Initialize fixture data, and Assert.IsFalse vs asserterror for boolean checks.
- transactionmodel-attribute-governs-test-transactions.md: the "Commit
  causes an error" behavior is specific to an explicitly declared
  AutoRollback attribute. A test method with no TransactionModel
  attribute at all is a distinct, valid shape — BCApps' own
  codeunit 134915 "ERM Online Mapping Setup" commits inside a lazy
  Initialize() with no attribute declared, cleaning up via a manual
  asserterror at the end. Evidence for commit-shared-test-fixture-
  inside-lazy-initialize.md (this PR), which is correct as submitted.
- confirm-needs-strsubstno-before-confirmhandler-sees-substituted-text.md:
  reframe as a known, unconfirmed-fix platform defect
  (microsoft/ALAppExtensions#23935) rather than designed behavior; add
  the Message/MessageHandler asymmetry as supporting evidence.
- table-relation-test-exclude-known-invalid-relations-via-event.md:
  note the test-app-only consumer dependency; correct "walks every
  TableRelation field property in the app" to the actual tenant-wide
  Table Relations Metadata scope across installed apps.
- Wire confirm-needs-strsubstno, commit-shared-test-fixture-inside-
  lazy-initialize, and table-relation-test-exclude-known-invalid-
  relations-via-event into al-testing-review.md's candidate-selection
  cues.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>


- commit-shared-test-fixture-inside-lazy-initialize.md: fundamentally
  rewritten. AutoCommit is the documented default TransactionModel, not
  AutoRollback. Explains the real mechanism (Commit() protects a fixture
  from the test method's own later deliberate rollback, per Codeunit.Run/
  TransactionModel-property semantics) and the TestIsolation dependency
  (Disabled/Codeunit survive across methods, Function does not). Fixtures
  rewritten to demonstrate the actual failure/success shape.
- transactionmodel-attribute-governs-test-transactions.md: now states the
  AutoCommit default explicitly and agrees with the article above, closing
  the contradiction Jesper flagged between the two testing articles.
- Deleted confirm-needs-strsubstno-before-confirmhandler-sees-substituted-text
  (.md/.good.al/.bad.al): the underlying platform bug (microsoft/
  ALAppExtensions#23935) was closed as completed in Feb 2024; cannot be
  reproduced or bc-version-pinned on any currently supported version.
- table-relation-test-exclude-known-invalid-relations-via-event.md: added
  the [Scope('OnPrem')] boundary verified against BCApps' Table Relation
  Test codeunit.
- use-assert-isfalse-not-asserterror-for-boolean-checks.md: added a Scope
  section resolving the overlap with asserterror-needs-expectederror-and-code.
- al-testing-review.md: fixed the shared-fixture cue to catch the actual
  anti-pattern instead of the compliant shape, added the missing cue for
  use-assert-isfalse-not-asserterror-for-boolean-checks, wired precedence
  between it and the generic asserterror rule, and removed the cue for the
  deleted article.
- Added in-file Source provenance (specific fluxxus.nl post per article,
  with what was independently verified vs. taken from the post) to the
  three surviving externally-inspired articles, per Jesper's request that
  provenance live in the knowledge file itself, not only the PR description.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- commit-shared-test-fixture-inside-lazy-initialize: three sub-issues.
  Recommended TestIsolation = Codeunit instead of listing Disabled as an
  equal option - Disabled never rolls back at all ("tests are not
  isolated from each other" per the property's own docs), so a fixture
  this pattern commits under Disabled is permanent database
  contamination unless something else tears it down; Disabled is now
  only mentioned alongside that explicit teardown requirement. Added
  precedence in al-testing-review.md so the deliberate end-of-test
  asserterror Error(...) rollback sentinel isn't also flagged by the
  generic asserterror-needs-expectederror-and-code rule. Rewrote both
  fixtures to actually demonstrate the pattern: persisted fixture data
  (an Item record) instead of an empty comment, a second [Test] method
  that depends on the fixture surviving into it, and an explicit
  Subtype = TestRunner / TestIsolation = Codeunit runner codeunit.

- table-relation-test-exclude-known-invalid-relations-via-event:
  the length/type rule was stated as one global requirement. Verified
  ValidateFieldRelation in codeunit 134926 directly (BCApps reference
  clone) and split it into the two branches the source actually has:
  a field with any unconditional relation needs exact length and exact
  resolved type; a field whose relations are all conditional only fails
  on being shorter (longer is fine) than the largest related field, and
  when the required type is specifically Code, a Text source passes too
  - a tolerance that does not apply on the unconditional side and does
  not extend to a required Text.

Rebased onto upstream/main (one conflict in
transactionmodel-attribute-governs-test-transactions.md - upstream had
already linked its sample references via the READ convention, ours
added a Source section; merged both). Also converted the 3 remaining
plain-backtick sample references in this PR to the READ-convention
markdown-link form, same fix as microsoft#156/microsoft#157/microsoft#158.
@MichaelDieringer
Michael Dieringer (MichaelDieringer) force-pushed the community-contribution/vanvugt-blog-patterns branch from 0b08c2f to 69b09db Compare September 21, 2026 20:50
@MichaelDieringer Michael Dieringer (MichaelDieringer) changed the title 4 AL/BC testing patterns from an external BC testing expert's blog (Luc van Vugt, fluxxus.nl) 3 AL/BC testing patterns from an external BC testing expert's blog (Luc van Vugt, fluxxus.nl) Sep 21, 2026
@MichaelDieringer

Copy link
Copy Markdown
Contributor Author

Thanks Jesper. Addressed all four items from the 2026-09-15 re-review.

1. Shared fixture (commit-shared-test-fixture-inside-lazy-initialize):

  • Recommend TestIsolation = Codeunit, not Disabled as an equal option — Disabled's own documentation says "tests are not isolated from each other" (nothing ever rolls back), so a fixture this pattern commits is permanent database contamination unless something else tears it down. Disabled is now mentioned only alongside that explicit-teardown requirement.
  • Added precedence in al-testing-review.md so the deliberate end-of-test asserterror Error(...) rollback sentinel isn't also caught by the generic asserterror-needs-expectederror-and-code rule.
  • Rewrote both fixtures to actually demonstrate the pattern: CreateSharedFixtureData now inserts a real Item record instead of an empty comment, a second [Test] method depends on that fixture surviving into it, and both fixtures include an explicit Subtype = TestRunner / TestIsolation = Codeunit runner codeunit.

2. Table Relation Test length/type rule: verified ValidateFieldRelation in codeunit 134926 directly and split the article into the two branches the source actually has — a field with any unconditional relation needs exact length and exact resolved type; a field whose relations are all conditional only fails on being shorter (longer is accepted) than the largest related field, and when the required type is specifically Code, a Text source passes too — a tolerance that's conditional-only and doesn't extend to a required Text.

3. Deterministic routing: already resolved in the prior round per your read — no further change needed there.

4. Rebase + stale title: rebased onto current main (one conflict in transactionmodel-attribute-governs-test-transactions.md — upstream had already linked its sample references, ours added a ## Source section; merged both). Updated the PR title and summary to "3 AL/BC testing patterns" and removed the deleted Confirm/StrSubstNo claim from the description.

Also converted the 3 remaining plain-backtick sample references in this PR to the READ-convention markdown-link form, same fix as #156/#157/#158.

All local validators pass clean: frontmatter (0 errors, 0 warnings), knowledge-index, knowledge-retrieval (336 articles / 563 samples), review-fixtures (108 cases / 20 leaf domains), skill-index.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Four merge-critical issues remain:

  1. In al-testing-review.md, the generic ExpectedError route excludes every asserterror Assert.IsTrue/IsFalse around a Boolean-returning call, while the specialized route accepts only constructs used solely to invert the Boolean. A test expecting the guarded Boolean function itself to raise therefore falls through both routes. Narrow the exclusion to the same inversion-only condition.

  2. The rollback-sentinel exception exists only in skill prose while asserterror-needs-expectederror-and-code.md remains unconditional. False-positive exclusions are normative knowledge and must be encoded there so every consumer avoids the harmful recommendation.

  3. commit-shared-test-fixture-inside-lazy-initialize.good.al hand-rolls an Item with Init, an invented key, and Insert(true), which another active rule correctly flags. Use LibraryInventory.CreateItem so the canonical fix is clean under the full ruleset.

  4. table-relation-test-exclude-known-invalid-relations-via-event.good.al and its bad pair reference undefined Sample Header and Sample Setup tables. The samples are not self-contained or compilable; define minimal tables or use existing symbols.

@JesperSchulz

Copy link
Copy Markdown
Contributor

The transaction-model rewrite is materially stronger. I left two discussions open because they still contain active contract details; the latest review makes the remaining fixes explicit and finite.

- al-testing-review.md: the generic ExpectedError cue's asserterror
  Assert.IsTrue/IsFalse exclusion was unconditional, but the
  specialized rule it deferred to only claims the pure-inversion
  shape. A test expecting the guarded Boolean-returning call itself to
  raise fell through both routes. Narrowed the exclusion to the same
  inversion-only condition the specialized cue already uses.
- asserterror-needs-expectederror-and-code.md: the rollback-sentinel
  exception (a trailing asserterror Error(...) used purely to force a
  fixture rollback, not to verify a specific failure) previously lived
  only in skill routing prose. Encoded it directly in the article's
  Anti Pattern section so every consumer of the knowledge base sees it,
  not just this one skill.
- commit-shared-test-fixture-inside-lazy-initialize.good.al/.bad.al:
  replaced hand-rolled Item.Init()/Insert(true) with
  LibraryInventory.CreateItem, so the canonical fixture doesn't itself
  trigger use-library-codeunits-for-test-fixtures.
- table-relation-test-exclude-known-invalid-relations-via-event.good.al/
  .bad.al: declared minimal "Sample Setup"/"Sample Header" tables
  inline instead of referencing undefined symbols, matching this
  repo's own convention that every fixture is self-contained.
@MichaelDieringer

Copy link
Copy Markdown
Contributor Author

Thanks Jesper. All four fixed:

  1. Narrowed `al-testing-review.md`'s generic ExpectedError exclusion for `asserterror Assert.IsTrue/IsFalse` to the same inversion-only condition the specialized rule already requires — a test expecting the guarded Boolean-returning call itself to raise now stays owned by `asserterror-needs-expectederror-and-code`.
  2. Encoded the rollback-sentinel exception directly in `asserterror-needs-expectederror-and-code.md`'s Anti Pattern section, not just the skill's routing prose.
  3. `commit-shared-test-fixture-inside-lazy-initialize`'s fixtures now use `LibraryInventory.CreateItem` instead of hand-rolled `Item.Init()`/`Insert(true)`.
  4. `table-relation-test-exclude-known-invalid-relations-via-event`'s fixtures now declare minimal `"Sample Setup"`/`"Sample Header"` tables inline instead of referencing undefined symbols.

Validators pass clean.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One merge-critical fixture issue remains. The new Sample Header."Category Code" field has no TableRelation, so the good subscriber's targeted RemoveTableRelation removes no metadata. The bad sample also has no second valid relation whose coverage its table-wide removal would destroy. The pair therefore demonstrates neither the recommended exclusion nor its anti-pattern.

Please add an actual relation that creates the targeted metadata row and another valid relation on the same table that remains checked by the good subscriber but is incorrectly removed by the bad subscriber. The four blockers from the latest review are otherwise resolved.

…one to protect

The "Category Code" field had no TableRelation at all, so the good
subscriber's RemoveTableRelation call targeted metadata that never
existed - a no-op. Added a real TableRelation to "Sample Setup" on
that field (the one known exception to exclude) and a second,
ordinary self-referencing relation ("Parent No." -> "Sample
Header"."No.") with no exception. The good fixture now removes only
the first; the bad fixture's table-wide removal (field/related
table/field all 0) now demonstrably also strips the second, showing
the actual anti-pattern instead of removing nothing meaningful.
@MichaelDieringer

Copy link
Copy Markdown
Contributor Author

Thanks Jesper. Fixed — you're right, "Category Code" had no `TableRelation` at all, so the good subscriber's `RemoveTableRelation` call targeted metadata that never existed. Added a real `TableRelation = "Sample Setup"."Primary Key"` on "Category Code" (the one known exception to exclude) and a second, ordinary self-referencing relation, `"Parent No." -> "Sample Header"."No."`, with no exception. The good fixture's targeted `RemoveTableRelation(..., 10, ...)` now removes only the first; the bad fixture's table-wide `RemoveTableRelation(..., 0, 0, 0)` now demonstrably also strips the second — so the pair actually shows both the recommended exclusion and its anti-pattern. Validators pass clean.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The final fixture blocker is resolved: the good sample removes one real relation metadata row while preserving a second valid relation, and the bad sample demonstrably removes both. The earlier transaction, routing, knowledge-contract, fixture-library, and table-relation semantics issues are also resolved. No new merge-critical issue found.

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

Copy link
Copy Markdown
Contributor

The merge conflict has been resolved and fully validated. Because GitHub reports push=false for our token on the Curabis fork despite maintainer edits being enabled, I opened Curabis#3 directly against this PR's source branch.

Please merge that small sync PR. It applies validated merge commit fb1ff3db7b5905426800b560092977be81a55fdf; once it lands, we intend to merge this PR immediately.

…ugt-blog-patterns

Resolve al-testing-review.md by union: keep both main's additions from microsoft#196 and this
PR's already-approved changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JesperSchulz
Jesper Schulz-Wedde (JesperSchulz) merged commit 830eaff into microsoft:main Sep 29, 2026
6 of 7 checks passed
@MichaelDieringer

Copy link
Copy Markdown
Contributor Author

Thanks Jesper — Curabis#3 is merged. main moved again right after (#196 landed at 13:03), which put this branch back into conflict in microsoft/skills/review/al-testing-review.md, so I merged main in on top of your sync commit (9448673).

Resolution is a plain union: #196's new reset-per-test-state-before-the-isinitialized-guard cue is kept, followed by this PR's already-approved cues unchanged (including the asserterror cue with the Assert.IsTrue/IsFalse inversion exclusion). No other files conflicted.

On the merged tree: validate_frontmatter.py (0/0), Test-ReviewContract.ps1, Test-ReviewFixtures.ps1, Test-KnowledgeIndex.ps1 and Test-SkillIndex.ps1 all pass. GitHub reports the PR as mergeable.

Michael Dieringer (MichaelDieringer) added a commit to Curabis/BCQuality that referenced this pull request Sep 29, 2026
…crosoft#198, microsoft#202) into document-distribution-batch

Resolve evaluation/review-fixtures.json semantically: data-modeling
articles list is the union of main's list and this PR's nine articles;
everything else is taken from main unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants