Major — Privacy Notice registered on the wrong codeunit
The event subscriber that registers the GitHub Copilot integration subscribes to Codeunit::"Privacy Notice" instead of Codeunit::"Privacy Notice Registrations":
// ❌ current — wrong publisher
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Privacy Notice", OnRegisterPrivacyNotices, '', false, false)]
local procedure RegisterGHCopilotPrivacyNotice(var TempPrivacyNotice: Record "Privacy Notice" temporary)
The OnRegisterPrivacyNotices event is published by Codeunit "Privacy Notice Registrations", not by Codeunit "Privacy Notice". Subscribing to the wrong codeunit means this procedure never fires, so the SMAGHCopilot integration is never added to the tenant's Privacy Notices registry. As a result, GetPrivacyNoticeApprovalState('SMAGHCopilot') at line 38 will always return a non-Agreed state, and every call to ImportUsageData will fail with PrivacyNoticeNotAgreedErr — even after an administrator tries to approve it on the Privacy Notices Status page, because the notice was never registered to begin with.
Additionally, the BCQuality reference implementation uses the higher-level PrivacyNotice.CreatePrivacyNoticeForIntegration(...) helper rather than manually initialising the temporary record.
Fix:
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Privacy Notice Registrations", OnRegisterPrivacyNotices, '', false, false)]
local procedure RegisterGHCopilotPrivacyNotice(var TempPrivacyNotice: Record "Privacy Notice" temporary)
var
PrivacyNotice: Codeunit "Privacy Notice";
begin
PrivacyNotice.CreatePrivacyNoticeForIntegration(
GHCopilotIntegrationIdTok, 'GitHub Copilot Metrics');
end;
BCQuality reference: microsoft/knowledge/privacy/register-integration-in-privacy-notice-registrations.md
which in its turn confuses the agent that tries to fix it.
Knowledger in microsoft/knowledge/privacy/register-integration-in-privacy-notice-registrations.md and matching good code example seem to be outdated. There is no published event in codeunit "Privacy Notice Registrations", the event is in "Privacy Notice".
This leads to advices like this:
which in its turn confuses the agent that tries to fix it.