Skip to content

refactor(types): move type clusters to leaves; types.ts becomes a pure barrel - #2023

Draft
lidge-jun wants to merge 2 commits into
codex/split-wp1-typesfrom
codex/split-wp1b-type-clusters
Draft

refactor(types): move type clusters to leaves; types.ts becomes a pure barrel#2023
lidge-jun wants to merge 2 commits into
codex/split-wp1-typesfrom
codex/split-wp1b-type-clusters

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

Stack (merge bottom-up):

# PR Layer Review focus
2 this type clusters -> leaves ← you are here name inventory + import edges
1 #2019 value clusters -> leaves runtime identity

Depends on #2019. Review this PR's diff only.

Layer 2 of the mega-file split program (devlog/_plan/260818_megafile_split_program). src/types.ts (1727 lines) becomes a 103-line pure barrel; every type cluster moves to a type-only leaf:

  • src/types/request.ts (352) — replay identity, OcxParsedRequest, messages/content, OcxRequestOptions, AdapterEvent, usage/citation.
  • src/types/config.ts (812) — OcxClaudeCodeConfig, desktop profiles, storage/custom-model/api-key, OcxConfig, combos, routing profiles, token guardian, sidecar configs.
  • src/types/provider.ts (515) — RefreshPolicy (relocated from the config cluster: its only consumer is OcxProviderConfig.refreshPolicy, and leaving it would create a config<->provider type cycle), OpenRouter routing, item-id repair, retry/pacing, FastWire/AttemptTierOutcome/TierObservationContext/TierDecision, OcxProviderConfig. Two inline import("./adapters/cursor/...") type queries rewritten to ../adapters/cursor/....
  • src/types/accounts.ts (28) — CodexAccount records.

The two runtime value re-export blocks from layer 1 (tools + wire) stay in the barrel unchanged, so the runtime import graph is untouched: the protected responses/core.ts -> types -> types/tools edge is identical, and type-only leaves are erased. Named re-exports only — no export * (would duplicate runtime names).

Independently audited twice (grok-4.6, gpt-5.6-sol) before implementation; audits corrected cluster boundaries, caught 3 missing dependency edges (request->provider tier types, config->accounts CodexAccount, the RefreshPolicy cycle) and the cursor path rewrites. Recipe recorded in devlog 020_wp1b_type_clusters.md.

Verification

At head b2ac250 on the remote validation host (Linux):

  • bun run test: 13,201 pass / 15 skip / 0 fail across 840 files (495.6s) — pass count identical to layer 1's baseline, proving zero behavior change
  • tests/core-lab-boundary.test.ts: 13 pass
  • bun run typecheck: exit 0
  • Duplicate-declaration check: every moved name declared in exactly one leaf

Checklist

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • ^dev$
  • ^preview$

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 51197aa4-787c-4771-b743-0633c00edd7d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@github-actions github-actions Bot added chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). intake: hygiene-blocked Deterministic PR hygiene checks failed labels 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 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.

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