Repository navigation
fix(brain): numeric version comparison + subprocess migrations - #1013
Conversation
Two bugs from PR review of #1010: 1. Version comparison used string comparison (`latestCore > localCore`) which fails on multi-digit segments: "260403.9" > "260403.10" is true lexicographically but wrong numerically. Added compareVersions() that splits on "." and compares segments as numbers. 2. Post-update migrations ran via `import()` which returns the cached pre-update module — new migrations from the pulled version would be silently skipped. Replaced with subprocess execution via `bun -e` which loads the rebuilt code from disk. Tests: 6 new tests for compareVersions covering multi-digit segments, different segment counts, and major version differences.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Two bugs found during /review of PR #1010 (dev→main):
1. [HIGH] Module cache — migrations run stale code
await import('@automagik/genie-brain')after git pull + rebuild returns the cached pre-update module. New migrations from the pulled version are silently skipped.Fix: Run migrations via
bun -esubprocess which loads the rebuilt code from disk, bypassing the import cache.2. [MEDIUM] Lexicographic version comparison
latestCore > localCoreis string comparison."260403.9" > "260403.10"→true(wrong, because"9" > "1").Fix: Added
compareVersions()that splits on.and compares segments numerically.Test plan
compareVersions('260403.10', '260403.9') > 0✓compareVersions('260403.1', '260403.1') === 0✓compareVersions('260403', '260403.0') === 0✓