Repository navigation
Conversation
handle() writes one Analytics Engine point per response (MasterMind RFC 0004 packet P5, telemetry.v1): blobs [event, release, route, method, status, code, app], doubles [1, ms]. The route is the route table's template, never the raw path; app is the request Origin against the account API's allowlist; release is the short sha CI writes into server/release.js before the Function build. telemetry/events.json is the allowlist, and server/telemetry.js writes nothing outside it. The write is never awaited and runs in a try once the response is final, so responses stay byte-identical with the binding absent, present or throwing. wrangler.toml binds EVENTS to syberlabs_events in production only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VHrJ4hmTtR1RFNpc215EK7
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needs Seth's handle:
wrangler.tomlfloors at keys. Merge after #188 (privacy copy).What changed
server/app.js: one Analytics Engine write per response inhandle().count()runs once the response is final (aftersecure(), CORS and the HEAD copy):env.EVENTS.writeDataPoint(point)inside a try, never awaited, skipped when there is no binding. Error codes travel beside responses throughtag()infail(), the 403 page andunavailable(); the two inline account-API 503s became onedown()helper with the same bytes.server/telemetry.js(new):sitePoint(fields)builds{ indexes: ['site.request'], blobs: [event, release, route, method, status, code, app], doubles: [1, ms] }from the allowlist or returns null;tag/codeOfkeep a code in a WeakMap. It imports nothing but the allowlist, soapp.jsandaccount-api.jsshare it without an import cycle.telemetry/events.json(new): the allowlist in the telemetry.v1 contract form (owner Seth, decision "Are account saves working for each consumer app?"). The code reads it: a field it does not list is never written, and a value outside a list drops the point.server/routes.js:template(table, pathname), the pattern a path matches whatever the method (so a 405 still has its template).server/account-api.js:accountRoute(pathname)(its three templates) andfailure()tags its error code.server/release.js(new):RELEASE = 'unknown'. CI's "Build and check the staff Function" step rewrites it with${GITHUB_SHA::7}just before the bundle and greps the bundle for it, so production carries the commit it was built from.wrangler.toml:[[analytics_engine_datasets]] binding = "EVENTS",dataset = "syberlabs_events", top level only (bindings do not inherit;env.previewhas none).server/CONTRACT.md: a site.request section and a test-table row.server/test/telemetry.test.js(new): 7 tests.unknowneverywhere else/admin/saves/:id/download), the account API's (/admin/api/v1/saves/:id), elseunmatched; never the raw pathGET,HEAD,POST,OPTIONS,other2xx,3xx,4xx,5xxnot_found,csrf,method_not_allowed,too_large),forbidden, the account API's error (signin_required,account_changed, ...),unavailablefor the fail-closed 503s, elsenoneomni,rise,sketch(Origin inAPP_ORIGINS),site(Origin isORIGIN), elsenone1,msNo user, session or save id, address, User-Agent or query string is read into a point.
Why
RFC 0004 packet P5 (https://github.com/SyberLabs/MasterMind/pull/68) and
docs/contracts/telemetry-v1.md: account saves have three consumers and no per-consumer error count.Tests
node --test 'server/test/**/*.test.js': 199 tests, 199 pass, 0 fail (192 existing, 7 new).telemetry.test.js: responses byte-identical (status, statusText, every header, body) across 27 requests with the binding absent, recording, throwing and malformed ({}), plus D1-down and missing-config 503s on a page and on the API; one point per response; every point's fields, order and closed sets; templates for routes with ids; method, status, code and app for 20 cases; text pushed into the path, query, Origin, User-Agent, CF-Connecting-IP, cookie, expected-user header, method and JSON body never reaching a point (nor the user id, session token or save id);sitePointrefusing out-of-set values and dropping unlisted fields; the allowlist's shape; the binding only at the top level ofwrangler.toml.site1, the binding added to preview 1, a response header changed when bound 1; a no-op control fails none.node --test scripts/account-nav.test.mjs: 9 pass.GITHUB_SHAafternpm ci --prefix deployandpnpm build:site(pnpm 11.25.0 through corepack, Node 22.22.0; CI uses 24): every guard passed, and wrangler 4.141.0 compiled a 246,902-byte bundle with the allowlist inlined andRELEASE = "3d16ebe".node scripts/qa.mjs: 24 pages, 0 errors, 0 warnings.server/release.jsis committed asunknown.Live and local verification
analytics_engine_datasetsis among the supported Pages config fields, its schema is{binding, dataset}and "not automatically inherited" by environments, and miniflare's local binding is a synchronous no-opwriteDataPoint(event).wrangler pages devon this branch listedenv.EVENTS (syberlabs_events) Analytics Engine Datasetand served a request throughcount().{"version":1,"error":"signin_required"}at 2026-10-31T02:02:11Z.Keys and sign-offs
Admitted-by:node tools/ledger/cli.mjs floor origin/main...HEADsayskeys: wrangler.toml. Nothing to create by hand: Analytics Engine createssyberlabs_eventson the first production write. Reading it needs the P4 read token./admin/api/v1/accountwith no Origin every ten minutes: about 144 points a day as/admin/api/v1/account GET 4xx signin_required none(288 at most with retries).none;siteappears on the site's own form posts..sy-accountcontrol), so no visitor page view becomes a count. If that header control returns, its per-page check would, and the privacy lede needs a look first._sample_interval.CF_PAGES_COMMIT_SHAis not used forrelease: wrangler only emulates it locally from git, and the deploy job has no checkout that could give a deployment its commit.Merge order
After #188, so the privacy page describes the counts before they start. It touches
cloudflare-pages.ymlin a different step from #187, so the two merge in either order.Generated by Claude Code