Skip to content

chore: migrate wrangler.toml to wrangler.jsonc#2

Open
chitcommit wants to merge 1 commit intomainfrom
chore/wrangler-toml-to-jsonc
Open

chore: migrate wrangler.toml to wrangler.jsonc#2
chitcommit wants to merge 1 commit intomainfrom
chore/wrangler-toml-to-jsonc

Conversation

@chitcommit
Copy link
Contributor

@chitcommit chitcommit commented Mar 16, 2026

Summary

  • Convert wrangler.toml to wrangler.jsonc format
  • Preserves all configuration (vars, bindings, routes, environments)
  • Part of ecosystem-wide migration to JSONC for comment support

Test plan

  • Verify npx wrangler deploy --dry-run succeeds with new config
  • Confirm no config drift vs. production

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Introduced infrastructure configuration for Cloudflare Workers deployment with observability features including logging and tracing.
    • Configured separate staging and development environments with environment-specific settings.
    • Set up data storage and state management bindings for the platform.
    • Established migration plan for managing system component updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 16, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
documint 26af052 Mar 16 2026, 07:17 AM

@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

📝 Walkthrough

Walkthrough

A new Cloudflare Workers configuration file (wrangler.jsonc) has been added at the project root. The configuration establishes deployment metadata, observability settings with sampling rates, tail consumers, Durable Objects bindings, migration plans, and multi-environment support (staging and development).

Changes

Cohort / File(s) Summary
Cloudflare Workers Configuration
wrangler.jsonc
New configuration file defining deployment metadata, observability (logs/traces with sampling), tail consumers (chittytrack service), Durable Objects bindings (ProofStateDO), migration plan (v1/v2), global variables, and environment-scoped configs for staging and development.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A config file hops into place,
Wrangler's workers find their space,
Durable Objects, migrations aligned,
Observability trails intertwined,
Staging and dev now hand in hand! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: migrating configuration from wrangler.toml to wrangler.jsonc, which matches the file addition and PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/wrangler-toml-to-jsonc
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@wrangler.jsonc`:
- Around line 25-49: The JSON config nests "routes" and "kv_namespaces" inside
the "tail_consumers" object which prevents those top-level settings from being
applied; move the "routes" array and the "kv_namespaces" array out of the
"tail_consumers" entry and place them as top-level keys in the file (keeping the
same objects/entries including the route pattern strings and the kv namespace
bindings "DOCUMINT_CACHE" and "PROOFS" and the "service": "chittytrack"
reference) so routes register and KV namespaces bind correctly.
- Around line 1-2: Remove the deprecated wrangler.toml to avoid config
drift—delete the wrangler.toml file from the repo and ensure wrangler.jsonc
remains the single source of truth; verify there are no remaining references to
wrangler.toml in CI scripts, README, or build/deployment configs (search for
"wrangler.toml" in repository) and update any such references to point to
wrangler.jsonc or remove them.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b221d034-a450-47f9-977b-c9b276b53eb3

📥 Commits

Reviewing files that changed from the base of the PR and between fe29dc4 and 26af052.

📒 Files selected for processing (1)
  • wrangler.jsonc

Comment on lines +1 to +2
// documint — Cloudflare Workers configuration
{
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if wrangler.toml still exists and whether it's being deleted in this PR

echo "=== Checking for wrangler.toml existence ==="
if [ -f "wrangler.toml" ]; then
    echo "WARNING: wrangler.toml still exists in the repository"
    echo ""
    echo "=== wrangler.toml contents ==="
    head -20 wrangler.toml
else
    echo "OK: wrangler.toml not found (likely deleted)"
fi

echo ""
echo "=== Checking git status for wrangler.toml deletion ==="
git diff --name-status HEAD~1 HEAD 2>/dev/null | grep -i wrangler || echo "No wrangler file changes detected in last commit"

Repository: chittyapps/documint

Length of output: 692


🌐 Web query:

Wrangler configuration file precedence wrangler.toml vs wrangler.jsonc

💡 Result:

Wrangler resolves the config file by searching upwards from your working directory (or from the --script directory). If you don’t explicitly pass -c/--config, it picks the first existing file in this order:

  1. wrangler.json
  2. wrangler.jsonc
  3. wrangler.toml

So if wrangler.jsonc and wrangler.toml are both present at the same level, wrangler.jsonc wins. If you pass -c/--config <path>, that file always takes precedence. [1]

Wrangler supports all three config formats (TOML + JSON/JSONC). [2]

Sources
[1] cloudflare/workers-sdk packages/workers-utils/src/config/config-helpers.ts (config discovery order and -c precedence) (raw.githubusercontent.com)
[2] Cloudflare Workers docs – Wrangler configuration (supported formats) (developers.cloudflare.com)

Citations:


Remove wrangler.toml — Wrangler will use wrangler.jsonc but keeping the old file creates maintenance confusion.

Both wrangler.toml and wrangler.jsonc now exist in the repository. While Wrangler prioritizes wrangler.jsonc over wrangler.toml in its config discovery order, having both files creates unnecessary confusion and risks configuration drift if the old file is accidentally modified later. Delete wrangler.toml to complete the migration.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wrangler.jsonc` around lines 1 - 2, Remove the deprecated wrangler.toml to
avoid config drift—delete the wrangler.toml file from the repo and ensure
wrangler.jsonc remains the single source of truth; verify there are no remaining
references to wrangler.toml in CI scripts, README, or build/deployment configs
(search for "wrangler.toml" in repository) and update any such references to
point to wrangler.jsonc or remove them.

