refactor: crypto UUID substitution - #13
Conversation
… use it - Added a randomUUID function to utils.ts for generating UUIDs in non-secure contexts. - Updated CV creation in multiple components to utilize the new randomUUID function instead of crypto.randomUUID for consistency and compatibility.
- Added `nanoid` package for unique ID generation. - Refactored CV creation functions to utilize `createId` instead of `randomUUID`. - Updated multiple components to ensure consistent ID generation for CVs. - Removed the deprecated `createCVFromTemplate` function and its associated template file.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR introduces a new ID generation utility based on nanoid, refactors CV creation from a template-based API to a simpler parameter-driven approach, updates all CV creation entry points, replaces dummy data, switches logo dark-mode handling to CSS classes, and consolidates imports across components and tests. ChangesCV Creation API and Infrastructure
UI and Component Updates
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/lib/components/dev/dummy-cv.ts (1)
8-169:⚠️ Potential issue | 🟠 Major | ⚡ Quick winRecompute
blockHashesafter populating the dummy blocks.
createCV()hashes the empty default blocks up front, then this helper overwrites nearly every block and returns without refreshingcv.blockHashes. Becausesrc/lib/e2e-bridge.ts:15-92persistscreateDummyCV()as-is, seeded CVs will carry hash metadata that no longer matches their content.Suggested fix
+import { computeBlockHashes } from '$lib/features/tailoring/hash'; import { createObjectId, type CV, type Tag } from '$lib/types/cv'; import { createCV } from '$lib/services/cv/create'; @@ export function createDummyCV(): CV { const cv = createCV({ name: 'Dummy — Dwight Schrute' }); @@ cv.blocks.education.value = [ @@ ]; + cv.blockHashes = computeBlockHashes(cv.blocks); return cv; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/components/dev/dummy-cv.ts` around lines 8 - 169, The dummy CV currently overwrites nearly all blocks after calling createCV() but never updates cv.blockHashes, leaving stale hashes; after populating the blocks in createDummyCV(), recompute and assign fresh block hashes to cv.blockHashes by invoking the same hashing routine used by createCV (e.g., call computeBlockHashes(cv) or the existing helper that createCV uses) so the persisted seeded CVs have matching blockHashes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib/components/dev/dummy-cv.ts`:
- Around line 59-128: The job-history seed in cv.blocks.jobHistory.value was
changed to Dwight-themed entries which breaks the editor E2E fixture that
expects Nimbus Labs, Cobalt Financial, and Bright Pixel Studio (see
e2e/editor.spec.ts:67-88); either restore those original entries in
cv.blocks.jobHistory.value (using the same object shape with createObjectId()
and tags(...) for skills) or, if intentional, update the E2E spec to assert the
new companies so both code and tests stay in sync.
---
Outside diff comments:
In `@src/lib/components/dev/dummy-cv.ts`:
- Around line 8-169: The dummy CV currently overwrites nearly all blocks after
calling createCV() but never updates cv.blockHashes, leaving stale hashes; after
populating the blocks in createDummyCV(), recompute and assign fresh block
hashes to cv.blockHashes by invoking the same hashing routine used by createCV
(e.g., call computeBlockHashes(cv) or the existing helper that createCV uses) so
the persisted seeded CVs have matching blockHashes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 06e9fb83-7cf5-4e71-b869-dc135921aa53
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (36)
docs/decisions/ADR-004-e2e-test-strategy.mdpackage.jsonsrc/lib/components/blocks/contacts-block.sveltesrc/lib/components/blocks/education-block.sveltesrc/lib/components/blocks/job-history-block.sveltesrc/lib/components/blocks/projects-block.sveltesrc/lib/components/blocks/skills-block.sveltesrc/lib/components/dashboard/new-cv-button.sveltesrc/lib/components/dev/dummy-cv.tssrc/lib/components/ui/editable-list/editable-list.sveltesrc/lib/components/ui/logo/logo.sveltesrc/lib/components/ui/tag-input/tag-input.sveltesrc/lib/features/export/generate.test.tssrc/lib/features/export/preprocess.test.tssrc/lib/features/export/themes/classic/classic.test.tssrc/lib/features/tailoring/_fixtures.tssrc/lib/features/tailoring/create-tailored.tssrc/lib/features/tailoring/locate.test.tssrc/lib/features/tailoring/present.test.tssrc/lib/id.tssrc/lib/services/cv/create.tssrc/lib/services/cv/templates.tssrc/lib/types/cv.tssrc/routes/+page.sveltesrc/stories/blocks/helpers/ContactsWrapper.sveltesrc/stories/blocks/helpers/EducationWrapper.sveltesrc/stories/blocks/helpers/FullNameWrapper.sveltesrc/stories/blocks/helpers/HighlightsWrapper.sveltesrc/stories/blocks/helpers/JobHistoryWrapper.sveltesrc/stories/blocks/helpers/LocationWrapper.sveltesrc/stories/blocks/helpers/PositionWrapper.sveltesrc/stories/blocks/helpers/ProjectsWrapper.sveltesrc/stories/blocks/helpers/SkillsWrapper.sveltesrc/stories/ui/helpers/BlockWrapperWrapper.sveltesrc/stories/ui/helpers/EditableListWrapper.sveltesrc/stories/ui/helpers/TagInputWrapper.svelte
💤 Files with no reviewable changes (1)
- src/lib/services/cv/templates.ts
Summary by CodeRabbit
New Features
Refactor
Style
Documentation
Tests