Skip to content

Refactor runtime and build paths#128

Merged
mahata merged 2 commits intomainfrom
codex/simplify-codebase
Mar 26, 2026
Merged

Refactor runtime and build paths#128
mahata merged 2 commits intomainfrom
codex/simplify-codebase

Conversation

@mahata
Copy link
Copy Markdown
Owner

@mahata mahata commented Mar 26, 2026

Summary

  • tighten Biome coverage so lint checks the application code instead of mostly root config files
  • simplify runtime behavior by keeping test/debug routes out of production and hardening the WebSocket/message flows
  • reduce repository and build noise by removing the npm lockfile, dropping an unused dependency, cleaning dist before builds, and limiting prod output to deployable server code
  • add a database index and migration for message history reads

Validation

  • pnpm test:run
  • pnpm lint
  • pnpm build
  • pnpm db:generate

Copilot AI review requested due to automatic review settings March 26, 2026 00:04
Copy link
Copy Markdown
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

Refactors build/lint/runtime wiring for the Hono app so production output is cleaner, dev/test-only routes stay out of prod, and message history reads are optimized.

Changes:

  • Adjust TypeScript prod build output layout (rootDir/include/exclude) and update start:prod to match.
  • Gate debug/test routes to development and tighten WebSocket/message handling.
  • Add messages.created_at index + migration and update message history query to return chronological results efficiently.

Reviewed changes

Copilot reviewed 21 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tsconfig.prod.json Sets rootDir, narrows include, and excludes test/static-only TS from prod build.
package.json Cleans build output before compiling, updates prod start path, removes unused dev dependency.
package-lock.json Removes npm lockfile to reduce repo noise (pnpm is the package manager).
hono/testApp.ts Tightens middleware typing for test app session injection.
hono/static/ChatPage.ts Minor formatting; keeps message-load timeout logic intact.
hono/routes/ws.ts Rejects unauthenticated WS connections on open; trims messages before storing/broadcasting.
hono/routes/ws.test.ts Formatting cleanup in test setup.
hono/routes/messages.ts Reworks message history query using a subquery to return oldest→newest without JS reversing.
hono/routes/messages.test.ts Updates DB mock shape for the new subquery-based message query.
hono/routes/emailAuth.test.ts Formatting update for mocked DB results.
hono/routes/auth.ts Restricts /debug/session to development; keeps OAuth env validation.
hono/db/schema.ts Adds messages_created_at_idx index definition.
hono/db/migrations/meta/_journal.json Registers the new migration in the drizzle journal.
hono/db/migrations/meta/0002_snapshot.json Adds schema snapshot including the new messages index.
hono/db/migrations/0002_bent_maria_hill.sql Creates the messages_created_at_idx index in SQL.
hono/components/RegisterPage.tsx Formatting-only JSX changes.
hono/components/LoginPage.tsx Formatting-only JSX changes.
hono/components/ChatPage.tsx Formatting-only JSX changes.
hono/components/AboutPage.tsx Formatting-only JSX changes; preserves link security attributes.
hono/components/AboutPage.test.ts Formatting-only changes to tests.
hono/app.tsx Registers testAuth routes only in development; improves middleware typing.
e2e/database-persistence.spec.ts Import order/formatting tweak.
e2e/app.spec.ts Import order/formatting tweak.
biome.json Narrows Biome includes to application code globs (hono/e2e) + root configs.
.gitignore Removes large unrelated ignore block to reduce noise while keeping relevant ignores.

Comment thread package.json
Comment on lines 8 to 15
"dev": "pnpm run build:client:watch & tsx watch hono/index.ts",
"build": "pnpm run build:client && tsc --project tsconfig.prod.json",
"build": "rm -rf dist && pnpm run build:client && tsc --project tsconfig.prod.json",
"build:client": "tsc --project tsconfig.client.json",
"build:client:watch": "tsc --project tsconfig.client.json --watch",
"build:check": "tsc --noEmit",
"start": "tsx hono/index.ts",
"start:prod": "node dist/hono/index.js",
"start:prod": "node dist/index.js",
"test": "vitest",
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

build uses rm -rf dist, which will fail on Windows shells. Consider replacing this with a cross-platform cleanup using Node’s fs.rmSync(..., { recursive: true, force: true }) (or an equivalent approach that doesn’t assume a POSIX shell).

Copilot uses AI. Check for mistakes.
@mahata mahata merged commit 111b1c3 into main Mar 26, 2026
3 checks passed
@mahata mahata deleted the codex/simplify-codebase branch March 26, 2026 01:14
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