Commit Graph
1124 Commits
Author SHA1 Message Date
Thomas DurieuxandClaude Opus 5.5 588a0e6461 style(admin): space the errors toolbar from the list and its states
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:33:20 +00:00
Thomas DurieuxandClaude Opus 5.5 2abd6beaa9 feat(admin): errors page built around issues, linked to repositories and users
The admin Errors page now shows one list of issues: records grouped by error
code (or exception type), service and route, each with a plain-language title,
a likely cause, its impact (failures, repositories, users), a trend and when it
was last seen. Expected 4xx answers sit in a collapsed group; slow and
interrupted requests are left out and counted, with a link to Performance.

- GET /api/admin/errors/issues groups server-side (admin-error-issues.ts). It
  reads central logs when they answer and the Redis history otherwise, accepts
  validated repoId/userId/service/window filters and resolves repository
  owners and user names when the database is connected.
- The cause is derived from external_request records of the same requests
  (#990 field names), fast 429s, storage and network codes, and the first
  application stack frame; otherwise it says nothing is known.
- Issue page (?issue=) with cause, affected repositories and owners, who hit
  it, failures over time and occurrences. Request view (&occurrence=) with a
  waterfall from the existing correlation lookup and Request, Exception and
  All fields tabs; missing data shows as "not recorded".
- Repositories (search = one repoId) and user admin pages list their issues,
  with a "failing now" banner.
- The source switch, export, clear history, telemetry and 24-hour counters
  move to a collapsed "Settings and diagnostics" section.
- Synthetic fixtures shared by dev-mock and preview-errors; old errors-page
  CSS removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:27:48 +00:00
Thomas DurieuxandClaude Opus 5.5 c281841f91 Merge origin/main into feat/log-repo-user-context; rebuild bundles
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 12:38:00 +00:00
Thomas DurieuxandClaude Opus 5.5 86a35d62f1 feat(logging): record repository, user and viewer on log records
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>
2026-11-29 12:36:09 +00:00
Thomas Durieux ec30a05886 Merge pull request #983 from tdurieux/fix/workspace-polish
fix(ui): steady loading tabs, tidy picker footer, clearer preview caption and capped expiry
2026-11-29 04:20:11 -08:00
Thomas Durieux 4e622adea3 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	public/asset-manifest.json
#	public/script/vendor.min.js
2026-11-29 12:12:42 +00:00
Thomas Durieux 2f38fc6a51 Merge pull request #987 from tdurieux/fix/expected-errors-info
fix(logging): one record per failed file request, expected outcomes at info
2026-11-29 04:11:54 -08:00
Thomas Durieux 50657b58a8 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	public/asset-manifest.json
#	public/css/all.min.css
#	public/css/style.css
#	public/script/vendor.min.js
#	scripts/dev-mock.js
2026-11-29 12:05:37 +00:00
Thomas Durieux 0233d1ad0b Merge remote-tracking branch 'origin/main' into fix/expected-errors-info
# Conflicts:
#	deploy/logging/sanitize.vrl
#	public/asset-manifest.json
#	public/script/vendor.min.js
#	src/core/log-diagnostic-schema.ts
2026-11-29 12:03:42 +00:00
Thomas Durieux 088b91e69e Merge pull request #982 from tdurieux/feat/repo-list-sync
feat: store the repository picker list and update it by webhook
2026-11-29 04:01:52 -08:00
Thomas DurieuxandClaude Opus 5.5 364642afa8 fix(ui): show the caption Files button only when the window has none
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 11:56:55 +00:00
Thomas DurieuxandClaude Opus 5.5 ef2a1b8ecc fix(i18n): translate the new streamer error codes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 11:55:44 +00:00
Thomas DurieuxandClaude Opus 5.5 8524903a5b test(repo-list): cover the stale resync and blocking before picker writes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 11:55:04 +00:00
Thomas Durieux 07bdae9252 Merge remote-tracking branch 'origin/main' into feat/repo-list-sync
# Conflicts:
#	deploy/logging/sanitize.vrl
#	public/asset-manifest.json
#	public/script/vendor.min.js
2026-11-29 11:52:53 +00:00
Thomas DurieuxandClaude Opus 5.5 f12cde1400 fix(repo-list): block installations before picker writes, resync stale lists, clear on revoke
- A failed picker write no longer skips blocking a deleted or suspended
  installation: the list update now runs after it.
- Lists older than 12 hours resync in the background, covering new org
  installs, OAuth lists and missed or reordered deliveries.
- Revoking a grant clears the stored list first, and a revoked App
  authorization webhook clears it too.
- The name index includes repositoryId to match the picker sort.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 11:50:37 +00:00
Thomas DurieuxandClaude Opus 5.5 27802177b6 Merge origin/main into fix/workspace-polish; keep the Files button below 992px
The caption's Files button was the only way to open the file tree on
narrow screens when the preview shows no file (no README, loading, error).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 11:50:00 +00:00
Thomas DurieuxandClaude Opus 5.5 0a0b579c13 fix(logging): keep uncoded streamer 4xx replies on the Errors page
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>
2026-11-29 11:47:06 +00:00
Thomas Durieux 5509b30b1b Merge remote-tracking branch 'origin/main' into fix/expected-errors-info 2026-11-29 11:44:26 +00:00
Thomas Durieux 2317544c5a Merge pull request #988 from tdurieux/fix/missing-error-codes
fix(logging): keep every thrown error code instead of a bare 400
2026-11-29 03:44:20 -08:00
Thomas Durieux 522bf9428e Merge pull request #986 from tdurieux/fix/client-abort-logging
fix: stop logging cancelled downloads as streamer 500s
2026-11-29 03:44:16 -08:00
Thomas Durieux 0405bbff21 Merge pull request #985 from tdurieux/fix/session-error-response
fix: return 404, not 502, to signed-in visitors of repos whose source is gone
2026-11-29 03:44:12 -08:00
Thomas DurieuxandClaude Opus 5.5 c761fc6c17 fix: log each failed file request once, expected outcomes at info
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>
2026-11-29 09:29:14 +00:00
Thomas DurieuxandClaude Opus 5.5 63343c871c fix: keep every thrown error code in the logs
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>
2026-11-29 09:16:35 +00:00
Thomas DurieuxandClaude Opus 5.5 0e3055fa9c fix(ui): name the expiry date in its option and reveal the input on Change date
The dated option now reads "Expire on Apr 29, 2027" with a muted line
below ("In 5 months · Maximum on your plan", or the conference, Extended
expiration or saved-date reason). "Change date" sits beside the option
and reveals the bounded date input inline; an invalid date reveals and
focuses it, also on submit (forms.js dispatches a "reveal" event to a
hidden invalid field). The date and "After expiry" rows share one label
column, and "Never expire" keeps the same text edge. Without a plan
limit the option reads "Expire on a date" with the input shown.

A saved date on the same day as an Extended expiration limit keeps the
add-on as the reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 09:08:03 +00:00
Thomas DurieuxandClaude Opus 5.5 1b20ffc2f0 fix: do not log a visitor who stops a cached download as a 500
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>
2026-11-29 09:05:51 +00:00
Thomas DurieuxandClaude Opus 5.5 111870b6e2 fix: keep a session reply intact when the streamer reports an error
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>
2026-11-29 08:59:50 +00:00
Thomas Durieux a4f65e7d30 Merge pull request #981 from tdurieux/fix/ci-tests-lint
fix(ci): stop the test job hanging, fix lint, stale tests and a reconnect UI bug
2026-11-29 00:42:46 -08:00
Thomas DurieuxandClaude Opus 5.5 94947ad0ec fix(ui): steady list loading, picker footer, preview caption and plan-limited expiry
- My work keeps its tab bar and counts while a tab, search or filter
  reloads: the first load holds the tab row with placeholders, a reload
  dims the current rows and shows placeholder rows instead of a false
  empty state. Admin repositories, users and conferences, the conference
  page and the conferences list get the same placeholders and busy state.
- Repository picker: one footer row with the access link on the left and
  a compact icon pager on the right; Previous only after page 1; a row's
  name tooltip only when the name is cut short.
- Preview caption: the title stands alone, the redaction status is a chip
  ("Nothing redacted yet: add terms" focuses the Terms field). The
  caption's Files toggle is gone: the tree is always shown from 992px and
  the window's own file bar opens it below.
- Under a plan limit the expiry reads as text ("Apr 29, 2027 · in 5
  months, the maximum on your plan") with the date input behind
  "Advanced: pick an exact date"; validation still applies and a submit
  opens the disclosure on an invalid date. Without a limit the picker
  stays, and the echo no longer repeats "Expires".
- dev-mock: serves the dashboard summary API (with an optional delay
  cookie), a 5-month free expiry and a long picker name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 08:09:28 +00:00
Thomas DurieuxandClaude Opus 5.5 c73e992b7c feat: store the repository picker list and update it by webhook
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>
2026-11-29 08:06:30 +00:00
Thomas DurieuxandClaude Opus 5.5 14eb4a5df8 fix(ui): show a failed reconnection instead of the old source's preview
Reconnecting cleared the source but left the previous source's debounced
preview pending, so previewStatus stayed "loading" and the preview pane
showed "Updating the anonymized preview…" over the reconnection error
until that timer fired. Whether the error was visible depended on timer
order, which is why the Vue test failed in CI but passed locally.

Cancel pending previews and reset the preview file on reconnect, as
urlSelected already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 08:05:14 +00:00
Thomas DurieuxandClaude Opus 5.5 c659bf81a7 test: detect structured streamer startup and stop children on timeout
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>
2026-11-29 07:54:00 +00:00
Thomas DurieuxandClaude Opus 5.5 7bc4475b02 test: update tests left stale by logging and metadata changes
- 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>
2026-11-29 07:54:00 +00:00
Thomas DurieuxandClaude Opus 5.5 23384dad92 fix: translate streamer and cache error codes
streamer_upstream_error and streamer_unreachable reach the browser from
AnonymizedFile when the streamer fails, and had no message. cache_miss is
an internal cache-only probe result, but the error-code coverage test
requires every backend code to have a translation. Rebuild the bundle,
which embeds the locale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 07:54:00 +00:00
Thomas DurieuxandClaude Opus 5.5 aeb052da36 test: import timers explicitly to satisfy no-undef
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>
2026-11-29 07:54:00 +00:00
Thomas Durieux 0640d741f1 Merge pull request #980 from tdurieux/fix/cdn-miss-classification
fix: report a deleted source repo as repo_not_found, not token_expired
2026-11-28 14:41:01 -08:00
Thomas DurieuxandClaude Opus 5.5 f02999e774 fix: report a jsDelivr 404 as repo_not_found, not token_expired
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>
2026-11-28 21:50:12 +00:00
Thomas Durieux 28b154b0eb Merge pull request #978 from tdurieux/fix/remove-shared-token-fallback
fix: stop using the shared GitHub token; serve public files via jsDelivr
2026-11-28 13:17:54 -08:00
Thomas DurieuxandClaude Opus 5.5 5b350aaebe fix: keep auto-update repos readable and refuse LFS pointers from jsDelivr
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>
2026-11-28 21:17:27 +00:00
Thomas Durieux 7156e658bc Merge pull request #979 from tdurieux/fix/ui-regressions
fix(ui): regressions from the PRs merged since #949
2026-11-28 12:41:13 -08:00
Thomas DurieuxandClaude Opus 5.5 ba15d3d4e0 fix(ui): don't double the picker's rule above the pager
Rows draw their divider on top, so the row cut by the scroll box no longer
stacks its bottom rule on the pager's top rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 20:28:20 +00:00
Thomas DurieuxandClaude Opus 5.5 14694e9242 test(ui): click Expand preview, not the preview's Files toggle
"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>
2026-11-28 20:17:34 +00:00
Thomas DurieuxandClaude Opus 5.5 2633fadba7 fix(admin): sit the Errors source tabs on the toolbar rule
The Central logs / Application history tabs (#957, #959) were centered in
a toolbar sized by the two-line health strip beside them, so their
underline floated ~10px above the rule. On desktop the toolbar now aligns
to the bottom and the active underline overlaps the rule, like the other
tab bars. Phones keep their stacked layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 20:17:34 +00:00
Thomas DurieuxandClaude Opus 5.5 48a246222e fix(admin): keep the admin tabs on one row and give Emails its own icon
#952 and #953 added Billing and Emails to the admin tabs. From 768px to
~860px the eight tabs no longer fit, so Errors wrapped onto a second row
under the others. In that range the tabs now drop their icons, as on
phones, and stay on one row (scrolling, not wrapping, if still too wide).

Emails reused the Queues list icon; it now has an envelope (ui-icon-mail).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 20:17:18 +00:00
Thomas DurieuxandClaude Opus 5.5 6c167a660e fix(ui): let the README fill the anonymize preview pane
#950 reuses the explorer in "What reviewers will see". The reading layout
keeps the reviewer page's 210px outline rail from 1200px up, sized on the
viewport, so in the ~500px side-by-side pane the README was squeezed into a
230-270px column next to an empty rail and code blocks were clipped.

The pane rule that should hide the file meta and Symbols was an @container
query; clean-css 4 drops @container blocks, so it never reached all.min.css
(the 1024px header overflowed). Both now key on the layout state instead:
outside the expanded preview the README is one full-width column with no
outline, and the meta and Symbols are hidden below a 1700px viewport, where
the pane stays under 700px. The reviewer page is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 20:16:51 +00:00
Thomas DurieuxandClaude Opus 5.5 4e10e6662d feat: serve public files through jsDelivr when the owner has no GitHub access
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>
2026-11-28 20:14:07 +00:00
Thomas DurieuxandClaude Opus 5.5 341b0cc973 fix: stop falling back to the shared GitHub token
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>
2026-11-28 19:35:32 +00:00
Thomas Durieux 62c3bf1daf Merge pull request #977 from tdurieux/feat/billing-route-labels
feat(logging): make the checkout funnel visible in logs
2026-11-28 18:54:38 +00:00
Thomas DurieuxandClaude Opus 5.5 4099953d8a feat(logging): label billing routes and checkout outcomes
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>
2026-11-28 18:30:40 +00:00
Thomas Durieux d34df81c8c Merge pull request #976 from tdurieux/fix/zip-worker-diagnostics
fix(logging): explain ZIP and worker failures and memory pressure
2026-11-20 17:53:09 -08:00
Thomas Durieux b284bfb4f9 fix(logging): retain safe ZIP and worker failure reasons 2026-11-19 15:04:03 +00:00