table 12116 "Withholding Tax": scope Reported/Paid modify guard to st…#9422
table 12116 "Withholding Tax": scope Reported/Paid modify guard to st…#9422Explorer986 wants to merge 1 commit into
Conversation
Copilot PR ReviewIteration 2 · Outcome: completed Knowledge source: https://github.com/microsoft/BCQuality@186d8a131465475c79244d994acb872cd5c0d4bf Findings by domainFindings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).
Totals: 0 knowledge-backed · 1 agent findings. Orchestrator pre-filter (2 file(s) excluded)
Findings produced by the AL review agent v1.7.3. Reply 👎 on any inline comment to flag false positives. |
Agentic PR Review - Round 1Recommendation: Request ChangesWhat this PR doesThis PR narrows the OnModify guard in table 12116 "Withholding Tax". A Reported or Paid record still errors when a standard field changes, but a modify that only changes extension fields is allowed. The approach is safer than an IsHandled event because it does not add a general bypass. The RecordRef comparison checks normal base fields below 50000 against xRec, so changes to official withholding tax values are still caught. I did not find a direct data-integrity hole in the code, but the new allowed path is not covered by a test. SuggestionsS1 - Add tests for scoped modify guard Risk assessment and necessityRisk: This touches an Italian compliance guard for reported or paid withholding tax records. The code change is narrow and has only a small RecordRef loop on modify, but a wrong comparison would either keep blocking partner data or allow changes to official reported values. There is no public event or schema change, and no BaseApp publisher dependency was introduced. Necessity: The linked request is valid, but the requested IsHandled bypass would be too broad. This narrower fix is the right direction because partners can store their own data without changing official values. A regression test is needed and feasible here; the IT test app already has table 12116 OnModify tests, and this is sensitive data-integrity logic.
|
…andard fields instead of adding an IsHandled bypass (AB#640860, ALAppExtensions #30231)
c1bb712 to
0534495
Compare
OnModify() now declares a local 'PreviousWithholdingTax: Record "Withholding Tax"' and re-fetches it with Get(Rec."Entry No.") purely to diff it against Rec.In a table trigger, xRec already holds the exact pre-modification state of the record, populated by the platform with no extra database round-trip. The added Get() (plus the 'if not ... then exit' guard, which can never actually fail here since OnModify only fires for a record that already exists) performs a redundant read on every single Modify() of this table. The underlying impact would normally be rated at least 'major' for a hot ledger-style table, but is capped here per agent-finding severity rules. Recommendation:
Suggested fix (apply manually — could not be anchored as a one-click suggestion): trigger OnModify()
begin
if (Reported or Paid) and StandardFieldModified(xRec) then
Error(Text1033);
end;Agent judgement — not directly backed by a BCQuality knowledge article. Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
What & why
The original request asked for an
IsHandledevent inOnModifyto bypass theReported/Paidimmutability check - which triage rejected because it lets any subscriber silently disable a compliance guard that official withholding-tax reporting/payment relies on. Instead, this narrows the guard: a modify on aReported/Paidentry is still blocked when any standard field changed, but modifications limited to extension fields (added by other apps) are allowed. Partners can maintain their own data without altering officially reported values, and no bypass hook is exposed.Linked work
Fixes AB#640860
How I validated this
What I tested and the outcome
OnModifynow callsStandardFieldModified(xRec), which comparesRecvsxRecover base fields (field no. < 50000,FieldClass::Normal) viaRecordRef. Table has only simple field types (no BLOB/Media), so the value comparison is safe. AL language server reports no errors.Risk & compatibility
Medium-low. Standard reported values stay fully immutable (no regression there); the only relaxation is allowing extension-field-only edits, which were previously over-blocked. Small per-modify
RecordRefloop on a low-volume, user-driven table — negligible perf. No schema/data impact. Worth a reviewer/product nod since it touches compliance behavior.