-
-
Notifications
You must be signed in to change notification settings - Fork 317
refactor: rename five-hour terminology to session terminology #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Replace hardcoded FIVE_HOURS_MS constant with SESSION_DURATION_MS to better reflect Claude Code official billing session terminology. This aligns with Anthropic documented 5-hour session billing cycles and makes the code more semantically clear about what the time period represents. The constant value remains unchanged (5 * 60 * 60 * 1000 = 18000000ms) but the name now accurately describes it as a session duration rather than just five hours.
Rename five-hour-blocks.internal.ts to session-blocks.internal.ts and corresponding test file to better reflect Claude Code session terminology. Update all import statements across the codebase to reference the new file names. Files renamed: - five-hour-blocks.internal.ts → session-blocks.internal.ts - five-hour-blocks.internal.test.ts → session-blocks.internal.test.ts Updated imports in: - data-loader.ts - commands/blocks.ts - session-blocks.internal.test.ts
Update type definition from FiveHourBlock to SessionBlock throughout the session-blocks.internal.ts file to better reflect Claude Code session terminology. This change aligns the type name with Anthropic official billing session concept rather than just describing the duration. All function signatures and variable declarations within the file have been updated to use the new SessionBlock type.
Update all imports and function calls to use new SessionBlock terminology: - loadFiveHourBlockData → loadSessionBlockData - FiveHourBlock → SessionBlock - identifyFiveHourBlocks → identifySessionBlocks Updated files: - data-loader.ts: function name and return type - commands/blocks.ts: import, function calls, and type annotations This completes the transition from FiveHour terminology to Session terminology in the core data handling logic.
Update command descriptions and user messages to use "session" terminology instead of "5-hour" references: - Command descriptions: "5-hour billing blocks" → "session billing blocks" - Error messages: "No active 5-hour block found" → "No active session block found" - UI titles: "5-Hour Block Status" → "Session Block Status" - Report headers: "5-Hour Blocks" → "Session Blocks" Updated in commands/blocks.ts and mcp.ts to provide consistent user-facing terminology that aligns with Claude Code official session concept.
Update all test files to use new session terminology: - FIVE_HOURS_MS → SESSION_DURATION_MS - FiveHourBlock → SessionBlock - loadFiveHourBlockData → loadSessionBlockData - identifyFiveHourBlocks → identifySessionBlocks This fixes compilation errors after refactoring to session-based naming convention. All test logic remains the same, only terminology has been updated to match the new API.
|
Caution Review failedThe pull request is closed. WalkthroughThis change refactors all code, types, and tests from the "five-hour blocks" terminology to "session blocks." It updates function names, constants, type annotations, imports, exports, and user-facing descriptions, while preserving the underlying logic and behavior. No changes are made to the control flow or algorithms. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant DataLoader
participant SessionBlockLogic
User->>CLI: Run "blocks" command
CLI->>DataLoader: loadSessionBlockData(options)
DataLoader->>SessionBlockLogic: identifySessionBlocks(entries)
SessionBlockLogic-->>DataLoader: SessionBlock[]
DataLoader-->>CLI: SessionBlock[]
CLI-->>User: Display session block usage report
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (6)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @ryoppippi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request implements a comprehensive terminology refactor across the codebase, replacing all instances of 'five-hour' with 'session' to accurately reflect Claude Code's official billing model. This change improves semantic clarity and aligns the application's language with Anthropic's documentation, without introducing any functional changes or breaking existing behavior. The refactor includes renaming constants, types, functions, and files, along with updating all user-facing text and ensuring test coverage remains intact.
Highlights
- Terminology Refactor: All instances of 'five-hour' terminology, including constants (
FIVE_HOURS_MStoSESSION_DURATION_MS), types (FiveHourBlocktoSessionBlock), and function names (identifyFiveHourBlockstoidentifySessionBlocks,loadFiveHourBlockDatatoloadSessionBlockData), have been renamed to 'session' terminology. - File Renaming: The core logic file
five-hour-blocks.internal.tsand its corresponding test filefive-hour-blocks.internal.test.tshave been renamed tosession-blocks.internal.tsandsession-blocks.internal.test.tsrespectively, reflecting the new terminology. - User Experience Alignment: User-facing text, such as command descriptions, error messages, and UI labels, has been updated to consistently use 'session' terminology, ensuring clarity and alignment with Claude Code's official billing concepts.
- Codebase Consistency: All affected files, including command handlers, data loaders, and their respective tests, have been updated to use the new 'session' naming conventions, maintaining full functionality and passing all existing tests.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the codebase to replace 'five-hour' terminology with 'session' terminology, aligning with Claude Code's billing session concept. The changes include renaming constants, types, functions, and files, as well as updating user-facing text and tests. The changes improve the semantic accuracy of the code and align it with Anthropic's official terminology. I have provided feedback to improve the descriptions and logging.
| export const blocksCommand = define({ | ||
| name: 'blocks', | ||
| description: 'Show usage report grouped by 5-hour billing blocks', | ||
| description: 'Show usage report grouped by session billing blocks', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const projection = projectBlockUsage(block); | ||
|
|
||
| logger.box('Current 5-Hour Block Status'); | ||
| logger.box('Current Session Block Status'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| else { | ||
| // Table view for multiple blocks | ||
| logger.box('Claude Code Token Usage Report - 5-Hour Blocks'); | ||
| logger.box('Claude Code Token Usage Report - Session Blocks'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| server.addTool({ | ||
| name: 'blocks', | ||
| description: 'Show usage report grouped by 5-hour billing blocks', | ||
| description: 'Show usage report grouped by session billing blocks', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor: rename five-hour terminology to session terminology
Summary
This PR refactors the codebase to use session terminology instead of five-hour terminology, aligning with Claude Code official billing session concept. Based on Anthropic documentation, Claude Code uses 5-hour sessions for billing, so the code should reflect this semantic meaning rather than just describing the duration.
Changes Made
Why This Change?
After researching Claude Code billing documentation, I found that the 5-hour period represents Claude official session billing cycle. Users start a session with their first message, and it lasts for 5 hours. The term session is more semantically accurate than five-hour blocks and aligns with Anthropic official terminology.
Impact
Test Plan
Summary by CodeRabbit