Skip to content

refactor(types): extract value clusters into types/tools and types/wire leaves - #2019

Draft
lidge-jun wants to merge 2 commits into
devfrom
codex/split-wp1-types
Draft

refactor(types): extract value clusters into types/tools and types/wire leaves#2019
lidge-jun wants to merge 2 commits into
devfrom
codex/split-wp1-types

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

First stacked PR of the mega-file split program (devlog/_plan/260818_megafile_split_program, risk basis in 000_risk_assessment.md). Pure move, zero behavior change: the two runtime value clusters leave src/types.ts (1867 -> 1729 lines) into leaf modules, with src/types.ts keeping every current export as a barrel re-export so no consumer or test import changes.

  • src/types/tools.ts — OcxTool, OcxToolChoice, namespacedToolName, toolChoiceAliases, toolAllowedByChoice, resolveToolChoiceWireName, modelInList, isAllowedToolChoice, toolChoiceToolPredicate. Zero imports; OcxTool travels with the cluster so the leaf never imports back through its own barrel (audit finding).
  • src/types/wire.ts — UPSTREAM_HTTP_VERSION_VALUES, REASONING_SUMMARY_DELIVERY_VALUES, OPENAI_PROVIDER_TIER_VERSION, MODEL_ADAPTER_OVERRIDE_ALLOWED, ANTHROPIC_WIRE_MODELS internals, captureWireAdapterHardPins, isWirePinnedModel, pinnedWireAdapter, UpstreamHttpVersion, ReasoningSummaryDelivery, CodexAccountMode. Zero imports.
  • src/types.ts — moved bodies deleted; top-of-file import type lines bind the aliases the remaining interfaces still reference (export type ... from does not bind locally — audit finding); in-place export/export type blocks keep the public surface byte-compatible. Extensionless specifiers so the lab-boundary walker follows the new edges.

Value identity is preserved by ESM re-export semantics: one declaration site per const, so MODEL_ADAPTER_OVERRIDE_ALLOWED stays a single ReadonlySet instance. The plan was audited by two independent reviewers (grok-4.6 NEAR-PASS, gpt-5.6-sol FAIL on a barrel-cycle recipe defect) and amended before implementation; both blockers were plan-recipe issues, fixed as described above.

Next in the stack: type-cluster split (request/config/provider/accounts) on this branch's head.

Verification

At head 194f9f2 on remote validation host (Linux):

  • bun run test: 13,201 pass / 15 skip / 0 fail across 840 files (482.9s)
  • tests/core-lab-boundary.test.ts: 13 pass standalone (new static edges types.ts -> types/tools.ts, types/wire.ts are walked and stay off src/lab/)
  • bun run privacy:scan: passed
  • bun run typecheck: exit 0
  • Source diff scope: exactly 3 files under src/ (git diff --stat dev..HEAD -- src)

Checklist

  • Targets dev
  • Focused tests cover the changed subsystem (full suite green — shared runtime file)
  • No user-facing behavior change, so no docs-site update needed
  • privacy:scan green

Summary by CodeRabbit

  • New Features

    • Added expanded tool metadata and tool-choice utilities, including namespaced tools, aliases, validation, and policy matching.
    • Added shared configuration options for upstream HTTP versions, reasoning-summary delivery, account modes, provider tiers, and model adapter overrides.
    • Added automatic handling for provider- and model-specific wire adapter requirements.
  • Refactor

    • Reorganized tool and wire-related functionality while preserving existing public exports and integrations.

@github-actions github-actions Bot added the intake: hygiene-blocked Deterministic PR hygiene checks failed label Aug 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Deterministic hygiene checks failed.

  • missing_regression_test — Behavior changed under src/ or gui/src/ without a test change. Add focused coverage or obtain test-exception-approved.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Aug 18, 2026
@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • hygiene: missing_regression_test.

What to do

  • Fix missing_regression_test — Behavior changed under src/ or gui/src/ without a test change. Add focused coverage or obtain test-exception-approved.

This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 18, 2026 11:07
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bc3e0f48-3374-433a-9f0c-0c7a86215fb7

📥 Commits

Reviewing files that changed from the base of the PR and between 542ea37 and 194f9f2.

📒 Files selected for processing (4)
  • devlog/_plan/260818_megafile_split_program/010_wp1_types_value_leaves.md
  • src/types.ts
  • src/types/tools.ts
  • src/types/wire.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The PR moves tool utilities and wire-policy logic from src/types.ts into src/types/tools.ts and src/types/wire.ts. src/types.ts preserves the existing public exports through imports and re-exports. The WP1 plan documents scope and verification criteria.

Changes

Types value-leaf extraction

Layer / File(s) Summary
Tool metadata and choice utilities
src/types/tools.ts
Adds OcxTool, OcxToolChoice, tool-name aliasing, model matching, allowed-tool validation, and tool-choice predicates.
Wire policy declarations and resolution
src/types/wire.ts
Adds shared wire-policy types and constants, plus provider/model adapter pinning helpers.
Barrel re-exports and extraction plan
src/types.ts, devlog/_plan/260818_megafile_split_program/010_wp1_types_value_leaves.md
Moves local declarations out of src/types.ts, re-exports the extracted bindings, and documents scope, verification, and import-graph constraints.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 194f9

This refactor moves existing type/value definitions into leaf modules while preserving the public exports and runtime identity; no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

Suggested reviewers: ingwannu

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main refactor: extracting value clusters from types.ts into types/tools and types/wire.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/split-wp1-types

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). intake: hygiene-blocked Deterministic PR hygiene checks failed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant