Include firewall domain decisions in logs JSON#59575
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✅ PR Code Quality Reviewer completed the code quality review. Reviewed PR #59575 and found no actionable review comments to publish.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. No ADR enforcement needed: PR does not have the implementation label and has <=100 new lines of code in business logic directories.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff
|
|
✅ Ponytail Reviewer completed successfully! Lean already. Ship. Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "ab.chatgpt.com"See Network Configuration for more information.
|
There was a problem hiding this comment.
🟡 Changes recommended
Placeholder keys must be excluded from normalized domain records before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds deterministic firewall-domain decisions and request counts to the logs JSON output.
Changes:
- Adds sorted domain records with acceptance state and request count.
- Tests mixed allowed/blocked decisions and serialization.
- Adds a patch changeset.
File summaries
| File | Review |
|---|---|
pkg/cli/logs_report_test.go |
Tests aggregation, ordering, and JSON output. |
pkg/cli/logs_report_firewall.go |
Builds normalized records, but must exclude placeholder domains such as (unknown) and -. |
.changeset/patch-logs-firewall-domains.md |
Documents the output enhancement. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| for _, domain := range sliceutil.SortedKeys(allRequestsByDomain) { | ||
| stats := allRequestsByDomain[domain] |
Comment MemoryNote This comment is managed by comment memory.It stores persistent context for this thread in the code block at the top of this comment.
|
There was a problem hiding this comment.
Verdict
Non-blocking change. The new firewall_log.domains payload matches the PR description by emitting one record per domain/decision pair, and I did not find a correctness or merge-blocking issue in the changed lines.
Themes
- The added aggregation is deterministic because it iterates sorted domain keys.
- Existing aggregate counters and
requests_by_domainremain intact, so the JSON expansion is additive rather than a breaking replacement. - The updated test covers the mixed allow/block case that this change introduces.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 30 AIC · ⌖ 7.32 AIC · ⊞ 21.8K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /grill-with-docs and /tdd on this small, well-tested feature addition.
📋 Key Themes & Highlights
Key Themes
- Naming:
Arity(see inline comment) is a nonstandard term for a request count and may confuse API consumers.
Positive Highlights
- ✅ Deterministic ordering via
sliceutil.SortedKeyskeeps JSON output stable for diffing/tests. - ✅ Test in
logs_report_test.goexercises the mixed allowed/blocked domain case and asserts both the struct value and the marshaled JSON substring. - ✅ Backward compatible: existing
requests_by_domain,allowed_domains,blocked_domainsfields are preserved untouched; new field isomitempty. - ✅ Changeset included for the patch release.
No blocking issues found; the single naming suggestion is non-blocking.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 34.8 AIC · ⌖ 14.7 AIC · ⊞ 10.3K
Comment /matt to run again
| type FirewallDomainRecord struct { | ||
| Domain string `json:"domain"` | ||
| Accepted bool `json:"accepted"` | ||
| Arity int `json:"arity"` |
There was a problem hiding this comment.
[/grill-with-docs] Arity is an unusual name for "number of requests" — arity normally means the number of arguments a function takes. This could confuse consumers of the JSON output.
💡 Suggestion
Consider renaming to something that matches the domain vocabulary already used elsewhere in this file, e.g. Count or Requests (compare DomainRequestStats.Allowed/Blocked and TotalRequests/AllowedRequests naming). The PR body's example JSON also uses arity, so the public JSON key would need to change too if you rename.
@copilot please address this.
There was a problem hiding this comment.
Reviewed the firewall domain-decisions JSON change (backend, no UI). Logic, tests, and changeset are solid. One non-blocking naming clarity issue flagged inline: arity is a confusing name for a request count.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 25.3 AIC · ⌖ 13.3 AIC · ⊞ 8.3K
| type FirewallDomainRecord struct { | ||
| Domain string `json:"domain"` | ||
| Accepted bool `json:"accepted"` | ||
| Arity int `json:"arity"` |
There was a problem hiding this comment.
The field name arity is unclear for API consumers — it actually represents a request count for a domain+decision pair, not mathematical arity (number of arguments/operands). Consider renaming to something self-explanatory like count or request_count (and the Go field to Count) so downstream JSON consumers don't need to guess its meaning from source code.
@copilot please address this.
The
logsJSON output lacked a normalized domain inventory showing whether firewall requests were allowed or blocked.firewall_log.domainsrecords.requests_by_domain.