Skip to content

Preparation for agent engineering#588

Draft
Perdolique wants to merge 10 commits intomasterfrom
vibe-improvements
Draft

Preparation for agent engineering#588
Perdolique wants to merge 10 commits intomasterfrom
vibe-improvements

Conversation

@Perdolique
Copy link
Copy Markdown
Owner

No description provided.

- 🗑️ Remove legacy features (brands, checklists, equipment, inventory)
- 🗑️ Delete unused API endpoints and database queries
- 🗑️ Clean up component library (forms, dialogs, tables, cards)
- 🗑️ Remove composables and state management utilities
- 🗑️ Delete admin-specific functionality
- 🔧 Add stricter TypeScript compiler options
- 🐛 Fix unused parameter warnings
- 🧹 Prepare clean foundation for upcoming refactoring
@Perdolique Perdolique self-assigned this Mar 27, 2026
Copilot AI review requested due to automatic review settings March 27, 2026 20:31
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 27, 2026

🎉 Deployed to Cloudflare!

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request contains extensive refactoring, including database schema updates, migration to UUIDs, and cleanup of server-side utilities and components. Several critical issues were identified: the Docker Compose configuration uses a non-existent PostgreSQL 18 image, the sidebar navigation was completely removed, user-facing error feedback was replaced with console logs, and the fallback error message was changed to a non-descriptive string.

I am having trouble creating individual review comments. Click here to see my feedback.

docker-compose.yml (3)

critical

The PostgreSQL image version is set to 18, which does not exist. This will cause the Docker Compose setup to fail. The latest stable version is 16. Please correct the image tag. If you intended to use version 16, it should be postgres:16.

    image: postgres:16

app/components/PerdSidebar/PerdSidebar.vue (17-53)

high

The removal of all SidebarItem components has left the application without any primary navigation. This makes it impossible for users to navigate to different sections of the application, such as the account page, without knowing the direct URL. While this might be an intentional part of the refactoring, it severely impacts the usability of the application for human users.

app/pages/account.vue (105)

medium

The error handling has been changed to only log to the console. Previously, a user-facing toast notification was displayed. This change removes important feedback for the user, who will now not be aware if an action fails. Consider re-introducing a user-facing notification for errors to improve the user experience.

app/utils/types.ts (23)

medium

The fallback error message ¯\_(ツ)_/¯ is not very user-friendly. It would be better to return a more standard and helpful message, such as "An unexpected error occurred.", which was the previous behavior in the now-removed use-api-error-toast.ts composable.

  return 'An unexpected error occurred.'

Copy link
Copy Markdown

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 PR appears to prepare the codebase for a leaner “agent engineering” setup by refactoring server utilities (DB/session/auth), introducing new OAuth/user database primitives, tightening lint/typecheck rules, and removing a large set of legacy app/API features.

Changes:

  • Refactors database access into HTTP vs WebSocket clients, updates middleware context, and adjusts user/session/oauth utilities accordingly.
  • Adds OAuth/user tables via a new migration and updates Twitch OAuth flow to ensure provider presence.
  • Introduces Oxlint + stricter TS compiler options, updates dependencies/tooling, and removes many legacy pages/components/routes and internal “skills” docs.

Reviewed changes

