Skip to content

refactor: deduplicate transaction-end-before-headers test fixtures#5659

Merged
lpcox merged 3 commits into
mainfrom
copilot/fix-duplicate-log-aggregator-tests
Jun 29, 2026
Merged

refactor: deduplicate transaction-end-before-headers test fixtures#5659
lpcox merged 3 commits into
mainfrom
copilot/fix-duplicate-log-aggregator-tests

Conversation

Copilot AI commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Two aggregateLogs tests repeated identical fixture arrays and assertion blocks for filtering benign Squid operational entries, making the filtering invariant harder to maintain consistently.

Changes

  • validTunnelEntries() — shared factory for the github.com + npmjs.org valid tunnel fixture pair
  • transactionEndEntry(overrides?) — shared factory for error:transaction-end-before-headers entries; accepts overrides to express the ::1 vs 172.30.0.20 client IP variants without repeating all five fields
  • expectOnlyValidTunnelStats(stats) — centralizes the seven shared assertions; the second test now also gains the byDomain.has('-') === false check it was previously missing
// Before: ~15-20 lines each, duplicated fixtures + assertions
it('should filter out transaction-end-before-headers entries', () => {
  const entries = [
    createLogEntry({ domain: 'github.com', url: 'github.com:443', isAllowed: true }),
    createLogEntry({ domain: '-', url: 'error:transaction-end-before-headers',
      decision: 'NONE_NONE:HIER_NONE', statusCode: 0, isAllowed: false }),
    createLogEntry({ domain: 'npmjs.org', url: 'npmjs.org:443', isAllowed: true }),
  ];
  // ...7 expect() calls...
});

// After: intent reads clearly, invariant lives in one place
it('should filter out transaction-end-before-headers entries', () => {
  const entries = [...validTunnelEntries(), transactionEndEntry()];
  const stats = aggregateLogs(entries);
  expectOnlyValidTunnelStats(stats);
});

it('should handle multiple transaction-end-before-headers entries', () => {
  const entries = [
    ...validTunnelEntries(),
    transactionEndEntry({ clientIp: '::1' }),        // healthcheck from localhost
    transactionEndEntry({ clientIp: '172.30.0.20' }), // shutdown-time connection closure
  ];
  const stats = aggregateLogs(entries);
  expectOnlyValidTunnelStats(stats);
});

All three helpers are scoped inside describe('aggregateLogs') to avoid polluting the outer test scope.

Copilot AI changed the title [WIP] Fix duplicate transaction-end-before-headers fixture assertions refactor: deduplicate transaction-end-before-headers test fixtures Jun 28, 2026
Copilot finished work on behalf of lpcox June 28, 2026 23:35
Copilot AI requested a review from lpcox June 28, 2026 23:35
@lpcox lpcox marked this pull request as ready for review June 28, 2026 23:38
Copilot AI review requested due to automatic review settings June 28, 2026 23:38

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.

Pull request overview

This PR refactors the aggregateLogs unit tests to deduplicate repeated fixture setup and assertions around filtering benign Squid error:transaction-end-before-headers log entries, improving maintainability of the filtering invariants.

Changes:

  • Introduces shared fixture factories (validTunnelEntries, transactionEndEntry) for repeated log-entry setup.
  • Centralizes shared expectations into expectOnlyValidTunnelStats and reuses it across filtering tests.
  • Adds a previously-missing assertion ensuring the filtered '-' domain does not appear in byDomain.
Show a summary per file
File Description
src/logs/log-aggregator.test.ts Refactors aggregateLogs filtering tests by introducing shared helpers for fixtures and assertions.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment on lines 138 to 141
const entries: ParsedLogEntry[] = [
createLogEntry({
domain: 'github.com',
url: 'github.com:443',
isAllowed: true
}),
createLogEntry({
domain: '-',
url: 'error:transaction-end-before-headers',
decision: 'NONE_NONE:HIER_NONE',
statusCode: 0,
isAllowed: false
}),
createLogEntry({
domain: 'npmjs.org',
url: 'npmjs.org:443',
isAllowed: true
}),
...validTunnelEntries(),
transactionEndEntry(),
];
Comment on lines 149 to 153
const entries: ParsedLogEntry[] = [
createLogEntry({
domain: 'github.com',
url: 'github.com:443',
isAllowed: true
}),
createLogEntry({
domain: '-',
url: 'error:transaction-end-before-headers',
clientIp: '::1', // healthcheck from localhost
decision: 'NONE_NONE:HIER_NONE',
statusCode: 0,
isAllowed: false
}),
createLogEntry({
domain: '-',
url: 'error:transaction-end-before-headers',
clientIp: '172.30.0.20', // shutdown-time connection closure
decision: 'NONE_NONE:HIER_NONE',
statusCode: 0,
isAllowed: false
}),
createLogEntry({
domain: 'npmjs.org',
url: 'npmjs.org:443',
isAllowed: true
}),
...validTunnelEntries(),
transactionEndEntry({ clientIp: '::1' }), // healthcheck from localhost
transactionEndEntry({ clientIp: '172.30.0.20' }), // shutdown-time connection closure
];
@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 98.16% 98.20% 📈 +0.04%
Statements 98.10% 98.13% 📈 +0.03%
Functions 99.54% 99.54% ➡️ +0.00%
Branches 94.14% 94.14% ➡️ +0.00%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/workdir-setup.ts 92.7% → 94.5% (+1.82%) 92.7% → 94.5% (+1.82%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@copilot Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

Address Copilot review feedback: place transaction-end-before-headers
entries between valid tunnel entries (not after them) to preserve
coverage of order-dependent filtering logic.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Security Guard has started processing this pull request

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini completed. All facets verified. 💎

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude passed

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Contribution Check completed successfully!

Contribution guidelines review complete for PR #5659: no important issues found. The change is a scoped test refactor, includes/updates tests in the appropriate test file, has a clear PR description, and does not require documentation updates.

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

  • API status: ✅ PASS
  • gh check: ✅ PASS
  • File status: ✅ PASS

Overall result: PASS

Generated by Smoke Claude for #5659 · 36.2 AIC · ⊞ 3.3K ·

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct) Mode ✅

GitHub MCP — Connected, PR data retrieved
github.com Connectivity — HTTP 200
File Write/Read — Successful
BYOK Inference — Active (direct mode via api-proxy → api.githubcopilot.com)

Status: PASS — Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY)

Assignees: @lpcox @Copilot

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

Copy link
Copy Markdown
Contributor

🔬 Smoke Test Results

Test Status
GitHub MCP connectivity
GitHub.com HTTP ✅ 200
File write/read

Overall: PASS

PR: refactor: deduplicate transaction-end-before-headers test fixtures
Author: @Copilot · Assignees: @lpcox, @Copilot

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

Copy link
Copy Markdown
Contributor

🔥 Smoke Test: Copilot PAT Auth — PASS

Test Result
GitHub MCP (list PRs)
GitHub.com connectivity
File write/read

Overall: PASS · Auth mode: PAT (COPILOT_GITHUB_TOKEN)

PR: refactor: deduplicate transaction-end-before-headers test fixtures · author @Copilot · assignees @lpcox @Copilot

🔑 PAT report filed by Smoke Copilot PAT

@github-actions

Copy link
Copy Markdown
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3 ❌ NO
Node.js v24.17.0 v22.23.0 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall: ❌ Tests did not pass — Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot

@github-actions

Copy link
Copy Markdown
Contributor

🔭 Smoke Test: API Proxy OpenTelemetry Tracing

Scenario Result Notes
1. Module Loading otel.js loads; exports startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled + test internals
2. Test Suite 59 passed, 0 failed across otel.test.js + otel-fanout.test.js
3. Env Var Forwarding api-proxy-env-config.ts forwards GH_AW_OTLP_ENDPOINTS, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, GITHUB_AW_OTEL_TRACE_ID, GITHUB_AW_OTEL_PARENT_SPAN_ID, OTEL_SERVICE_NAME
4. Token Tracker Integration onUsage callback present in token-tracker-http.js (lines 283, 324, 326) — confirmed OTEL hook point
5. OTEL Diagnostics 1 span exported to /tmp/gh-aw/otel.jsonl (gh-aw.agent.setup, run 28340214495) with correct trace context and resource attributes

All scenarios pass. ✅

📡 OTel tracing validated by Smoke OTel Tracing

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox

  • GitHub MCP Testing: ✅
  • GitHub.com Connectivity: ✅
  • File Write/Read Test: ✅
  • BYOK Inference Test: ✅

Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) authenticated via Microsoft Entra

Status: PASS

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: GitHub Actions Services Connectivity

Check Result
Redis PING ❌ Timeout — no response on host.docker.internal:6379
PostgreSQL pg_isready ❌ No response on host.docker.internal:5432
PostgreSQL SELECT 1 ❌ Timeout — connection failed

Overall: FAIL

host.docker.internal resolves correctly (172.17.0.1) but both Redis (port 6379) and PostgreSQL (port 5432) are unreachable. Service containers may not be running in this workflow context.

🔌 Service connectivity validated by Smoke Services

@github-actions

Copy link
Copy Markdown
Contributor

Gemini Engine Smoke Test Results

Overall Status: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • localhost

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "localhost"

See Network Configuration for more information.

💎 Faceted by Smoke Gemini

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx All passed ✅ PASS
Node.js execa All passed ✅ PASS
Node.js p-limit All passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Note: Java tests initially failed due to ~/.m2 directory being owned by root. Fixed by using -Dmaven.repo.local pointing to a writable path.

Generated by Build Test Suite for #5659 · 60.6 AIC · ⊞ 7.8K ·

@github-actions

Copy link
Copy Markdown
Contributor

@Copilot @lpcox
MCP PR List: ✅
GitHub.com: ✅
File I/O: ✅
BYOK Inference: ✅
Running in direct BYOK mode via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
Overall: PASS

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)

@github-actions

Copy link
Copy Markdown
Contributor

Smoke test results:

  • fix: handle EACCES during chroot-home cleanup in rootless Docker
  • docs(runner-doctor): add C7 failure mode for DIFC probe on *.ghe.com
  • refactor: deduplicate transaction-end-before-headers test fixtures by Copilot
  • GitHub title check ✅
  • File write/readback ✅
  • Build (npm ci && npm run build) ✅
    Overall: PASS

🔮 The oracle has spoken through Smoke Codex

@lpcox lpcox merged commit 1d90760 into main Jun 29, 2026
88 checks passed
@lpcox lpcox deleted the copilot/fix-duplicate-log-aggregator-tests branch June 29, 2026 02:54
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.

3 participants