Skip to content

Conversation

@marcuscastelo
Copy link
Owner

@marcuscastelo marcuscastelo commented Jun 10, 2025

This pull request introduces significant improvements and refactors across the codebase:

  • Error Handling: Centralizes and enhances error handling by enforcing the use of parseWithStack and jsonParseWithStack for all .parse() calls, ensuring stack trace preservation and improved traceability. Updates all relevant domain, application, and infrastructure code to comply with this pattern.
  • Domain & Application Logic: Refactors domain models (e.g., ItemGroup, Recipe, Weight, User, Food, etc.) for improved type safety, error messaging, and logic clarity. Removes redundant fields, infers types where possible, and updates related tests.
  • Prompt Automation: Adds and refines multiple .github/prompts for PR, commit, and issue automation, including auto-closing issues from branch names and improved output formatting. Updates prompt structure and documentation for clarity and best practices.
  • ESLint & Linting: Restricts the no-restricted-syntax rule to only JSON.parse and Zod .parse calls, enforcing safer parsing patterns.
  • Documentation & Templates: Updates and adds new issue templates, clarifies commit message guidelines, and improves prompt documentation.
  • UI & Section Updates: Minor improvements to UI components and hooks for consistency and error handling.
  • Miscellaneous: General code cleanup, improved import ordering, and removal of deprecated logic.

Notable Implementation Details:

closes #698

…trace on validation errors

- Replace all direct .parse calls on Zod schemas with parseWithStack utility
- Add import of parseWithStack where needed
- Ensures all Zod validation errors have a JS stack trace for better debugging
#changes
…e() calls, fix all type/lint errors

- Replace all direct .parse() and JSON.parse calls with parseWithStack or jsonParseWithStack utilities
- Add runtime type guards where needed for type safety
- Fix all resulting type and lint errors
- Ensure all imports are correct and sorted
- Codebase passes all checks and tests
…iginal error to createExpandableErrorData in showError (#changes)
… recipe presence

- Remove explicit type field from ItemGroup models and schemas
- Add getItemGroupType utility to infer type based on recipe
- Update type guards and tests to use new logic
- Ensure no type field is persisted or required
#changes
Ensure templateToItem assigns a valid id to all returned items, preventing Zod validation errors when adding items/groups via TemplateSearchModal. All checks and tests passed.
…uired fields in Zod schemas

Improves all main domain schemas with custom required_error and invalid_type_error messages for required fields, making validation feedback much clearer and user-friendly.
…aceability

Use wrapErrorWithStack in all error throws in infrastructure (Supabase, API, DAO) to guarantee stack trace for all errors propagated to the application layer, even for plain object errors (e.g., Supabase). Export wrapErrorWithStack from errorHandler and adjust imports as needed.
…romise

- Ensure all error toasts preserve stack trace and error context by passing the original Error object, even with custom messages.
- Remove all usages of formatError/error.errorMessage in showError/showPromise calls.
- Add handleApiError context where missing.
- Update UI and error handling for all affected modules.
- All checks passing.
…arkdown templates

- Updated all .github/prompts/github-issue-*.prompt.md files to reference and require use of new markdown templates in docs/
- Added new issue templates: ISSUE_TEMPLATE_BUGFIX.md, ISSUE_TEMPLATE_FEATURE.md, ISSUE_TEMPLATE_REFACTOR.md, ISSUE_TEMPLATE_SUBISSUE.md
- Updated ISSUE_TEMPLATE_LLM.md for consistency and improved structure
- Renamed issue-breakdown.prompt.md to github-issue-breakdown.prompt.md and updated to require subissue template usage
Copilot AI review requested due to automatic review settings June 10, 2025 04:42
@marcuscastelo marcuscastelo self-assigned this Jun 10, 2025
@vercel
Copy link

vercel bot commented Jun 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marucs-diet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 10, 2025 5:04am

This comment was marked as outdated.

Added a new prompt file `.github/prompts/repeat-output-markdown.prompt.md` that instructs the agent to repeat the last output as a markdown code block in English, using four backticks for easy copying.
Added a new prompt file `.github/prompts/repeat-output-markdown.prompt.md` that instructs the agent to repeat the last output as a markdown code block in English, using four backticks for easy copying.

This comment was marked as outdated.

@marcuscastelo marcuscastelo changed the title Refactor toast system and improve error handling Refactor and enhance error handling, prompt automation, and domain logic; update documentation and templates Jun 10, 2025
@marcuscastelo marcuscastelo requested a review from Copilot June 10, 2025 05:01
@github-actions github-actions bot added the bug Report a problem or malfunction label Jun 10, 2025

This comment was marked as outdated.

@marcuscastelo marcuscastelo requested a review from Copilot June 10, 2025 05:09
@marcuscastelo marcuscastelo merged commit 2a52900 into rc/v0.11.0 Jun 10, 2025
5 checks passed
@marcuscastelo marcuscastelo deleted the marcuscastelo/issue698 branch June 10, 2025 05:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request refactors error handling and domain logic, updates prompt automation, and refreshes documentation and templates across the codebase. The changes include:

  • Enhanced error handling using specialized parse functions and improved domain model definitions.
  • Updated GitHub templates and a suite of new and revised prompt files to support PR, commit, and issue automation.
  • Minor adjustments to ESLint rules, UI components, and commit message guidance.

Reviewed Changes

Copilot reviewed 77 out of 77 changed files in this pull request and generated no comments.

Show a summary per file
File Description
docs/ISSUE_TEMPLATE_SUBISSUE.md Added a new subissue template.
docs/ISSUE_TEMPLATE_REFACTOR.md Introduced a refactor issue template with clear structure.
docs/ISSUE_TEMPLATE_LLM.md Removed the LLM issue template; verify this removal is intentional.
docs/ISSUE_TEMPLATE_FEATURE.md Added a new feature request template.
docs/ISSUE_TEMPLATE_BUGFIX.md Added a new bug report template with detailed reproduction steps.
.github/prompts/* (multiple files) Added and updated various prompt files to streamline automation flows.
.github/copilot-instructions.md Updated instructions to use unique tee file identifiers per command.
.github/copilot-commit-message-instructions.md Enhanced commit message guidelines, particularly for renaming changes.
Comments suppressed due to low confidence (1)

docs/ISSUE_TEMPLATE_LLM.md:1

  • The removal of the ISSUE_TEMPLATE_LLM.md file may impact workflows that rely on this template. Verify that this removal is intentional and update all related documentation to reflect the change.
## Issue #<number>: <title>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Report a problem or malfunction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zod validation error when adding item via TemplateSearchModal after union refactor

2 participants