Skip to content

Deduplicate shared ParsedLogEntry fixtures across log tests#4208

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-duplicate-parsedlogentry
Open

Deduplicate shared ParsedLogEntry fixtures across log tests#4208
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-duplicate-parsedlogentry

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 2, 2026

Several log tests were each carrying their own copy of the same canonical ParsedLogEntry and Squid access log line, which made the test fixture shape drift-prone. This consolidates those defaults into one test utility and updates the affected log suites to consume the shared fixture.

  • Shared log test fixture

    • Added src/logs/log-test-fixtures.test-utils.ts
    • Centralizes the canonical parsed entry via createLogEntry(overrides)
    • Adds createRawLogLine(overrides) so tests using raw Squid lines derive from the same source of truth
  • Updated affected log test suites

    • log-formatter.test.ts now builds allowed/denied entries from the shared fixture
    • log-aggregator.test.ts imports the shared parsed-entry factory and raw log-line helper instead of defining its own local defaults
    • audit-enricher.test.ts keeps its local makeEntry() wrapper but now composes it from the shared fixture
    • log-streamer.test.ts replaces duplicated raw Squid log strings with createRawLogLine()
  • Result

    • The canonical log shape and sample values now live in one place
    • Tests still override only the fields relevant to each scenario
import { createLogEntry, createRawLogLine } from './log-test-fixtures.test-utils';

const allowedEntry = createLogEntry();

const deniedEntry = createLogEntry({
  statusCode: 403,
  decision: 'TCP_DENIED:HIER_NONE',
  isAllowed: false,
});

const logLine = createRawLogLine({ clientPort: '39749' });

Copilot AI changed the title [WIP] Refactor duplicate ParsedLogEntry fixture in test files Deduplicate shared ParsedLogEntry fixtures across log tests Jun 2, 2026
Copilot finished work on behalf of lpcox June 2, 2026 14:50
Copilot AI requested a review from lpcox June 2, 2026 14:50
@lpcox lpcox marked this pull request as ready for review June 2, 2026 15:08
Copilot AI review requested due to automatic review settings June 2, 2026 15:08
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 96.35% 96.40% 📈 +0.05%
Statements 96.21% 96.26% 📈 +0.05%
Functions 98.27% 98.27% ➡️ +0.00%
Branches 90.42% 90.47% 📈 +0.05%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/config-writer.ts 89.3% → 90.9% (+1.65%) 89.3% → 90.9% (+1.65%)
✨ New Files (1 files)
  • src/logs/log-test-fixtures.test-utils.ts: 100.0% lines

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

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 consolidates duplicated Squid ParsedLogEntry and raw access-log fixtures across multiple log-related unit test suites into a shared test utility, reducing drift risk and making fixture updates easier to manage.

Changes:

  • Added a shared log test fixture utility (createLogEntry, createRawLogLine) under src/logs/.
  • Updated log test suites to consume the shared fixture instead of maintaining local copies of the canonical entry/log line.
  • Simplified/standardized per-test overrides to focus only on scenario-specific fields.
Show a summary per file
File Description
src/logs/log-test-fixtures.test-utils.ts Introduces shared factories for canonical parsed log entries and raw Squid log lines.
src/logs/log-streamer.test.ts Replaces duplicated raw log strings with createRawLogLine() usage.
src/logs/log-formatter.test.ts Switches allowed/denied ParsedLogEntry fixtures to createLogEntry() with overrides.
src/logs/log-aggregator.test.ts Uses shared fixture helpers for parsed entries and selected raw log inputs; removes local helper duplication.
src/logs/audit-enricher.test.ts Updates the local makeEntry() wrapper to compose from the shared createLogEntry() fixture.

Copilot's findings

Tip

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

  • Files reviewed: 5/5 changed files
  • Comments generated: 1

Comment thread src/logs/log-test-fixtures.test-utils.ts Outdated
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Smoke Test: Claude Engine

  • ✅ GitHub API: 2 PR entries found
  • ✅ GitHub check: playwright_check=✅ PASS
  • ✅ File verify: smoke-test-claude-26834098742.txt exists

Result: PASS

💥 [THE END] — Illustrated by Smoke Claude

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Recent merged PRs:\n- refactor(api-proxy): extract duplicate collectLogOutput() into shared test helper\n- [Test Coverage] container-lifecycle.ts branch coverage\n\nChecks:\n- GitHub reads ✅\n- Playwright ✅\n- File write/read ✅\n- Discussion lookup/comment ✅\n- Build ✅\n\nOverall: PASS

Warning

Firewall blocked 1 domain

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

  • registry.npmjs.org

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

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

🔥 Smoke Test: Copilot BYOK (Offline) Mode

Test Result
GitHub MCP connectivity ✅ PR list returned (latest merged: #4207)
GitHub.com HTTP ⚠️ Pre-step data unavailable (template not expanded)
File write/read ⚠️ Pre-step data unavailable (template not expanded)
BYOK inference (agent → api-proxy → api.githubcopilot.com) ✅ Responding in BYOK offline mode

Running in BYOK offline mode (COPILOT_OFFLINE=true) via api-proxy → api.githubcopilot.com.

PR author: @Copilot · Assignees: @lpcox, @Copilot

Overall: PARTIAL (pre-step outputs not injected into prompt)

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

🔬 Smoke Test Results

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

PR: Deduplicate shared ParsedLogEntry fixtures across log tests
Author: @Copilot | Assignees: @lpcox, @Copilot

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Chroot Smoke Test Results

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

Result: FAILED — Python and Node.js versions differ between host and chroot.

Tested by Smoke Chroot

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Gemini Smoke Test Results:

  • GitHub MCP Testing: ❌
  • GitHub.com Connectivity: ❌
  • File Writing Testing: ✅
  • Bash Tool Testing: ✅

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

github-actions Bot commented Jun 2, 2026

🏗️ 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

Generated by Build Test Suite for issue #4208 · sonnet46 1.1M ·

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Smoke Test Results — Services Connectivity

Check Result
Redis PING ❌ timeout
PostgreSQL pg_isready ❌ no response
PostgreSQL SELECT 1 ❌ connection timeout

Overall: FAIL

host.docker.internal resolves to 172.17.0.1 but all ports are unreachable — service containers appear not to be running or accessible in this environment.

🔌 Service connectivity validated by Smoke Services

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.

[Duplicate Code] ParsedLogEntry fixture object duplicated across four log test files

3 participants