Skip to content

refactor(sentry): give every server report one capture body - #1102

Merged
sydevs-bot merged 17 commits into
mainfrom
claude/refactor-1100-capture-warning
Nov 11, 2026
Merged

sydevs-bot merged 17 commits into
mainfrom
claude/refactor-1100-capture-warning

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • One body, capture, now reports every server event — an exception as well as a message. It is the only place in src/ that reaches Sentry.captureException or Sentry.captureMessage, and a spec fails any other spelling. Fifteen sites stop spelling the level, the tags, the log mirror and the never-throw guard themselves.
  • captureFailure keeps its closed field list and its exclusions, but now only classifies a routed failure and reports through that body.
  • No capture attaches an environment tag. Every event already names its deployment in its own environment field, which Sentry.init sets — so refactor(sentry): give a reported warning one capture body, with the environment tag #1100's criterion 1 asked for a copy, not a capability.
  • Joined: capturedFrom replaces four copies of the same spec reader, two of which had already drifted in how they typed tags.

Change outline

Files — one body, and one classifier above it

 src/plugins/sentry/
+├── capture.ts               # the one body: level, tags, log mirror, never-throw, one SDK call each way
 ├── captureFailure.ts        # classifies a routed failure, and reports through capture
-├── captureNotice.ts         # folded in: it was capture with the level defaulted
-├── tags.ts                  # folded in: one caller, once capture owned the send
 ├── credentialRejection.ts   # still owns the rejection's own facts; captures through the body
 └── index.ts                 # still exports neither, and says so for both

Neither takes the SDK's own export name, so a reader cannot mistake one for Sentry.captureMessage sitting beside it.

Flow — a per-item failure inside a run written to continue

 ExpireEvents / SendSessionReminders / SendDigests / sendInvitations
-  Sentry.withScope((scope) => {
-    scope.setContext('expireEvents', { eventId, dueSince })
-    scope.setTag('expire_events.event_id', String(eventId))
-    Sentry.captureException(error)                    # no try — see below
-  })
-  req.payload.logger.warn({ msg, eventId, dueSince, error: error.message })
+  capture({
+    error,
+    message: 'ExpireEvents: per-event failure — continuing',
+    extra: { eventId, dueSince },
+    tags: { 'expire_events.event_id': String(eventId) },
+    logger: req.payload.logger,
+  })

⚠ Those four catch blocks exist so the run continues, and the capture inside them had no try. A Sentry transport error there aborted exactly the run that was written not to abort. That is the defect this answers, and it is why the second question thread's answer is "one body" rather than "consistency is nicer".

Behaviour — the six reports the one body reached

 ExpireEvents.ts           per-event sweep failure      error, event-id tag + extras, mirrored
 SendSessionReminders.ts   per-event reminder failure   error, extras, mirrored
 SendDigests.ts            per-role digest failure      error, extras, mirrored
 invitations.ts            an invitation that failed    error, extras, mirrored
 frames.ts                 node-weights cache write     error, 3 tags, extras, mirrored
 resendAdapter.ts          a thrown Resend send         error, mirrored

Every Sentry level is unchanged, and all six now cannot throw. Three of them had their Sentry level (error, the SDK's default) and their log line (warn) disagreeing; this body gives a report one level for both, and error is the half that was kept — § Detail says why that was the load-bearing one.

Types — a report with no subject does not compile

-  tags?: Record<string, unknown>          # every non-string silently dropped
+  tags?: Record<string, string | undefined>
CaptureArgs = CaptureCommon & ({ error: unknown; message?: string } | { error?: undefined; message: string })

The wide Record<string, unknown> is gone from both sides. The earlier body of this PR said captureFailure needs it for a numeric job_id; that was wrong — jobCapture.ts:81 passes String(args.job.id), so nothing ever handed it a non-string.

Preview

  • No page shows this change: it alters only what this service sends to Sentry, which a preview link cannot display. The host is https://sahajcloud-sahajcloud-pr-1102.up.railway.app if a reviewer wants to trigger a report — the event's environment field reads pr-1102 there, which is the whole of what the deleted tag was copying.

Email previews

  • None. src/plugins/email/resendAdapter.ts changes only on its three failure paths, and the preview scripts post through Mailpit's own adapter, so no rendered message differs. tests/unit/resend-adapter.spec.ts drives the two drop paths.

Test results

  • Lean gate: ✓ .claude/skills/pr-prep/check.sh — lint, format, typecheck, typecheck:tests, test:unit (255 files / 3451 tests), 122 s
  • Targeted specs: ✓ expire-events.int, digests.int, session-reminders.int, user-submissions-repeat-registration.int, admin-write-capture.int, manager-signin-page.int, meditationFrames.int, atlas-submission-routing.int
  • Security review: ✓ no invariant breached. The branch touches src/collections/UserSubmissions/hooks/, so the conditional sweep ran. It diffed all ten moved or renamed sites against their pre-change form and found no value newly reaching an extra, a tag, a message, a fingerprint or user; confirmed the caller IP cannot reach an extra on any path, including through captureFailure's rejected; confirmed only the truncated key fingerprint is still emitted; and read [email protected]'s own fetchRequest to confirm the one reachable throw at resendAdapter.ts:160 cannot carry a recipient, subject or body. It raised three accuracy points, all fixed in ae727f8 — the job levels, captureFailure's status default, and the mirror's comment. It also notes that no withScope/setTag/setExtra/setContext survives anywhere in src/, so there is no cross-request scope-bleed surface left
  • Build: N/A — Railway builds the preview

Every new assertion was watched failing against its defect: a message routed to captureException, one level default for both kinds, a mirror that drops the exception, an IP outranking the acting user, the never-throw guard removed, a site reaching the SDK itself, the environment tag restored, the per-event tag dropped from ExpireEvents, and captureFailure's status default moved back outside its try.

Manual verification

  1. In Sentry, confirm the credential-rejection and abuse-milestone issues still group as they did. Both kept their fingerprint and their tags, but Sentry's own grouping is the one thing no spec here can see.
  2. Confirm the environment selector still filters as before. It reads the event's environment field, which is untouched — but that is the premise the tag's removal rests on, and only Sentry can show it.
  3. The four per-item job reports now carry their context as extras rather than a named card. Same values, different pane.

Notes for reviewer

  • Thread 1 (the environment tag): B is built, in faee06c. tags.ts had already gone in cbb28d2 — once one body owned the send, its filter had one caller rather than two — so B itself landed as one line. refactor(sentry): give a reported warning one capture body, with the environment tag #1100's criterion 1 is retracted on the ticket, with the replacement in its place.
  • Thread 2 (one body vs two): recommended and built, in cbb28d2. The recommendation turns on the reliability half of your three words, not the consistency half: four of the six inline sites sit in a catch that exists so a run continues, and a throwing capture there aborted it. Consistency is what the two SDK spellings cost; this is what they cost that a reader cannot see.
  • The browser's three reporters stay out, and the deployment tag is no longer the reason they do. Dropping the tag removed that barrier, so this is a fresh judgement rather than the old one restated — § Detail has it.
  • Declared behaviour changes. No Sentry level moves; nothing stops being sent.
    • A scope.setContext(...) named card becomes plain extras, for ExpireEvents, SendSessionReminders, SendDigests and frames.ts — on top of the abuse-milestone abuse_details card already declared.
    • Three log lines go from warn to error: the per-item failures in ExpireEvents, SendSessionReminders and SendDigests. Their Sentry level was already error, and one level now drives both halves. sendInvitations reports the identical shape at error/error already.
    • A mirrored log line carries the exception itself rather than its message, so it keeps the stack. Four sites previously wrote error: <message>; invitations.ts already passed the error.
  • Two things I left alone. usage/tasks.ts keeps its own NEXT_PUBLIC_SENTRY_DSN gate, which the body deliberately does not have — removing it would stop its aggregate log line on a deployment with no DSN. And captureFailure keeps its own outer try: the three readers it classifies from run before capture is reached, and one of them turned out to be reachable before any try at all (ae727f8).
  • Dismissed findings. Two review passes proposed changes that are now moot: folding tags.ts back (the file is gone), and deleting a tag case from the body's spec as redundant (the captureTags(undefined) case it protected is now capture's own "adds no deployment tag" case).
