Feature/evolutions #2
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pokebedrock/pokebedrock-showdown!2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/evolutions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores
Documentation
Walkthrough
This set of changes refactors stat calculation logic across multiple modules, updates Pokémon evolution data, restructures and renames rulesets for LGPE formats, and overhauls database handling to improve SQL safety and abstraction. The Postgres database module is removed and replaced with a new abstraction, requiring updates to all dependent modules and tests. Documentation, help pages, and error handling are also updated, alongside numerous adjustments to public interfaces and method signatures.
Changes
README.md,server/chat-plugins/helptickets.tsdata/mods/gen7letsgo/rulesets.ts,data/rulesets.ts,sim/dex-formats.ts,sim/team-validator.tssim/battle.ts,sim/global-types.ts,sim/pokemon.ts,data/mods/gen7letsgo/scripts.ts,config/formats.tsstatModifymethods, replacing batchspreadModifyandnatureModify. Interfaces and implementations updated accordingly in core simulation and Gen 7 LGPE logic. Format definitions updated to use new stat calculation hooks.data/pokedex.ts,sim/dex-species.tsdata/formats-data.ts,config/formats.tslib/database.ts,lib/postgres.ts,lib/index.ts,server/chat-plugins/teams.ts,test/lib/postgres.jsPGDatabase). All SQL queries in teams handling and tests refactored to use tagged template literals and structured methods. Exports updated. Integration tests for Postgres are replaced with unit tests for the new SQL template system.server/chat-plugins/seasons.tsSequence Diagram(s)
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
✨ Finishing Touches
🧪 Generate unit tests
feature/evolutionsThanks 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
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
I pushed a fix in commit <commit_id>, please review it.Explain this complex logic.Open a follow-up GitHub issue for this discussion.@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and explain its main purpose.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai generate unit teststo generate unit tests for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.Other keywords and placeholders
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed.@coderabbitai summaryto generate the high-level summary at a specific location in the PR description.@coderabbitaianywhere in the PR title to generate the title automatically.CodeRabbit Configuration File (
.coderabbit.yaml).coderabbit.yamlfile to the root of your repository.# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.jsonDocumentation and Community
Actionable comments posted: 6
🔭 Outside diff range comments (2)
🧹 Nitpick comments (6)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between
4d3ecadea5and0bba0d69a6.📒 Files selected for processing (20)
README.md(2 hunks)config/formats.ts(3 hunks)data/formats-data.ts(1 hunks)data/mods/gen7letsgo/rulesets.ts(1 hunks)data/mods/gen7letsgo/scripts.ts(1 hunks)data/pokedex.ts(8 hunks)data/rulesets.ts(1 hunks)lib/database.ts(6 hunks)lib/index.ts(1 hunks)lib/postgres.ts(0 hunks)server/chat-plugins/helptickets.ts(1 hunks)server/chat-plugins/seasons.ts(1 hunks)server/chat-plugins/teams.ts(14 hunks)sim/battle.ts(1 hunks)sim/dex-formats.ts(1 hunks)sim/dex-species.ts(6 hunks)sim/global-types.ts(1 hunks)sim/pokemon.ts(2 hunks)sim/team-validator.ts(1 hunks)test/lib/postgres.js(2 hunks)💤 Files with no reviewable changes (1)
🧰 Additional context used
🧬 Code Graph Analysis (3)
test/lib/postgres.js (1)
sim/global-types.ts (3)
sim/battle.ts (2)
🪛 markdownlint-cli2 (0.17.2)
README.md
18-18: Heading style
Expected: setext; Actual: atx
(MD003, heading-style)
18-18: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
43-43: Bare URL used
(MD034, no-bare-urls)
67-67: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
68-68: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
69-69: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
70-70: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
71-71: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
121-121: Bare URL used
(MD034, no-bare-urls)
🪛 LanguageTool
README.md
[uncategorized] ~71-~71: Do not mix variants of the same word (‘Pokemon’ and ‘Pokémon’) within a single text.
Context: ...FAQ compiled by Kaiepi regarding making Pokemon Showdown bots - mainly chatbots and bat...
(EN_WORD_COHERENCY)
🔇 Additional comments (27)
⚠️ Potential issue
Critical issue with stat calculation logic - potential division by zero and incorrect formula
The new
statModifymethod has several serious problems:tr(tr(stat * 110, 16) / 100)but ifstatis 0, this could cause issuestr(tr(...), 16)on line 1614 is unusual and may not be intendedThe stat swapping logic appears fundamentally incorrect. Consider this fix:
Additionally, add bounds checking and fix the truncation:
🤖 Prompt for AI Agents
💡 Verification agent
🧩 Analysis chain
Evolution method changed to item-based with Leaders Crest.
The change from level-based to item-based evolution using "Leaders Crest" aligns with the pattern of evolution updates seen throughout this file (similar to Probopass). The item name fits the regal theme of Kingambit.
Verify that the evolution system properly handles the new item-based evolutions and that "Leaders Crest" is properly defined in the items database.
🏁 Script executed:
Length of output: 1245
🏁 Script executed:
Length of output: 813
🏁 Script executed:
Length of output: 358
Missing “Leaders Crest” item definition
I wasn’t able to locate a
Leaders Crestentry in the items database (e.g. any ofdata/items.ts,sim/dex-items.ts, or their mod variants). Without that definition, the new evoItem reference will be invalid at runtime.• data/pokedex.ts (lines ~17929–17931):
evoType: "useItem",
evoItem: "Leaders Crest",
evoCondition: "Give Bisharp a Leaders Crest"
Please add a corresponding
Leaders Crestitem in your items files (name, id, effects, etc.) so that this evolution method resolves correctly.🤖 Prompt for AI Agents
⚠️ Potential issue
Missing LIMIT 1 clause in updateOne method.
The
updateOnemethod no longer includesLIMIT 1, which means it could update multiple rows despite its name suggesting a single row update. This is a breaking change and could lead to unintended data modifications.Consider adding back the LIMIT clause for MySQL or using a primary key constraint:
🤖 Prompt for AI Agents
⚠️ Potential issue
Remove unsafe non-null assertion in PGDatabase constructor.
Using
null!when config is falsy will cause runtime errors. The constructor should properly handle missing configuration.📝 Committable suggestion
🤖 Prompt for AI Agents
⚠️ Potential issue
Remove unsafe non-null assertion that can cause runtime errors.
The non-null assertion
null!is dangerous. IfConfig.usepostgresis falsy,teamsDBwill be null but TypeScript will treat it as non-null, leading to runtime errors when any methods are called on it.Consider using a more defensive approach:
Then add null checks where these are used, or throw an error immediately if the database is required but not configured.
📝 Committable suggestion
🤖 Prompt for AI Agents
⚠️ Potential issue
Potential issue with uninitialized PGDatabase instance.
Creating a
PGDatabaseinstance without configuration may cause issues. Based on the implementation inlib/database.ts, when no config is provided, the connection is set tonull!, which could lead to runtime errors if any methods that require a database connection are called.Consider either:
_resolveSQLmethod which doesn't require a connection🤖 Prompt for AI Agents
Pull request closed