Skip to content

[API tests] Initialize cancellation reason-code fixtures - #11225

Draft
Prangshuman Das (t-prda) wants to merge 5 commits into
prdas/646383-split-vatfrom
prdas/646383-split-cancellation-reasons
Draft

Prangshuman Das (t-prda) wants to merge 5 commits into
prdas/646383-split-vatfrom
prdas/646383-split-cancellation-reasons

Conversation

@t-prda

@t-prda Prangshuman Das (t-prda) commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes AB#653122

Scope

Ensure a reason code exists before corrective-credit-memo and invoice-cancellation scenarios. Keep changes in four API test codeunits; no production cancellation logic is changed.

Related umbrella646383.

Evidence and limits

Four corrective-credit-memo methods in CUs139728/139828 failed in AU in saved result sets 2 and 4. Six invoice methods additionally reach the changed fixture; those are dependency coverage, not observed failures.

Only this layer's original fix/exclusion patch is reviewed here (6 paths); the patch is unchanged by Expense-first restructuring.

Exact head: 004919ad225b516a3c708440ca6e44f55c3d4d52; tree: 498d8504ab6ba6e8b5ea30d57802fc55cb511cf4.

Expense-first sequencing using existing exclusions

The same 193 method-specific temporary exclusions (135 APIV1 +58 APIV2 across12 codeunits) now live in the existing src/DisabledTests/_Exclude_APIV1__Tests/_Exclude_APIV1__Tests.DisabledTest.json and src/DisabledTests/_Exclude_APIV2__Tests/_Exclude_APIV2__Tests.DisabledTest.json. No separate sequencing files remain. Original entries retain their order/style/content; no new duplicate or wildcard/codeunit-wide exclusion is introduced. Unrelated pre-existing APIV2 duplicates are preserved rather than mixed with this change.

#11860 removes the temporary additions from these same existing manifests alongside its already-reviewed authentication uptake. All193 temporary stage entries are removed in #11860, but it makes 192/193 target methods eligible: the independent 139739::TestDeleteInUse exclusion remains until the VAT fixture fix PR #11224 removes it. From #11224 onward all193 are eligible; eligibility is not runtime success. All general/downstream cumulative trees are exactly byte-identical to the preceding checkpoint; the full checkpoint has none of these193 methods excluded. No app-name allowlist, selection setting, runner/authentication/test/production change or Logiq exclusion is added.

Why these methods started executing: they already required Disabled isolation and were IntegrationTest codeunits. Ordinary typed selection in TestSuiteMgt332–352 selects None|Codeunit; the old extra Disabled pass in RunTestsInBcContainer was UnitTest-only. The clean-execution switch newly reaches Disabled IntegrationTest codeunits and still honors the existing JSON exclusions. These193 methods were not listed in those exclusions. This is a pre-existing selection gap, not a newly introduced product auth bug or proof they never ran in any historical configuration. A complete67-codeunit audit preserves existing UnitTest/Legacy behavior and the ten independently handled Logiq integration tests.

**Expense scope is unchanged:**51 API reenables, nine non-API exclusions, baseline six cases and all consolidated regressions. The two legacy Spend Requests methods remain conditional on not CLEAN30. Focused #12325 review:21 files, including the two existing exclusion manifests. General #11860 review:159 files.

The official NAV Disable-NAVALTest helper was inspected: it has no destination/app-file parameter, writes NAV's App/DisabledTests using per-codeunit filenames and sorts entries. It cannot safely preserve these BCApps files. A bounded JSON relocation preserved original prefixes/order and checked exact identities, then exercised the unchanged real loader. No new shared helper/framework or NAV selector change was made.

Validation and presentation evidence

Pester117/117 passed independently at the new Expense/general/full heads. Actual existing-loader checks confirm identical effective193-method selection after relocation and preserved51/9 Expense scope. All nine downstream Git tree hashes remain exactly unchanged. Fresh exact-head CI is pending; old-head successes are not substituted for current runtime evidence.

Historical run37330893173 at head88881be reached193 general methods:171 genuine401 failures and22 nominal passes (17 bare-ASSERTERROR cases can accept the wrong error; five local fixtures). Separately, all51 Expense methods passed in13 inspected countries (663 results), and all63 touched API methods yielded819 results; Activity coverage was117/198 at that checkpoint. These are bounded historical results, not a full/current matrix pass. The preceding stage-fix runs hit50 hosted-runner acquisition cancellations; other jobs were active, so this was not a claimed global outage. New pushes schedule fresh CI, not an AL retry. The general SQL-pool NRE and missing warning-reference artifacts remain separate unresolved limitations.

