Skip to content

fix(ledger.lic): v1.4.1 change lootcap estimate from monthly to weekly#2313

Merged
mrhoribu merged 1 commit intomasterfrom
fix/ledger-v1.4.1
May 7, 2026
Merged

fix(ledger.lic): v1.4.1 change lootcap estimate from monthly to weekly#2313
mrhoribu merged 1 commit intomasterfrom
fix/ledger-v1.4.1

Conversation

@mrhoribu
Copy link
Copy Markdown
Contributor

@mrhoribu mrhoribu commented May 6, 2026

Summary by CodeRabbit

  • New Features
    • Transitioned loot cap calculations from monthly to weekly basis.
    • Added Daylight Saving Time-aware timezone handling for accurate week-boundary detection in America/New_York region.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

📝 Walkthrough

Walkthrough

The PR updates scripts/ledger.lic to replace monthly loot-cap estimation with a DST-aware weekly estimator. It adds TZInfo as a required dependency, implements week-boundary calculations in America/New_York timezone, and increments the version to 1.4.1 with corresponding release notes.

Changes

Ledger Weekly Loot Cap

Layer / File(s) Summary
Dependencies
scripts/ledger.lic
TZInfo gem added to the gems_to_load array to enable timezone and DST handling.
Core Implementation
scripts/ledger.lic
Monthly loot-cap estimator replaced with DST-aware weekly estimator that computes the start of the current week (Monday–Sunday, America/New_York) and filters transactions from week start to present; backward-compatible year/month parameters retained but marked unused.
Versioning & Documentation
scripts/ledger.lic
Version bumped from 1.4.0 to 1.4.1; release notes added describing the weekly loot cap change and DST-aware implementation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: converting the loot cap estimate calculation from monthly to weekly with DST awareness in v1.4.1.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ledger-v1.4.1

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/ledger.lic`:
- Around line 334-341: The method estimate_loot_cap currently accepts year and
month kwargs but silently ignores them which can mislead callers; update
estimate_loot_cap to detect non-default year or month inputs and fail loudly
(e.g., raise ArgumentError) when callers pass explicit year/month values, or
alternatively implement proper historical-week handling if desired; modify the
start of estimate_loot_cap (the method signature and the initial lines that set
_ = year; _ = month) to either validate and raise when year/month !=
Time.now.year/Time.now.month or to compute the correct historical window and use
those values instead, and add a clear error message explaining that historical
queries are unsupported and suggesting the new API if applicable.
- Line 69: The script fails on systems without system zoneinfo because it only
loads "tzinfo"; update the gems_to_load array (where gems_to_load = ["sequel",
"terminal-table", "tzinfo"]) to also include "tzinfo-data" so
TZInfo::Timezone.get calls (referenced around the TZInfo::Timezone.get usage)
will have timezone data available at runtime, and ensure the require/load
happens before any TZInfo usage to avoid TZInfo::DataSourceNotFound.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 73997127-18b3-4786-ae69-e1bc365a61bb

📥 Commits

Reviewing files that changed from the base of the PR and between 9a8a2f9 and b01cc63.

📒 Files selected for processing (1)
  • scripts/ledger.lic

Comment thread scripts/ledger.lic
Comment thread scripts/ledger.lic
@mrhoribu mrhoribu merged commit 419bffc into master May 7, 2026
4 checks passed
@mrhoribu mrhoribu deleted the fix/ledger-v1.4.1 branch May 7, 2026 18:17
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