Skip to content

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

Merged
lidge-jun merged 1 commit into
devfrom
codex/split-wp1b-type-clusters
Aug 19, 2026
Merged

refactor(types): move type clusters to leaves; types.ts becomes a pure barrel#2023
lidge-jun merged 1 commit into
devfrom
codex/split-wp1b-type-clusters

Conversation

@lidge-jun

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

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

Summary by CodeRabbit

  • Refactor
    • Reorganized shared type definitions into focused request, configuration, provider, and account modules.
    • Preserved existing public type access through a unified export surface.
    • Added comprehensive contracts for account data, provider settings, routing, retries, tool calls, reasoning, search, usage, and integrations.
  • Documentation
    • Added a plan documenting the type organization, dependencies, compatibility criteria, and risks.

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ef531496-0537-4fcb-82a9-b4a70b7e9306

📥 Commits

Reviewing files that changed from the base of the PR and between da86a83 and a0f8c01.

📒 Files selected for processing (6)
  • devlog/_plan/260818_megafile_split_program/020_wp1b_type_clusters.md
  • src/types.ts
  • src/types/accounts.ts
  • src/types/config.ts
  • src/types/provider.ts
  • src/types/request.ts

📝 Walkthrough

Walkthrough

The PR splits the shared type declarations into request, provider, configuration, and account modules. src/types.ts remains the public barrel and preserves runtime wire exports and type re-exports.

Changes

Type Cluster Split

Layer / File(s) Summary
Request contracts
src/types/request.ts
Adds request, message, content, tool-call, continuation, adapter-event, citation, and usage types.
Provider contracts
src/types/provider.ts
Adds provider policy, routing, retry, pricing, pacing, tier, repair, and provider configuration types.
Account contracts
src/types/accounts.ts
Adds account identity, credential, and credential-record interfaces.
Configuration contracts
src/types/config.ts
Adds integration, storage, routing, account-pool, sidecar, token-guardian, and main configuration contracts.
Barrel exports and extraction plan
src/types.ts, devlog/_plan/260818_megafile_split_program/020_wp1b_type_clusters.md
Replaces inline declarations with grouped type-only re-exports, preserves wire exports, and documents the extraction plan and compatibility criteria.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested reviewers: ingwannu

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/split-wp1b-type-clusters

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.

Automatic draft conversion failed (token cannot change draft status). Please convert this pull request to a draft manually. The required enforce-target check will keep failing until every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 18, 2026 11:48
@lidge-jun
lidge-jun force-pushed the codex/split-wp1-types branch from 194f9f2 to 35990f6 Compare August 19, 2026 10:10
@lidge-jun
lidge-jun force-pushed the codex/split-wp1b-type-clusters branch from b2ac250 to 874598b Compare August 19, 2026 10:11
@lidge-jun

Copy link
Copy Markdown
Owner Author

리뷰 · 우선순위 24 / 80

draft 이고 intake: hygiene-blocked 입니다. base 는 dev 가 아니라 codex/split-wp1-types (#2019) 입니다. 이 목록의 다른 PR 과 달리 dev 위 단독 리뷰가 아닙니다. 부모 없이는 Files changed 가 스택 diff 로 커집니다. src/types.ts 1727줄을 103줄 barrel 로 줄이고 request/config/provider/accounts 리프로 옮기는 type-only 이동입니다. runtime value 블록(tools/wire)은 barrel 에 남깁니다.

RefreshPolicy 를 config 가 아니라 provider 리프로 둔 것은 OcxProviderConfig.refreshPolicy 만 쓰기 때문입니다. config→provider 한 방향입니다. src/types/request.tsTierDecision / TierObservationContext 를 provider 에서 가져옵니다. 인라인 import("./adapters/cursor/...")../adapters/cursor/... 로 바뀝니다. export * 는 없고 named export type 만 씁니다. 런타임 이름 중복을 피하려는 선택입니다.

hygiene 이 빨간 채로 13201 pass / typecheck 0 을 본문에 적었습니다. 이 체크아웃에서 그 스위트를 다시 돌리지는 않았습니다. 새 테스트는 없고 core-lab-boundary 가 barrel 의 value re-export 를 걷는다고 합니다. type-only 리프는 런타임 그래프에 안 타야 합니다. 선언이 두 리프에 겹치면 typecheck 가 깨지므로, 그 검사는 컴파일에 의존합니다.

해결방안: #2019 를 먼저 머지하고 이 PR 을 dev 로 retarget 한 뒤 hygiene 을 고치십시오. barrel 이 public 이름(OcxConfig, OcxParsedRequest, OcxProviderConfig 등)을 전부 re-export 하는지 src/index.ts 와 한 번 더 맞추십시오. draft 를 유지하고 동작 변경이 없는 이동만 남기십시오.

이 댓글은 grok-bot이 작성했습니다

@lidge-jun lidge-jun mentioned this pull request Aug 19, 2026
7 tasks
@lidge-jun
lidge-jun force-pushed the codex/split-wp1-types branch 2 times, most recently from a2eb3c3 to 3ddae40 Compare August 19, 2026 13:22
@lidge-jun
lidge-jun changed the base branch from codex/split-wp1-types to dev August 19, 2026 13:23
…e barrel

Recut onto the rebased WP1 parent rather than rebased onto it. A rebase
conflicted across the whole file for a mechanical reason: this commit rewrites
types.ts into a 103-line barrel, so any dev commit that adds a declaration to
the old 1884-line file collides with the rewrite everywhere.

Three declarations landed on dev after the fork point and are re-homed into the
leaf that owns their cluster rather than dropped:

- OcxReasoningReplayIdentity.credentialDurableIdentity (#1926) -> types/request
- CodexAccount.planSource and .planCredentialGeneration -> types/accounts

Verified: tsc --noEmit clean, 150 tests pass across the two suites that read
these types most directly.
@lidge-jun
lidge-jun force-pushed the codex/split-wp1b-type-clusters branch from 874598b to a0f8c01 Compare August 19, 2026 13:24
@lidge-jun
lidge-jun marked this pull request as ready for review August 19, 2026 13:25
@lidge-jun
lidge-jun merged commit 2235f45 into dev Aug 19, 2026
5 of 7 checks passed
@lidge-jun
lidge-jun deleted the codex/split-wp1b-type-clusters branch August 20, 2026 13:30
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