chore: correct false comments, remove dead code, wire missing telemetry - #779
Merged
Merged
Conversation
lakhansamani
force-pushed
the
chore/comment-accuracy-and-dead-code
branch
from
August 17, 2026 06:02
34b367a to
9a75b89
Compare
A repo-wide scan for comments asserting behaviour the code does not have, and for exported identifiers nothing references. False claims corrected: - Two comments named a test that does not exist (TestSchemaForMessage_ScalarOnly, TestValidate_PreservesInvariant) — renamed to the functions they actually document. mcp/server.go's reference to TestServer_StdioOnly is left alone: it is past tense and transport_test.go documents the replacement. - memory_store/db/cache.go claimed "7 providers" / "all 7 backends" in three places. There are 6; the 7th directory is provider_template, a scaffold. Every other comment in the repo, and AGENTS.md, says six. Dead code removed: - webhook_event_authorization.go: 13 constants for resource/scope/policy/ permission events. Nothing fired them AND nothing could subscribe — they were never added to validators.validWebhookEventNames, so registering a webhook for one was rejected as invalid. The same file's header records this exact bug happening before with the SCIM events. - GoogleUserInfoURL (already self-documented "deprecated and not used") and MicrosoftUserInfoURL: both providers resolve via OIDC discovery. - TokenTypeURNRefreshToken / TokenTypeURNIDToken: RFC 8693 URNs this server does not accept (see isSupportedExchangeTokenType). The block now states what Authorizer accepts rather than copying the registry. Missing telemetry wired — the constants existed, nothing emitted them: - AuditPasswordChangedEvent and AuditMFADisabledEvent now fire from UpdateProfile, IN ADDITION to AuditProfileUpdatedEvent so nothing consuming that today breaks. A password change and an MFA disable were indistinguishable from a display-name edit. - metrics.EventMagicLink and metrics.EventVerifyOTP are now recorded. Magic-link and OTP volume were invisible beside login/signup/oauth on the same dashboard; EventVerifyOTP was even asserted by a test while never being emitted in production. Deliberately NOT deleted: nine audit-event constants that remain unemitted. Each now says RESERVED and why, rather than "is logged when X" — which was the false claim. AuditAdminUserCreatedEvent is the clearest case: there is no admin create-user operation at all (AdminProvider has Users/User/UpdateUser/DeleteUser; creation goes through the invite flow), so it was never a missing log call.
lakhansamani
force-pushed
the
chore/comment-accuracy-and-dead-code
branch
from
August 17, 2026 06:09
9a75b89 to
301e879
Compare
lakhansamani
added a commit
that referenced
this pull request
Aug 17, 2026
…po (#783) The rule keeping e2e-playground's TLS fixtures tracked cited docs/superpowers/plans/2026-07-20-playground-e2e.md as its justification. That path is gitignored (.gitignore:29) and was never committed, so the citation could not be followed by anyone cloning the repo — and the file has since been deleted locally too. States the reason inline instead. Same class as the stale references corrected in #779; this one was missed because .gitignore is not a Go file and the scan only walked *.go.
lakhansamani
added a commit
that referenced
this pull request
Aug 19, 2026
* docs(changelog): cover #773-#783 Unreleased linked 50 PRs and none of #773-#783, so every change made after rc.22 - including four security fixes - was missing from the CHANGELOG a user reads at 2.4.0. Refs #773, #774, #775, #776, #777, #778, #779, #781, #782, #783 * chore: bump web/app to authorizer-react 2.2.0 authorizer-react 2.2.0 is published on authorizer-js 4.0.0; drop the -rc.7 pin. Also stamps the CHANGELOG's Unreleased section as 2.4.0. * test(e2e): make the authorizer host ports overridable The seven authorizer services published fixed host ports, so the suite could not run on a machine already using 8080-8086 - it failed at "address already in use" before any test ran. The mock services already take this shape. Playwright reaches every service by compose DNS, so the host mapping is for humans only and the defaults are unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A repo-wide scan for two things: comments asserting behaviour the code does not
have, and exported identifiers nothing references.
unusedis already enabled in.golangci.yml, but it only catches unexported identifiers within a package —exported-but-unreferenced code in
internal/slips past it, which is where all ofthis was hiding.
False claims corrected
mcp/schema_test.go:69TestSchemaForMessage_ScalarOnlyTestSchemaForMessage_AllScalarKindsinterceptors_test.go:147TestValidate_PreservesInvariantTestValidate_BuildsCleanlymemory_store/db/cache.gox3provider_template, a scaffoldmcp/server.go's reference toTestServer_StdioOnlyis deliberately left: it ispast tense ("the guard that enforced it"), and
transport_test.go:17documents thereplacement. Accurate history, not a stale claim.
Dead code removed
webhook_event_authorization.go— 13 constants. Worse than unused: nothingfired them and nothing could subscribe to them. They were never added to
validators.validWebhookEventNames, so registering a webhook forpermission.createdwas rejected as an invalid event name. The file's own headerrecords this exact bug happening before with the SCIM events — same shape, second
occurrence.
GoogleUserInfoURL(already self-documented "deprecated and not used") andMicrosoftUserInfoURL— both providers resolve via OIDC discovery now.TokenTypeURNRefreshToken/TokenTypeURNIDToken— RFC 8693 URNs this serverdoes not accept (
isSupportedExchangeTokenTypetakes access_token and jwt only).The block now states what Authorizer accepts rather than copying the registry.
Missing telemetry wired
The constants existed; nothing emitted them. Same class of defect — a name
asserting behaviour never implemented.
AuditPasswordChangedEventandAuditMFADisabledEventnow fire fromUpdateProfile, in addition toAuditProfileUpdatedEventso nothingconsuming that today breaks. A password change and an MFA disable were
indistinguishable from a display-name edit — anyone auditing "who changed a
password" had nothing to query.
metrics.EventMagicLinkandmetrics.EventVerifyOTPare now recorded.Magic-link and OTP volume were invisible next to login/signup/oauth on the same
dashboard.
EventVerifyOTPwas even asserted by a test while never emitted inproduction.
Deliberately not deleted
Nine audit-event constants remain unemitted. Each now says RESERVED and why,
instead of "is logged when X" — the "is logged when" was the false claim, not the
constant's existence.
AuditAdminUserCreatedEventis the clearest. I first read it as a compliance gap(update and delete are audited, create isn't) and that was wrong: there is no
admin create-user operation at all.
AdminProviderexposesUsers/User/UpdateUser/DeleteUser, and creation goes through the invite flow, which
logs
AuditAdminInviteSentEvent. Never a missing log call.After this PR plus #776 and #777, every remaining zero-reference exported constant
is either explicitly RESERVED with a stated reason, or a
TokenEndpointAuthMethodClientSecretPost-style enum member used only in tests. Not"zero unused code" — documented and accounted for, which is the honest goal.
Verification
TestProfileSecurityEventsAreAuditedSeparatelyconfirmed failing with the sourcereverted (
no user.password_changed audit entry,no user.mfa_disabled audit entry).