Skip to content

fix(events): log why uploads are rejected or fail, without client-chosen names - #76

Merged
yaacovcorcos merged 4 commits into
mainfrom
claude/events-diagnostics-20261116
Nov 16, 2026
Merged

yaacovcorcos merged 4 commits into
mainfrom
claude/events-diagnostics-20261116

Conversation

@yaacovcorcos

Copy link
Copy Markdown
Contributor

What

The events gateway now explains why it rejected or failed an upload.

  • Every ingestion 400 returns and logs a closed reason and stage (headers, body, size, batch, event, privacy).
  • The rejection log adds:
    • the batch size and the rejected event's position;
    • the client's appVersion, buildChannel and contractRevision, only when they match their formats;
    • a user-agent family.
  • Nothing the client chose is logged: no event names, property keys or values, IDs, tokens or IPs. Nothing is authenticated at rejection time.
  • The body is read before the token check, so a token rejection still logs these fields. Validation is as strict as before.
  • Internal failures log the step that failed, the error's class and name, and a closed storage error_kind, never the error message.
  • The conformance corpus (fixtures/contract-v11.json) is regenerated from Desktop's contract (generateConformance.ts --check passes).

Why

  • On Nov 16, 13:00–14:20 UTC, 68 rejections from one Node client with no installation token were logged only as validation.
  • Four 500s on Nov 10–11 were logged only as internal.

Testing

  • Passing: vitest (187 passed, 2 opt-in skipped), events:typecheck, oxfmt --check.
  • Review: Codex found two privacy problems in the logged names; both fixed, final pass "Fixes verified".

Documentation impact: Updated — README.md

Deploy (manual, needs the owner's go): merge, run bun run check, then bun run events:deploy. No migrations, secrets or binding changes. Afterwards, confirm worker_version on /health.

🤖 Generated with Claude Code

yaacovcorcos and others added 4 commits November 16, 2026 18:39
A rejected upload now carries a closed reason and stage in its 400 body and
log line, with a privacy-safe batch description: size, event-name counts,
the client's appVersion, buildChannel and contractRevision when they match
their formats, a user-agent family, and for a property rejection the key.
The body is read before the token check so token rejections keep that
context. An internal failure logs the ingestion step, error class and name,
and a closed storage error kind, never the message. Maintenance,
identity-link and deletion failures log the same error diagnostics.

Validation strictness is unchanged. Desktop's uploader ignores the body of
an unsuccessful response, so the extra 400 fields are compatible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Desktop's turn and delivery fields (retryAttempts, failure details,
runtime-change details, oldestEventAgeBucket) were missing from the
gateway's copy of the contract-v11 corpus. Regenerated with
generateConformance.ts; --check passes against desktop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review (Codex): a tokenless request could get any name of a valid shape,
such as one with an IP address, into the rejection log. Only names of
lowercase words joined by dots, as Scient's code writes them, are logged;
anything else is counted as "(other)".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Re-check (Codex): a name pattern cannot tell an event name from one that
carries a person's name (patient.john.smith). Nothing is authenticated
when a batch is rejected, so its log keeps only counts, the rejected
event's position, the client's release fields and the reason; no event
names or property keys.

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

Copy link
Copy Markdown

Deploying scientfactory-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 74465eb
Status: ✅  Deploy successful!
Preview URL: https://7f5c2493.scientfactory-website.pages.dev
Branch Preview URL: https://claude-events-diagnostics-20.scientfactory-website.pages.dev

View logs

@yaacovcorcos
yaacovcorcos merged commit efc582f into main Nov 16, 2026
2 checks passed
@yaacovcorcos
yaacovcorcos deleted the claude/events-diagnostics-20261116 branch November 16, 2026 17:21
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