refactor: convert wrangler config from TOML to JSONC#104
Conversation
Replace inline fractal scope projection with thin adapter over the shared @chittyos/schema/scope-projector library. Reduces central-workflows.ts from 175 to 59 lines — the SQL upsert, status mapping, and type definitions now live in chittyschema and are reused across services. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Convert both root wrangler.toml and deploy/system-wrangler.toml to JSONC - Sync root config with deploy config (adds hyperdrive, send_email, crons that were previously only in deploy/) - Update CI workflow, detect-mode script, and rotate-db-secret references - Validated via `wrangler deploy --dry-run` — all bindings resolve correctly Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
chittyfinance | 4d715d5 | Apr 24 2026, 08:17 AM |
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 55 minutes and 54 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review Please evaluate:
|
Code Review — PR #104: refactor: convert wrangler config from TOML to JSONCOverviewThis PR converts both The motivation is sound — JSONC allows inline comments which makes config maintenance much easier. The execution has a few issues that need addressing before merge. 🚨 Blockers1. Local "@chittyos/schema": "file:../../CHITTYFOUNDATION/chittyschema"This path assumes a specific monorepo sibling layout on the developer's machine. It will not resolve on Cloudflare Workers Builds, GitHub Actions, or any other environment that doesn't share that exact directory tree. This is the most critical issue — the worker build will fail in CI/CD. Options: publish 2. The file header correctly documents the rule:
Yet
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d715d52ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "test:run": "vitest run" | ||
| }, | ||
| "dependencies": { | ||
| "@chittyos/schema": "file:../../CHITTYFOUNDATION/chittyschema", |
There was a problem hiding this comment.
Replace local schema path with installable dependency
The new dependency specifier points to a filesystem path outside this repository (file:../../CHITTYFOUNDATION/chittyschema), so a normal checkout cannot install dependencies unless that exact sibling directory exists; in CI this breaks pnpm install (and with the current unchanged lockfile it also fails --frozen-lockfile immediately). Because server/lib/central-workflows.ts now imports from @chittyos/schema/scope-projector, this makes build/test pipelines fail before compilation in environments that only have this repo.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Converts Cloudflare Wrangler configuration from TOML to JSONC and updates related tooling to reference the new config files.
Changes:
- Replace
wrangler.toml/deploy/system-wrangler.tomlwithwrangler.jsonc/deploy/system-wrangler.jsoncand sync bindings across configs. - Refactor scope projection to delegate to
@chittyos/schema/scope-projector. - Update scripts and workflow triggers that reference the deploy wrangler config.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| wrangler.toml | Removes legacy root TOML wrangler config. |
| wrangler.jsonc | Adds root JSONC wrangler config with synced bindings (hyperdrive/email/crons). |
| deploy/system-wrangler.toml | Removes legacy deploy TOML wrangler config. |
| deploy/system-wrangler.jsonc | Adds deploy JSONC wrangler config equivalent to prior TOML. |
| server/lib/central-workflows.ts | Replaces in-file scope projection logic with shared projector adapter. |
| scripts/rotate-db-secret.py | Updates rotated secret deployment to use JSONC config path. |
| scripts/detect-mode.js | Detects system mode via presence of JSONC (and TOML fallback) config. |
| package.json | Adds @chittyos/schema dependency for shared scope projector usage. |
| .github/workflows/register.yml | Updates workflow path trigger to watch the JSONC config file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
| "dependencies": { | ||
| "@chittyos/schema": "file:../../CHITTYFOUNDATION/chittyschema", | ||
| "@hookform/resolvers": "^3.9.1", |
There was a problem hiding this comment.
package.json was updated to add a new dependency, but pnpm-lock.yaml wasn’t updated in this PR. CI runs pnpm install --frozen-lockfile (see .github/workflows/security-gates.yml:91), so this will fail until the lockfile is regenerated and committed.
| "@hookform/resolvers": "^3.9.1", |
| "test:run": "vitest run" | ||
| }, | ||
| "dependencies": { | ||
| "@chittyos/schema": "file:../../CHITTYFOUNDATION/chittyschema", |
There was a problem hiding this comment.
Using a local file:../../CHITTYFOUNDATION/chittyschema dependency makes installs non-reproducible and will break in any environment where that external path doesn’t exist (including most CI/checkouts). Consider switching to a published/versioned dependency (registry or git URL), or vendor/workspace the package within this repo so dependency resolution works from a clean checkout.
| "@chittyos/schema": "file:../../CHITTYFOUNDATION/chittyschema", | |
| "@chittyos/schema": "2.0.0", |
| financeProjector(c, env, { | ||
| externalId: projection.externalId, | ||
| scopeType: projection.scopeType, | ||
| characterization: projection.characterization, | ||
| title: projection.title, | ||
| summary: projection.summary, | ||
| localStatus: projection.localStatus, | ||
| statusReason: projection.statusReason, | ||
| metadata: { | ||
| tenantId: projection.tenantId, | ||
| ...(projection.metadata ?? {}), | ||
| }, | ||
| }); |
There was a problem hiding this comment.
scopeLog previously guaranteed “fire-and-forget / fail-open” behavior in non-Workers runtimes by wrapping waitUntil in a try/catch. The new implementation calls the shared projector directly without any guard; if the shared projector uses c.executionCtx.waitUntil (as other clients do), this can throw in node/test contexts and break request handlers. To match existing conventions (e.g., server/lib/ledger-client.ts:113-120 and server/lib/discovery-client.ts:100-108), wrap the projector invocation in a try/catch (or otherwise ensure it no-ops safely when executionCtx is unavailable).
| financeProjector(c, env, { | |
| externalId: projection.externalId, | |
| scopeType: projection.scopeType, | |
| characterization: projection.characterization, | |
| title: projection.title, | |
| summary: projection.summary, | |
| localStatus: projection.localStatus, | |
| statusReason: projection.statusReason, | |
| metadata: { | |
| tenantId: projection.tenantId, | |
| ...(projection.metadata ?? {}), | |
| }, | |
| }); | |
| try { | |
| financeProjector(c, env, { | |
| externalId: projection.externalId, | |
| scopeType: projection.scopeType, | |
| characterization: projection.characterization, | |
| title: projection.title, | |
| summary: projection.summary, | |
| localStatus: projection.localStatus, | |
| statusReason: projection.statusReason, | |
| metadata: { | |
| tenantId: projection.tenantId, | |
| ...(projection.metadata ?? {}), | |
| }, | |
| }); | |
| } catch { | |
| // Best-effort / fail-open in non-Workers runtimes where waitUntil may be unavailable. | |
| } |
Summary
wrangler.tomlanddeploy/system-wrangler.tomlto JSONC formatwrangler deploy --dry-run— all bindings resolve correctlyTest plan
wrangler deploy --dry-run --config wrangler.jsoncparses all bindings🤖 Generated with Claude Code