Copilot reviewed 187 out of 194 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
server/utils/user.ts Switches to dbHttp for session user lookup; moves OAuth queries/transactions to a WebSocket client; consolidates exports.
server/utils/session.ts Adds Valibot validation for SESSION_SECRET; changes exports style; switches constants import.
server/utils/provider-twitch.ts Converts to internal functions + explicit export list.
server/utils/database.ts Splits DB creation into createHttpClient vs createWebSocketClient; uses validated env.
server/utils/admin.ts Removes admin validation helper entirely.
server/middleware/database.ts Renames injected DB context to dbHttp and always initializes it.
server/middleware/api-session-check.ts Updates constants import to #shared/constants.
server/database/relations.ts Removes most relations, leaving oauth-related relations.
server/database/migrations/20260327200015_boring_thundra/migration.sql Adds new users, oauth_providers, oauth_accounts tables.
server/database/migrations/20241126185426_graceful_excalibur/migration.sql Removes legacy brands/equipment migration.
server/database/migrations/20241017201709_lean_wendell_rand/migration.sql Removes legacy equipment constraint migration.
server/database/migrations/20241009182341_nice_blockbuster/migration.sql Removes legacy equipment FK rename migration.
server/database/migrations/20241007185625_eager_solo/migration.sql Removes legacy equipment columns/FK migration.
server/database/migrations/20240924193134_abandoned_redwing/migration.sql Removes legacy equipmentGroups/types timestamp/index migration.
server/api/user/index.get.ts Simplifies handler to expression form.
server/api/search/equipment.get.ts Removes equipment search endpoint.
server/api/search/equipment-drafts.get.ts Removes equipment drafts search endpoint.
server/api/search/checklist-inventory.get.ts Removes checklist inventory search endpoint.
server/api/search/brands.get.ts Removes brands search endpoint.
server/api/oauth/twitch/index.post.ts Ensures oauthProviders entry exists; updates calls to new user util signatures.
server/api/oauth/twitch/index.get.ts Awaits redirect.
server/api/inventory/index.post.ts Removes inventory add endpoint.
server/api/inventory/index.get.ts Removes inventory list endpoint.
server/api/inventory/[id].delete.ts Removes inventory delete endpoint.
server/api/equipment/types/index.post.ts Removes equipment type creation endpoint.
server/api/equipment/types/index.get.ts Removes equipment types list endpoint.
server/api/equipment/items/index.post.ts Removes equipment item creation endpoint.
server/api/equipment/items/index.get.ts Removes equipment items list endpoint.
server/api/equipment/items/[itemId]/status.patch.ts Removes equipment status update endpoint.
server/api/equipment/items/[itemId]/index.patch.ts Removes equipment item update endpoint.
server/api/equipment/items/[itemId]/index.get.ts Removes equipment item detail endpoint.
server/api/equipment/items/[itemId]/index.delete.ts Removes equipment item delete endpoint.
server/api/equipment/groups/index.post.ts Removes equipment group creation endpoint.
server/api/equipment/groups/index.get.ts Removes equipment groups list endpoint.
server/api/checklists/index.post.ts Removes checklist creation endpoint.
server/api/checklists/index.get.ts Removes checklist list endpoint.
server/api/checklists/[checklistId]/items/index.post.ts Removes checklist item add endpoint.
server/api/checklists/[checklistId]/items/index.get.ts Removes checklist item list endpoint.
server/api/checklists/[checklistId]/items/[itemId].delete.ts Removes checklist item delete endpoint.
server/api/checklists/[checklistId]/index.get.ts Removes checklist detail endpoint.
server/api/checklists/[checklistId]/index.delete.ts Removes checklist delete endpoint.
server/api/brands/index.post.ts Removes brand creation endpoint.
server/api/brands/index.get.ts Removes brands list endpoint.
server/api/brands/[brandId].patch.ts Removes brand update endpoint.
server/api/brands/[brandId].get.ts Removes brand detail endpoint.
server/api/brands/[brandId].delete.ts Removes brand delete endpoint.
server/api/auth/create-session.post.ts Switches DB context usage from db to dbHttp.
pnpm-workspace.yaml Adds publicHoistPattern for h3.
package.json Updates scripts, dependencies/devDependencies, adds oxlint tooling, bumps pnpm version.
nuxt.config.ts Switches to node: imports, adds runtimeConfig, tightens TS compiler options, disables auto-imports.
drizzle.config.ts Uses validated env var for db URL and configures dbCredentials.
docker-compose.yml Switches Postgres image, changes volume mount, replaces neon proxy image, removes wsproxy service.
app/utils/units.ts Removes weight formatting utilities.
app/utils/types.ts Adds Valibot validation for FetchError payload; converts to explicit exports.
app/utils/string.ts Converts to internal function + explicit export.
app/utils/dom.ts Removes view transition helper.
app/utils/date-time.ts Removes date formatting helper (and date-fns usage).
app/utils/async.ts Switches to delay package; explicit exports.
app/pages/manager/equipment/types.vue Removes equipment types manager page.
app/pages/manager/equipment/index.vue Removes equipment manager page.
app/pages/manager/equipment/groups.vue Removes equipment groups manager page.
app/pages/manager/equipment/add.vue Removes manager add equipment page.
app/pages/login.vue Updates imports to explicit #imports usage; removes view transition usage; uses globalThis.location.
app/pages/inventory.vue Removes inventory page.
app/pages/index.vue Adds explicit definePageMeta import.
app/pages/equipment/item/[itemId]/edit.vue Removes equipment edit page.
app/pages/equipment/index.vue Removes equipment list page.
app/pages/equipment/add.vue Removes equipment add page.
app/pages/checklists/index.vue Removes checklists index page.
app/pages/checklists/[checklistId].vue Removes checklist detail page.
app/pages/brands/index.vue Removes brands index page.
app/pages/brands/details/[brandId]/index.vue Removes brand details page.
app/pages/brands/details/[brandId]/edit.vue Removes brand edit page.
app/pages/brands/add.vue Removes brand add page.
app/pages/auth/twitch.vue Updates imports to explicit #imports/vue/ofetch usage and shared constants alias.
app/pages/account.vue Makes imports explicit and replaces toast-based error handling with console error.
app/models/twitch.ts Switches interfaces to internal + exported types.
app/models/checklist.ts Removes checklist item model.
app/models/brand.ts Removes brand model.
app/middleware/admin.ts Updates imports to explicit #imports usage and shared constants alias.
app/middleware/1.auth.global.ts Updates imports to explicit #imports usage and shared constants alias.
app/middleware/0.user.global.ts Adds explicit imports for middleware.
app/layouts/default.vue Adds explicit imports for computed and useRoute.
app/composables/use-user-state.ts Adds explicit imports for computed, useFetch, useState.
app/composables/use-user-equipment.ts Removes user equipment composable.
app/composables/use-toaster.ts Removes toaster composable.
app/composables/use-equipment-types-state.ts Removes equipment types state composable.
app/composables/use-equipment-groups-state.ts Removes equipment groups state composable.
app/composables/use-checklists-data.ts Removes checklists data composable.
app/composables/use-checklist-toggle.ts Removes checklist toggle composable.
app/composables/use-checklist-store.ts Removes checklist store composable.
app/composables/use-checklist-items-data.ts Removes checklist items data composable.
app/composables/use-brands.ts Removes brands composable.
app/composables/use-app-state.ts Adds explicit imports for useCookie/useState.
app/composables/use-api-error-toast.ts Removes API error toast composable.
app/components/manager/equipment/EquipmentTable.vue Removes equipment manager table component.
app/components/manager/equipment/EquipmentCards.vue Removes equipment manager cards component.
app/components/manager/equipment/EquipmentCard.vue Removes equipment manager card component.
app/components/inputs/PerdInput.vue Removes wrapper for @perd-ui/text-input.
app/components/experimental/ExperimentalSelect.vue Removes experimental select component.
app/components/equipment/SearchInput.vue Removes equipment search input component.
app/components/equipment/EquipmentTable.vue Removes equipment table component.
app/components/equipment/EquipmentFilters.vue Removes equipment filters component.
app/components/equipment/EquipmentFilterDialog.vue Removes equipment filter dialog component.
app/components/equipment/EquipmentCards.vue Removes equipment cards component.
app/components/equipment/EquipmentCard.vue Removes equipment card component.
app/components/equipment/AddEquipmentForm.vue Removes add equipment form component.
app/components/dialogs/ModalDialog.vue Adds explicit Vue imports used in script.
app/components/dialogs/InputDialog.vue Removes input dialog component.
app/components/checklists/ChecklistsItem.vue Removes checklist item tile component.
app/components/checklists/ChecklistsContainer.vue Removes checklists container component.
app/components/checklists/ChecklistItemsList.vue Removes checklist items list component.
app/components/checklists/ChecklistItem.vue Removes checklist item component.
app/components/brands/EditBrandForm.vue Removes edit brand form component.
app/components/brands/BrandsTable.vue Removes brands table component.
app/components/brands/BrandInfoItem.vue Removes brand info item component.
app/components/brands/BrandInfo.vue Removes brand info component.
app/components/brands/BrandCards.vue Removes brand cards component.
app/components/brands/BrandCard.vue Removes brand card component.
app/components/_experimental/EditableText.vue Removes experimental editable text component.
app/components/SwitchBase.vue Removes switch base component.
app/components/PerdToggle.vue Removes toggle component.
app/components/PerdToaster.vue Removes toaster component.
app/components/PerdToast.vue Removes toast component.
app/components/PerdTextArea.vue Removes text area component.
app/components/PerdTag.vue Removes tag component.
app/components/PerdTable/PerdTable.vue Removes table component.
app/components/PerdTable/HeaderRow.vue Removes table header row component.
app/components/PerdSwitch.vue Removes switch component.
app/components/PerdSidebar/SidebarItem.vue Removes sidebar item component.
app/components/PerdSidebar/PerdSidebar.vue Removes navigation items and makes imports explicit.
app/components/PerdSelect.vue Removes select component.
app/components/PerdSearch/SearchOptionAdd.vue Removes search option “add” component.
app/components/PerdSearch/EmptyOption.vue Removes search “empty option” component.
app/components/PerdSearch/DefaultOption.vue Removes search default option component.
app/components/PerdPaginator.vue Removes paginator component.
app/components/PerdMenu/OptionToggle.vue Removes menu toggle option component.
app/components/PerdMenu.vue Adds explicit Vue imports used in script.
app/components/PerdHeading.vue Adds explicit Vue imports used in script.
app/components/PerdButton.vue Adds explicit Vue imports used in script.
app/components/PageHeader.vue Adds explicit imports for #imports and ofetch.
app/components/ImageUpload.vue Removes image upload component.
app/components/IconButton.vue Removes icon button component.
app/components/EmptyState.vue Removes empty state component.
app/components/ComboBox/ComboBox.vue Removes combo box component.
app/app.vue Removes toaster mount and adds explicit useHead import.
Dockerfile Removes custom postgres image build (ulid extension install).
AGENTS.md Replaces detailed docs with mandatory typecheck + oxlint commands.
.vscode/extensions.json Removes ESLint extension recommendation.
.oxlintrc.jsonc Adds Oxlint configuration and overrides.
.node-version Bumps Node version.
.github/skills/vue-patterns/references/styling.md Removes internal skill reference doc.
.github/skills/vue-patterns/references/formatting.md Removes internal skill reference doc.
.github/skills/vue-patterns/references/composables.md Removes internal skill reference doc.
.github/skills/vue-patterns/references/components.md Removes internal skill reference doc.
.github/skills/vue-patterns/SKILL.md Removes internal skill definition.
.github/skills/typescript-patterns/references/validation.md Removes internal skill reference doc.
.github/skills/typescript-patterns/references/types.md Removes internal skill reference doc.
.github/skills/typescript-patterns/references/type-assertions.md Removes internal skill reference doc.
.github/skills/typescript-patterns/references/imports.md Removes internal skill reference doc.
.github/skills/typescript-patterns/references/guards.md Removes internal skill reference doc.
.github/skills/typescript-patterns/SKILL.md Removes internal skill definition.
.github/skills/database/references/schema-patterns.md Removes internal skill reference doc.
.github/skills/database/references/relations.md Removes internal skill reference doc.
.github/skills/database/references/queries.md Removes internal skill reference doc.
.github/skills/database/references/migrations.md Removes internal skill reference doc.
.github/skills/database/references/formatting.md Removes internal skill reference doc.
.github/skills/database/SKILL.md Removes internal skill definition.
.github/skills/code-style/references/naming.md Removes internal skill reference doc.
.github/skills/code-style/references/functions.md Removes internal skill reference doc.
.github/skills/code-style/references/formatting.md Removes internal skill reference doc.
.github/skills/code-style/references/errors.md Removes internal skill reference doc.
.github/skills/code-style/references/comparisons.md Removes internal skill reference doc.
.github/skills/code-style/references/async.md Removes internal skill reference doc.
.github/skills/code-style/SKILL.md Removes internal skill definition.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import { useSession, getSession, updateSession, clearSession } from 'h3'
import { sessionCookieName } from '~~/constants';
import { validateSessionSecret } from './validate';
// oxlint-disable import/no-relative-parent-imports
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

