Handlers that resolve an anonymized repository, pull request or gist now
put its public ID on the log context, so request, job and error records
carry repoId, pullRequestId or gistId. The signed-in user's internal _id
(userId) is recorded on account routes. On routes that serve anonymized
content, userId is kept only when the user owns, co-authors or
administers the project; otherwise the record carries viewer "visitor"
or "anonymous" and no userId. The collector, the Redis mirror and the
admin log APIs apply the same rule. Jobs carry repoId and the owner's
userId stamped at enqueue time.
The admin Errors page links repoId to the admin repository search and
userId to the admin user page, which now accepts a user _id.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An uncoded 4xx comes from something in front of the streamer (body-size
limit, ingress, wrong entrypoint), so it is now streamer_unexpected_response
(502, error) rather than an info-level file_not_found. The streamer's
catch-all route gets its own code so a misrouted call logs at warn.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A streamer error such as repo_not_found produced three warnings: the
streamer's handleError, the API's streamer_fetch_failed and the API's
handleError. Expected client outcomes (repo_not_found, repository_expired,
file_not_found, github_app_access_required, ...) were all logged at warn,
which filled the admin Errors page.
- handleError picks the level with errorLogLevel: codes in
EXPECTED_CLIENT_ERRORS with a 4xx status log at info; other 4xx (rate
limits, token_expired, validation) stay warn and 5xx stay error.
- The streamer passes { internal: true }: expected outcomes drop to debug
there because the API logs the request's end state. Faults keep their
level and the streamer-side stack. Its direct 400 replies now go through
handleError so they are logged too.
- The API no longer logs streamer_fetch_failed or streamer_zip_fetch_failed.
The relayed error carries upstreamStatus, and when the streamer's coded
reply shows it already logged the failure, the API logs it at info.
Every record keeps requestId, so the chain can still be found by request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The logger keeps errorCode only for allowlisted codes, and so does the
collector (sanitize.vrl). Both lists are maintained by hand, so codes
added since then were dropped and logged as a bare 400. Among them:
invalid_billing_expiration (billingError), invalid_auth_state
(appError), streamer_unreachable, github_unavailable, user_banned and
most billing and GitHub App codes, 41 in all.
scripts/generate-log-diagnostics.js now collects the codes passed to
AnonymousError, billingError and appError, plus codes assigned to an
errCode/code variable. It writes them to LOG_THROWN_ERROR_CODES, which
the logger accepts, and appends them to the collector's errorCode
allowlist. A test fails when a thrown code is missing from either list.
Regenerating also refreshes source function names that had gone stale
(jsDelivrFileUrl, ownerGitHubAccessRequired, ...), whose stack frames
the collector was dropping.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shared cache sends blobs with pipeline(stream, res). When the client
goes away, pipeline rejects with ERR_STREAM_PREMATURE_CLOSE. The
response is destroyed but req.aborted is false (the POST body was read),
so isResponseCancellation did not match and handleError logged a
code-less Error with httpStatus 500.
Watch the response and the source before piping. If the response closed
unfinished before the source failed, rethrow as response_cancelled, which
handleError already skips. A source that errors or closes without ending
still surfaces as a fault.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With a session cookie, express-session's res.end writes all but the last
body byte and sends that byte after the Redis touch. In between,
headersSent is true and writableEnded is false, so the res.destroy()
that followed handleError cut the API's own 404 reply. Nginx then saw
no response header and returned 502 to logged-in visitors of repos
whose source is gone.
Decide whether to cut the response from headersSent before handleError
replies, as the zip proxy already does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The anonymize page's "Your repositories" picker now pages and searches a
per-user list stored in MongoDB instead of calling GitHub on every page and
search. GitHub is read only when the list is empty, when the user presses
the new refresh button, or after an installation change marks it stale.
- One sync per list (Mongo lock with a renewed lease); full pagination in
the background after the first page is returned; rate limits pause syncs.
- GitHub App installation, installation_repositories and repository
webhooks update the stored lists idempotently. The App must subscribe to
the Repository event (documented in docs/github-app-setup.md).
- Legacy OAuth lists change only on refresh.
- Picker header shows "Updated 3 min ago" and a refresh button.
- dev-mock: stored list, simulated refresh and webhook endpoint.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The streamer now logs {"event":"streamer_started"} instead of the text
"streamer started", so readiness never resolved, every lifecycle test
timed out, and the forked streamers were never killed. Their IPC
channels kept mocha alive until GitHub cancelled the job after hours.
Parse the JSON log lines for the event, and reject readiness before the
mocha timeout so each test's finally block always stops its child.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- large-repository-tree: queued jobs now carry a logJobId trace id
(structured logging); assert it instead of an exact job payload.
- repository-activity: FileModel.exists() is chained with .hint() since
#951; stub it with a query-like object.
- performance-integration: staged markers are cleared through
File.collection.updateMany since #951, so the old Model.updateMany stub
never injected the interruption.
- performance-worker: workers report fixed codes only, so a regex
timeout surfaces as anonymization_deadline_exceeded; the elapsed bound
still proves the 1s regex deadline applied.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test ESLint config does not declare timer globals. Import setTimeout
from node:timers (callbacks) or node:timers/promises (awaited delay), as
the rest of the suite does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without owner access, a jsDelivr 404 was sent to the GitHub API probe,
which cannot run for the CDN token and failed with token_expired. The
path comes from the stored tree of a pinned commit, so a CDN 404 means
the repository is no longer public.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without owner access, a reviewer visit to an auto-update repository tried
a GitHub API refresh and failed with token_expired; it now skips the
refresh and serves the stored tree. jsDelivr returns Git LFS pointers,
which match their blob SHA, so they are now refused like on the raw path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"keeps all settings and the live preview visible in the split workspace"
clicked the first .reviewer-preview .rp-open. Since #950 the caption also
has a "Files" button with that class, which toggles the preview's file
tree, so preview-expanded never turned on. The UI behaves as intended; the
test now targets .rp-open.is-toggle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Instead of failing, repositories whose owners have no usable credential read
files from jsDelivr at the pinned commit, and archives from codeload. Neither
needs a token or spends GitHub API quota, and neither serves private content.
The shared cache still verifies every file against its Git blob SHA. Calls that
need the GitHub API (tree listing, refresh, metadata) still return
token_expired, and a jsDelivr read does not clear the owner's access alert.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a repository, gist or pull request owner had no usable GitHub
credential, content was fetched with the operator's GITHUB_TOKEN. That token
shares one rate limit with its account, so these fallbacks exhausted it and
made unrelated requests wait and time out. Owners now get token_expired (401),
which already asks them to renew their connection, and the server no longer
reads GITHUB_TOKEN.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Billing API calls and Stripe return pages were logged as route "other", so
the purchase funnel could only be read from Stripe. Give them fixed labels in
the app, Nginx and the collector allowlist, and record the ?billing= outcome
(success, cancelled, portal) on edge requests. Only fixed values are kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The subscriptions list shows one row per sale, grouped with the same
stages as the summary: a paper pack is one "Paper pack" row with its
parts on a second line. Filters, state tabs, sort and pagination count
sales. A new "Started" filter matches the summary periods.
- N days now draw N buckets ending today (12 months: 52 weeks), and the
tiles count from the same start.
- One family vocabulary: Subscriptions, Repository add-ons, Conferences in
the legend, the By-plan grouping and the list.
- Cancelling folds into "Renews / ends", revocation into "Status"; rows
have one height. Names and repository ids use proportional figures,
since Inter's tabular figures widen hyphens.
- New Amount column (cached Stripe list price, per period for
subscriptions, once per pack). Chart tooltips show count and revenue
per family and the total per currency.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>