From da88be2175c22215f68dfd7906848fb5c5a482c5 Mon Sep 17 00:00:00 2001 From: Arthur van de Vondervoort Date: Fri, 16 Oct 2026 17:00:02 +0200 Subject: [PATCH] revert: docs(AC0032): document CalcSums as a read and the CalcFields limitation (#201) This reverts commit c20580d4314654a56092ca8e1821ea535977dde0, matching the analyzer revert: CalcSums is no longer counted as a read. Co-Authored-By: Claude Opus 5.5 (1M context) --- content/docs/analyzers/ApplicationCop/AC0031.md | 6 +----- content/docs/analyzers/ApplicationCop/AC0032.md | 6 ------ 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/content/docs/analyzers/ApplicationCop/AC0031.md b/content/docs/analyzers/ApplicationCop/AC0031.md index 075ab75..89713e1 100644 --- a/content/docs/analyzers/ApplicationCop/AC0031.md +++ b/content/docs/analyzers/ApplicationCop/AC0031.md @@ -48,7 +48,7 @@ The following record method calls trigger this diagnostic: | Permission | Methods | |---|---| -| Read (`r`) | `Find`, `FindFirst`, `FindLast`, `FindSet`, `Get`, `GetBySystemId`, `IsEmpty`, `Count`, `Next`, `CalcSums` | +| Read (`r`) | `Find`, `FindFirst`, `FindLast`, `FindSet`, `Get`, `GetBySystemId`, `IsEmpty`, `Count`, `Next` | | Insert (`i`) | `Insert` | | Modify (`m`) | `Modify`, `ModifyAll`, `Rename` | | Delete (`d`) | `Delete`, `DeleteAll` | @@ -57,10 +57,6 @@ The following record method calls trigger this diagnostic: Calls through the implicit `Rec` variable inside table objects are included (for example, `Rec.Modify()` in a table procedure). -`CalcSums` is a SQL aggregate over the receiver table, so it counts as a read on that table. - -`CalcFields` is not checked. A FlowField is calculated from the table named in its `CalcFormula`, not from the receiver, and a user needs read permission on both tables ([Security considerations](https://learn.microsoft.com/dynamics365/business-central/dev-itpro/security/security-considerations)). Charging the receiver would require the wrong table, and resolving the formula's source table is not supported yet. - `Next` counts as a read even when the record set was positioned by another object. Permissions do not flow through the call stack: when a helper procedure runs `FindSet` on a `var` record parameter and the caller iterates it with `repeat ... until Rec.Next() = 0`, each `Next` call reads the table on behalf of the *calling* object, so the caller needs its own read (`r`) permission. {{< highlight al >}} diff --git a/content/docs/analyzers/ApplicationCop/AC0032.md b/content/docs/analyzers/ApplicationCop/AC0032.md index 4b42e22..438ad19 100644 --- a/content/docs/analyzers/ApplicationCop/AC0032.md +++ b/content/docs/analyzers/ApplicationCop/AC0032.md @@ -116,12 +116,6 @@ codeunit 50100 "Customer Processing" } {{< /highlight >}} -### Aggregates and FlowFields - -`CalcSums` counts as a read (`r`) operation: it is a SQL aggregate over the receiver table, so an object whose only access is `SetRange` followed by `CalcSums` is using its `r` permission and AC0032 does not report it. - -`CalcFields` is not traced. The read happens on the table named in the FlowField's `CalcFormula`, not on the receiver, and a user needs read permission on both tables ([Security considerations](https://learn.microsoft.com/dynamics365/business-central/dev-itpro/security/security-considerations)). A permission declared only for a `CalcFields` receiver can therefore still be reported, and the table the formula reads is not recognised as used either. - ### RecordRef operations A `RecordRef` can point to any table, and which table it targets is only known at runtime. When an object contains **any** database operation on a `RecordRef` receiver (`Find`, `FindFirst`, `FindLast`, `FindSet`, `Get`, `GetBySystemId`, `IsEmpty`, `Count`, `Next`, `Insert`, `Modify`, `ModifyAll`, `Rename`, `Delete`, or `DeleteAll`), the rule cannot determine which declared permission that operation consumes. AC0032 is therefore disabled for the entire object: no unused-permission diagnostics are reported, and the code fix is not offered.