Skip to content

fix(killtracker): v2.12 codex tracking#2336

Open
mrhoribu wants to merge 3 commits into
masterfrom
fix/killtracker-v2.12
Open

fix(killtracker): v2.12 codex tracking#2336
mrhoribu wants to merge 3 commits into
masterfrom
fix/killtracker-v2.12

Conversation

@mrhoribu

@mrhoribu mrhoribu commented May 25, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Complete codex tracking with weekly metrics, per-week/search counters, and "Since Last Codex" stats
    • New codex report command and expanded summary report (totals, this week, remaining, averages)
    • Codex finds exportable to external spreadsheets; bulk submission included
    • Codex events now merged into gemstones/dust reporting
  • Bug Fixes

    • Improved robustness when loading persisted data with warnings and safe abort on invalid files

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4b45143d-f503-43ef-a9b7-58218b99a0e3

📥 Commits

Reviewing files that changed from the base of the PR and between ca0fa7c and 362ed43.

📒 Files selected for processing (1)
  • scripts/killtracker.lic
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/killtracker.lic

📝 Walkthrough

Walkthrough

Adds codex find/search persistence and counters, parses codex-found and onslaught-search events, enforces weekly-cap eligibility, snapshots and backfills weekly codex totals, adds summary and detailed codex reports, supports external spreadsheet submission for codex records, and hardens YAML loading/validation.

Changes

Codex Tracking Feature

Layer / File(s) Summary
Changelog, regexes, and constants
scripts/killtracker.lic
Changelog updated to v2.12. Adds FOUND_CODEX matcher, CODEX_WEEKLY_CAP (default 10), and ONSLAUGHT_CREATURES regex.
Data init and YAML load hardening
scripts/killtracker.lic
Validates YAML loads are Hash, adds log_data_warning, initializes persisted codex maps/counters (:codex_found, :weekly_codex, :weekly_codex_searches, :searches_since_codex), and tightens legacy-migration guards.
Weekly snapshot, reset and backfill
scripts/killtracker.lic
Weekly reset writes codex totals into :weekly_counts and resets weekly codex counters. Backfill resets codex counters and recomputes :weekly_codex from stored :codex_found timestamps and reports recalculated totals.
Downstream parsing and eligibility gating
scripts/killtracker.lic
parse_downstream records codex finds with week/search snapshots, resets :searches_since_codex, distinguishes ascension vs onslaught searches, and increments codex search counters only when codex_currently_eligible? (based on CODEX_WEEKLY_CAP).
Summary, help, and detailed codex reports
scripts/killtracker.lic
Adds ;kt codex report help entry. summary_report computes codex totals, this-week searches, remaining slots, status, averages, and "Since Last Codex". Adds Killtracker.codex_report and merges codex into gemstones_report.
Send-to-sheet and command dispatch
scripts/killtracker.lic
send_to_sheet supports ev_type == "codex". send_all_finds streams codex records in a dedicated phase. Main loop enqueues "found codex" announcements and routes /send codex report/. Command dispatch adds /codex report/.
Eligibility file checks and data validation
scripts/killtracker.lic
Validates jewel-eligibility YAML as Hash with warnings. validate_data includes codex counters and enforces :weekly_codexCODEX_WEEKLY_CAP.

🎯 4 (Complex) | ⏱️ ~45 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 'fix(killtracker): v2.12 codex tracking' accurately summarizes the main change: adding codex tracking functionality to Killtracker at version 2.12, which includes tracking, reporting, and external submission features.
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/killtracker-v2.12

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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/killtracker.lic`:
- Around line 425-426: Don't reset $killtracker[:weekly_codex_searches] unless
you also rebuild it; remove the line that sets
$killtracker[:weekly_codex_searches] = 0 or replace it with logic that
recomputes weekly_codex_searches from the same data used to rebuild
$killtracker[:weekly_codex]. Locate the assignments to
$killtracker[:weekly_codex] and $killtracker[:weekly_codex_searches] and either
only zero/recompute weekly_codex or add code to aggregate existing kill
records/events into $killtracker[:weekly_codex_searches] (same
time-window/bucketing logic used for weekly_codex) so the count remains correct
after running the fix.
- Around line 1225-1228: The codex event is currently recording the gem search
counter ($killtracker[:weekly_ascension_searches]) into ev[:searches_week] which
miscounts codex-only eligibility; change the stored value to the codex counter
($killtracker[:weekly_codex]) so that the codex record created at
$killtracker[:codex_found][key] uses $killtracker[:searches_since_codex] and
$killtracker[:weekly_codex] (keep the existing keys searches_since and
searches_week).
🪄 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: d9d5712d-6b9d-4984-8123-db387ee567f9

📥 Commits

Reviewing files that changed from the base of the PR and between ce2925a and ca0fa7c.

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

Comment thread scripts/killtracker.lic
Comment on lines +425 to +426
$killtracker[:weekly_codex] = 0
$killtracker[:weekly_codex_searches] = 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Don't zero weekly_codex_searches unless you also rebuild it.

This method recomputes weekly_codex, but not weekly_codex_searches. After ;kt fix find count, the codex summary added in this PR will show 0 current-week codex searches until more kills arrive, even if the previous value was correct.

🤖 Prompt for 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.

In `@scripts/killtracker.lic` around lines 425 - 426, Don't reset
$killtracker[:weekly_codex_searches] unless you also rebuild it; remove the line
that sets $killtracker[:weekly_codex_searches] = 0 or replace it with logic that
recomputes weekly_codex_searches from the same data used to rebuild
$killtracker[:weekly_codex]. Locate the assignments to
$killtracker[:weekly_codex] and $killtracker[:weekly_codex_searches] and either
only zero/recompute weekly_codex or add code to aggregate existing kill
records/events into $killtracker[:weekly_codex_searches] (same
time-window/bucketing logic used for weekly_codex) so the count remains correct
after running the fix.

Comment thread scripts/killtracker.lic
Comment on lines +1225 to +1228
$killtracker[:weekly_codex] += 1
$killtracker[:codex_found][key] = {
searches_since: $killtracker[:searches_since_codex],
searches_week: $killtracker[:weekly_ascension_searches],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Persist the codex search counter here, not the gem search counter.

Line 1228 stores weekly_ascension_searches into codex events, but codex eligibility is now tracked independently. Once a character is gem-ineligible but still codex-eligible, detailed codex reports, averages, and sheet exports will all undercount because they read ev[:searches_week] from this record.

Suggested fix
       $killtracker[:codex_found][key] = {
         searches_since: $killtracker[:searches_since_codex],
-        searches_week: $killtracker[:weekly_ascension_searches],
+        searches_week: $killtracker[:weekly_codex_searches],
         name: name,
         room: room,
         creature: $killtracker[:creature]
       }
🤖 Prompt for 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.

In `@scripts/killtracker.lic` around lines 1225 - 1228, The codex event is
currently recording the gem search counter
($killtracker[:weekly_ascension_searches]) into ev[:searches_week] which
miscounts codex-only eligibility; change the stored value to the codex counter
($killtracker[:weekly_codex]) so that the codex record created at
$killtracker[:codex_found][key] uses $killtracker[:searches_since_codex] and
$killtracker[:weekly_codex] (keep the existing keys searches_since and
searches_week).

This PR addresses:

- Validate YAML loads before using persisted Killtracker data as Hash-backed state.
- Guard legacy migration paths so malformed event entries do not call Hash methods on non-Hash values.

The remaining items may be issues, but are historical in context and need careful evaluation before addressing:

- Permissions to send data offsite may be ignored or overridden in some identified cases.
- Startup performs gem installation for missing dependencies.
- Network submissions have no timeout and treat any HTTP response code as success.
- File paths include runtime identity values directly.
- Restore command handling appears shadowed by the broader backup command.
- Global mutable Killtracker state is exposed process-wide.
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.

2 participants