Skip to content

refactor(shared): move the session history types into their own file - #1753

Merged
devswha merged 1 commit into
mainfrom
refactor/types-session-history
Oct 23, 2026
Merged

devswha merged 1 commit into
mainfrom
refactor/types-session-history

Conversation

@devswha

@devswha devswha commented Oct 23, 2026

Copy link
Copy Markdown
Owner

The last type-only slice of phase 2 (plan .omo/plans/feature-slices-plan.md, section 7, item 7). It follows the other type-only slices (#1699 to #1713) and waited for the session resume PR (#1598), which added SessionResumeSource, SessionResumeRequest and SessionResumeResponse beside the history types. The session history types move out of shared/protocol.ts into shared/session-history.ts. Their routes were already split out (server/session-history-routes.ts), so only the contract types were left in protocol.ts.

What changes

  • Moved: SessionHistoryAgent, SessionResumeSource, SessionHistoryRow, SessionResumeRequest, SessionResumeResponse, SessionHistoryResponse, verbatim with their doc comments, into the new shared/session-history.ts. The file holds types only, with no imports and no values.
  • Stays in protocol.ts: export type { SessionHistoryAgent, SessionResumeSource, SessionHistoryRow, SessionResumeRequest, SessionResumeResponse, SessionHistoryResponse } from "./session-history.ts"; at the old place, so every importer compiles unchanged.
  • No other protocol.ts declaration uses these names, so nothing else had to stay behind.

There is no behaviour to pin: types are erased at runtime, and the routes and their tests are untouched.

Checks

  • --color-moved: git diff --color-moved=plain origin/main...HEAD -- shared shows the declarations and their comments as moved (96 lines). The only other line is the re-export in protocol.ts.
  • Client imports: bun run typecheck passes on both tsconfigs, so every importer still compiles through the re-export. No file in src/ or site/ imports shared/session-history.ts.
  • HERDR_TEST_MODE=unit bun test server/session-history.test.ts server/machine-proxy.test.ts src/lib/sessionHistory.test.ts server/claude-store.test.ts: 190 pass, 0 fail. The routes' contract tests (server/api.contract.test.ts, server/device-access.contract.test.ts) run in CI's integration lane.
  • bun run check fast: passes (unit 6244 pass, 0 fail, 13 skip in 442 files, 8 at a time, 57.6s)

Outside PRs that touch the same files

No other maintainer PR touches these files. Outside contributors' PRs that touch shared/protocol.ts: #1714, #1706, #1652, #1442 and #1427.

Move-only: moved declarations plus one re-export line. No changelog fragment: users see no change.

The last type-only slice (plan: .omo/plans/feature-slices-plan.md, section 7):
SessionHistoryAgent, SessionResumeSource, SessionHistoryRow, SessionResumeRequest, SessionResumeResponse, SessionHistoryResponse
move verbatim from shared/protocol.ts into shared/session-history.ts (types
only). It waited for the session resume PR (#1598), which added the resume
types beside them. Their routes were already split out
(server/session-history-routes.ts); protocol.ts re-exports the names, so every
importer compiles unchanged.
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 1153e92 and ec5215f.

📒 Files selected for processing: 2
  • shared/protocol.ts
  • shared/session-history.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Refactor
    • Session-history and resume information now follow consistent shared definitions across the app. This update changes how that information is represented internally, without changing the available session-history or resume features or how they behave for users. No new user-facing functionality or changes to the session-history experience are included in this release.

Session-history types now reside in shared/session-history.ts. shared/protocol.ts re-exports them, preserving the existing exported type names.

Changes: Session-history types

Layer / File(s) Summary
Define and export session-history contracts
shared/session-history.ts, shared/protocol.ts
Adds shared types for session-history agents, rows, responses, and Claude resume requests. shared/protocol.ts re-exports these types.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Refactor

Possibly related issues

  • devswha/ovis#1643 requests contributor documentation links to session-history types in shared/protocol.ts. This PR keeps that path as a re-export but does not change the documentation.

Possibly related PRs

  • devswha/ovis#1598 added the session-history contracts that this PR moves to shared/session-history.ts.

Suggested reviewers: diegolhambi

Merge Risk: ⚪ Minimal · up to ec521

No actionable merge risk is identified for this type extraction; it is mergeable after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: moving the session history types into a dedicated shared file.
Description check Passed The description explains the change, resulting behavior, scope, validation results, and absence of runtime impact. It uses “What changes” and “Checks” instead of the template headings, but it provides…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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.
Full details: Description check

Explanation

The description explains the change, resulting behavior, scope, validation results, and absence of runtime impact. It uses “What changes” and “Checks” instead of the template headings, but it provides the required information in a complete form.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@devswha

devswha commented Oct 23, 2026

Copy link
Copy Markdown
Owner Author

Merge pass: move-only PR, merged on its checks without waiting for a CodeRabbit review, as AGENTS.md allows.

@devswha
devswha merged commit d7c3f82 into main Oct 23, 2026
17 checks passed
@devswha
devswha deleted the refactor/types-session-history branch October 23, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant