Skip to content

feat(AC0034): make the rule opt-in (Info, disabled by default) - #586

Merged
Arthurvdv merged 5 commits into
mainfrom
feat/ac0034-opt-in
Oct 17, 2026
Merged

Arthurvdv merged 5 commits into
mainfrom
feat/ac0034-opt-in

Conversation

@Arthurvdv

@Arthurvdv Arthurvdv commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Lowers AC0034 (TelemetryRequiresTelemetryLogger) to Info and disables it by default, mirroring the AC0033 change. The check, its reach (the compiling module only) and the analyzer logic are unchanged. The resx text is rewritten around the opt-in intent: every app ships its own Telemetry Logger, so its telemetry does not depend on which other apps from the publisher are installed.

Why opt-in (runtime facts)

From the System Application Telemetry/src/Logging/ sources:

  • Telemetry.LogMessage and Feature Telemetry use the calling app's publisher; Telemetry Impl.LogMessageInternal raises "Telemetry Loggers".OnRegisterTelemetryLogger and then looks the logger up by publisher.
  • Register keys the logger by the registering app's publisher, requires that publisher on the call stack, and keeps the first registration per publisher. The event fires on every telemetry call.
  • Any installed app from the same publisher can supply the logger; it does not have to be a dependency. The logger app's own Session.LogMessage runs in that app, so its connection string receives the event.
  • No logger for the publisher: message discarded, warning 0000G7K. The duplicate-registration warning 0000G7J existed until BC 24; since 25.0 a duplicate is ignored silently, so a logger in every app is safe.
  • Microsoft documents one logger per publisher, so a logger in a sibling app is valid and cannot be seen from the compiling module.

Changes

  • DiagnosticDescriptors.cs: Info, isEnabledByDefault: false.
  • resx: new title, message and description.
  • Tests: new TelemetryRequiresTelemetryLogger.ruleset.json wired through Setup; the AC0033 ruleset enables both rules so BothRulesOneObjectReportsBoth keeps seeing AC0034; new DisabledWithoutRuleSet.
  • Rule doc updated (purpose, design decisions, platform facts, references, test notes).

Test plan

  • With only the descriptor change, the 9 AC0034 HasDiagnostic cases fail (10 NoDiagnostic pass); with the ruleset wired all pass
  • TelemetryRequiresTelemetryLogger tests: 20 passed; RestClientRequiresHttpClientHandler tests: 29 passed
  • dotnet build ALCops.sln, dotnet format ALCops.sln --verify-no-changes, ApplicationCop Release CI build (ContinuousIntegrationBuild=true, no-incremental), Validate-Rules.ps1

Docs PR: ALCops/alcops.dev#207

Review notes

Automated review (3 rounds). Justified and not changed:

  • Companion docs pages AC0034.md and AC0033.md in ../alcops.dev still show Warning: separate docs PR, per house workflow.
  • Title is imperative: deliberately mirrors the AC0033 title style.
  • AC0033 test ruleset enables both rules: needed by BothRulesOneObjectReportsBoth; documented in the rule doc test notes.
  • Default Warning to disabled drops the diagnostic for users who never configured it: intended by the opt-in change (same as AC0033); needs a release-notes line at release time.
  • Platform facts now name the BC code-history snapshots they were verified against, and the description states the intent as deployment independence (an app's telemetry does not depend on which sibling apps are installed) rather than per-app routing.
  • .vscode/Copy-BinToALAnalyzers.ps1 is a pre-existing unrelated local change, not staged.

🤖 Generated with Claude Code

Arthurvdv and others added 2 commits October 17, 2026 11:10
The Telemetry and Feature Telemetry codeunits look up the Telemetry
Logger registered for the calling app's publisher on every call. Any
installed app from the same publisher can register it, the first
registration wins (since BC 25.0 a duplicate is ignored silently), and
the logger app's own connection string receives the event. Microsoft
documents one logger per publisher, so a logger supplied by a sibling
app is a valid design that the analyzer cannot see from the compiling
module.

AC0034 now targets teams that want every app to carry its own logger.
It is Info and disabled by default, the resx text is rewritten around
that intent, and the tests enable the rule through a ruleset. The AC0033
ruleset enables both rules so the two-rule object keeps reporting both.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Arthurvdv and others added 3 commits October 17, 2026 11:17
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…d snapshots

The description and the rule doc said every app "carries its own" logger,
which reads as per-app routing. The benefit of the opt-in rule is that an
app's telemetry does not depend on which other apps from the publisher are
installed; the lookup stays per publisher and the first registration wins.
The Platform facts now name the BC code-history snapshots they were read
from, including the two snapshots whose diff shows the 25.0 change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Arthurvdv
Arthurvdv merged commit f06285b into main Oct 17, 2026
47 checks passed
@Arthurvdv
Arthurvdv deleted the feat/ac0034-opt-in branch October 17, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant