Skip to content

Refactor option parser facade to direct re-exports and unify flag validation type#3428

Merged
lpcox merged 2 commits into
mainfrom
copilot/export-audit-remove-dead-public-exports
May 19, 2026
Merged

Refactor option parser facade to direct re-exports and unify flag validation type#3428
lpcox merged 2 commits into
mainfrom
copilot/export-audit-remove-dead-public-exports

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

src/parsers/* exposed a broad public API that was only consumed by src/option-parsers.ts, while the facade itself added pass-through wrappers and duplicated validation types. This made the parser surface look externally supported when it is effectively internal behind the facade.

  • Facade simplification

    • Replaced *Impl import + wrapper-function pattern in src/option-parsers.ts with direct export { ... } from ... re-exports for parser modules.
    • Removed redundant wrapper implementations and the local duplicate FlagValidationResult interface from the facade.
  • Type deduplication

    • Added src/types/validation.ts with a single shared FlagValidationResult definition.
    • Re-exported the type from src/types/index.ts.
    • Updated parser modules that previously defined their own copy:
      • src/parsers/rate-limit-parsers.ts
      • src/parsers/host-port-parsers.ts
  • Behavioral guard for facade contract

    • Added src/option-parsers-reexports.test.ts to assert the facade exports are direct references to the underlying parser functions (not wrappers).
// src/option-parsers.ts
export {
  buildRateLimitConfig,
  validateRateLimitFlags,
  validateEnableOpenCodeFlag,
  validateEnableTokenSteeringFlag,
} from './parsers/rate-limit-parsers';

Copilot AI changed the title [WIP] Remove dead public exports in src/parsers submodules Refactor option parser facade to direct re-exports and unify flag validation type May 19, 2026
Copilot finished work on behalf of lpcox May 19, 2026 15:43
Copilot AI requested a review from lpcox May 19, 2026 15:43
@lpcox lpcox marked this pull request as ready for review May 19, 2026 21:35
Copilot AI review requested due to automatic review settings May 19, 2026 21:35
@github-actions
Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 95.57% 95.62% 📈 +0.05%
Statements 95.40% 95.46% 📈 +0.06%
Functions 96.55% 96.55% ➡️ +0.00%
Branches 87.91% 87.95% 📈 +0.04%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/option-parsers.ts 99.0% → 98.8% (-0.20%) 99.0% → 98.9% (-0.15%)
src/config-writer.ts 83.0% → 85.6% (+2.54%) 83.0% → 85.6% (+2.54%)

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

@github-actions
Copy link
Copy Markdown
Contributor

🔬 Smoke Test Results

Test Status
GitHub MCP (list PRs)
GitHub.com HTTP connectivity ❌ template vars unresolved
File write/read ❌ template vars unresolved

Overall: FAIL — pre-step outputs (${{ steps.smoke-data.outputs.* }}) were not substituted before agent execution.

PR: "Refactor option parser facade to direct re-exports and unify flag validation type" by @Copilot · Assignees: @lpcox, @Copilot

📰 BREAKING: Report filed by Smoke Copilot

@github-actions
Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK Offline Mode

Test Result
GitHub MCP (list PRs) ✅ PR #3414 "fix: switch doc-maintainer from copilot to claude engine"
GitHub.com connectivity ⚠️ Pre-step data unavailable (template vars unexpanded)
File write/read ⚠️ Pre-step data unavailable (template vars unexpanded)
BYOK inference (api-proxy → api.githubcopilot.com) ✅ Responding normally

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

Overall: PARTIAL — BYOK inference ✅, pre-step smoke data not injected.

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

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions
Copy link
Copy Markdown
Contributor

Smoke Test Results

✅ GitHub API: 2 PR entries verified
✅ Playwright: GitHub title confirmed
✅ File verify: smoke-test-claude-26108177203.txt exists

PASS — Claude engine validation complete

💥 [THE END] — Illustrated by Smoke Claude

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 reduces the apparent public surface area of src/parsers/* by simplifying the src/option-parsers.ts facade to use direct re-exports (instead of wrapper functions), and deduplicates the FlagValidationResult type into a single shared definition under src/types.

Changes:

  • Replaced wrapper functions in src/option-parsers.ts with direct export { ... } from ... re-exports.
  • Introduced a shared FlagValidationResult type in src/types/validation.ts and re-exported it from src/types/index.ts; updated parser modules to use it.
  • Added a Jest test to assert the facade exports are direct references to underlying parser exports.
Show a summary per file
File Description
src/types/validation.ts Adds shared FlagValidationResult type definition.
src/types/index.ts Re-exports FlagValidationResult from the types barrel.
src/parsers/rate-limit-parsers.ts Switches to importing the shared FlagValidationResult type.
src/parsers/host-port-parsers.ts Switches to importing the shared FlagValidationResult type.
src/option-parsers.ts Simplifies the facade to direct re-exports and removes duplicate type/wrappers.
src/option-parsers-reexports.test.ts Adds guard test ensuring facade exports are direct references (no wrappers).

Copilot's findings

Tip

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

  • Files reviewed: 6/6 changed files
  • Comments generated: 0

@github-actions
Copy link
Copy Markdown
Contributor

✅ GitHub merged PR review: fix: switch doc-maintainer from copilot to claude engine; Optimize Security Guard workflow token usage and reduce runaway turn cost
❌ Safe Inputs GH CLI: safeinputs-gh unavailable (fallback titles: Refactor option parser facade to direct re-exports and unify flag validation type; tests: replace host-env barrel imports with canonical host-env split modules)
✅ Playwright: GitHub title verified
❌ Tavily search: bridge exposed no search tools
✅ File writing + bash: smoke file created and read
❌ Discussion safe-input: github-discussion-query unavailable; discussion 3049 comment posted via fallback
✅ Build AWF: npm ci && npm run build
Overall status: FAIL

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

Chroot Version Comparison

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3
Node.js v24.15.0 v22.22.3
Go go1.22.12 go1.22.12

Result: Some versions differ between host and chroot. The smoke-chroot label was not added.

Tested by Smoke Chroot

@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

Generated by Build Test Suite for issue #3428 · ● 5.8M ·

@github-actions
Copy link
Copy Markdown
Contributor

Smoke Test: GitHub Actions Services Connectivity

Check Result
Redis PING (host.docker.internal:6379) ❌ No response
PostgreSQL pg_isready (host.docker.internal:5432) ❌ No response
PostgreSQL SELECT 1 ❌ No response

Overall: FAIL — service containers are not reachable via host.docker.internal or 127.0.0.1 from this environment.

🔌 Service connectivity validated by Smoke Services

@github-actions
Copy link
Copy Markdown
Contributor

Smoke test FAIL (Connectivity ❌)

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

@lpcox lpcox merged commit 9dded34 into main May 19, 2026
69 of 74 checks passed
@lpcox lpcox deleted the copilot/export-audit-remove-dead-public-exports branch May 19, 2026 22: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.

[Export Audit] Dead public exports in src/parsers/ submodules — exclusively consumed via option-parsers.ts facade

3 participants