-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix/double tap full send #4398
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
base: main
Are you sure you want to change the base?
Fix/double tap full send #4398
Changes from 8 commits
f4c07cb
799ee08
18ffe46
4275211
100aa73
90f2375
2ef3c05
7186d77
6319ee0
97201e7
7425af5
b39102a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -359,7 +359,10 @@ export const AllianceExtensionIntentSchema = z.object({ | |||||||||||||||||
| export const AttackIntentSchema = z.object({ | ||||||||||||||||||
| type: z.literal("attack"), | ||||||||||||||||||
| targetID: ID.nullable(), | ||||||||||||||||||
| troops: z.number().nonnegative().nullable(), | ||||||||||||||||||
| troopCount: z.number().nonnegative(), | ||||||||||||||||||
| troopRatio: z.number().gt(0).max(1), | ||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||||||||||||||||||
| // maxTroopSent present only for retaliation. | ||||||||||||||||||
| maxTroopSent: z.number().nonnegative().optional(), | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor 🧩 Analysis chain🏁 Script executed: # First, let's read the file and understand the schema structure
head -n 380 src/core/Schemas.ts | tail -n 30Repository: openfrontio/OpenFrontIO Length of output: 910 🏁 Script executed: sed -n '370,380p' src/core/Schemas.tsRepository: openfrontio/OpenFrontIO Length of output: 419 🏁 Script executed: # Search for all troopCount and similar troop-related integer fields in the file
rg "troopCount|maxTroopSent|troop" src/core/Schemas.ts -nRepository: openfrontio/OpenFrontIO Length of output: 535 🏁 Script executed: # Let's see the context around line 426 to understand the donate_troops schema
sed -n '422,430p' src/core/Schemas.tsRepository: openfrontio/OpenFrontIO Length of output: 398 🏁 Script executed: # Check if .int() is used elsewhere in Zod schemas in this file
rg "\.int\(" src/core/Schemas.tsRepository: openfrontio/OpenFrontIO Length of output: 668 🏁 Script executed: # Let's verify the broader context - check the actual structure of these schemas and ensure the .int() placement is correct
sed -n '360,380p' src/core/Schemas.tsRepository: openfrontio/OpenFrontIO Length of output: 732 🏁 Script executed: # Search for tests related to these schemas to see if any tests validate decimal troop counts
find . -name "*.test.ts" -o -name "*.spec.ts" | head -20Repository: openfrontio/OpenFrontIO Length of output: 1168 🏁 Script executed: # Search for tests of schemas, especially AttackIntentSchema or BoatAttackIntentSchema
find . -path "*/tests/*" -name "*[Ss]chema*.test.ts" -exec grep -l "AttackIntent\|BoatAttackIntent\|troopCount" {} \;Repository: openfrontio/OpenFrontIO Length of output: 161 🏁 Script executed: # Search for tests that validate intent schemas
rg "AttackIntentSchema|BoatAttackIntentSchema" tests/ --type tsRepository: openfrontio/OpenFrontIO Length of output: 161 🏁 Script executed: # Let's check if there are any usages of AttackIntentSchema or BoatAttackIntentSchema that might show how troopCount is used
rg "AttackIntentSchema|BoatAttackIntentSchema|donate_troops" src/ --type ts -A 2 -B 2 | head -50Repository: openfrontio/OpenFrontIO Length of output: 2568 🏁 Script executed: # Check where these intents are created to see if they're ever given decimal troopCount values
rg "troopCount|donate_troops|troops:" src/core/ --type ts -B 2 -A 2 | head -80Repository: openfrontio/OpenFrontIO Length of output: 3916 🏁 Script executed: # Let's look at the broader context in ExecutionManager to see how troopCount is used
sed -n '1,50p' src/core/execution/ExecutionManager.ts | head -30Repository: openfrontio/OpenFrontIO Length of output: 1976 🏁 Script executed: # Look at the exact calculation with Math.floor to understand the intent
rg "Math.floor.*troopRatio.*troopCount" src/core/execution/ExecutionManager.ts -B 5 -A 5Repository: openfrontio/OpenFrontIO Length of output: 631 🏁 Script executed: # Let's check the DonateTroopIntentSchema and see if troops should also be an integer
sed -n '422,428p' src/core/Schemas.tsRepository: openfrontio/OpenFrontIO Length of output: 317 Validate troop counts as integers.
Suggested schema changes- troopCount: z.number().nonnegative(),
+ troopCount: z.number().int().nonnegative(),
troopRatio: z.number().gt(0).max(1),
// maxTroopSent present only for retaliation.
- maxTroopSent: z.number().nonnegative().optional(),
+ maxTroopSent: z.number().int().nonnegative().optional(),- troopCount: z.number().nonnegative(),
+ troopCount: z.number().int().nonnegative(),
troopRatio: z.number().gt(0).max(1),Consider also applying the same fix to 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Katokoda marked this conversation as resolved.
Outdated
|
||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| export const SpawnIntentSchema = z.object({ | ||||||||||||||||||
|
|
@@ -369,7 +372,8 @@ export const SpawnIntentSchema = z.object({ | |||||||||||||||||
|
|
||||||||||||||||||
| export const BoatAttackIntentSchema = z.object({ | ||||||||||||||||||
| type: z.literal("boat"), | ||||||||||||||||||
| troops: z.number().nonnegative(), | ||||||||||||||||||
| troopCount: z.number().nonnegative(), | ||||||||||||||||||
| troopRatio: z.number().gt(0).max(1), | ||||||||||||||||||
| dst: z.number(), | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.