Comment on lines +25 to +49
"tail_consumers": [
{
"service": "chittytrack",
"routes": [
{
"pattern": "documint.chitty.cc/*",
"zone_name": "chitty.cc"
},
{
"pattern": "api.chitty.cc/documint/*",
"zone_name": "chitty.cc"
}
],
"kv_namespaces": [
{
"binding": "DOCUMINT_CACHE",
"id": "7809a9bc99ef43cc9ecc05f296c7bc08"
},
{
"binding": "PROOFS",
"id": "b7ee5b57ca224279827cc761e6b7146a"
}
]
}
],
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: routes and kv_namespaces incorrectly nested inside tail_consumers.

In the original wrangler.toml, routes and kv_namespaces are top-level keys, not nested within tail_consumers. The TOML structure places them after [[tail_consumers]] visually, but they are separate top-level configurations. This misconfiguration will prevent routes from being registered and KV namespaces from being bound.

🐛 Proposed fix: Move routes and kv_namespaces to top level
   "tail_consumers": [
     {
-      "service": "chittytrack",
-      "routes": [
-        {
-          "pattern": "documint.chitty.cc/*",
-          "zone_name": "chitty.cc"
-        },
-        {
-          "pattern": "api.chitty.cc/documint/*",
-          "zone_name": "chitty.cc"
-        }
-      ],
-      "kv_namespaces": [
-        {
-          "binding": "DOCUMINT_CACHE",
-          "id": "7809a9bc99ef43cc9ecc05f296c7bc08"
-        },
-        {
-          "binding": "PROOFS",
-          "id": "b7ee5b57ca224279827cc761e6b7146a"
-        }
-      ]
+      "service": "chittytrack"
     }
   ],
+  "routes": [
+    {
+      "pattern": "documint.chitty.cc/*",
+      "zone_name": "chitty.cc"
+    },
+    {
+      "pattern": "api.chitty.cc/documint/*",
+      "zone_name": "chitty.cc"
+    }
+  ],
+  "kv_namespaces": [
+    {
+      "binding": "DOCUMINT_CACHE",
+      "id": "7809a9bc99ef43cc9ecc05f296c7bc08"
+    },
+    {
+      "binding": "PROOFS",
+      "id": "b7ee5b57ca224279827cc761e6b7146a"
+    }
+  ],
   "durable_objects": {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"tail_consumers": [
{
"service": "chittytrack",
"routes": [
{
"pattern": "documint.chitty.cc/*",
"zone_name": "chitty.cc"
},
{
"pattern": "api.chitty.cc/documint/*",
"zone_name": "chitty.cc"
}
],
"kv_namespaces": [
{
"binding": "DOCUMINT_CACHE",
"id": "7809a9bc99ef43cc9ecc05f296c7bc08"
},
{
"binding": "PROOFS",
"id": "b7ee5b57ca224279827cc761e6b7146a"
}
]
}
],
"tail_consumers": [
{
"service": "chittytrack"
}
],
"routes": [
{
"pattern": "documint.chitty.cc/*",
"zone_name": "chitty.cc"
},
{
"pattern": "api.chitty.cc/documint/*",
"zone_name": "chitty.cc"
}
],
"kv_namespaces": [
{
"binding": "DOCUMINT_CACHE",
"id": "7809a9bc99ef43cc9ecc05f296c7bc08"
},
{
"binding": "PROOFS",
"id": "b7ee5b57ca224279827cc761e6b7146a"
}
],
"durable_objects": {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wrangler.jsonc` around lines 25 - 49, The JSON config nests "routes" and
"kv_namespaces" inside the "tail_consumers" object which prevents those
top-level settings from being applied; move the "routes" array and the
"kv_namespaces" array out of the "tail_consumers" entry and place them as
top-level keys in the file (keeping the same objects/entries including the route
pattern strings and the kv namespace bindings "DOCUMINT_CACHE" and "PROOFS" and
the "service": "chittytrack" reference) so routes register and KV namespaces
bind correctly.

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.

1 participant