Skip to content

Add runtime configuration for file validation and wire schema normalization#149

Draft
Copilot wants to merge 4 commits into
masterfrom
copilot/make-configurable-runtime-values
Draft

Add runtime configuration for file validation and wire schema normalization#149
Copilot wants to merge 4 commits into
masterfrom
copilot/make-configurable-runtime-values

Conversation

Copilot AI commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

Implements production readiness tasks 13.1, 13.4, 13.6, and 15.x. Tasks requiring auth system, rate limiting, or background jobs infrastructure are deferred.

Configuration System

Server-side:

  • OPENROUTER_URL - OpenRouter endpoint (proxy/alternative deployments)

Client-side:

  • NUXT_PUBLIC_ALLOWED_MIME_TYPES - File upload allowlist (comma-separated)
  • NUXT_PUBLIC_MAX_FILE_SIZE_BYTES - Upload size limit

All defaults match previous hardcoded values. Zero breaking changes.

// nuxt.config.ts
runtimeConfig: {
  openrouterUrl: process.env.OPENROUTER_URL || 'https://openrouter.ai/api/v1/chat/completions',
  public: {
    allowedMimeTypes: process.env.NUXT_PUBLIC_ALLOWED_MIME_TYPES || 'image/jpeg,image/png,...',
    maxFileSizeBytes: parseInt(process.env.NUXT_PUBLIC_MAX_FILE_SIZE_BYTES || '20971520', 10),
  }
}

Wire Schema Normalization

Database uses snake_case (SQL convention), JavaScript uses camelCase. Added utilities to accept both formats and normalize to snake_case for storage.

import { normalizeWireSchema } from '~~/shared/utils/casing';

// Accepts both formats
const data = { userId: 123, created_at: Date.now() }; // Mixed
const normalized = normalizeWireSchema(data);
// => { user_id: 123, created_at: ... }

// Ready for Zod validation and database storage
const validated = ThreadSchema.parse(normalized);

Utilities:

  • normalizeWireSchema(obj) - Primary ingestion function
  • keysToSnakeCase(obj) / keysToCamelCase(obj) - Recursive key transformation
  • camelToSnake(str) / snakeToCamel(str) - String conversion

Documentation

  • docs/runtime-configuration.md - Config reference with proxy/dev/prod examples
  • docs/wire-schema-normalization.md - Schema casing patterns and integration guide

Tests

  • tests/unit/casing.test.ts - 20 tests covering conversion edge cases
  • tests/unit/file-upload-config.test.ts - 13 tests for configurable validation
  • All existing tests pass (718 total)

Deferred Tasks

  • 13.2, 13.3, 13.5 - Rate limits, GC retention, background job config (infrastructure not implemented)
  • 14.x - Per-user resource limits (requires auth system)
  • 16.x - Background jobs execution plan (requires job queue)

See planning/or3-cloud-production-readiness/IMPLEMENTATION_SUMMARY.md for details.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: Saluana <46250649+Saluana@users.noreply.github.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Feb 12, 2026

Copy link
Copy Markdown

Deploying or3-chat with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1a6ab80
Status:🚫  Build failed.

View logs

Copilot AI and others added 2 commits February 12, 2026 15:15
- Add MIME type allowlist configuration (NUXT_PUBLIC_ALLOWED_MIME_TYPES)
- Add max file size configuration (NUXT_PUBLIC_MAX_FILE_SIZE_BYTES)
- Add OpenRouter URL configuration (OPENROUTER_URL)
- Create casing utilities for camelCase/snake_case normalization
- Add comprehensive tests for file upload config and casing
- Document all new config options and wire schema normalization

Co-authored-by: Saluana <46250649+Saluana@users.noreply.github.com>
Co-authored-by: Saluana <46250649+Saluana@users.noreply.github.com>
Copilot AI changed the title [WIP] Add configurable hardcoded values for runtime settings Add runtime configuration for file validation and wire schema normalization Feb 12, 2026
Copilot AI requested a review from Saluana February 12, 2026 15:20
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