Detail

Why captureFailure is still a separate function. Its inputs are an error plus one of four CaptureSource values, and its job is deriving a level, tags, extras, a fingerprint and a user from a PayloadRequest. That derivation is one caller shape's classification, not policy shared by all fifteen reports — the afterError hook, the Local API wrapper, the job runner and the two sign-in paths are infrastructure seams rather than call sites. Folding it into the one public body would put a closed source union in front of every ordinary site that has no source. So: one body that sends, one classifier above it for the routed-failure shape.

Why the three browser reporters stay out. Their exclusion used to rest on captureTags being unable to read the deployment in a browser. That reason is gone with the tag, so here is the one that is left. clientLogger.error is the browser's own mirror-and-capture body — the client-side equivalent of capture, not one of its callers — and ErrorBoundary branches on Sentry.getClient() !== undefined to fall back to console.error, which no server site wants. One body carrying both a pino logger and a console mirror, with a getClient() check only one caller reads, would be less streamlined than two. ErrorBoundary also passes contexts.react.componentStack, which Sentry's React integration renders in its own pane; flattening it to an extra would be a reporting regression, not a simplification.

Why the three job sites kept error rather than warning. Matching their warn log line was the first answer, and it was wrong. A sweep that catches per-item failures so the run continues succeeds — so jobCapture's final-attempt capture never fires, and those per-item events are the only error-level signal a night of total failure produces: a bad migration, a dead Resend key, an expired Mapbox token. Dropping them to warning would have removed the one thing a level:error alert could see. sendInvitations already reports the identical shape at error with a matching logger.error, so keeping error both preserves every Sentry level and makes the four consistent. The log lines move instead, which adds noise and loses nothing.

Why the mirror is opt-in, still. Three of the four sites #1100 listed wrote logger.warn({ msg, ...extra }) beside the capture; the abuse-milestone task logs one aggregate line for a whole run instead. Passing a logger is how a site stops writing both halves by hand; leaving it out is how that task keeps the one line it wants.

Why deliverProposal keeps info. The system contact is the last rung of its routing ladder, not a failure of it — the function's own docblock says so — and adminProposalsWhere (src/lib/atlasOverview/openItems.ts) already puts a proposal that reached it on the admin home. The level is now explicit rather than Sentry's default, with the reason beside it.

Where #733's breadcrumb went. It used to sit on the environment tag, crediting it with a fix that belongs to sentry.server.config.ts and instrumentation-client.ts. It now sits on deploymentEnvironment() itself, which is what those two init calls read. docs/architecture.md said "tag" in three places where it meant "field" — that wording is what put criterion 1 on the ticket, so it is corrected rather than left for the next reader.

The unit lane's figures. 255 files and 3451 tests, re-measured from this tree's own gate run. The file count did not move, so perf-figures-pinned.spec.ts could not have caught the test count drifting — nothing but the four consumer docs agreeing holds that half.

Closes #1100


Generated by Claude Code

Five sites each had their own idea of what a message capture attaches: two
spelled the level by hand, one left it off so Sentry defaulted to `info`, two
built a scope through `withScope`, and three mirrored the message to
`payload.logger.warn` beside the capture while two did not. Nothing held them
in step, so a field added to one reached none of the others.

`captureMessage` is the body they now share, the twin of `captureFailure` for
anything that is not an exception. It defaults the level to `warning`, never
throws — most of its sites report from a path that is otherwise succeeding, so
a telemetry error there would fail a working operation — and takes the logger
when a site wants the mirror.

