mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-06 17:36:53 +01:00
Complete AL review knowledge readiness
Fill telemetry and Query coverage, strengthen thin review domains, correct audited content defects, and add deterministic cheap-model evaluation and reference-integrity safeguards. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9825b012-e653-496a-9310-c1f4b6f8ac27
This commit is contained in:
parent
809af9708e
commit
e81632b4be
103 changed files with 2350 additions and 210 deletions
|
|
@ -15,7 +15,7 @@ Error method trace telemetry includes the AL error string only when the first `E
|
|||
|
||||
## Best Practice
|
||||
|
||||
Declare the complete message as a `Label` or `TextConst` and pass it directly to `Error`, followed by substitution values. The client receives the formatted message while telemetry can retain the static message template without using the dynamic values as its message. See `error-direct-substitution-safe-for-telemetry.md`.
|
||||
Declare the complete message as a `Label` or `TextConst` and pass it directly to `Error`, followed by substitution values. The client receives the formatted message while telemetry retains the static message template without using the dynamic values as its message. Independently review whether each substitution value is appropriate to show to the current user.
|
||||
|
||||
See sample: `avoid-strsubstno-prebuild-before-error.good.al`.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
codeunit 50205 "Privacy Sample Direct Error"
|
||||
{
|
||||
procedure ValidateCustomer(var Customer: Record Customer)
|
||||
var
|
||||
InvalidEmailErr: Label 'Customer %1 has an invalid e-mail address: %2.', Comment = '%1 = Customer No., %2 = E-Mail';
|
||||
begin
|
||||
if not Customer."E-Mail".Contains('@') then
|
||||
Error(InvalidEmailErr, Customer."No.", Customer."E-Mail");
|
||||
end;
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
bc-version: [20..]
|
||||
domain: privacy
|
||||
keywords: [error, strsubstno, direct-substitution, telemetry, classification, label]
|
||||
technologies: [al]
|
||||
countries: [w1]
|
||||
application-area: [all]
|
||||
---
|
||||
|
||||
# Use a Label or TextConst for the Error telemetry message
|
||||
|
||||
## Description
|
||||
|
||||
For Error method trace telemetry, the platform includes the AL error string only when `Error` receives a `Label` or `TextConst` as its first argument. Substitution values format the client message, but the static label supplies the telemetry message and preserves its classification context. A string literal, local `Text`, `StrSubstNo` result, or concatenation is not equivalent: telemetry substitutes generic guidance instead of that dynamic string.
|
||||
|
||||
## Best Practice
|
||||
|
||||
Define the complete error template as a `Label` with placeholder comments, pass the label directly as the first argument, and pass values separately. Independently review whether those values are appropriate to show to the current user.
|
||||
|
||||
See sample: `error-direct-substitution-safe-for-telemetry.good.al`.
|
||||
|
||||
## Anti Pattern
|
||||
|
||||
Assuming that any direct format string is telemetry-safe, or that a `StrSubstNo`/concatenated first argument is logged verbatim. The required telemetry shape is specifically a directly supplied `Label` or `TextConst`; see `avoid-strsubstno-prebuild-before-error.md`.
|
||||
|
|
@ -2,20 +2,20 @@ codeunit 50213 "Privacy Sample Telemetry Bad"
|
|||
{
|
||||
procedure LogCustomerProcessed(var Customer: Record Customer)
|
||||
begin
|
||||
Session.LogMessage('0000', StrSubstNo('Processed %1', Customer.Name), Verbosity::Normal,
|
||||
Session.LogMessage('PRIV0001', StrSubstNo('Processed %1', Customer.Name), Verbosity::Normal,
|
||||
DataClassification::SystemMetadata, TelemetryScope::All,
|
||||
'Category', 'Privacy');
|
||||
end;
|
||||
|
||||
procedure LogFileError(FileName: Text)
|
||||
begin
|
||||
Session.LogMessage('0001', StrSubstNo('Error processing file %1', FileName), Verbosity::Error,
|
||||
Session.LogMessage('PRIV0002', StrSubstNo('Error processing file %1', FileName), Verbosity::Error,
|
||||
DataClassification::SystemMetadata, TelemetryScope::All);
|
||||
end;
|
||||
|
||||
procedure LogEmployeeUpdate(EmployeeCode: Code[20])
|
||||
begin
|
||||
Session.LogMessage('0002', StrSubstNo('Employee %1 updated record', EmployeeCode), Verbosity::Normal,
|
||||
Session.LogMessage('PRIV0003', StrSubstNo('Employee %1 updated record', EmployeeCode), Verbosity::Normal,
|
||||
DataClassification::SystemMetadata, TelemetryScope::All);
|
||||
end;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ codeunit 50212 "Privacy Sample Telemetry Good"
|
|||
{
|
||||
procedure LogCustomerProcessed(var Customer: Record Customer)
|
||||
begin
|
||||
Session.LogMessage('0000', 'Customer record processed', Verbosity::Normal,
|
||||
Session.LogMessage('PRIV0001', 'Customer record processed', Verbosity::Normal,
|
||||
DataClassification::SystemMetadata, TelemetryScope::All,
|
||||
'Category', 'Privacy');
|
||||
end;
|
||||
|
||||
procedure LogFileError()
|
||||
begin
|
||||
Session.LogMessage('0001', 'Error processing uploaded file', Verbosity::Error,
|
||||
Session.LogMessage('PRIV0002', 'Error processing uploaded file', Verbosity::Error,
|
||||
DataClassification::SystemMetadata, TelemetryScope::All);
|
||||
end;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@ codeunit 50211 "Privacy Sample LogMessage Bad"
|
|||
{
|
||||
procedure LogCompleted()
|
||||
begin
|
||||
Session.LogMessage('0003', 'Operation completed', Verbosity::Normal);
|
||||
Session.LogMessage('PRIV0004', 'Operation completed', Verbosity::Normal);
|
||||
end;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ codeunit 50210 "Privacy Sample LogMessage Good"
|
|||
{
|
||||
procedure LogCompleted()
|
||||
begin
|
||||
Session.LogMessage('0003', 'Operation completed', Verbosity::Normal,
|
||||
Session.LogMessage('PRIV0004', 'Operation completed', Verbosity::Normal,
|
||||
DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher);
|
||||
end;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue