feat(guide): validate lesson collections [Codex] - #1346
Conversation
Validate guide lesson IDs, exercise IDs, and positions during content loading. Extract parsing into a testable frontmatter boundary with focused coverage for valid and invalid lesson collections.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
guide | 4a849b4 | Commit Preview URL Branch Preview URL |
Sep 13 2026, 09:20 PM |
| exercise: exerciseFromFrontmatter(~dict=exerciseDict, ~sourcePath), | ||
| switch GuideLessonFrontmatter.parse(~raw, ~sourcePath) { | ||
| | Ok(lesson) => lesson | ||
| | Error(message) => throw(GuideLessonFrontmatter.InvalidFrontmatter(message)) |
There was a problem hiding this comment.
If GuideLessonFrontmatter.parse already wraps stuff in a try/catch and returns a nice result, why do we need to throw here again?
There was a problem hiding this comment.
Good catch, fixed!
Keep frontmatter parsing failures as result values until the route loader exception boundary.
Guide Cloudflare deployment⛅️ wrangler 4.114.0 To deploy this version to production traffic use the command wrangler versions deploy Changes to non-versioned settings (config properties 'logpush' or 'tail_consumers') take effect after your next deployment using the command wrangler versions deploy Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy |
Cloudflare deploymentDeployement ID: be98c1c4-1f2d-43ef-9594-81d201bfb382 ⛅️ wrangler 4.114.0 ✨ Uploading _redirects |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4a849b45a6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Guide lessons were loaded without collection-wide uniqueness checks, so duplicate identifiers or positions could create ambiguous navigation and persisted progress keys.
This extracts frontmatter parsing into GuideLessonFrontmatter, preserves build-time failure at the loader boundary, and rejects duplicate lesson IDs, exercise IDs, and positions with both source paths in the diagnostic. Focused coverage exercises complete and invalid frontmatter plus valid and invalid lesson collections.