Durable session presentation notes: api-test-enablement-presentation-notes.md, with source-pinned selection proof, fix/coverage inventory, helper limitations and historical-vs-current evidence boundaries. Fresh runtime proof must still establish the51 Expense cases and actual193-case suppression at Expense stage.

Related umbrella646383. Native stack #12327 remains #12325 → #11860 → #11224 → #11225 → #11226 → #11227 → #11228 → #11229 → #11230 → #11322. Protected merged #10085/#11862/#11891 and validation #11892 are untouched; validation-only #11861/#11455 remain Do Not Merge. No new main integration, native-group/base change, PR merge, queue operation, Actions cancellation or manual retry was made. All prior heads remain ancestors; source publication used backups and an atomic forward-only push with explicit leases.

Exact current head: 004919ad225b516a3c708440ca6e44f55c3d4d52; source tree: 498d8504ab6ba6e8b5ea30d57802fc55cb511cf4.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

@t-prda
Prangshuman Das (t-prda) removed this pull request from stack #11232 September 24, 2026 15:27
@t-prda
Prangshuman Das (t-prda) added this pull request to stack #11863 September 24, 2026 15:27
@t-prda
Prangshuman Das (t-prda) removed this pull request from stack #11863 September 25, 2026 08:46
@t-prda
Prangshuman Das (t-prda) added this pull request to stack #11893 September 25, 2026 08:47
@github-actions

Copy link
Copy Markdown
Contributor

Issue #11561 is not valid. Please make sure you link an issue that exists, is open and is approved.

@t-prda
Prangshuman Das (t-prda) marked this pull request as ready for review September 28, 2026 10:50
@t-prda
Prangshuman Das (t-prda) requested a review from a team September 28, 2026 10:50
@t-prda
Prangshuman Das (t-prda) requested a review from a team as a code owner September 28, 2026 10:51
@t-prda Prangshuman Das (t-prda) added the Team: SCM GitHub request for SCM area label Sep 28, 2026
@github-actions github-actions Bot removed the Team: SCM GitHub request for SCM area label Sep 28, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Accept

What this PR does

This change initializes a reason code before corrective credit memo and invoice cancellation test flows, then re-enables the ten affected API tests. The implementation matches the country-specific cancellation contract: invoice cancellation setup can select an existing reason code, and corrective invoices carry a reason code into the posted document. The V1 and V2 implementations are aligned.

Problem-solution fit

Fit: Strong

The changed fixtures directly address the missing reason-code prerequisites for the reported cancellation scenarios. The exclusion changes match the methods covered by those fixtures.

Suggestions

None.

Risk assessment and necessity

Risk: The change is limited to test fixtures and disabled-test manifests. Production behavior and public surfaces are unchanged, both API versions use the same fixture shape, and the current head has no failing checks.

Necessity: The setup is required for country-specific cancellation rules. Without it, the ten targeted API tests remain unusable even though the tested production scenarios are supported.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=11225 round=1 by=alexei-dobriansky at=2026-09-28T22:20:57.969Z lastSha=e68683f8e152f1de666d2f66211fc19cda6b029f reviewKey=2337d54b9b6402767ac4c030d862fa1d944f17732b31d27fe94a0597458a76d8 suggestions=

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

CreatePostedSalesInvoice(SalesInvoiceHeader);
EnsureReasonCode();
LibrarySales.SetDefaultCancelReasonCodeForSalesAndReceivablesSetup();
Commit();

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.

$\textbf{🟠\ High\ Severity\ —\ Testing}$

The newly added Commit executes from TestActionSendCancelledInvoice through CreateCancelledSalesInvoice, but the test codeunit does not declare a TransactionModel for the test. With the default AutoRollback transaction model, the commit path can fail before the API behavior is verified; set the affected test to AutoCommit and run it under an isolation-enabled test runner.

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.47.6

CreatePostedSalesInvoice(SalesInvoiceHeader);
EnsureReasonCode();
LibrarySales.SetDefaultCancelReasonCodeForSalesAndReceivablesSetup();
Commit();

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.

$\textbf{🟠\ High\ Severity\ —\ Testing}$