`captureTags` is what both bodies read their tags from, so neither can tag a
deployment the other leaves untagged.

Two decisions the ticket asked for. The logger mirror is opt-in, because the
abuse-milestone task logs one aggregate line for a whole run of reports and the
mail adapter's own line carries detail the report deliberately omits; passing
a logger is how the other two stop writing both halves by hand. And
`deliverProposal` keeps `info`: the system contact is the last rung of its
routing ladder rather than a failure of it, and the admin home already lists a
proposal that reached it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYvvk73ifTAQh9uxHz
The per-site specs each drive one caller, so none of them can see what a site
leaves out. These cover the defaults, the mirror's level mapping, and a
transport that throws while the caller is mid-success.

`endpoint-guard-credential-rejected.spec.ts` now reads the capture context the
way its throwing-path twin already does, rather than five scope setters.

The last case is the ticket's own `rg` made permanent: nothing but the body may
call `Sentry.captureMessage`, since the defaults and the mirror are invisible
to a site that reaches the SDK itself.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYvvk73ifTAQh9uxHz
… pass

The review pass found three fields carrying no weight. `contexts` served one
site, and its own doc warned readers off it, so the abuse-milestone report
sends plain extras instead — the named card is the one thing an operator sees
differently. `user` was only ever given an address, so the body takes `ip` and
builds the field itself, keeping the ⚠ that says why an IP may not be an extra.
`CaptureMessageArgs` is no longer exported; nothing imported it.

`tags.ts` no longer credits the tag with closing #733. `Sentry.init` sets the
event's own `environment` field on every event, so the tag is the searchable
copy beside it, not the thing that makes a preview's errors legible — and
nothing should read that comment as a reason it cannot be removed. The module
also says it is server-side only, since `deploymentEnvironment` reads an
environment a browser bundle never carries.

`capturedFrom` replaces four copies of the same reader, two of which had
already drifted apart in how they typed `tags`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYvvk73ifTAQh9uxHz
… report

A logger that throws was taking the Sentry event with it, which is the one
thing `describeRejectedCredential` already guards its own WARN line against and
`docs/architecture.md` states as a rule. The two guards are siblings now, and a
spec drives a throwing destination.

`index.ts` also speaks for both bodies, since `src/AGENTS.md` now points there
for why neither is in the barrel.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYvvk73ifTAQh9uxHz
@railway-app

railway-app Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-1102 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Nov 11, 2026 at 3:38 pm UTC
1 service not affected by this PR
  • mailpit

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 questions for the reviewer, one per thread.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread src/plugins/sentry/tags.ts Resolved
Comment thread src/plugins/sentry/captureNotice.ts Resolved
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 10, 2026
@sydevs-bot

sydevs-bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 15:26Z resolve-conflicts · attempt 1 · session · done
  • 15:26Z resolve-conflicts · attempt 1 · session
  • 18:37Z address-review · attempt 1 · session · done
  • 18:37Z address-review · attempt 1 · session
  • 18:01Z address-review · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 10, 2026
Four conflicts, all Markdown, all the same figure. Both sides raised the unit
lane's recorded counts from the merge base's 242 / 3143 — this branch to
243 / 3155 for the spec it adds, main to 251 / 3382 across nine files — so
neither side's number describes the merged tree.

