Repository navigation
refactor(storage): unify vault topic scanning into loadTopics boundary - #98
Conversation
…#83) - Implement loadTopics(vaultPath) in src/storage/loader.ts to centralize walkVault + frontmatter parsing + TopicNode normalization - Re-export loadTopics and LoadedTopic from src/storage/index.ts - Expand TopicNode and Topic data models in src/types.ts with typed scheduling/pillar fields - Refactor dashboard, migrate, next, plan, progress, review, and validate handlers to use loadTopics - Add unit tests in test/storage-loader.test.ts verifying normalization, aliases, and fallbacks
There was a problem hiding this comment.
Kuldeep2822k has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
Important Review available on request
Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 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 |
PR Summary by Qodorefactor(storage): centralize vault topic parsing in loadTopics
AI Description
Diagram
High-Level Assessment
Files changed (11)
|
…ort to loadTopics (#83) - Parse and clamp topic_mastery and assessment pillars [0.0, 1.0] with 4-decimal rounding - Support string numeric scores in frontmatter
There was a problem hiding this comment.
Kuldeep2822k has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
Code Review by Qodo
1.
|
| const loaded = loadTopics(vaultPath); | ||
| const candidates = loaded.filter( | ||
| (t) => | ||
| t.palee_id === topicQuery || | ||
| t.palee_id.includes(topicQuery) || | ||
| t.title.toLowerCase().includes(topicQuery.toLowerCase()) | ||
| ); |
There was a problem hiding this comment.
4. Review.ts loads and normalizes entire vault per query 🐞 Bug ➹ Performance
reviewCommand now routes topic lookup through loadTopics(vaultPath), which reads, parses, and fully normalizes every markdown topic in the vault (SM-2 fields, difficulty, dependencies, etc.) just to filter down to the single topic matching topicQuery, adding avoidable per-file normalization overhead on a command typically invoked once per review session.
… in validate (#83) - Use parseNumber and parseInteger to guard against YAML .nan / non-finite review counters - Pass scanned files array to loadTopics in validate.ts to prevent redundant second walk - Normalize vault walker to always start from resolved absolute path and exclude dot-files
There was a problem hiding this comment.
Kuldeep2822k has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
@coderabbitai full review |
|
There was a problem hiding this comment.
Kuldeep2822k has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
…tCode in review (#83) - Do not silently swallow readFileSync errors in loadTopics so callers fail loudly on unreadable files - Standardize reviewCommand to use process.exitCode instead of hard process.exit
There was a problem hiding this comment.
Kuldeep2822k has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
…ing (#83) - Default status to 'not_started' when mapping LoadedTopic to ProgressTopic
There was a problem hiding this comment.
Kuldeep2822k has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
Kuldeep2822k has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
Replaces repeated
walkVault()+readFileSync()+parseFrontmatter()loops across CLI command handlers with a single, centralizedloadTopics(vaultPath)boundary insrc/storage/loader.ts.Fixes #83
Changes
loadTopics(vaultPath)insrc/storage/loader.tsreturning normalizedLoadedTopic[](normalizing titles, aliases, dependencies, difficulties, scores, and SM-2 metadata).loadTopicsandLoadedTopicinsrc/storage/index.ts.TopicNodeinterface insrc/types.tswith flatpalee_schema: 1properties.dashboard.ts,migrate.ts,next.ts,plan.ts,progress.ts,review.ts, andvalidate.tsto consumeloadTopics().test/storage-loader.test.ts.Verification
npm run check: passing.npm test: 170 passing tests.