Skip to content

Split shared config validation logger into per-file loggers - #12252

Merged
lpcox merged 2 commits into
mainfrom
copilot/refactor-validation-shared-logger
Aug 31, 2026
Merged

Split shared config validation logger into per-file loggers#12252
lpcox merged 2 commits into
mainfrom
copilot/refactor-validation-shared-logger

Conversation

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

internal/config/validation_shared.go existed only to declare a single package-level logValidation logger, reused across 7 other files (66 call sites). Since logger.ForFile() derives its debug namespace from where the variable is declared, all 66 call sites logged under config:validation_shared regardless of the actual emitting file — making DEBUG=config:* filtering misleading.

Changes

  • Removed internal/config/validation_shared.go.
  • Declared a dedicated logger.ForFile() logger directly in each file that previously used the shared one, so its namespace reflects the correct source file:
    • agent_policy.gologAgentPolicy
    • expand.gologExpand
    • validation_errors.gologValidationErrors
    • validation_gateway.gologValidationGateway
    • validation_rules.gologValidationRules
    • validation_server.gologValidationServer
    • validation_tracing.gologValidationTracing
  • Updated all call sites within each file to use its local logger variable.

No behavioral change — this only restores per-file DEBUG namespace accuracy for config validation logging.

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor logger namespace in validation_shared.go Split shared config validation logger into per-file loggers Aug 31, 2026
Copilot AI requested a review from lpcox August 31, 2026 23:06
@lpcox
lpcox marked this pull request as ready for review August 31, 2026 23:46
Copilot AI balanced review requested due to automatic review settings August 31, 2026 23:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

All shared logger references were consistently replaced with correctly scoped per-file loggers.

Pull request overview

Splits config validation logging into per-file loggers so DEBUG namespaces identify the actual source file.

Changes:

  • Adds dedicated logger.ForFile() instances across seven config files.
  • Updates all 66 references and removes the obsolete shared logger file.
File summaries
File Description
internal/config/agent_policy.go Adds the agent-policy logger.
internal/config/expand.go Adds the expansion logger.
internal/config/validation_errors.go Adds the validation-error logger.
internal/config/validation_gateway.go Adds the gateway-validation logger.
internal/config/validation_rules.go Adds the rule-validation logger.
internal/config/validation_server.go Adds the server-validation logger.
internal/config/validation_shared.go Removes the shared logger declaration.
internal/config/validation_tracing.go Adds the tracing-validation logger.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

🔒 mcpg Read-Only Stress — gVisor

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: gVisor (runsc) kernel-level isolation

Part Surface Op Result Expected Status
A MCP reads (issues/PRs/file/commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) all absent from catalog BLOCKED ⚠️
C CLI reads (list_issues, get_file_contents) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) gh unauthenticated BLOCKED ⚠️
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh unauthenticated BLOCKED ⚠️

Overall: INCONCLUSIVE

⚠️ Part B: Gateway exposed 23 read-only tools, zero write tools. All 7 write attempts returned unknown tool [-32602] — confirms GITHUB_READ_ONLY=1 prevents backend registration, but does not independently confirm gateway DIFC/guard enforcement. No write leaked.

⚠️ Parts D & E: gh not authenticated in this environment. REST/GraphQL token-scope boundary untestable. All D/E rows INCONCLUSIVE.

No writes succeeded. Zero FAILs. RESULT=INCONCLUSIVE RUNTIME=gvisor RUNID=33449217297

References: §33449217297

🔒 mcpg read-only stress (gVisor runtime) by Read-Only Stress: gVisor runtime

@github-actions

Copy link
Copy Markdown
Contributor

🔒 mcpg Read-Only Stress — docker-sbx

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: docker-sbx (KVM-isolated microVM)

Part Surface Op Result Expected Status
A MCP reads (issues/PRs/file/commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) all tools absent from catalog BLOCKED ⚠️
C CLI reads (issues/PRs via github CLI) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) gh unauthenticated BLOCKED ⚠️
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh unauthenticated BLOCKED ⚠️

Overall: INCONCLUSIVE

⚠️ Part B: All 23 exposed MCP tools are read-only; no write tools appear in the catalog. The backend runs with GITHUB_READ_ONLY=1, so write tools are never registered — this confirms gh-aw's defense-in-depth but does not independently confirm gateway-level DIFC/guard enforcement (write calls never reach a write-capable backend). All Part B rows are INCONCLUSIVE per methodology.

⚠️ Parts D & E: gh reports GH_TOKEN is invalid/unauthenticated in this environment. No REST or GraphQL write could be attempted. All Part D/E rows are INCONCLUSIVE — the token-scope boundary cannot be validated in this run.

No writes leaked. No FAIL conditions triggered.

References: §33449217230

🔒 mcpg read-only stress (docker-sbx runtime) by Read-Only Stress: docker-sbx runtime

@github-actions

Copy link
Copy Markdown
Contributor

🔒 mcpg Read-Only Stress — default AWF

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default AWF (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads (issues/PRs/file/commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) all tools absent from catalog BLOCKED ⚠️
C CLI reads (list_issues, get_file_contents) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) gh unauthenticated BLOCKED ⚠️
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh unauthenticated BLOCKED ⚠️

Overall: INCONCLUSIVE

⚠️ Part B: All 7 write tools (add_issue_comment, star_repository, issue_write, create_branch, create_or_update_file, create_pull_request) were absent from the MCP tool catalog (backend launched with GITHUB_READ_ONLY=1; only 23 read-only tools registered). Refusals prove gh-aw framework defense-in-depth, not gateway-level DIFC enforcement. No write succeeded.

⚠️ Parts D/E: gh is not authenticated in this environment — all write attempts failed with "set GH_TOKEN environment variable", not a real API 403. Cannot confirm token-scope boundary.

No write leaked. Gateway DIFC/guard enforcement was not independently exercised on this run due to structural limitations (backend never registers write tools; gh CLI unauthenticated). Independent confirmation of gateway write-blocking is covered by internal/guard and internal/difc unit tests.

References: §33449217272

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@lpcox
lpcox merged commit 4686996 into main Aug 31, 2026
51 checks passed
@lpcox
lpcox deleted the copilot/refactor-validation-shared-logger branch August 31, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] Semantic Function Clustering Analysis: minor validation_shared.go logger namespace nit

3 participants