`perf-figures-pinned.spec.ts` pins the file count to what is on disk and holds
every consumer doc to PERF.md, so the counts are re-measured here rather than
chosen: 252 files, 3407 tests, from this tree's own gate run. That also
corrects main's new sentence in `testing-reqs.md`, which git merged in clean
and which states the same pair.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjUsAuvKB1ezkDBghp9
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1102 November 10, 2026 17:30 Destroyed
The merged tree runs 3407 unit tests, not the 3394 that adding both sides'
new cases to main's figure predicts. `perf-figures-pinned.spec.ts` pins only
the file count to disk, so a wrong test count stays green as long as all four
consumer docs agree on it — which is exactly how the figure it governs drifted
before (#990).

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjUsAuvKB1ezkDBghp9
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1102 November 10, 2026 17:31 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged main in. Four conflicts, all Markdown, all the same figure: both sides had raised the unit lane's recorded counts from the merge base's 242 / 3143 — this branch to 243 / 3155, main to 251 / 3382.

So neither side's number describes the merged tree, and I took neither. perf-figures-pinned.spec.ts pins the file count to what is on disk, so the counts are re-measured from this tree's own gate run: 252 files / 3407 tests, restated in AGENTS.md, docs/rules/testing-reqs.md and tests/AGENTS.md. That includes main's new sentence in testing-reqs.md, which merged clean and states the same pair.

3407 is 13 above the 3394 that adding both sides' new cases predicts. The spec pins only the file count, so a derived test count would have stayed green and wrong.

No code conflict. tests/unit/endpoint-guard-credential-rejected.spec.ts was the only non-doc file both sides touched, and the two edits do not overlap — main moved the client gate from _status to enabled, this branch rewrote the Sentry mock.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 10, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 10, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 10, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 10, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

This PR is the size of #1100, no larger. Seven call sites and two new modules; the ticket's own rg criterion pulls in the three sites beyond its four. tags.ts earns its file under src/AGENTS.md:43 — two callers, beside them. Correctness reads clean: the tag filter drops nothing the if (value) setTag loop sent (RejectedCredentialContext.tags is all string | undefined), and the new edge into deploymentEnvironment adds no client-bundle hazard.

Both architectural calls already sit in question threads — whether the environment tag should exist, and message-vs-exception versus one body. I raise neither again. No contract surface is touched, so there is no consumer side to read.

Findings

  • should-fix — the body takes the SDK's own export name, where its twin avoids it. captureMessage.ts:41.
  • should-fix — tags is typed wider than anything it keeps. captureMessage.ts:38.
  • should-fix — ## Test results quotes the pre-merge run, 243 files / 3155 tests. This branch's docs now record 252 / 3407, re-measured after the main merge. Refresh it.

What was checked

  • #1100's four criteria against the diff. All four hold, and sentry-capture-message.spec.ts guards criterion 2 across .ts and .tsx.
  • Read whole on the branch: both capture bodies, tags.ts, credentialRejection.ts, deploymentEnvironment.ts, all seven call sites.
  • Ladder: captureMessage.ts is the ticket's ask, tags.ts the src/AGENTS.md:43 rule, tests/utils/sentryCapture.ts replaces four inline copies.
  • Client bundle: deploymentEnvironment.ts is not in client-bundle-safety.spec.ts's SERVER_ONLY, and clientDeploymentEnvironment (named at tags.ts:11) exists.
  • Counts: 252 unit spec files here, 251 on main; the diff adds 12 cases.
  • Preview: the host answers 200, and no page shows a Sentry change.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread src/plugins/sentry/captureMessage.ts Resolved
Comment thread src/plugins/sentry/captureMessage.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 10, 2026
#1087 moved the unit lane's recorded counts again. Both sides had raised
them from the merge base, so neither figure describes the merged tree;
these are re-measured in the next commit, from this tree's own gate run.

No code conflict. #1087's own files and this branch's do not overlap.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVR6JWLAcsDvjpUicx
`captureFailure` deliberately avoids the SDK's `captureException`; the
message body took `captureMessage` and lost that. `resendAdapter.ts` is
where it cost something — ours sat ten lines from a real
`Sentry.captureException`, under a name the SDK also exports.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVR6JWLAcsDvjpUicx
The body accepted `Record<string, unknown>` and silently dropped
everything that was not a string, so `usage/tasks.ts` forgetting its
`String(report.clientId)` would have lost the tag naming the abusing
client with no compiler error. `RejectedCredentialContext.tags` already
carries the narrow type, and every caller satisfies it.

`captureTags` keeps the wide argument, because `captureFailure` passes
it a job id. Its non-string filter is therefore only reachable from
that side, and is pinned there instead.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVR6JWLAcsDvjpUicx
255 files and 3445 tests, from this tree's own gate run. #1087 raised
main's figures while this branch raised its own, so the merge left all
four consumer docs stating a pair that described neither side.

`perf-figures-pinned.spec.ts` pins the file count to disk, so only that
half could go red; the test count is held by the four docs agreeing,
which is how the figure drifted before (#990).

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVR6JWLAcsDvjpUicx
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1102 November 10, 2026 18:16 Destroyed
3450 tests, from this tree's own gate run; 255 files is unchanged, so
`perf-figures-pinned.spec.ts` could not have caught the drift — nothing
but the four consumer docs agreeing holds the test count.

`tests/COVERAGE.md` gains the row for `sentry-capture.spec.ts`, beside
the three Sentry rows already there.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZShQHAHuZbzeMYzrf
The branch-level security sweep found no invariant breached — no value
newly reaches an extra, a tag, a message or `user`, the caller IP stays
on `user.ip_address`, and only the truncated key fingerprint is emitted.
It raised three accuracy points, each fixed here.

**The three per-item job reports stay at `error`.** Passing
`level: 'warning'` would have matched their log lines, but the Sentry
level was load-bearing in a way neither half showed: a sweep that catches
per-item failures *succeeds*, so `jobCapture`'s final-attempt capture
never fires, and those per-item events were the only `error`-level signal
a night of total failure produced. `sendInvitations` already reports the
same shape — a per-item failure inside a continuing loop — at `error`
with a matching `logger.error`, so matching it keeps the Sentry level
untouched and makes the four consistent.

**`captureFailure` really never throws now.** `status = errorStatus(error)`
was a parameter default, evaluated before the body's `try`, and
`errorStatus` reads the error's own `status` — so a throwing getter
escaped the guard. Resolved inside the `try` instead, and pinned.

**The log mirror's comment no longer reasons from pino.** This repo's one
logger is `workerSafeLogger`, which has no serializers and no `redact`
and reduces an Error under any key. The stack is still what the `err`
key buys; pino's rules are not what buys it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZShQHAHuZbzeMYzrf
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1102 November 10, 2026 19:17 Destroyed
@sydevs-bot sydevs-bot changed the title refactor(sentry): give a reported message one capture body, with the environment tag refactor(sentry): give every server report one capture body Nov 10, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Both question threads answered and built. Pushed ae727f8.

What decided the recommendation: six sites captured inline with no try, four inside a catch that exists so the run continues past a per-item failure. A transport error there aborted that run.

Look at: every Sentry level is unchanged; three log lines move warn → error to match their event's level; four per-item reports carry context as extras, not a named card.

Gate ✓ 255 files / 3451 tests. 8 int specs ✓. Security sweep ✓ — no invariant breached, three accuracy points fixed in ae727f8.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 10, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 10, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 11, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Pending in SYDevelopers Technical Roadmap Nov 11, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 11, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 11, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 11, 2026
Three doc conflicts, all one figure: the unit lane's file and test counts.
Both sides moved 254/3431 independently — this branch to 255/3451, main to
255/3457 — so neither number describes the merged tree. Re-measured here:
256 files, 3478 tests. AGENTS.md states the file count too and never
conflicted, because both sides said 255; perf-figures-pinned.spec.ts checks
it against disk, so it would have gone red on either side taken whole.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWo4RQkAJtqPe72vrB
#1108 renamed Clients.name to label; #1106 landed after it with two new
scripts still reading name. The two touch different files, so GitHub merged
#1106 without a conflict and main has not typechecked since: tsc --noEmit on
e543e6a reports the same three errors this branch inherited on merging it.

Both scripts are operator audits printing an internal identifier, so label is
the right half of the split rather than the public title.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWo4RQkAJtqPe72vrB
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1102 November 11, 2026 15:35 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged main in. Three conflicts, all the same figure: the unit lane's counts.

Both sides moved 254 / 3431 on their own — this branch to 255 / 3451, main to 255 / 3457 — so neither number describes the merged tree. Re-measured it instead: 256 files, 3478 tests. AGENTS.md states the file count too and never conflicted, because both sides said 255; perf-figures-pinned.spec.ts checks that one against disk, so either side taken whole would have gone red.

main does not typecheck, and this branch inherited it. #1108 renamed Clients.name to label; #1106 landed after it with two new scripts still reading name. Different files, so GitHub merged #1106 cleanly. tsc --noEmit on e543e6a reports the same three errors — not this PR's doing. Fixed in e4c85fe, its own commit, since it blocks this PR's gate: both scripts are operator audits printing an internal identifier, so label is the right half of the split, not title.

Lean gate green on the merged tree: lint, format, typecheck, typecheck:tests, 256 files / 3478 tests, 134 s.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 11, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 11, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit f65c5d7 Nov 11, 2026
15 checks passed
@sydevs-bot
sydevs-bot deleted the claude/refactor-1100-capture-warning branch November 11, 2026 16:06
@sydevs-bot sydevs-bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 11, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 11, 2026
…er-contacts

Four conflicts. Three are one fact again: the unit lane's file and test
counts, in docs/rules/testing-reqs.md, tests/AGENTS.md and tests/PERF.md.
main's #1102 and this branch each added a spec file since the seventh
merge, so neither side's number describes the merged tree. Measured
instead: 257 files, 3488 tests. AGENTS.md states the file count too and
merged clean at the stale 256, so it is corrected here —
tests/unit/perf-figures-pinned.spec.ts pins all four against the tree.

The fourth is an import line in src/plugins/login/invitations.ts, where
this branch added selfOrAdminFieldAccess and #1102 added capture. Both are
used, so both are kept.

main added no migration, so the chain and its snapshot stand as the seventh
merge left them.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYptMd7SiHURhD6ufY
sydevs-bot pushed a commit that referenced this pull request Nov 11, 2026
Five Markdown conflicts and one semantic conflict no marker showed.

Four of the five are the same fact twice: both sides recounted the unit
lane from 255 / 3457. Measured on the merged tree rather than added up —
262 files and 3530 tests. `tests/PERF.md` takes this run as its
forty-seventh row; `AGENTS.md`, `docs/rules/testing-reqs.md` and
`tests/AGENTS.md` quote the same pair.

The fifth is `docs/architecture.md`'s Sentry paragraph. #1102 rewrote it
from "the `environment` tag" to "the `environment` FIELD", adding why no
capture sets a tag beside it; this branch had only renamed
`next.config.mjs` to `next.config.ts` in it, twice. Resolved as main's
prose carrying this branch's two renames.

**The semantic conflict is `tests/unit/submission-deliverers.spec.ts`,
which git merged clean and which then failed.** #1102 added a mock
factory for `@/lib/env/deploymentEnvironment` declaring
`deploymentEnvironment` alone — complete against `main`, where that
module exports nothing else a deliverer reaches. On this branch
`getServerUrl()` reads `railwayEnvironmentName()` from the same module,
and a factory replaces the module whole, so the review link's
`adminDocUrl()` threw vitest's missing-export error inside
`deliverProposal`'s try, which reported it as a retryable delivery
failure and sent no email. The factory now declares both exports, the
second off-Railway to match the `'test'` name beside it.

Neither side is wrong, and neither could have seen it: the mock is
complete on `main` and the import is correct here.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXTetkJdxYxxUHBYFi

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-1102 — e4c85feb Deployed Nov 11, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

refactor(sentry): give a reported warning one capture body, with the environment tag

3 participants