TemaDeveloper / TemaDeveloper/personal_planner

bug: AI-generated calendar sections are unusable — buildTemplateDoc omits calendarCategories

Open Beginner friendly
#45 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
2
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Description

The section-generation prompt allows viewType: "calendar" (src/lib/profile/generate-sections.ts:39) and parseSections passes it through, but buildTemplateDoc (src/lib/profile/persist-sections.ts:34-63) never populates calendarCategories. The model default is undefined (section-template.ts:85). Entry creation enforces validateCalendarEvent(body, template.calendarCategories ?? []) (src/app/api/sections/[slug]/entries/route.ts:117-121validations.ts:309), and with an empty category array categories.some(...) is always false.

Failure scenario

The adaptive engine generates a calendar-view section. The user opens it and adds any event → POST always returns 400 "Unknown category". The section can never hold a single entry. (The manual template POST path defaults to DEFAULT_CATEGORIEStemplates/route.ts:72-77 — so only the adaptive-engine path is broken.)

Fix

In buildTemplateDoc, default calendarCategories to DEFAULT_CATEGORIES when viewType === "calendar" (or have the generator emit categories).

Severity

Medium (feature entirely unusable when generated).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/lib/profile/persist-sections.ts at buildTemplateDoc, then compare its calendar handling with DEFAULT_CATEGORIES in src/app/api/templates/route.ts and validation in src/lib/profile/validations.ts. Reproduce an adaptive-generated calendar section and verify that posting an event no longer returns 400 "Unknown category" when the section has no model-supplied categories.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, typescript
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.