Remove dead ApiKeyService.ValidateKeyAsync usage-recording path (#1409) - #1420
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Adversarial Code ReviewReviewed the full diff (3 files, deletions only) against auth/authz, dual-writer, dead-code, layer-purity, and test-coverage lenses. CRITICAL
HIGH
MEDIUM
LOW
Bot Comments Addressed
Summary0 CRITICAL / 0 HIGH / 0 MEDIUM / 0 LOW. Deletion-only dead-code removal with the compiler as the dead-code proof. Verification: build clean (0 errors); |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Coordinator — second independent review lens (blast radius / non-static references): MERGE-SAFE, 0 findingsLens 2 attempted to refute the removal on four axes; all failed to produce a finding:
One precision note on the PR description (informational, not a defect): the clean Release build alone proves deadness for Gate status: both lenses MERGE-SAFE with zero findings → no fix round required. Merge follows CI green on |
What
Removes the dead
ApiKeyService.ValidateKeyAsyncusage-recording path and its supporting domain helper.Removed
ApiKeyService.ValidateKeyAsync(string, CancellationToken)(Application) — plus the#1409dead-path / dual-writer warning comment on it.ApiKey.RecordUsage()(Domain) — its only production caller wasValidateKeyAsync; zero production callers remain after that removal.ApiKeyTests.RecordUsage_UpdatesLastUsedAt(Domain.Tests) — the only test exercisingRecordUsage().Why
ValidateKeyAsynchad zero callers and was a dual-writer trap. MCP authentication is performed byApiKeyMiddleware, which records usage directly viaExecuteUpdateAsync(#1402/#1406; ownerIsActivefolded into the initialApiKeyslookup in #1404/PR #1412). If anyone had wiredValidateKeyAsyncinto that pipeline it would double-writeLastUsedAt/UpdatedAton every authenticated request. Recorded decision (#1409): remove it rather than wire it.ApiKey.RecordUsage()followed it out: a grep after removingValidateKeyAsyncshowed no remaining production callers (only the one domain unit test, which is removed here). TheLastUsedAtproperty itself is untouched — the middleware still persists it viaExecuteUpdateAsync.ApiKeyServiceimplements no interface (concrete class registered in DI), so there was no interface member to remove. Surviving methods (CreateKeyAsync,ListKeysAsync,RevokeKeyAsync,GenerateKey,HashKey) are unchanged.Compiler-proof
dotnet build backend/Taskdeck.sln -c Release -m:1is clean (0 errors) after removing both members. A clean build with no unresolved references is proof that neitherValidateKeyAsyncnorRecordUsage()had any remaining caller in production or test code.Verification
dotnet build backend/Taskdeck.sln -c Release -m:1— 0 errors (11 pre-existing unrelated warnings).dotnet test backend/Taskdeck.sln -c Release -m:1 --filter "FullyQualifiedName~ApiKey"— all green:RecordUsagetest accounts for the delta).Scope note
No cascade beyond this slice — no other members became unreferenced.
Closes #1409