This file disables import/no-relative-parent-imports to reach into ../../shared/constants, while other server code uses the #shared/constants alias. Switching this import to #shared/constants would remove the need for the file-level disable and keep import conventions consistent.

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +13
import * as v from 'valibot'
import { sessionCookieName } from '../../shared/constants';
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

This file disables import/no-relative-parent-imports to reach into ../../shared/constants, while other server code uses the #shared/constants alias. Switching this import to #shared/constants would remove the need for the file-level disable and keep import conventions consistent.

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +27
await event.context.dbHttp
.insert(tables.oauthProviders)
.values({
type: 'twitch',
name: 'Twitch'
})
.onConflictDoNothing()
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

This attempts an insert into oauthProviders on every Twitch OAuth callback. Even with onConflictDoNothing(), it adds a write attempt to a hot path and can become unnecessary overhead. Consider moving provider seeding to a migration/seed step, or ensuring it once at startup (or within the user-creation transaction where it’s needed).

Copilot uses AI. Check for mistakes.
Comment on lines +81 to +84
try {
const dbWebsocket = createWebSocketClient()

const newUser = await dbWebsocket.transaction(async (transaction) => {
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The new catch-all converts all failures into a generic 500 with no logging or cause propagation. That makes debugging production issues difficult and can also misclassify client-facing errors (e.g., unique constraint conflicts) as 500s. Consider capturing the caught error, logging it (at least server-side), and mapping known DB errors to more specific HTTP statuses/messages (e.g., 409 for conflicts).

Copilot uses AI. Check for mistakes.
Comment on lines +139 to +142
} catch {
throw createError({
message: 'Failed to create user',
status: 500
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The new catch-all converts all failures into a generic 500 with no logging or cause propagation. That makes debugging production issues difficult and can also misclassify client-facing errors (e.g., unique constraint conflicts) as 500s. Consider capturing the caught error, logging it (at least server-side), and mapping known DB errors to more specific HTTP statuses/messages (e.g., 409 for conflicts).

Suggested change
} catch {
throw createError({
message: 'Failed to create user',
status: 500
} catch (error) {
// Log the underlying error for debugging while avoiding leaking details to the client
// eslint-disable-next-line no-console
console.error('Failed to create OAuth user', error)
// If this is already an HTTP-style error with a status, rethrow to preserve it
if (
error &&
typeof error === 'object' &&
('statusCode' in error || 'status' in error)
) {
throw error
}
// Otherwise, wrap the original error in a generic 500 error, keeping it as the cause
throw createError({
message: 'Failed to create user',
status: 500,
cause: error

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants