Skip to content

perf(creatures): find fear auras through an index - #428

Merged
Mathih13 merged 1 commit into
mainfrom
perf/fear-aura-candidates
Sep 4, 2026
Merged

Mathih13 merged 1 commit into
mainfrom
perf/fear-aura-candidates

Conversation

@Mathih13

@Mathih13 Mathih13 commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Fear movement scanned every aura on each creature tick to find the few control auras that cause fear. A composite index on the existing effect-kind and parameter columns now selects those candidates directly. Scope checks, deduplication and the source-caster tie break keep their existing behavior.

This addresses the aura-scan finding in the performance and correctness report.

Verified with 1,470 Module tests in an isolated build, the focused cycle suite, a Wasm check and offline preflight. A plain publish from the baseline to this change on a private in-memory Standalone created only the new index and preserved a distinctive existing row. No row shape, generated binding or backfill changes are needed. This removes unrelated aura reads; it is not a measured realm capacity result.

Implemented by GPT-5.6 Sol through Codex, reviewed by GPT-6 through Codex.

Summary by CodeRabbit

  • Performance
    • Improved fear-effect processing by using a targeted index, reducing unnecessary scanning while preserving existing resolution and gameplay behavior.
  • Tests
    • Updated validation to confirm fear-effect lookups use the optimized path.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 4a993bfe-6d8b-4bba-900f-6fcefe4b54e2

📥 Commits

Reviewing files that changed from the base of the PR and between 3850bae and 90e9c7e.

📒 Files selected for processing (3)
  • module/src/creatures/cycle/ctx.rs
  • module/src/creatures/cycle/harness.rs
  • module/src/spell/tables.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change adds a game_aura.by_kind_param index and updates fear handling and its production adapter to use indexed aura queries instead of full-table scans.

Changes

Fear aura lookup

Layer / File(s) Summary
Indexed fear query
module/src/spell/tables.rs, module/src/creatures/cycle/ctx.rs, module/src/creatures/cycle/harness.rs
game_aura now exposes a B-tree index on (eff_kind, eff_p0). FearSink::panicked and its adapter expectation use the index to find control/fear auras.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 90e9c

Fear movement now selects control/fear aura candidates through a composite index rather than scanning all auras, preserving the existing resolution behavior while reducing per-tick work. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: using an index to find fear auras for creature processing.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/fear-aura-candidates

Comment @coderabbitai help to get the list of available commands.

@Mathih13
Mathih13 merged commit a447495 into main Sep 4, 2026
6 checks passed
@Mathih13
Mathih13 deleted the perf/fear-aura-candidates branch October 11, 2026 18:21
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