Skip to content

Enable RU tests#9576

Open
spetersenms wants to merge 3 commits into
mainfrom
spetersen/RUTests
Open

Enable RU tests#9576
spetersenms wants to merge 3 commits into
mainfrom
spetersen/RUTests

Conversation

@spetersenms

@spetersenms spetersenms commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Enables RU tests.

AB#642528

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome (required — be specific: scenarios, commands, screenshots for UI changes)

Risk & compatibility

@spetersenms
spetersenms requested review from a team July 17, 2026 10:46
@github-actions github-actions Bot added Build: scripts & configs Build scripts and configuration files Finance GitHub request for Finance area labels Jul 17, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 17, 2026
Comment thread src/Layers/RU/Tests/Local/RUReportDownloadHandler.Codeunit.al
@github-actions

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 1 · Outcome: completed

Knowledge source: https://github.com/microsoft/BCQuality@186d8a131465475c79244d994acb872cd5c0d4bf

Findings by domain

Findings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).

Domain Findings Knowledge-backed Agent Inline Fallback
Agent 1 0 1 0 0
Events 1 1 0 1 0

Totals: 1 knowledge-backed · 1 agent findings.

Orchestrator pre-filter (2 file(s) excluded)

  • layer-disabled (knowledge) : 2 file(s)

Findings produced by the AL review agent v1.7.3. Reply 👎 on any inline comment to flag false positives.

@JesperSchulz JesperSchulz added Other GitHub request for other area than SCM, Finance or Integration Ownership: Manual Preserve the manually selected team ownership and removed Finance GitHub request for Finance area labels Jul 17, 2026
@spetersenms
spetersenms requested a review from a team July 20, 2026 08:52
// manual subscribers) because many RU report test codeunits rely on this behavior; a static
// subscriber is allowed here because this is not a test codeunit (AL0501 only applies to those).

[EventSubscriber(ObjectType::Codeunit, Codeunit::"File Management", 'OnBeforeDownloadHandler', '', false, false)]

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\ —\ Events}$

RUReportDownloadHandler (codeunit 147210) is a static [EventSubscriber] on File Management.OnBeforeDownloadHandler that is always bound and fires for every download in every session that loads this test app, not just the RU report-validation tests it was written for. The knowledge article's anti-pattern is exactly this shape: an always-on side effect (here, silently copying a server file to the target path and forcing IsHandled := true) implemented as a static subscriber when the behavior is inherently scoped to specific tests. Any other test in the same app that triggers a client-side download will silently hit this handler too, which can mask genuine download failures or change behavior the test did not expect. The article recommends EventSubscriberInstance = Manual with BindSubscription/UnbindSubscription scoped to the tests that need it instead of a session-wide static subscriber.

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

Comment thread src/DisabledTests/Tests-ERM/Tests-ERM.DisabledTest.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build: scripts & configs Build scripts and configuration files Other GitHub request for other area than SCM, Finance or Integration Ownership: Manual Preserve the manually selected team ownership

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants