[repository-quality] Repository Quality Improvement Report — Logger Name Collision & Instantiation Hygiene #45489
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
🎯 Repository Quality Improvement Report — Logger Name Collision & Instantiation Hygiene
Analysis Date: 2026-07-14
Focus Area: Logger Name Collision & Instantiation Hygiene
Strategy Type: Custom
Custom Area: Yes — the
pkg/loggersubsystem uses namespace strings as its filtering identity; collisions silently corruptDEBUG=filter behaviour at runtimeExecutive Summary
The project uses
pkg/loggerwith namespace strings as the primary observability mechanism (DEBUG=cli:update_checkfilters log output). Three namespace strings are declared more than once across independent source files, meaningDEBUG=cli:update_checkenables two unrelated loggers that share the same label — confusing operators and obscuring which subsystem emitted a line. Six packages (pkg/linters/*andpkg/modelsdev) declarevar log = logger.New(...), shadowing the stdliblogidentifier and masking accidental raw-log calls from therawloginliblinter. Threelogger.Newcalls live inside a static slice literal (struct fields) rather than as package-level variables, creating logger objects with no greppable variable identity. One helper (newValidationLogger) constructs logger names by runtime string concatenation, making the full set of names statically unknowable.None of these issues are crashes, but collectively they erode the namespace-based filtering contract that operators rely on when debugging agentic runs. All four tasks are small, mechanical, and independently deliverable.
Full Analysis Report
Focus Area: Logger Name Collision & Instantiation Hygiene
Current State Assessment
The codebase contains 685
logger.New(...)calls across 683 source files producing 682 unique namespace strings.Metrics Collected:
logger.Newcallsvar logshadowing variableslogger.NewcallsnewValidationLoggerFindings
Strengths
pkg:componentnaming convention used across all 682+ namespaces — zero deviations from the colon-separator schemerawloginliblinter already prevents rawlog.Print*calls in library packagesAreas for Improvement
cli:update_checkdeclared in bothpkg/cli/compile_update_check.go(line 21) andpkg/cli/update_check.go(line 18) — two unrelated update-check subsystems share one filter labelvar log = logger.New(...)in 6 files shadows the stdliblogidentifier:pkg/linters/largefunc,deferinloop,httprespbodyclose,httpstatuscode,excessivefuncparams, andpkg/modelsdev/catalog.go—rawloginliblinter cannot fire becauselogresolves topkg/loggernot stdlibloglogger.Newcalls insidecloseEntityRegistryslice literal (pkg/workflow/close_entity_helpers.golines 172, 185, 198) are not reachable bygrep -rn 'var.*Log.*= logger.New'auditsnewValidationLoggerinpkg/workflow/validation_helpers.go:48builds names via runtime concatenation — all 10 call sites pass string literals and could be inlinedDetailed Analysis
Duplicate 1 —
cli:update_checkcompile_update_check.gohandles compile-time version checking (unauthenticated HTTP probe), whileupdate_check.gohandles authenticated gh-release version checking. RunningDEBUG=cli:update_checkproduces interleaved output from both, defeating namespace isolation.var logshadowingrawloginlibdetectslog.Print*(...)calls only whenlogresolves to the stdliblogpackage viaastutil.IsPkgSelector. When a file declaresvar log = logger.New(...), thelogsymbol resolves topkg/logger.Loggerand the linter is blind to it. Six production files are affected.Inline logger instantiation in
closeEntityRegistryThe three
Logger: logger.New("workflow:close_*")struct field initializers diverge from the convention (var xxxLog = logger.New(...)at package scope) and are invisible to standard auditing greps.Dynamic name construction
newValidationLogger("domain")→"workflow:" + domain + "_validation"makes the 10 generated names unreachable by static tooling. All 10 callers already pass string literals.🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Rename colliding
cli:update_checklogger incompile_update_check.goPriority: High
Estimated Effort: Small
Focus Area: Logger Name Collision & Instantiation Hygiene
Description: Two independent source files both call
logger.New("cli:update_check"). Rename the logger inpkg/cli/compile_update_check.goto"cli:compile_update_check"so the two subsystems have distinct, filterable namespace strings.Acceptance Criteria:
pkg/cli/compile_update_check.goline 21:logger.New("cli:update_check")→logger.New("cli:compile_update_check")grep -rn 'logger.New("cli:update_check")' pkg/returns exactly one result (inupdate_check.go)make fmt && make lintpassesCode Region:
pkg/cli/compile_update_check.go:21Task 2: Rename
var logto descriptive names in linter and modelsdev packagesPriority: High
Estimated Effort: Small
Focus Area: Logger Name Collision & Instantiation Hygiene
Description: Six source files declare
var log = logger.New(...), shadowing the stdliblogidentifier. Rename each to a descriptive name following thevar xxxLog = logger.New(...)convention.Acceptance Criteria:
pkg/linters/largefunc/largefunc.go:var log→var largefuncLog; alllog.Printf(...)call sites updatedpkg/linters/deferinloop/deferinloop.go:var log→var deferinloopLog; call sites updatedpkg/linters/httprespbodyclose/httprespbodyclose.go:var log→var httprespbodycloseLog; call sites updatedpkg/linters/httpstatuscode/httpstatuscode.go:var log→var httpstatuscodeLog; call sites updatedpkg/linters/excessivefuncparams/excessivefuncparams.go:var log→var excessivefuncparamsLog; call sites updatedpkg/modelsdev/catalog.go:var log→var catalogLog; call sites updatedgrep -rn '^var log = logger.New' pkg/returns zero resultsmake fmt && make lintpassesCode Region:
pkg/linters/largefunc/largefunc.go,pkg/linters/deferinloop/deferinloop.go,pkg/linters/httprespbodyclose/httprespbodyclose.go,pkg/linters/httpstatuscode/httpstatuscode.go,pkg/linters/excessivefuncparams/excessivefuncparams.go,pkg/modelsdev/catalog.goTask 3: Hoist inline
logger.Newcalls incloseEntityRegistryto package-level variablesPriority: Medium
Estimated Effort: Small
Focus Area: Logger Name Collision & Instantiation Hygiene
Description: Three entries in the
closeEntityRegistryslice inpkg/workflow/close_entity_helpers.go(lines 172, 185, 198) instantiate loggers inline as struct field values, diverging from the package-levelvar xxxLog = logger.New(...)convention.Acceptance Criteria:
var closeIssueLog,var closePRLog,var closeDiscussionLogcloseEntityRegistryentries reference these variables instead of inlinelogger.New(...)calls"workflow:close_issue","workflow:close_pull_request","workflow:close_discussion")grep -n 'logger.New(' pkg/workflow/close_entity_helpers.goreturns zero resultsmake fmt && make lintpassesCode Region:
pkg/workflow/close_entity_helpers.go:172,185,198Task 4: Replace
newValidationLoggerdynamic construction with explicit package-level varsPriority: Medium
Estimated Effort: Small
Focus Area: Logger Name Collision & Instantiation Hygiene
Description:
newValidationLogger(domain string)inpkg/workflow/validation_helpers.go:48builds logger names at runtime. All 10 callers pass string literals and can be inlined, making the full name set statically enumerable.Acceptance Criteria:
newValidationLoggerfunction removed frompkg/workflow/validation_helpers.gologger.New("workflow:<domain>_validation")directlygrep -rn 'newValidationLogger' pkg/returns zero resultsmake fmt && make lint && make testpassesCode Region:
pkg/workflow/validation_helpers.go:48,pkg/workflow/features_validation.go,pkg/workflow/network_firewall_validation.go,pkg/workflow/pull_request_target_validation.go,pkg/workflow/runtime_validation.go,pkg/workflow/tools_validation.go,pkg/workflow/compiler_filters_validation.go,pkg/workflow/event_validation.go,pkg/workflow/agent_validation.go,pkg/workflow/runs_on_validation.go,pkg/workflow/dangerous_permissions_validation.go📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
cli:update_checkcollision inpkg/cli/compile_update_check.go— Priority: Highvar logshadow variables in 6 linter/modelsdev files — Priority: HighShort-term Actions (This Month)
closeEntityRegistryloggers to package-level vars — Priority: MediumnewValidationLoggercall sites and delete the helper — Priority: MediumLong-term Actions (This Quarter)
duplicateloggernameslinter rule to detect duplicatelogger.New("...")strings at compile time — Priority: Low📈 Success Metrics
var logshadow declarations: 6 → 0Next Steps
References:
Generated by Repository Quality Improvement Agent
Beta Was this translation helpful? Give feedback.
All reactions