Commit Graph
213 Commits
Author SHA1 Message Date
Thomas DurieuxandClaude Opus 5.5 dff9f580ee Merge origin/main (#993) into feat/admin-errors-ux; rebuild bundles
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:35:53 +00:00
Thomas DurieuxandClaude Opus 5.5 fdd8f58944 fix(admin): split uncoded errors by crash site, label signed-in visitors, scope external calls
- Errors without a code are grouped by their first app stack frame (or the
  logging module), so unrelated TypeErrors no longer share one issue.
- "visitor" is a signed-in user with no role on the repository; it is no
  longer shown as "not signed in". Anonymous viewers are counted apart.
- The issue page no longer offers "Open user" next to "Open repository":
  users and repositories are counted from different records.
- With a service, repository or user filter, failed external calls are looked
  up by the faults' request IDs instead of the newest 2000 calls overall.
- The page says when the 2000-failure cap was reached.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:35:34 +00:00
Thomas DurieuxandClaude Opus 5.5 d161d89cee perf(anonymize): show the README preview without waiting on the branch list
The preview rendered only after repo details, the full branch list and the
README loaded one after another. The early README fetch was usually
discarded and fetched again, the README endpoint listed every branch from
GitHub first, and preview calls were slowed down after 50 API requests.

Render as soon as the README and details are in, keep a default-branch
README once that branch is selected, skip identical preview requests,
fetch the README by branch name on a cache miss, and drop the slowdown on
the CPU-only preview endpoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 14:31:37 +00:00
Thomas DurieuxandClaude Opus 5.5 d3860f29ad fix(admin): group errors by code and service, list the routes that failed
- An issue is now one error code (or exception type) per service: one cause,
  such as a rate-limit burst, hits many routes. Rows show the most frequent
  route and "+N routes"; the issue page lists them with a count and a bar.
- The request header shows the viewer as a role ("Viewer: owner", "Viewer not
  signed in") beside the owner chip, with a user link only for another user.
- List meta parts no longer leave a lone separator when they wrap.
- The issue page shows the 10 latest occurrences and a "Show all" button
  instead of clipping the list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:55:02 +00:00
Thomas DurieuxandClaude Opus 5.5 c91e662034 Merge origin/main (#990, #991) into feat/admin-errors-ux; link users as id:<_id>, rebuild bundles
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:39:52 +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 Durieux cc5e06022f Merge remote-tracking branch 'origin/feat/external-request-logs' into HEAD
# Conflicts:
#	deploy/logging/sanitize.vrl
#	public/asset-manifest.json
#	public/script/vendor.min.js
#	src/core/log-record.ts
2026-11-29 13:11:41 +00:00
Thomas DurieuxandClaude Opus 5.5 d8a777cd35 fix(logging): keep reviewers unlinkable, look admin users up by explicit id
- Requests carry userId on warn and error records only. The app calls
  /api/user on every page load, so a userId on routine info records sat
  next to the repoId a signed-in reviewer opened, and timestamps linked
  them. Jobs keep it at every level. Logger, collector and the admin
  projection apply the same rule.
- Admin user routes take an _id only as id:<_id>; a 24-hex GitHub login
  can no longer match another account's _id for ban or promote.
- The download-job expectation includes the owner id the PR adds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:08:19 +00:00
Thomas Durieux 7c9e803fbd Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	deploy/logging/sanitize.vrl
2026-11-29 13:03:03 +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 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 DurieuxandClaude Opus 5.5 e571268e56 feat(logging): record each outbound call to GitHub and other external services
One info record per HTTP request to an external host (fetch and node:http),
with method, host, a fixed endpoint label, status or error code, duration and
the caller's requestId. Internal hops are skipped. Labels keep only literal
segments, so no owner, repository, path or identifier is logged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 11:57:28 +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 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 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 Durieux 55eb8b3e09 fix: preserve incidents when optional baseline lookup fails 2026-11-15 13:55:38 +00:00
Thomas Durieux 0f9d8c657a feat: add operational incident evidence and recovering alerts 2026-11-15 13:45:38 +00:00
Thomas Durieux d2e3954d21 fix: explain interrupted requests and account for overlapping latency 2026-11-15 13:31:16 +00:00
Thomas Durieux 6035c01956 Merge remote-tracking branch 'origin/main' into integrate/diagnostics
# Conflicts:
#	deploy/logging/README.md
#	public/asset-manifest.json
#	public/css/all.min.css
#	public/css/style.css
#	public/script/vendor.min.js
2026-11-14 23:19:22 +00:00
Thomas Durieux 0b967aa8af perf: paginate repository discovery and search 2026-11-14 21:49:12 +00:00
Thomas Durieux 5dbf3e7829 feat: retain bounded failed-request reproduction context 2026-11-14 21:44:48 +00:00
Thomas Durieux f6574069da feat: preserve safe request and exception diagnostics 2026-11-14 21:22:28 +00:00
Thomas Durieux 35e69b3291 Merge main and preserve email and log investigation styles 2026-11-14 17:24:13 +00:00
Thomas Durieux 8e57cc3d0e Merge pull request #956 from tdurieux/t3/oss-logging-infrastructure
feat: add private structured logging and investigation dashboards
2026-11-14 18:22:32 +01:00
Thomas Durieux 88d0d0cd12 Merge pull request #955 from tdurieux/fix/remaining-production-findings
fix: stop quota retry loops, narrow folder queries and diagnose upstream failures
2026-11-14 18:22:19 +01:00
Codex 20621c0660 fix(admin): include unknown releases and edge failures in investigations 2026-11-14 16:53:13 +00:00
Codex 88d696ca7c fix(admin): reserve Redis capacity for complete stats transactions 2026-11-14 16:44:31 +00:00
Codex 8b928a4c82 feat(admin): investigate correlated logs from the Errors page 2026-11-14 16:33:37 +00:00
Codex 7e2a6e9d75 feat: add private structured logging and investigation dashboards 2026-11-14 13:40:40 +00:00
Thomas Durieux 99bf9f173e feat(admin): add email activity and investigation workflow 2026-11-14 13:21:03 +00:00
Thomas Durieux b456ab8739 fix: stop quota retry loops and narrow directory queries 2026-11-14 13:03:22 +00:00
Thomas Durieux 6400760fcb feat(admin): track email delivery attempts 2026-11-14 12:51:32 +00:00
Thomas DurieuxandClaude Opus 5.5 511dcd7067 feat(admin): billing tab to monitor subscriptions and sales (#952)
* feat(admin): add a Billing tab for subscriptions and sales

The admin can now follow subscriptions and sales without opening Stripe:
- Summary tiles: active subscriptions (monthly/annual), MRR with annual
  plans counted as 1/12, sales and revenue for 7d/30d/90d/12m/all time,
  all-time sales, subscriptions cancelling at period end, and refunds
  and disputes.
- A stacked chart of sales per day, week or month by plan family.
- A by-plan table: active grants, period and all-time sales and revenue.
- A paginated list of grants with plan, Stripe status, active/expired/
  revoked and user filters, linked to the admin user, repository or
  conference.
- One row of webhook health: pending, failed, oldest pending event, last
  error and unreviewed payment reversals.

A sale is one checkout or subscription, so a paper pack's three grants
count once. Revenue is each sale's Stripe list price, resolved once per
price and cached in memory. Currencies are never added together. Without
Stripe the page shows counts and marks revenue as unavailable.

GET /api/admin/billing/summary and /grants sit behind the admin check.
Grants get a { purchasedAt, _id } index for the list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: preserve payment history in admin billing totals

* fix: scope billing history and preserve original sale prices

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:37:29 +01:00
Thomas DurieuxandClaude Opus 5.5 476f25e264 feat(ui): browse and check every file in the anonymize preview (#950)
* feat(ui): browse and check every file in the anonymize preview

The "What reviewers will see" window now redacts the README GitHub actually
shows and lets authors open any file of the commit.

- README: resolved from the file list like GitHub (.github/, root, docs/,
  any case, Markdown first) and only that path is tested against the
  "Leave files unredacted" rules. Before the list loads, only root names are
  assumed, so leaving docs/ unredacted no longer unredacts the root README.
  The file bar shows the README's real name.
- New GET /api/repo/:owner/:repo/file?commit=&path= (same access checks as
  /tree): raw text, no-store, path traversal rejected, 1 MB cap
  (file_too_big, 413), binary files reported as { binary: true }.
  /tree also lists binary files (binaryFiles) for the preview's tree.
- Tree rows open files (keyboard accessible, explorer active rail). Text is
  redacted through /api/anonymize-preview by the same batcher as the README;
  files left unredacted are sent without terms and tagged "Left unredacted"
  (opens the dialog). Markdown renders like the README, code is highlighted
  with Prism, images/PDF/binary/too-large files get a short note. Loading
  and error (Retry) states reuse rp-state.
- File and folder names are redacted through /api/anonymize-preview.
- Caption counts the open file; "<name> left unredacted" when preserved.
- Phones: the Files button opens the tree as a sheet.
- dev-mock: a jsmith/robust-repair source with tree, file and
  anonymize-preview endpoints and fixtures carrying the mock's terms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(ui): reuse the explorer in the anonymize preview

Share the explorer file renderer and tree with the author preview. Apply
preserved-file rules on the server and keep the reviewer rendering and
redaction slots consistent across both views.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ui): keep the reviewer page unchanged by the preview reuse

The preview reuses tree.js and the shared file viewer; its differences now
apply only inside the anonymize preview.

- The narrow-pane rule that hid the file meta and Symbols applied to the
  reviewer page too (visible with a widened sidebar); it is scoped to
  .reviewer-preview. The token capture moves from body to the page that
  holds the preview.
- tree.js: aria-expanded/aria-current and tree-only scrolling apply only
  when the tree is embedded (selectedPath set); the reviewer page keeps
  scrollIntoView and its original markup.
- file-viewer: the extra menu-closing click listener, the #L hash writes and
  the Ctrl+F/G and Alt+Z shortcuts are limited to the preview (shortcuts
  only while its code has focus), so the form keeps the browser's Find.
- Preview: the tree's file list is cached between renders, name batches are
  chunked under the JSON body limit, /api/anonymize-preview accepts up to
  3 MB so files up to the 1 MB preview limit can be redacted, and on phones
  the caption's "<name> left unredacted" opens the dialog (the header tag
  squeezed the path out).
- dev-mock: long and nested names for the tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ui): restore the redaction number on the right and level the slots

The redesign centered the term number in every redaction slot; it sits on
the right edge again, in code, Markdown, the tree and the breadcrumb. Tree,
breadcrumb and paragraph slots also sat about 2px below the text; they now
center on the line's letters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: address preview navigation and path review findings

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:27:13 +01:00
Thomas Durieux d508ab1754 fix: bound metadata work and distinguish cancelled requests (#951) 2026-11-13 11:38:26 +01:00
Thomas DurieuxandClaude Opus 5.5 0f78182c58 fix: keep legacy prices and address review findings
Subscriptions sold at a replaced price lost their plan, because a
subscription was matched only against the configured price. Resolve
prices through the configured price, STRIPE_LEGACY_PRICES, then a
registry that now also records subscription prices and every configured
price at startup. Store the price on subscription grants.

Review fixes:
- Recover a Never expire add-on found by reconciliation before expiring.
- Open Checkout for the subscription cycle the hosting option shows.
- Report conference hosting only while the package payment stands.
- Keep automatic updates on a paid-slot repository while its owner subscribes.
- Apply the repository expiration limit only to repositories.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 17:13:19 +00:00
Thomas DurieuxandClaude Opus 5.5 d25e5336ce feat: let authors pay once per paper instead of subscribing
Most authors use the service for one paper a few times a year, so a
subscription does not fit. Add cheap one-time options (Paper pack, Extra
repository, Live updates, Extended expiration, Never expire), cap free
dated expiration at 5 months, keep cheaper subscriptions for heavy users,
and make every new conference a paid review package in three sizes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:04:31 +00:00
Thomas DurieuxandClaude Opus 5.5 643f4b87e9 feat: let authors leave their bibliography unredacted (#941) (#943)
* feat: let owners leave chosen files unredacted (#941)

Redacting self-citations in a bibliography reveals which papers are the
authors' own. Owners can now pick files whose content is served as
written; file names are still redacted. Patterns follow .gitignore rules.

The form gets a file picker fed by GitHub's tree API, and the terms box
grows with its content and only warns about regex symbols that can stop a
term from matching.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: honour !patterns, keep picked braces literal, preview unredacted README

- Patterns now apply in order and the last match wins, as in .gitignore,
  so "*.bib" then "!private.bib" excludes private.bib instead of
  preserving every other file.
- Picked paths escape glob characters, braces included, with a
  backslash; "[{]" did not survive brace expansion.
- The README preview drops terms when the README is an unredacted file,
  and refreshes when the list changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: keep rule order when deduplicating unredacted-file patterns

Rules apply in order and the last match wins, so dedupe keeps the last
copy of a repeated pattern instead of the first. The picker also keeps a
plain path in its place when it follows another rule, rather than moving
it to the front as a pick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: apply unredacted-file rules to folders, as in .gitignore

A rule that matches a folder now covers every file inside it, so "*.bib"
then "!private" keeps private/refs.bib redacted. A trailing "/" limits a
rule to folders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: folder unchecks win over broad rules; accept short commit hashes

- Unchecking a folder that a broader rule such as "*.bib" still covers
  appends a "!/folder/" exclusion, so its files really go back to being
  redacted.
- The tree endpoint accepts the 6+ character hashes the commit field
  allows and resolves them to a full SHA before reading the tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: picker counts folder rules exactly as the server does

Rules ending in "/" stay patterns instead of being read as picked files,
and the checkboxes now run the saved rule list (picks, then patterns)
through the server's matcher, so the dialog cannot show files as
redacted that the server leaves unredacted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: insert escaped terms literally in "Match as written"

String.replace expanded "$&", "$'" and "$1" in the term, so the fix
could corrupt the line. Splice by index instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 14:10:54 +01:00
Codex 3999a71583 perf: index repository lookups and billing maintenance 2026-11-11 10:18:20 +00:00
Codex 7c7caa845c fix: prevent folder downloads from exposing GitHub metadata 2026-11-09 10:45:24 +00:00
Codex 6593319c87 fix: persist login sessions across browser restarts 2026-11-08 20:32:03 +00:00
Thomas Durieux d4b9fd85e7 fix: isolate website limits and scope explorer counts 2026-11-03 15:03:23 +00:00
Thomas Durieux 860169f27b merge: preserve billing admission with bounded tree preparation 2026-11-03 08:33:12 +00:00
Thomas Durieux e71e6b6389 merge: reconcile paid hosting with shared cache and main 2026-11-03 08:26:43 +00:00
Thomas Durieux 97e5b50cf0 merge: integrate main after progress fence and cache merges 2026-11-03 08:25:43 +00:00
Thomas Durieux 88cd1b4cdb Merge pull request #915 from tdurieux/feat/shared-blob-cache
perf: deduplicate cached files across projects and track cache reuse
2026-11-03 09:23:07 +01:00
Thomas Durieux abfe153cdc fix: preserve saved snapshot during source replacement 2026-11-02 22:10:28 +00:00
Thomas Durieux af23ad9eb5 fix: bound large repository tree memory and cleanup 2026-11-02 21:57:33 +00:00
Thomas Durieux 807e38dfc7 fix: preserve publication fences during download progress 2026-11-02 21:52:30 +00:00
Thomas Durieux 47a436ee4e fix: admit dated repositories before offering checkout 2026-11-02 21:46:26 +00:00