Skip to content

chore: remove dead notion-sync-worker + monitor script#23

Open
chitcommit wants to merge 2 commits into
mainfrom
chore/remove-dead-notion-sync-worker
Open

chore: remove dead notion-sync-worker + monitor script#23
chitcommit wants to merge 2 commits into
mainfrom
chore/remove-dead-notion-sync-worker

Conversation

@chitcommit

@chitcommit chitcommit commented Jun 4, 2026

Copy link
Copy Markdown
Member

Summary

  • Delete src/workers/notion-sync-worker.js — not bound by any wrangler config and only self-referenced.
  • Delete scripts/monitor-notion-sync.js — reads NOTION_SYNC_WORKER_URL which is unset anywhere; targets a worker that is not deployed.

Investigation

  • wrangler.jsonc, wrangler.hybrid.toml, wrangler-pages.toml: zero Notion references.
  • Cross-repo grep across CHITTYFOUNDATION/* and CHITTYOS/*: zero external references.
  • Intra-repo: only the worker references itself; monitor references only the worker.
  • Current Notion integration uses src/services/notion-sync.js and src/api/notion-bridge.js (untouched).
  • Git history shows only mechanical rename/URL-repair commits since initial — no active development.

Surfaced during chittyid PR #22 cleanup (orphan task 4b35b6e3-51a4-4c44-a8e4-ac43b9b17e68).

Test plan

  • CI green
  • Confirm no deploy pipeline references removed files

Generated with Claude Code

Summary by CodeRabbit

  • Removed Features

    • Removed Notion synchronization integration and its associated monitoring tools.
  • Changes

    • Service endpoint configuration is now dynamically configured through environment variables instead of a hardcoded value, allowing for more flexible deployment configurations.

chitcommit and others added 2 commits June 3, 2026 22:48
The mothership->chittyid rename incorrectly transformed account-subdomain
segments of workers.dev URLs. Cloudflare workers.dev URL shape is
<worker_name>.<account_subdomain>.workers.dev, so notion-sync.chittyid-mothership.workers.dev
had "chittyid-mothership" as the *account subdomain*, not the worker name.
Renaming that segment to "chittyid" produced URLs that don't resolve.
Also, this worker has workers_dev: false, so neither URL was ever live.

- src/services/registry-client.js: read endpoint from
  env.CHITTYID_SERVICE_URL (matches src/client/index.js convention) /
  SERVICE_PUBLIC_URL, fallback to canonical route https://id.chitty.cc.
- scripts/monitor-notion-sync.js: require NOTION_SYNC_WORKER_URL to be
  set explicitly; fail with a clear error otherwise. No notion-sync
  wrangler config deploys src/workers/notion-sync-worker.js in this repo,
  so guessing a canonical URL would be wrong.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
These files are leftovers from an older notion-sync architecture:

- src/workers/notion-sync-worker.js is not bound by any wrangler config
  (wrangler.jsonc, wrangler.hybrid.toml, wrangler-pages.toml all have
  zero Notion references) and is only referenced by itself.
- scripts/monitor-notion-sync.js reads NOTION_SYNC_WORKER_URL which is
  not set anywhere in the repo or ecosystem and targets a worker that
  is not deployed.
- No cross-repo references exist in CHITTYFOUNDATION/* or CHITTYOS/*.
- Current Notion integration flows through src/services/notion-sync.js
  and src/api/notion-bridge.js, which are unaffected.

Surfaced during chittyid PR #22 cleanup (orphan task
4b35b6e3-51a4-4c44-a8e4-ac43b9b17e68).

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

Copy link
Copy Markdown

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
chittyid ec72dc9 Jun 04 2026, 01:16 PM

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR removes the Notion synchronization worker and its monitoring CLI script, eliminating all Notion-related endpoints and functionality. The service registry endpoint is reconfigured to be dynamically derived from environment variables rather than hardcoded, allowing flexibility in service URL assignment.

Changes

Notion Sync Removal and Service Endpoint Configuration

Layer / File(s) Summary
Service endpoint configuration
src/services/registry-client.js
buildServiceInfo() now sets endpoint from environment variables CHITTYID_SERVICE_URL or SERVICE_PUBLIC_URL with fallback to https://id.chitty.cc, replacing hardcoded https://chittyid.chitty.workers.dev.
Notion sync worker removal
src/workers/notion-sync-worker.js
Entire NotionSyncWorker class and Cloudflare Worker router removed, eliminating /bridges/notion/facts:sync, /sync/notion/dlq, and /sync/notion/verify endpoints along with field mapping, payload transformation, and DLQ operations.
Monitoring script removal
scripts/monitor-notion-sync.js
CLI monitoring script and NotionSyncMonitor class removed, eliminating Notion configuration verification, sync metrics evaluation, DLQ depth checks, test syncs, and continuous monitoring capability.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through code so neat,
Deleting sync from Notion's street,
Config endpoints now can dance,
With env vars' gentle chance—
Less to monitor, more to chant! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: remove dead notion-sync-worker + monitor script' directly and accurately summarizes the main changes in the PR: removal of two unused/dead files (the Notion sync worker and its monitoring script).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/remove-dead-notion-sync-worker
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch chore/remove-dead-notion-sync-worker

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/services/registry-client.js (1)

205-206: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Missing mandatory ChittyID agent auth headers on direct ChittyID call.

The fetch to ChittyID health endpoint is sent without X-ChittyOS-Agent-ChittyID and X-ChittyOS-API-Key, and there is no visible ChittyTrust signature validation step before/for this call path.

As per coding guidelines, "Every agent call to ChittyID MUST present X-ChittyOS-Agent-ChittyID header ... and X-ChittyOS-API-Key header ... and validate token signature against ChittyTrust on every call."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/services/registry-client.js` around lines 205 - 206, The direct fetch to
the ChittyID health endpoint is missing required auth headers and signature
validation; update the call in src/services/registry-client.js (the fetch that
assigns to response) to include the X-ChittyOS-Agent-ChittyID and
X-ChittyOS-API-Key headers populated from the current agent identity/secret, and
before making the request ensure you validate the agent token signature against
ChittyTrust (e.g., call the existing ChittyTrust validation helper such as
validateChittyTrustSignature or ChittyTrust.verifySignature with the agent
token) and abort/log on validation failure so every agent call to the ChittyID
health endpoint presents both headers and has its token signature verified.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/services/registry-client.js`:
- Around line 21-24: buildServiceInfo now uses env vars (CHITTYID_SERVICE_URL /
SERVICE_PUBLIC_URL) to set publicUrl but getHealthStatus still calls the legacy
hardcoded health endpoint, causing split-brain; update getHealthStatus to derive
the health probe URL from the same source used in buildServiceInfo (use
this.env?.CHITTYID_SERVICE_URL || this.env?.SERVICE_PUBLIC_URL ||
'https://id.chitty.cc') and append the health path (/api/health) so health
checks target the advertised service; ensure references to publicUrl logic are
consolidated (e.g., reuse the same variable or helper used in buildServiceInfo)
and remove the hardcoded 'https://chittyid.chitty.workers.dev/api/health' string
in getHealthStatus.

---

Outside diff comments:
In `@src/services/registry-client.js`:
- Around line 205-206: The direct fetch to the ChittyID health endpoint is
missing required auth headers and signature validation; update the call in
src/services/registry-client.js (the fetch that assigns to response) to include
the X-ChittyOS-Agent-ChittyID and X-ChittyOS-API-Key headers populated from the
current agent identity/secret, and before making the request ensure you validate
the agent token signature against ChittyTrust (e.g., call the existing
ChittyTrust validation helper such as validateChittyTrustSignature or
ChittyTrust.verifySignature with the agent token) and abort/log on validation
failure so every agent call to the ChittyID health endpoint presents both
headers and has its token signature verified.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 927f128c-43b5-42e9-bde8-fd8889a9c858

📥 Commits

Reviewing files that changed from the base of the PR and between a2bf8b2 and ec72dc9.

📒 Files selected for processing (3)
  • scripts/monitor-notion-sync.js
  • src/services/registry-client.js
  • src/workers/notion-sync-worker.js
💤 Files with no reviewable changes (2)
  • src/workers/notion-sync-worker.js
  • scripts/monitor-notion-sync.js

Comment on lines +21 to +24
const publicUrl =
this.env?.CHITTYID_SERVICE_URL ||
this.env?.SERVICE_PUBLIC_URL ||
'https://id.chitty.cc';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Endpoint source changed, but health checks still use the legacy hardcoded host.

buildServiceInfo() now advertises an env-derived endpoint (Line 21-24, Line 30), but getHealthStatus() still probes https://chittyid.chitty.workers.dev/api/health (Line 205). This creates split-brain health reporting when CHITTYID_SERVICE_URL/SERVICE_PUBLIC_URL points elsewhere.

Suggested fix
  buildServiceInfo() {
    const publicUrl =
      this.env?.CHITTYID_SERVICE_URL ||
      this.env?.SERVICE_PUBLIC_URL ||
      'https://id.chitty.cc';
    return {
@@
      endpoint: publicUrl,
@@
    };
  }
@@
  async getHealthStatus() {
    try {
-      const response = await fetch('https://chittyid.chitty.workers.dev/api/health');
+      const base = this.serviceInfo?.endpoint || 'https://id.chitty.cc';
+      const response = await fetch(`${base.replace(/\/$/, '')}/api/health`);

Also applies to: 30-30

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/services/registry-client.js` around lines 21 - 24, buildServiceInfo now
uses env vars (CHITTYID_SERVICE_URL / SERVICE_PUBLIC_URL) to set publicUrl but
getHealthStatus still calls the legacy hardcoded health endpoint, causing
split-brain; update getHealthStatus to derive the health probe URL from the same
source used in buildServiceInfo (use this.env?.CHITTYID_SERVICE_URL ||
this.env?.SERVICE_PUBLIC_URL || 'https://id.chitty.cc') and append the health
path (/api/health) so health checks target the advertised service; ensure
references to publicUrl logic are consolidated (e.g., reuse the same variable or
helper used in buildServiceInfo) and remove the hardcoded
'https://chittyid.chitty.workers.dev/api/health' string in getHealthStatus.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec72dc9dad

ℹ️ 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".

version: '2.0.0',
description: 'Identity management system with hardened security pipeline',
endpoint: 'https://chittyid.chitty.workers.dev',
endpoint: publicUrl,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use the registered endpoint for health checks

When this registers the service at CHITTYID_SERVICE_URL/SERVICE_PUBLIC_URL/https://id.chitty.cc, subsequent /api/registry/update calls still send health: await this.getHealthStatus(), and getHealthStatus() probes the old hard-coded https://chittyid.chitty.workers.dev/api/health. In the production config I checked, wrangler.jsonc has workers_dev: false and routes only id.chitty.cc/*, so status updates for the newly advertised endpoint can report an unhealthy service even when id.chitty.cc is healthy.

Useful? React with 👍 / 👎.

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