@crvouga/mockingbird-service-sentry 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog — @crvouga/mockingbird-service-sentry
2
+
3
+ ## 0.1.0 (2026-10-05)
4
+
5
+ Initial release.
package/DISCOVERY.md ADDED
@@ -0,0 +1,55 @@
1
+ # @crvouga/mockingbird-service-sentry discovery
2
+
3
+ This is the installed-package index for coding agents and tooling. All relative links resolve
4
+ inside `node_modules/@crvouga/mockingbird-service-sentry/`; no repository checkout is needed to discover the mock's
5
+ supported surface or documented behavior.
6
+
7
+ ## Capability and behavior sources
8
+
9
+ | Question | Authoritative file | What it contains |
10
+ | --- | --- | --- |
11
+ | Behaviour and integration | [`README.md`](README.md) | Routes, state transitions, auth, webhooks, controls, presets and deliberate omissions. |
12
+ | Exact capabilities | [`SUPPORT.md`](SUPPORT.md) | Supported, unsupported and parity-covered operations or commands, including reasons for gaps. |
13
+ | Wire contract | [`openapi.yaml`](openapi.yaml) | Machine-readable paths, methods, schemas, responses and parity annotations. |
14
+ | Public API | [`dist/index.d.ts`](dist/index.d.ts) | The installed package's exact TypeScript exports and signatures. |
15
+ | Package metadata | [`package.json`](package.json) | Runtime/entry-point claims, vendor links, parity scope/tier and `mockingbird.discovery`. |
16
+
17
+ Read these together: the contract/capability matrix says *what* is available, while the README
18
+ defines stateful behavior, lifecycle rules, test controls, and intentional oracle differences.
19
+ If prose and an executable surface disagree, report a parity mismatch instead of adding a
20
+ consumer-side workaround.
21
+
22
+ ## Parity and oracle
23
+
24
+ - Declared parity surface: **SDK ingestion, events, issues and attachments**.
25
+ - Parity tier: **cold** (the repository controls when live checks run).
26
+ - Oracle: **Live vendor API or sandbox**.
27
+ - Repository command: `bun run parity:service -- sentry`.
28
+ - Evidence model: Run from a Mockingbird checkout; credentials come only from .env.local or GitHub Actions secrets. Missing credentials exit 2.
29
+
30
+ The npm package contains evidence summaries and the exact contract, not credentials or the
31
+ repository-only parity harness. Self-parity/property and acceptance tests run in the Mockingbird
32
+ repository; live parity is an additional oracle check, not a substitute for the packaged matrix.
33
+
34
+ ## Runtime introspection
35
+
36
+ - `GET /__admin/health`
37
+ - `GET /__admin`
38
+ - `GET /__admin/state`
39
+ - `GET /__admin/requests`
40
+ - `GET /__admin/metrics`
41
+ - `GET /__admin/faults/presets`
42
+ - `GET /__admin/ui`
43
+
44
+ For HTTP services, use `x-mockingbird-namespace` (or the documented credential/path carrier) so
45
+ parallel tests do not share state. Admin state, journal, metrics and fault-preset endpoints are
46
+ designed for assertions and diagnosis by consuming test suites.
47
+
48
+ ## Report a mismatch or missing capability
49
+
50
+ Follow the [agent reporting contract](https://github.com/crvouga/mockingbird/blob/main/docs/REPORTING_ISSUES.md). Include package version,
51
+ operation/command, a minimal redacted request, actual mock result, expected oracle result or vendor
52
+ documentation, and whether the mismatch appears in the matrix. Never include keys, tokens,
53
+ customer data, prompts, PHI, card data, or unredacted recordings.
54
+
55
+ Service key: `sentry`.
package/README.md ADDED
@@ -0,0 +1,166 @@
1
+ # @crvouga/mockingbird-service-sentry
2
+
3
+ > Familiar calls. Faithful echoes. Part of [Mockingbird](https://github.com/crvouga/mockingbird).
4
+
5
+ A stateful Sentry SDK transport and event/issue assertion mock. This initial package is **wip**:
6
+ its bounded surface follows the official envelope protocol and Relay responses, not the entire
7
+ Sentry product. No vendor account, container, secret or outbound call is needed for tests.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ bun add -d @crvouga/mockingbird-service-sentry
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```ts
18
+ import { createRuntime, DEFAULT_PROJECT } from "@crvouga/mockingbird-service-sentry"
19
+
20
+ const sentry = createRuntime()
21
+ const response = await sentry.fetch(new Request(
22
+ `http://sentry.local/api/1/store/?sentry_key=${DEFAULT_PROJECT.publicKey}&sentry_version=7`,
23
+ { method: "POST", headers: { "content-type": "application/json" },
24
+ body: JSON.stringify({ message: "Fixture failure", fingerprint: ["fixture-group"] }) },
25
+ ))
26
+ console.log(response.status) // 200
27
+ ```
28
+
29
+ For the official `@sentry/nextjs` or `@sentry/node` SDK, start `createServer()` from the `/server`
30
+ entry and set `SENTRY_DSN` to `http://<DEFAULT_PROJECT.publicKey>@127.0.0.1:<port>/1`, or give that
31
+ DSN to `init`/`NodeClient`. Both SDKs are tested at **11.4.0** (the report supplied no pinned version).
32
+ Use SDK `flush()` to finish submission, then `POST /__admin/flush {"eventIds": […], "count": n}`
33
+ for an immediate assertion: `flushed: false` means the condition is not met; it never sleeps.
34
+
35
+ REST requests use `Authorization: Bearer fixture-rest-token`. `projects` and `restTokens` options
36
+ replace these constructor fixtures. Each project includes its organization, numeric-string ID,
37
+ slug, name and 32-hex public key. The defaults are obviously synthetic. Each namespace receives
38
+ its own constructor fixtures and returns to them on reset.
39
+
40
+ ```sh
41
+ mockingbird-sentry serve --port 8810
42
+ ```
43
+
44
+ ## Routes and behavior
45
+
46
+ - `POST /api/{project}/envelope/`: byte-accurate envelope parsing, implicit or explicit lengths,
47
+ UTF-8 JSON headers, binary attachments, unknown item retention, event/transaction/session/
48
+ sessions/client-report items. Gzip/deflate request compression is supported. Responses are
49
+ `200 {"id": "<event ID>"}` when an ID applies, or `200 {}` for session/report-only envelopes.
50
+ - `POST /api/{project}/store/`: JSON event ingestion; generates a deterministic 32-hex event ID
51
+ when absent. Legacy `message: false` is accepted and ignored, matching Relay LogEntry; raw
52
+ input attributes cannot overwrite normalized REST fields. Event IDs dedupe per project, including concurrent retries: a replay returns the
53
+ same ID without a second capture, issue count or attachment.
54
+ - `POST /api/{project}/minidump/`: raw native minidump or multipart `upload_file_minidump`, optional
55
+ `sentry` JSON and additional files. Returns the hyphenated event UUID as plain text, like Relay.
56
+ Validates the MDMP/PMDM magic and retains bytes; native crash symbolication is not simulated.
57
+ - `GET /api/0/projects/{organization}/{project}/events/`: error events newest first, bare array,
58
+ `full=true` caps a page at 10. Transactions remain available in event detail and admin search.
59
+ - `GET /api/0/projects/{organization}/{project}/events/{event}/`: event ID, message/title,
60
+ exception/stacktrace entries, contexts, breadcrumbs, tags and fixture user identity.
61
+ - `GET /api/0/projects/{organization}/{project}/issues/`: bare-array groups; defaults to
62
+ `is:unresolved`, `query=` includes all statuses. Explicit fingerprints take priority; fallback
63
+ grouping is deterministically based on exception title/frames, or message when configured.
64
+ - `GET`/`PUT /api/0/issues/{issue}/` and `/api/0/organizations/{organization}/issues/{issue}/`:
65
+ read or set `status` to `unresolved`, `resolved`, or `ignored`. Resolving persists until an
66
+ explicit status update; automatic regression detection is outside this initial mock.
67
+ - `GET /api/0/projects/{organization}/{project}/events/{event}/attachments/` and `/{attachment}/`:
68
+ attachment metadata; `?download=1` on detail returns the original bytes to the authenticated caller.
69
+
70
+ Read pagination uses `limit` (1–100), `cursor=0:<offset>:<previous flag>` and Sentry's `Link`
71
+ header with both `rel="previous"` and `rel="next"`, their cursors, and `results="true|false"`.
72
+ Stable insertion order avoids duplicates when walking a fixed result set. Links preserve filters
73
+ and the selected namespace, including a custom admin prefix. The mock supports release/tag/trace
74
+ and status filters; production search syntax, sampling, trend/rank sorting and statistics are
75
+ not silently represented as implemented features (see boundaries below).
76
+
77
+ Ingest auth accepts `X-Sentry-Auth: Sentry sentry_key=…, sentry_version=7`, query `sentry_key`
78
+ with optional `sentry_version`, or a self-authenticated envelope DSN. Conflicting header/query
79
+ credentials, missing auth, malformed keys, incompatible protocol versions, bad envelopes and
80
+ unknown project keys receive Relay-shaped `{"detail": "…"}` errors. There is no invented generic
81
+ API error code or request ID: the ingest response's `id` is the vendor event identifier. Exact
82
+ production quota, filter-reason details and REST error text beyond the documented cases are bounded
83
+ approximations. The default payload ceiling is 20 MiB, configurable with `maxPayloadBytes`.
84
+
85
+ ## Test controls
86
+
87
+ All internal endpoints move together with `adminPrefix` (default `/__admin`). Namespace carriers:
88
+ `x-mockingbird-namespace`, `/__admin/ns/<suite>/…`, or DSN query/header credentials and REST tokens
89
+ mapped with `PUT /__admin/credentials`. Self-authenticated envelope-only DSNs use header/path
90
+ namespaces; credential mapping cannot inspect a body before the shared runtime selects a namespace.
91
+ Clock, reset, Timeline checkpoints/branches and snapshot aliases, request journal, metrics, admin
92
+ UI, collection introspection and generic faults are the shared service contract.
93
+
94
+ - `GET /__admin/events?project=1&release=…&tag=key:value&trace=…`: normalized captured errors and
95
+ transactions. All listed fields, timestamps, fingerprints, tags, contexts and breadcrumbs survive
96
+ subject to redaction; `user` retains only the fake fixture `id`.
97
+ - `GET /__admin/issues`: matching groups with current resolution state, using the same filters.
98
+ - `GET /__admin/envelopes?project=1`: item/header metadata and rejection flags; never raw bytes.
99
+ - `GET`/`PUT /__admin/settings`: `grouping: "exception"|"message"`, `sensitivePaths` (dot paths;
100
+ defaults `request.data`, `request.cookies`) and `rejectItems` (types to discard while accepting
101
+ other items with 200). These are synthetic controls, not public Sentry settings APIs.
102
+ - `POST /__admin/flush {eventIds?, count?, project?}`: immediate capture condition/result.
103
+ - `POST /__admin/issues/{id}/status {status}`: resolve/reopen/ignore.
104
+ - `POST /__admin/projects/{id}/clear`: clear that project's telemetry while retaining its fixture.
105
+
106
+ Presets: `rate_limited` (429, `Retry-After: 60`, `X-Sentry-Rate-Limits: 60:error:organization`),
107
+ `server_error` (503), `network_reset` (socket drop) and `item_rejected` (synthetic 403 filter).
108
+ Each is scoped to ingestion and operates before writes. Generic faults can force other 5xx/429
109
+ responses. The official SDK test proves error-category quotas drop further errors without blocking
110
+ transactions. It verifies behavior immediately, without retry sleeps.
111
+
112
+ ### Raw capture and redaction
113
+
114
+ Authorization/cookies and credential-named fields are filtered recursively, including header
115
+ pairs. Configured sensitive body paths are filtered before normalized data enters storage or
116
+ vendor/admin diagnostics. Personal email, name and IP attributes are dropped. Journals/log sinks
117
+ contain request metadata and resource IDs only, never bodies, headers or attachment bytes.
118
+ Raw wire bodies and attachment bytes are retained **encrypted with AES-GCM** in ordinary Collections,
119
+ so reset/Timeline cover them without disclosing plaintext through generic state diagnostics.
120
+ `runtime.instance(namespace).rawEnvelope(id)` is explicit programmatic owner access to original
121
+ wire bytes; it is not exposed by an admin HTTP route. Supply a `captureKey` from `createCaptureKey()`
122
+ when reopening persistent SQLite storage; the default key lives only for that runtime's lifetime.
123
+ Treat this explicit raw access as sensitive test-owner access. Normal event/detail/search paths
124
+ return redacted data, while authenticated attachment download is an explicit byte retrieval.
125
+
126
+ ## Oracle evidence
127
+
128
+ - [Official envelope grammar and item rules](https://develop.sentry.dev/sdk/foundations/envelopes/).
129
+ - [Official transport rate limits](https://develop.sentry.dev/sdk/foundations/transport/rate-limiting/).
130
+ - [Official pagination headers and cursor examples](https://docs.sentry.io/api/pagination/).
131
+ - [Project event list](https://docs.sentry.io/api/events/list-a-projects-error-events/),
132
+ [project issue list](https://docs.sentry.io/api/events/list-a-projects-issues/) and
133
+ [issue detail](https://docs.sentry.io/api/events/retrieve-an-issue/).
134
+ - [Relay envelope response](https://github.com/getsentry/relay/blob/c4e9930349068039dd6ecd06cf338c527ee90165/relay-server/src/endpoints/envelope.rs),
135
+ [auth status/messages](https://github.com/getsentry/relay/blob/c4e9930349068039dd6ecd06cf338c527ee90165/relay-server/src/extractors/request_meta.rs),
136
+ [ingest errors, quota headers and minidump response](https://github.com/getsentry/relay/blob/c4e9930349068039dd6ecd06cf338c527ee90165/relay-server/src/endpoints/common.rs).
137
+ - [Relay legacy message normalization](https://github.com/getsentry/relay/blob/c4e9930349068039dd6ecd06cf338c527ee90165/relay-event-schema/src/protocol/logentry.rs) explicitly ignores `message: false`; its CI-discovered seed is retained in the regression registry.
138
+ - Official npm SDK source for `@sentry/node`, `@sentry/core` and `@sentry/nextjs` 11.4.0; served
139
+ tests use the actual clients and transport, not a reimplementation of SDK quota handling.
140
+
141
+ `bun run parity:service -- sentry` requires `SENTRY_API_URL`, `SENTRY_AUTH_TOKEN`,
142
+ `SENTRY_ORGANIZATION_SLUG`, `SENTRY_PROJECT_ID` and `SENTRY_PROJECT_SLUG`. The runner compares only
143
+ safe reads and never submits to a live vendor. Tests need none of these keys. Live parity has not
144
+ been claimed without access; docs and SDK source are the initial oracle.
145
+
146
+ ## Deliberately not modelled
147
+
148
+ Vendor dashboards/billing, full organization/project/release management, production quotas,
149
+ complete search DSL and search time windows, sort modes other than newest/last-seen, statistical
150
+ series/sampling, source-map/native symbolication, sessions aggregate analytics, profiling/replays,
151
+ full crash dump validation, legacy compressed-base64 store ingestion, automatic issue regressions,
152
+ alert-rule evaluation or optional issue-alert webhooks. Unknown envelope items are retained, not
153
+ processed as unsupported product features. Group fallback rules and forced filter behavior are
154
+ explicit deterministic test policies, not Sentry's production grouping algorithm. Issues are
155
+ explicitly resolved/reopened by controls or vendor PUT, and never invent asynchronous workers.
156
+
157
+ ## API
158
+
159
+ Main entry runtime exports: `SentryAPI` (`fetch`, `reset`, `rawEnvelope`, `captured`, `issueWire`,
160
+ `sqlite`, `state`, `app`), `createRuntime`, `SENTRY_NAMESPACE`, `SENTRY_PRESETS`, `DEFAULT_PROJECT`,
161
+ `createCaptureKey`, `sentryCredential`, `document` and `supportedOperationIds`.
162
+ Types include `SentryAPIOptions`, `SentryRuntime`, `SentryRuntimeOptions`, `ProjectFixture`,
163
+ `SentrySettings`, `CapturedEvent`, `CapturedEnvelope`, and `IssueRecord`.
164
+ Server entry runtime exports: `createServer`, `DEFAULT_PORT`, `serveTarget`. Server types:
165
+ `SentryServer`, `SentryServerOptions`. `createServer` returns `{url, runtime, close, …}`; close the
166
+ server after each test. The CLI entry runs `serve` with the common host/port/admin-prefix options.
package/SUPPORT.md ADDED
@@ -0,0 +1,22 @@
1
+ # Sentry transport and event API — operation support
2
+
3
+ Generated from `openapi.yaml`; do not edit by hand.
4
+
5
+ - operations in spec: **12**
6
+ - supported by the mock: **12**
7
+ - parity enabled: **10**
8
+
9
+ | operationId | route | mock | parity | notes |
10
+ | --- | --- | --- | --- | --- |
11
+ | `IngestEnvelope` | `POST /api/{project}/envelope/` | ✅ supported | ❌ disabled | Envelope byte lengths and mixed binary items require the dedicated official SDK and codec acceptance tests. |
12
+ | `StoreEvent` | `POST /api/{project}/store/` | ✅ supported | ⚠️ unsafe (opt-in) | |
13
+ | `IngestMinidump` | `POST /api/{project}/minidump/` | ✅ supported | ❌ disabled | Native minidump and multipart bodies require the dedicated served binary tests. |
14
+ | `ListProjectEvents` | `GET /api/0/projects/{organization}/{project}/events/` | ✅ supported | ✅ | |
15
+ | `GetProjectEvent` | `GET /api/0/projects/{organization}/{project}/events/{event}/` | ✅ supported | ✅ | |
16
+ | `ListProjectIssues` | `GET /api/0/projects/{organization}/{project}/issues/` | ✅ supported | ✅ | |
17
+ | `GetIssue` | `GET /api/0/issues/{issue}/` | ✅ supported | ✅ | |
18
+ | `UpdateIssue` | `PUT /api/0/issues/{issue}/` | ✅ supported | ⚠️ unsafe (opt-in) | |
19
+ | `GetOrganizationIssue` | `GET /api/0/organizations/{organization}/issues/{issue}/` | ✅ supported | ✅ | |
20
+ | `UpdateOrganizationIssue` | `PUT /api/0/organizations/{organization}/issues/{issue}/` | ✅ supported | ⚠️ unsafe (opt-in) | |
21
+ | `ListEventAttachments` | `GET /api/0/projects/{organization}/{project}/events/{event}/attachments/` | ✅ supported | ✅ | |
22
+ | `GetEventAttachment` | `GET /api/0/projects/{organization}/{project}/events/{event}/attachments/{attachment}/` | ✅ supported | ✅ | |