The newly added Commit executes from TestActionSendCancelledInvoice through CreateCancelledSalesInvoice, but the test codeunit does not declare a TransactionModel for the test. With the default AutoRollback transaction model, the commit path can fail before the API behavior is verified; set the affected test to AutoCommit and run it under an isolation-enabled test runner.

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.47.6

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 2

Recommendation: Accept

What this PR does

This round reconciles the stacked branch with its refreshed parent while keeping the four AL fixture changes intact. The net change creates a reason code when needed, assigns or configures it before invoice correction, and re-enables the ten matching API tests; the V1 and V2 paths remain aligned and the setup is committed before cross-session API or correction flows.

Status of previous suggestions

None.

New observations (commits since round 1)

None - the new commits only reconcile the stacked parent, and the current net changes remain correct.

Risk assessment and necessity

Risk: The change is limited to test fixtures and disabled-test metadata. Production behavior and public surfaces are unchanged, the four AL files pass static structure and whitespace checks, and both exclusion files parse correctly. Fresh runtime validation at the current head is still pending.

Necessity: AU cancellation requires an available reason code. Without this setup, the ten targeted API tests cannot reliably reach the behavior they are meant to verify.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=11225 round=2 by=alexei-dobriansky at=2026-09-30T23:42:44.483Z lastSha=27632f5ef2989fbc96fde7531013ccbcc3202920 reviewKey=47a03f7135098e3dcf6f625d96612bc2cae1b4af6d77010cadc2ffccbaa63adf suggestions= parentRound=1

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 3

Recommendation: Accept

What this PR does

This round only reconciles the stacked branch with its refreshed parent. There are no author-owned non-merge commits since round 2, and the current six-file patch has the same stable patch ID as the previously reviewed patch. The net change still creates a reason code before the AU cancellation paths and re-enables only the ten matching API tests; the V1 and V2 paths remain aligned.

Status of previous suggestions

None.

New observations (commits since round 2)

None - the new commits only reconcile the stack and base branch. The exact author-owned incremental diff is empty.

Risk assessment and necessity

Risk: The patch is limited to test fixtures and disabled-test metadata. Production behavior and public surfaces are unchanged, the application build checks pass, and fresh exact-head runtime tests are still queued or pending.

Necessity: AU cancellation requires an available reason code. Without this setup, the ten targeted API tests cannot reliably reach the behavior they verify.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=11225 round=3 by=alexei-dobriansky at=2026-10-02T22:30:00.857Z lastSha=38208fdefd4521f4236872cea832da8b695f65c7 reviewKey=fa18ac20eb61d4993df6dd815fdedb401edb1b422d2305907ed771ef36338878 suggestions=none parentRound=2

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session:3952f078-a881-4da8-ad96-13b727e48a91
@t-prda
Prangshuman Das (t-prda) force-pushed the prdas/646383-split-cancellation-reasons branch from bad788e to 17423f0 Compare October 5, 2026 13:30
@t-prda
Prangshuman Das (t-prda) removed this pull request from stack #11893 October 5, 2026 13:31
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session:3952f078-a881-4da8-ad96-13b727e48a91
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session:3952f078-a881-4da8-ad96-13b727e48a91
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session:3952f078-a881-4da8-ad96-13b727e48a91
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session:3952f078-a881-4da8-ad96-13b727e48a91
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Issue #11224 is not valid. Please make sure you link an issue that exists, is open and is approved.

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 4

Recommendation: Accept

What this PR does

This round only updates the stacked ancestry. The current six-file patch is identical to the previously reviewed source change, with stable patch ID b65a45d63528e5df6a8a15655c62aa80e37ff9f8. It creates the required reason-code fixtures before AU cancellation flows and re-enables the ten matching API tests.

Status of previous suggestions

None.

New observations (commits since round 3)

None - the reviewed six file contents are unchanged. Two independent review samples agreed that the fixture setup and exclusion removals are correct.

Risk assessment and necessity

Risk: Low. The patch changes test fixtures and disabled-test metadata only. V1 and V2 remain aligned, both JSON manifests parse successfully, and production behavior is unchanged. Fresh exact-head checks are still running; the current link-validation failure is unrelated to these source changes.

Necessity: AU cancellation requires an existing reason code and configured default cancellation reason code. Without this setup, the ten targeted tests cannot reliably reach the behavior they verify.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=11225 round=4 by=alexei-dobriansky at=2026-10-05T23:06:07.517Z lastSha=004919ad225b516a3c708440ca6e44f55c3d4d52 reviewKey=e37fd36451e96f5978828e8b00d8cf8aba3eb2a9deed4e2481b4c67e26a72bc4 suggestions=none parentRound=3

melnikbo pushed a commit to melnikbo/BCApps that referenced this pull request Oct 7, 2026
…microsoft#12325)

## Scope

Related authentication and API enablement:
[AB#646383](https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/646383)
(link only; this PR does not resolve the umbrella item).

Fixes
[AB#653119](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/653119)

Separate test defect: [653119 - Policy snapshot API URL composition and
response
isolation](https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/653119).
This tracks the policy-snapshot test corrections, not production access
permissions or unrelated runtime failures.

Expense-first adoption directly against main after the external squash
merge of workflow microsoft#11891; remaining general APIs follow in microsoft#11860.

- Migrate the 11 reviewed Expense API/helper paths to shared
authentication and remove exactly 51 existing Expense API exclusions.
Preserve exactly nine non-API Expense exclusions; all 19 previously
retained API exclusions are now removed.
- Enable the existing `enableCleanTestCodeunitExecution` boolean. Use
existing DisabledTests selectors throughout discovery, ordinary
execution and clean-codeunit execution/reruns. No app-name allowlist,
new selection setting or runner implementation/test change.
- Include the six-line license-safe WorkDate helper needed by PerDiem,
five query-safe policy URL compositions, four independent response
clears, and the existing unlimited-approval fixture. Preserve all nine
Activity Log tests and upstream assertions.
- Consolidate microsoft#11453's exact assigned-user filter (no cross-table range
compression), true fallback fixture and regressions. Upstream wildcard
quoting alone did not fix the range-gap case.
- Consolidate microsoft#11451's unique denied-approval error/permission capture
and microsoft#11454's existing repeated-delta, missing-header-permission,
Released-status and real deletion-total regressions, including its
internal test-only permission set.
- Do not reintroduce upstream repairs from microsoft#11654 (three permission-role
tests and posted zero-amount fixture), the obsolete date test removed by
microsoft#12074, or the production indirect-Modify change already supplied by
microsoft#11333. microsoft#11452's duplicate deletion helper is absent; existing callers
use the upstream shared helper.
- All seven artificial Expense exclusions introduced by the previous
uptake are absent here and at every general checkpoint. This is not
blanket re-enablement of Expense tests.

This focused review diff has21 paths, using the two existing API
exclusion manifests. No NAV selectors, local NST, BC-ExpenseAgent
changes, unrelated new test scope or production permission changes.

Exact head: `bd3bbc04e13965f967a26eef435bdbf0cbc09ad7`; tree:
`2b8c47b138846f63bd49d47188f54ea7e86c1f24`.

## Expense-first sequencing using existing exclusions

The same **193 method-specific temporary exclusions (135 APIV1 +58 APIV2
across12 codeunits)** now live in the existing
`src/DisabledTests/_Exclude_APIV1__Tests/_Exclude_APIV1__Tests.DisabledTest.json`
and
`src/DisabledTests/_Exclude_APIV2__Tests/_Exclude_APIV2__Tests.DisabledTest.json`.
No separate sequencing files remain. Original entries retain their
order/style/content; no new duplicate or wildcard/codeunit-wide
exclusion is introduced. Unrelated pre-existing APIV2 duplicates are
preserved rather than mixed with this change.

microsoft#11860 removes the temporary additions from these same existing
manifests alongside its already-reviewed authentication uptake. All193
temporary stage entries are removed in microsoft#11860, but it makes **192/193
target methods eligible**: the independent `139739::TestDeleteInUse`
exclusion remains until the VAT fixture correction in PR
[microsoft#11224](microsoft#11224) removes it.
From microsoft#11224 onward all193 are eligible; eligibility is not runtime
success. All general/downstream cumulative trees are **exactly
byte-identical** to the preceding checkpoint; the full checkpoint has
none of these193 methods excluded. No app-name allowlist, selection
setting, runner/authentication/test/production change or Logiq exclusion
is added.

**Why these methods started executing:** they already required Disabled
isolation and were IntegrationTest codeunits. Ordinary typed selection
in TestSuiteMgt332–352 selects None|Codeunit; the old extra Disabled
pass in RunTestsInBcContainer was UnitTest-only. The clean-execution
switch newly reaches Disabled IntegrationTest codeunits and still honors
the existing JSON exclusions. These193 methods were not listed in those
exclusions. This is a pre-existing selection gap, not a newly introduced
product auth bug or proof they never ran in any historical
configuration. A complete67-codeunit audit preserves existing
UnitTest/Legacy behavior and the ten independently handled Logiq
integration tests. Historical baseline run37215976231 at
head69df41756d918a516a3c868ca66f45cbfd320428 independently corroborates
this: zero of the exact193 methods appear across five inspected W1
result artifacts containing37,626 testcases (Integration, both Legacy
buckets, default/unit and Uncategorized). This evidence is limited to
that W1 baseline, not every country or historical run. The completed
alternate-path audit found no other ordinary configured baseline BCApps
lane: APIV1/APIV2 are outside Legacy buckets, Disabled-unit fallback
retains UnitTest filtering, discovery skips test procedures, and
ordinary PR/CI/CD/rerun routes do not bypass those constraints. Manual
or explicitly untyped execution remains possible; no universal
historical or NAV absence is claimed.

**Expense scope is unchanged:**51 API reenables, nine non-API
exclusions, baseline six cases and all consolidated regressions. The two
legacy Spend Requests methods remain conditional on not CLEAN30. Focused
microsoft#12325 review:21 files, including the two existing exclusion manifests.
General microsoft#11860 review:159 files.

The official NAV `Disable-NAVALTest` helper was inspected: it has no
destination/app-file parameter, writes NAV's App/DisabledTests using
per-codeunit filenames and sorts entries. It cannot safely preserve
these BCApps files. A bounded JSON relocation preserved original
prefixes/order and checked exact identities, then exercised the
unchanged real loader. No new shared helper/framework or NAV selector
change was made.

## Validation and presentation evidence

**Pester117/117 passed independently at the new Expense/general/full
heads.** Actual existing-loader checks confirm identical
effective193-method selection after relocation and preserved51/9 Expense
scope. All nine downstream Git tree hashes remain exactly unchanged.
Fresh exact-head CI is pending; old-head successes are not substituted
for current runtime evidence.

Historical run37330893173 at head88881be reached193 general methods:171
genuine401 failures and22 nominal passes (17 bare-ASSERTERROR cases can
accept the wrong error; five local fixtures). Separately, all51 Expense
methods passed in13 inspected countries (663 results), and all63 touched
API methods yielded819 results; Activity coverage was117/198 at that
checkpoint. These are bounded historical results, not a full/current
matrix pass. The preceding stage-fix runs hit50 hosted-runner
acquisition cancellations; other jobs were active, so this was not a
claimed global outage. New pushes schedule fresh CI, not an AL retry.
The general SQL-pool NRE and missing warning-reference artifacts remain
separate unresolved limitations.

Durable session presentation notes:
**api-test-enablement-presentation-notes.md**, with source-pinned
selection proof, fix/coverage inventory, helper limitations and
historical-vs-current evidence boundaries. Fresh runtime proof must
still establish the51 Expense cases and actual193-case suppression at
Expense stage.


[AB#646383](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/646383)
(link only). Native stack #12327 remains microsoft#12325 → microsoft#11860 → microsoft#11224 →
microsoft#11225 → microsoft#11226 → microsoft#11227 → microsoft#11228 → microsoft#11229 → microsoft#11230 → microsoft#11322. Protected
merged microsoft#10085/microsoft#11862/microsoft#11891 and validation microsoft#11892 are untouched;
validation-only microsoft#11861/microsoft#11455 remain Do Not Merge. No new main
integration, native-group/base change, PR merge, queue operation,
Actions cancellation or manual retry was made. All prior heads remain
ancestors; source publication used backups and an atomic forward-only
push with explicit leases.

Exact current head: `bd3bbc04e13965f967a26eef435bdbf0cbc09ad7`; source
tree: `2b8c47b138846f63bd49d47188f54ea7e86c1f24`.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3952f078-a881-4da8-ad96-13b727e48a91
@t-prda
Prangshuman Das (t-prda) marked this pull request as draft October 7, 2026 13:12

This branch was successfully deployed

1 active (outdated) deployment
triage — e68683f8 Deployed Sep 28, 2026 by t-prda via Classify team ownership #5938
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Team: Integrations GitHub request for Integrations area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants