@ultimat3/cli 30.9.0 → 31.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/CLAUDE.md +80 -64
- package/README.md +4 -1
- package/package.json +30 -29
- package/src/admin-registration.ts +1 -1
- package/src/affected-base.ts +51 -0
- package/src/affected.ts +34 -11
- package/src/app-boundaries.ts +88 -9
- package/src/app-load-async.ts +133 -0
- package/src/app-load-batch.ts +203 -0
- package/src/app-load-prebuilt.ts +147 -0
- package/src/app-load-register.ts +175 -0
- package/src/app-load.ts +143 -175
- package/src/app-loader-imports.ts +31 -0
- package/src/app-root.ts +13 -0
- package/src/app-runtime.ts +5 -1
- package/src/boundary-findings.ts +12 -0
- package/src/browser-launcher-port.ts +3 -7
- package/src/browser-launcher.ts +1 -1
- package/src/budgets-scan.ts +8 -0
- package/src/budgets.ts +10 -1
- package/src/build-registry-background.ts +59 -0
- package/src/build-registry.ts +207 -0
- package/src/cdp-shot-clock.ts +3 -11
- package/src/cdp-shot-driver.ts +3 -2
- package/src/cdp-shot-element.ts +3 -2
- package/src/cdp-shot-page.ts +2 -2
- package/src/cdp-shot-watch.ts +4 -3
- package/src/ci-log.ts +76 -13
- package/src/cmd-affected-spec.ts +7 -3
- package/src/cmd-affected.ts +91 -77
- package/src/cmd-auth.ts +3 -3
- package/src/cmd-ci.ts +6 -3
- package/src/cmd-db-recount.ts +15 -0
- package/src/cmd-drill.ts +10 -6
- package/src/cmd-exercise.ts +2 -1
- package/src/cmd-generate-spec.ts +6 -0
- package/src/cmd-generate.ts +22 -4
- package/src/cmd-mail.ts +1 -1
- package/src/cmd-pr-spec.ts +1 -1
- package/src/cmd-pr.ts +72 -1
- package/src/cmd-routes.ts +2 -2
- package/src/cmd-secrets-spec.ts +4 -1
- package/src/cmd-shot.ts +14 -262
- package/src/cmd-test-spec.ts +2 -2
- package/src/cmd-verify-spec.ts +21 -1
- package/src/cmd-verify.ts +16 -4
- package/src/coverage-source.ts +4 -1
- package/src/db-diagnostics.ts +8 -1
- package/src/dev-boot.ts +29 -15
- package/src/dev-dashboard-invalidations.ts +43 -0
- package/src/dev-dashboard.ts +13 -16
- package/src/dev-n-plus-one.ts +7 -3
- package/src/dev-rebuild.ts +2 -1
- package/src/dev-route-table.ts +1 -1
- package/src/dev-traces.ts +16 -15
- package/src/document-options.ts +12 -1
- package/src/drift-store.ts +55 -0
- package/src/error-catalog.ts +8 -3
- package/src/error-codes-boundary.ts +32 -0
- package/src/error-codes-package.ts +38 -0
- package/src/error-codes.ts +28 -40
- package/src/errors.ts +17 -7
- package/src/exercise-database.ts +13 -1
- package/src/exercise-findings.ts +36 -18
- package/src/exercise-services.ts +84 -0
- package/src/exercise-subject.ts +38 -13
- package/src/failure-capture-boot.ts +9 -5
- package/src/framework-schema.ts +5 -5
- package/src/generate-exercise.ts +1 -1
- package/src/generate-files.ts +27 -7
- package/src/generate-kinds.ts +5 -0
- package/src/generate-refresh.ts +53 -0
- package/src/generate-workspace.ts +169 -0
- package/src/generate-write.ts +8 -2
- package/src/hold.ts +19 -8
- package/src/image-prepare.ts +6 -2
- package/src/index.ts +5 -20
- package/src/island-bundle.ts +7 -3
- package/src/island-capture.ts +2 -2
- package/src/island-harness.ts +1 -1
- package/src/job-registration.ts +43 -6
- package/src/jobs-driver.ts +4 -5
- package/src/mcp-errors.ts +20 -4
- package/src/mcp-host.ts +5 -1
- package/src/mcp-ui-interact.ts +3 -0
- package/src/messages-gate.ts +10 -0
- package/src/new-shapes-generate.ts +1 -1
- package/src/otlp-export.ts +94 -29
- package/src/output.ts +24 -10
- package/src/page-sync.ts +3 -1
- package/src/pr-activity.ts +150 -0
- package/src/pr-bots.ts +109 -0
- package/src/pr-threads.ts +7 -2
- package/src/role-load.ts +17 -11
- package/src/role-start.ts +5 -4
- package/src/role-sync.ts +7 -8
- package/src/route-islands-preload.ts +46 -0
- package/src/route-islands.ts +6 -2
- package/src/runtime-admin.ts +5 -1
- package/src/runtime-bindings.ts +25 -19
- package/src/runtime-boot-ports.ts +66 -0
- package/src/runtime-bus.ts +29 -5
- package/src/runtime-cache-bus.ts +53 -0
- package/src/runtime-cache.ts +43 -13
- package/src/runtime-isr-outcome.ts +5 -4
- package/src/runtime-jobs.ts +2 -2
- package/src/runtime-keys.ts +37 -0
- package/src/runtime-overrides.ts +148 -42
- package/src/runtime-port-bindings-queue.ts +36 -0
- package/src/runtime-port-bindings.ts +117 -0
- package/src/runtime-ports.ts +164 -0
- package/src/runtime-purge.ts +41 -28
- package/src/runtime-push.ts +7 -3
- package/src/runtime-queue.ts +70 -55
- package/src/runtime-realtime.ts +5 -5
- package/src/runtime-render-document.ts +4 -1
- package/src/runtime-services.ts +110 -158
- package/src/runtime-storage-boot.ts +111 -0
- package/src/runtime-storage-upload.ts +9 -7
- package/src/runtime-storage.ts +7 -1
- package/src/serve-boot.ts +8 -4
- package/src/serve-entry.ts +3 -0
- package/src/serve-env.ts +47 -14
- package/src/serve-prebuilt-paths.ts +3 -0
- package/src/serve-prebuilt.ts +15 -4
- package/src/serve.ts +2 -2
- package/src/shot-gpu.ts +61 -0
- package/src/shot-route.ts +95 -0
- package/src/shot-run.ts +189 -0
- package/src/shot-verdict.ts +5 -0
- package/src/static-cards.ts +3 -2
- package/src/static-report.ts +2 -2
- package/src/style-bundle.ts +1 -1
- package/src/sync-authenticator.ts +17 -18
- package/src/templates/action-tests.ts +4 -4
- package/src/templates/backfill.ts +5 -8
- package/src/templates/entity.ts +3 -0
- package/src/templates/github/ci.yml.ts +3 -1
- package/src/templates/github/dependabot.yml.ts +73 -0
- package/src/templates/job.ts +13 -22
- package/src/templates/naming.ts +20 -1
- package/src/templates/pinned/docker-compose.yml +1 -1
- package/src/templates/query.ts +7 -8
- package/src/templates/route.ts +5 -3
- package/src/templates/scaffold-api.ts +1 -1
- package/src/templates/scaffold-auth.ts +5 -3
- package/src/templates/scaffold-claude-commands.ts +6 -3
- package/src/templates/scaffold-claude.ts +4 -4
- package/src/templates/scaffold-container-compose.ts +2 -4
- package/src/templates/scaffold-domain-package.ts +1 -1
- package/src/templates/scaffold-entries.ts +6 -1
- package/src/templates/scaffold-helm-fences.ts +3 -2
- package/src/templates/scaffold-helm.ts +35 -6
- package/src/templates/scaffold-repo.ts +47 -135
- package/src/templates/scaffold-runtime-ports.ts +62 -0
- package/src/templates/scaffold-verify-floor.ts +97 -0
- package/src/templates/shapes/overlay.ts +1 -1
- package/src/templates/sign-in-oidc.ts +5 -3
- package/src/templates/sign-in-shared.ts +28 -10
- package/src/templates/workspace.ts +75 -0
- package/src/test-ignores.ts +5 -2
- package/src/test-select.ts +4 -1
- package/src/tsconfig-aliases.ts +85 -0
- package/src/upgrade-gate.ts +30 -5
- package/src/upgrade-report.ts +7 -1
- package/src/verify-changed-facts.ts +53 -0
- package/src/verify-changed-scope.ts +162 -0
- package/src/verify-changed.ts +174 -0
- package/src/verify-checks.ts +33 -19
- package/src/verify-drift-owner.ts +30 -0
- package/src/verify-e2e.ts +2 -1
- package/src/verify-factories.ts +86 -0
- package/src/verify-run.ts +13 -11
- package/src/verify-step.ts +13 -0
- package/src/verify-tests.ts +58 -6
- package/src/workspace-external-deps.ts +164 -0
- package/src/write-line.ts +21 -6
- package/wiki/Actions.md +2 -2
- package/wiki/Adapters.md +400 -0
- package/wiki/Admin-Dashboard.md +1 -1
- package/wiki/Agents.md +9 -9
- package/wiki/Auth.md +78 -2
- package/wiki/Building-Your-Own-Base.md +1 -1
- package/wiki/CLI-Reference.md +45 -14
- package/wiki/Caching-And-Invalidation.md +17 -5
- package/wiki/Compared.md +8 -2
- package/wiki/Configuration.md +14 -14
- package/wiki/Deployment.md +28 -1
- package/wiki/Entities-And-Migrations.md +47 -1
- package/wiki/FAQ.md +8 -2
- package/wiki/Feature-Flags.md +1 -1
- package/wiki/Home.md +3 -2
- package/wiki/Jobs-And-Workflows.md +107 -6
- package/wiki/Known-Gaps.md +4 -3
- package/wiki/MCP-And-AI.md +18 -4
- package/wiki/Mail.md +14 -5
- package/wiki/Migrations-And-Backfills.md +29 -4
- package/wiki/Money.md +2 -0
- package/wiki/N-Plus-One-Detection.md +24 -22
- package/wiki/Notify.md +28 -4
- package/wiki/Observability.md +121 -15
- package/wiki/Queries-And-Live-Queries.md +2 -2
- package/wiki/Realtime.md +9 -4
- package/wiki/Routes-And-Render-Modes.md +5 -0
- package/wiki/Scraping.md +57 -11
- package/wiki/Shapes.md +2 -2
- package/wiki/Stability.md +7 -5
- package/wiki/Storage-And-Uploads.md +56 -4
- package/wiki/Testing.md +65 -52
- package/wiki/Troubleshooting.md +1 -1
- package/wiki/Tutorial-01-First-App.md +1 -1
- package/wiki/Tutorial-04-Jobs-And-Realtime.md +1 -1
- package/wiki/Tutorial-05-Deploy-Free.md +1 -1
- package/wiki/Tutorial-06-Growing-Up.md +8 -8
- package/wiki/Upgrading.md +136 -5
package/src/messages-gate.ts
CHANGED
|
@@ -37,6 +37,10 @@ export const GATE_MESSAGES = {
|
|
|
37
37
|
'cli.ci.tested.api': 'not tested: GitHub did not answer ({detail}) — a full run',
|
|
38
38
|
'cli.ci.tested.sha':
|
|
39
39
|
'not tested: no GITHUB_SHA, and git rev-parse HEAD named no commit — a full run',
|
|
40
|
+
// A review bot that said it did NOT review leaves no thread, so its silence reads as a clean
|
|
41
|
+
// review unless a line says otherwise. `notice` is the same fact once the bot reviewed after it.
|
|
42
|
+
'cli.pr.bot.blocked': ' {login} did not review: {excerpt} ({kind}, {at}) — {url}',
|
|
43
|
+
'cli.pr.bot.notice': ' {login} posted a {kind} notice at {at}, then reviewed at {reviewed}',
|
|
40
44
|
'cli.pr.body.truncated': ' … {hidden} more line(s) — re-run with --full',
|
|
41
45
|
/** The line of a thread whose anchor GitHub answers null for — a value, not a column key. */
|
|
42
46
|
'cli.pr.line.unknown': '-',
|
|
@@ -47,6 +51,8 @@ export const GATE_MESSAGES = {
|
|
|
47
51
|
'thread {id} is marked resolved on GitHub — that records the conversation, not that the finding is fixed',
|
|
48
52
|
'cli.pr.review.count':
|
|
49
53
|
'{unresolved} unresolved and {resolved} resolved review thread(s) on {repo}#{pr}',
|
|
54
|
+
'cli.pr.review.activity':
|
|
55
|
+
' {reviews} review(s), {comments} PR comment(s), {bots} review bot(s) — bodies in --json',
|
|
50
56
|
'cli.pr.review.current': ' submitted against the current head {head}',
|
|
51
57
|
'cli.pr.review.decision': ' review: {decision} by {author} at {submitted}',
|
|
52
58
|
'cli.pr.review.none': 'no review thread is anchored to a line on {repo}#{pr}',
|
|
@@ -80,6 +86,10 @@ export const GATE_MESSAGES = {
|
|
|
80
86
|
// The `errors` step's own coverage, in `output`: a scan without a parser reads most fix lines
|
|
81
87
|
// and not all of them, and a step that reports findings alone claims a completeness it lacks.
|
|
82
88
|
'cli.verify.fixCoverage': 'checked {checked} fix line(s), could not read {unreadable}',
|
|
89
|
+
// The `drift` step on an app whose only store is a `defineDriver` one: migrations describe
|
|
90
|
+
// Postgres, and that store owns its schema — said in `output`, so the step is not a silent green.
|
|
91
|
+
'cli.verify.driftNonSql':
|
|
92
|
+
'skipped: no SQL driver is configured — the app stores rows in {stores}, which owns its schema; migrations, drift and x db describe Postgres only',
|
|
83
93
|
// Why a skipped step is a dash when the step can say so: the suite exists and not one of its
|
|
84
94
|
// tests ran. Each test's own name carries the reason it skipped, and `bun test` prints only the
|
|
85
95
|
// counts — so the line says how many and `x test <type>` prints the names.
|
|
@@ -26,7 +26,7 @@ export class NewShapeGenerateError extends UltimateError {
|
|
|
26
26
|
`cd ${renderFixShellArg(input.target, '<the new app directory>')}`,
|
|
27
27
|
'&&',
|
|
28
28
|
...['bunx', 'x', ...input.argv, '--json'].map(quoteArg),
|
|
29
|
-
' # reproduces it; then bun test packages/cli/src/templates/shapes',
|
|
29
|
+
' # reproduces it; then bun test ./packages/cli/src/templates/shapes',
|
|
30
30
|
].join(' '),
|
|
31
31
|
});
|
|
32
32
|
}
|
package/src/otlp-export.ts
CHANGED
|
@@ -3,77 +3,142 @@
|
|
|
3
3
|
// deployment configured a collector, the collector received nothing, and the only signal that
|
|
4
4
|
// anything was wrong was an empty dashboard.
|
|
5
5
|
|
|
6
|
+
import type { OtlpSignal, ShutdownReason } from '@ultimat3/core';
|
|
6
7
|
import {
|
|
7
|
-
configureMetrics,
|
|
8
|
-
configureTelemetry,
|
|
9
8
|
logger,
|
|
10
|
-
noopExporter,
|
|
11
|
-
noopMetricExporter,
|
|
12
9
|
onShutdown,
|
|
10
|
+
otlpEndpointLabel,
|
|
11
|
+
otlpLogExporter,
|
|
13
12
|
otlpMetricExporter,
|
|
14
13
|
otlpSpanExporter,
|
|
15
14
|
startMetricExport,
|
|
15
|
+
subscribe,
|
|
16
|
+
subscribeSemconvMetrics,
|
|
17
|
+
systemClock,
|
|
16
18
|
tryOtlpEndpoint,
|
|
17
19
|
} from '@ultimat3/core';
|
|
18
20
|
import type { Env } from './runtime-bindings';
|
|
19
21
|
|
|
22
|
+
/**
|
|
23
|
+
* The endpoint a signal exports to, unless `OTEL_<SIGNAL>_EXPORTER=none` switched it off or
|
|
24
|
+
* `OTEL_SDK_DISABLED=true` switched every signal off — the OpenTelemetry spellings, read as the
|
|
25
|
+
* spec does: case-insensitive, surrounding space ignored (`NONE`, `none `). The generic
|
|
26
|
+
* `OTEL_EXPORTER_OTLP_ENDPOINT` names all three signals, and a collector with no logs pipeline
|
|
27
|
+
* would answer every logs batch with a 404.
|
|
28
|
+
*/
|
|
29
|
+
export function signalEndpoint(signal: OtlpSignal, env: Env): string | undefined {
|
|
30
|
+
if (envWord(env['OTEL_SDK_DISABLED']) === 'true') return undefined;
|
|
31
|
+
if (envWord(env[`OTEL_${signal.toUpperCase()}_EXPORTER`]) === 'none') return undefined;
|
|
32
|
+
return tryOtlpEndpoint(signal, env);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const envWord = (value: string | undefined): string => (value ?? '').trim().toLowerCase();
|
|
36
|
+
|
|
20
37
|
/** How often counters are pushed. Core's own default; named here because the boot chose it. */
|
|
21
38
|
export const METRIC_EXPORT_INTERVAL_MS = 60_000;
|
|
22
39
|
|
|
23
40
|
/**
|
|
24
|
-
* Install whichever exporters an endpoint was configured for,
|
|
41
|
+
* Install whichever exporters an endpoint was configured for — traces, metrics, logs — plus the
|
|
42
|
+
* semconv histograms every boot records, and return the release.
|
|
25
43
|
*
|
|
26
44
|
* `tryOtlpEndpoint` is asked FIRST, per signal, because both constructors throw
|
|
27
45
|
* `X_OTLP_ENDPOINT_INVALID` when nothing configured one — deliberately, so that a telemetry
|
|
28
46
|
* exporter can never silently send nowhere. Asking is what makes the exporter optional without
|
|
29
47
|
* making it silent.
|
|
30
48
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
49
|
+
* ONE drain hook flushes every signal, in PARALLEL and capped at what is left of the drain's
|
|
50
|
+
* deadline (`flushWithin`): three hooks in turn, each waiting out its own 10 s export budget against
|
|
51
|
+
* a black-holed collector, overran a 25 s drain and turned a clean exit into `X_SHUTDOWN_TIMEOUT`.
|
|
52
|
+
* `phase: 'close'`: the last spans of a drain are the ones that explain it. That phase runs
|
|
53
|
+
* last-registered first, so the boot calls this BEFORE anything whose teardown should be seen.
|
|
35
54
|
*
|
|
36
|
-
* The release UNINSTALLS what it installed, per signal. `
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* installed no exporter must not uninstall one it never owned.
|
|
55
|
+
* The release UNINSTALLS what it installed, per signal. Spans are a `span.end` SUBSCRIPTION on
|
|
56
|
+
* core's instrumentation bus and the release is its unsubscribe, so a second `serveApp` in the same
|
|
57
|
+
* process never exports into a released exporter, and `x dev`'s trace RECORDER — its own subscriber
|
|
58
|
+
* — is untouched. Each exporter is SHUT DOWN before it is unsubscribed — its queued batch goes out
|
|
59
|
+
* and its timer stops, rather than being dropped and leaked. Metrics are the same shape since
|
|
60
|
+
* 31.0.0: a `metric.export` subscription, released by its unsubscribe.
|
|
43
61
|
*/
|
|
44
62
|
export function startOtlpExport(env: Env = process.env): () => void {
|
|
45
63
|
const releases: (() => void)[] = [];
|
|
64
|
+
const flushes: (() => Promise<void>)[] = [];
|
|
65
|
+
|
|
66
|
+
// Every boot, collector or not: the semconv histograms (`db_client_operation_duration_seconds`,
|
|
67
|
+
// `job_duration_seconds`, `gen_ai_client_token_usage`) are bus subscribers, and `/metrics` serves
|
|
68
|
+
// them to a scrape-only deployment exactly as OTLP pushes them to a collector. Pushed first, so
|
|
69
|
+
// the reversed release below drops them last — the drain's own statements are still counted.
|
|
70
|
+
releases.push(subscribeSemconvMetrics());
|
|
46
71
|
|
|
47
72
|
// The boot's OWN env, not `process.env`, and the resolved endpoint is then passed to the
|
|
48
73
|
// exporter explicitly: `runRole({ env })` is a real seam — a test and an in-process host both
|
|
49
74
|
// pass an env that is not the process's — and an exporter that re-read `process.env` would
|
|
50
75
|
// answer a different question from the one this function just asked.
|
|
51
|
-
const traces =
|
|
76
|
+
const traces = signalEndpoint('traces', env);
|
|
52
77
|
if (traces !== undefined) {
|
|
53
78
|
const exporter = otlpSpanExporter({ endpoint: traces });
|
|
54
|
-
configureTelemetry({ exporter });
|
|
55
79
|
// Pushed first, so the reversed run below applies it LAST — after the drain hook is dropped,
|
|
56
80
|
// the same order `dev-boot.ts` releases the recorder in.
|
|
57
|
-
releases.push(() =>
|
|
58
|
-
releases.push(
|
|
59
|
-
|
|
81
|
+
releases.push(subscribe('span.end', (event) => exporter.export(event.payload)));
|
|
82
|
+
releases.push(() => void exporter.shutdown());
|
|
83
|
+
flushes.push(() => exporter.shutdown());
|
|
84
|
+
logger.info('ultimate otlp traces', { endpoint: otlpEndpointLabel(traces) });
|
|
60
85
|
}
|
|
61
86
|
|
|
62
|
-
const metrics =
|
|
87
|
+
const metrics = signalEndpoint('metrics', env);
|
|
63
88
|
if (metrics !== undefined) {
|
|
64
89
|
const exporter = otlpMetricExporter({ endpoint: metrics });
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
// the drain's — for the whole life of the process.
|
|
90
|
+
releases.push(subscribe('metric.export', (event) => exporter.export(event.payload)));
|
|
91
|
+
// The push loop, and not only the subscription: it names where a snapshot goes and nothing
|
|
92
|
+
// decides when one is taken, so without this the collector receives one export — the
|
|
93
|
+
// drain's — for the whole life of the process.
|
|
70
94
|
const stopTimer = startMetricExport(METRIC_EXPORT_INTERVAL_MS);
|
|
71
95
|
releases.push(stopTimer);
|
|
72
|
-
|
|
73
|
-
logger.info('ultimate otlp metrics', { endpoint: metrics });
|
|
96
|
+
flushes.push(() => exporter.flush());
|
|
97
|
+
logger.info('ultimate otlp metrics', { endpoint: otlpEndpointLabel(metrics) });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const logs = signalEndpoint('logs', env);
|
|
101
|
+
if (logs !== undefined) {
|
|
102
|
+
const exporter = otlpLogExporter({ endpoint: logs });
|
|
103
|
+
// Synchronously inside the handler: the exporter reads the ACTIVE span there, which is what
|
|
104
|
+
// joins a log line to its trace in the collector. Only the process logger's lines reach the
|
|
105
|
+
// bus, after redaction — never a logger given its own writer.
|
|
106
|
+
releases.push(subscribe('log.record', (event) => exporter.export(event.payload)));
|
|
107
|
+
releases.push(() => void exporter.shutdown());
|
|
108
|
+
flushes.push(() => exporter.shutdown());
|
|
109
|
+
logger.info('ultimate otlp logs', { endpoint: otlpEndpointLabel(logs) });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (flushes.length > 0) {
|
|
113
|
+
releases.push(onShutdown('otlp', (reason) => flushWithin(flushes, reason), { phase: 'close' }));
|
|
74
114
|
}
|
|
75
115
|
|
|
76
116
|
return () => {
|
|
77
117
|
for (const release of releases.reverse()) release();
|
|
78
118
|
};
|
|
79
119
|
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* What is left of the drain's budget a flush may spend: most of it, so the hooks behind this one
|
|
123
|
+
* and the exit still fit. Real monotonic time, as `ShutdownReason.deadlineAt` is.
|
|
124
|
+
*/
|
|
125
|
+
export const OTLP_FLUSH_SHARE = 0.8;
|
|
126
|
+
|
|
127
|
+
/** Every signal's flush at once, abandoned (not awaited further) when the share is spent. */
|
|
128
|
+
export async function flushWithin(
|
|
129
|
+
flushes: readonly (() => Promise<void>)[],
|
|
130
|
+
reason: Pick<ShutdownReason, 'deadlineAt'>,
|
|
131
|
+
): Promise<void> {
|
|
132
|
+
const budget = Math.max(0, (reason.deadlineAt - systemClock.monotonic()) * OTLP_FLUSH_SHARE);
|
|
133
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
134
|
+
const spent = new Promise<'spent'>((resolve) => {
|
|
135
|
+
timer = setTimeout(() => resolve('spent'), budget);
|
|
136
|
+
timer.unref();
|
|
137
|
+
});
|
|
138
|
+
const all = Promise.allSettled(flushes.map((flush) => flush())).then(() => 'flushed' as const);
|
|
139
|
+
const outcome = await Promise.race([all, spent]);
|
|
140
|
+
clearTimeout(timer);
|
|
141
|
+
if (outcome === 'spent') {
|
|
142
|
+
logger.warn('otlp flush abandoned at the drain deadline', { signals: flushes.length });
|
|
143
|
+
}
|
|
144
|
+
}
|
package/src/output.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// output (axiom 4). The human renderer owns the canonical 3-line error format.
|
|
4
4
|
|
|
5
5
|
import { ERROR_DOCS_URL, renderThrowable, singleLine, stringField } from '@ultimat3/core';
|
|
6
|
+
import type { JsonValue } from '@ultimat3/schema';
|
|
6
7
|
import { unresolvedImportFinding } from './app-load-unresolved';
|
|
7
8
|
import { msg } from './messages';
|
|
8
9
|
import { causeWithCount, findingsForReader, type ReaderOptions } from './output-findings';
|
|
@@ -32,8 +33,10 @@ export interface Finding {
|
|
|
32
33
|
readonly at?: string;
|
|
33
34
|
/**
|
|
34
35
|
* Where the finding's TEXT came from, when not from this process. `'ci-log'` is `x ci` reading
|
|
35
|
-
* a finding back out of a CI log that anyone who can push a branch writes: its `fix` is
|
|
36
|
-
*
|
|
36
|
+
* a finding back out of a CI log that anyone who can push a branch writes: its `fix` is the
|
|
37
|
+
* log's instruction, never this CLI's, and is never rewritten into a runnable one. The value
|
|
38
|
+
* stays the clean text — the provenance is this field, `meta.job`, and the `[from=ci-log …]`
|
|
39
|
+
* marker `renderFinding` prints on the head; never markup inside `fix`.
|
|
37
40
|
*/
|
|
38
41
|
readonly source?: 'ci-log';
|
|
39
42
|
/**
|
|
@@ -92,13 +95,8 @@ export interface StepResult {
|
|
|
92
95
|
readonly tests?: TestCounts;
|
|
93
96
|
}
|
|
94
97
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
| number
|
|
98
|
-
| boolean
|
|
99
|
-
| null
|
|
100
|
-
| readonly JsonValue[]
|
|
101
|
-
| { readonly [key: string]: JsonValue };
|
|
98
|
+
// `@ultimat3/schema`'s one declaration, re-exported for this package's callers — never restated.
|
|
99
|
+
export type { JsonValue };
|
|
102
100
|
|
|
103
101
|
export interface CommandResult {
|
|
104
102
|
readonly ok: boolean;
|
|
@@ -207,7 +205,7 @@ export function renderFinding(finding: Finding, indent = ''): string {
|
|
|
207
205
|
: undefined;
|
|
208
206
|
const stepLabel = typeof stepValue === 'string' ? ` [step=${singleLine(stepValue)}]` : '';
|
|
209
207
|
const pathLabel = finding.at === undefined ? '' : ` (${singleLine(finding.at)})`;
|
|
210
|
-
const head = `${code}${pathLabel}${stepLabel}`;
|
|
208
|
+
const head = `${code}${pathLabel}${stepLabel}${fromLabel(finding)}`;
|
|
211
209
|
const lines = [
|
|
212
210
|
`${indent}${head}`,
|
|
213
211
|
`${indent} cause: ${singleLine(finding.cause)}`,
|
|
@@ -217,6 +215,22 @@ export function renderFinding(finding: Finding, indent = ''): string {
|
|
|
217
215
|
return lines.join('\n');
|
|
218
216
|
}
|
|
219
217
|
|
|
218
|
+
/**
|
|
219
|
+
* The provenance marker for a finding read out of a CI log, printed LAST on the head so the
|
|
220
|
+
* human render still says which findings came from outside (`x ci`) while `fix` stays the clean
|
|
221
|
+
* command. Brackets in a job name become parentheses: the marker must stay one bracketed token,
|
|
222
|
+
* and `ci-log`'s `LOCATOR` stands aside for exactly that token.
|
|
223
|
+
*/
|
|
224
|
+
function fromLabel(finding: Finding): string {
|
|
225
|
+
if (finding.source !== 'ci-log') return '';
|
|
226
|
+
const job = finding.meta?.['job'];
|
|
227
|
+
const named =
|
|
228
|
+
typeof job === 'string' && job !== ''
|
|
229
|
+
? ` ${singleLine(job).replaceAll('[', '(').replaceAll(']', ')')}`
|
|
230
|
+
: '';
|
|
231
|
+
return ` [from=ci-log${named}]`;
|
|
232
|
+
}
|
|
233
|
+
|
|
220
234
|
/** Same format, but titled with the error's own summary line when it has one. */
|
|
221
235
|
export function renderUltimateError(error: UltimateErrorShape, indent = ''): string {
|
|
222
236
|
const summary = summaryOf(error);
|
package/src/page-sync.ts
CHANGED
|
@@ -41,7 +41,7 @@ export async function pageSync(
|
|
|
41
41
|
root: string,
|
|
42
42
|
env: Readonly<Record<string, string | undefined>>,
|
|
43
43
|
buildId: string,
|
|
44
|
-
realtime: Pick<RealtimeConfig, 'enabled'>,
|
|
44
|
+
realtime: Pick<RealtimeConfig, 'enabled' | 'maxQueued'>,
|
|
45
45
|
): Promise<PageSync> {
|
|
46
46
|
// Off: no `ultimate-sync`, no worker, no boot script — the boot is the outbox and the disk
|
|
47
47
|
// restore, which exist to feed the socket. Checked before either build, which would be wasted.
|
|
@@ -59,6 +59,8 @@ export async function pageSync(
|
|
|
59
59
|
buildId,
|
|
60
60
|
...(worker === undefined ? {} : { workerUrl: worker.url }),
|
|
61
61
|
...(boot === undefined ? {} : { bootUrl: boot.url }),
|
|
62
|
+
// The page outbox's ceiling: the boot builds the outbox, and reads it off the document.
|
|
63
|
+
...(realtime.maxQueued === undefined ? {} : { outboxMaxQueued: realtime.maxQueued }),
|
|
62
64
|
},
|
|
63
65
|
persisted: persistedRecordTypes,
|
|
64
66
|
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// The rest of a pull request's conversation, beside its inline threads: every review with its
|
|
2
|
+
// verdict and body, and every ISSUE comment. A bot that said "I did not review this" says it in one
|
|
3
|
+
// of these two places and never in a thread, so `x pr review` asks for both in the same round trip.
|
|
4
|
+
|
|
5
|
+
import { t } from '@ultimat3/schema';
|
|
6
|
+
|
|
7
|
+
/** The newest reviews, and the newest issue comments, one page each. */
|
|
8
|
+
export const ACTIVITY_PAGE = 50;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The fragment `REVIEW_QUERY` (`pr-threads.ts`) splices into its `pullRequest` selection. `last`,
|
|
12
|
+
* not `first`: a long pull request's oldest conversation is the least likely to still matter, and
|
|
13
|
+
* a bot's "review limit" notice is by construction among the newest.
|
|
14
|
+
*/
|
|
15
|
+
export const ACTIVITY_FIELDS =
|
|
16
|
+
`reviews(last:${ACTIVITY_PAGE}){totalCount nodes{id state body submittedAt url ` +
|
|
17
|
+
'author{login __typename} commit{oid}}} ' +
|
|
18
|
+
`comments(last:${ACTIVITY_PAGE}){totalCount nodes{id body createdAt updatedAt url ` +
|
|
19
|
+
'author{login __typename}}}';
|
|
20
|
+
|
|
21
|
+
const ACTOR = t.nullable(t.object({ login: t.string, __typename: t.string }));
|
|
22
|
+
|
|
23
|
+
/** The two connections, as `REVIEW_RESPONSE` declares them inside `pullRequest`. */
|
|
24
|
+
export const ACTIVITY_SCHEMA = {
|
|
25
|
+
reviews: t.object({
|
|
26
|
+
totalCount: t.number,
|
|
27
|
+
nodes: t.array(
|
|
28
|
+
t.object({
|
|
29
|
+
id: t.string,
|
|
30
|
+
state: t.string,
|
|
31
|
+
body: t.string,
|
|
32
|
+
submittedAt: t.nullable(t.string),
|
|
33
|
+
url: t.string,
|
|
34
|
+
author: ACTOR,
|
|
35
|
+
commit: t.nullable(t.object({ oid: t.string })),
|
|
36
|
+
}),
|
|
37
|
+
),
|
|
38
|
+
}),
|
|
39
|
+
comments: t.object({
|
|
40
|
+
totalCount: t.number,
|
|
41
|
+
nodes: t.array(
|
|
42
|
+
t.object({
|
|
43
|
+
id: t.string,
|
|
44
|
+
body: t.string,
|
|
45
|
+
createdAt: t.string,
|
|
46
|
+
updatedAt: t.string,
|
|
47
|
+
url: t.string,
|
|
48
|
+
author: ACTOR,
|
|
49
|
+
}),
|
|
50
|
+
),
|
|
51
|
+
}),
|
|
52
|
+
} as const;
|
|
53
|
+
|
|
54
|
+
/** One submitted review: a verdict (`APPROVED`, `CHANGES_REQUESTED`, `COMMENTED`, …) and its body. */
|
|
55
|
+
export interface PrReviewEntry {
|
|
56
|
+
readonly id: string;
|
|
57
|
+
readonly state: string;
|
|
58
|
+
readonly author: string;
|
|
59
|
+
readonly isBot: boolean;
|
|
60
|
+
readonly submittedAt: string | null;
|
|
61
|
+
readonly commit: string | null;
|
|
62
|
+
/** Submitted against a commit that is no longer the head — the same rule as `PrReview.stale`. */
|
|
63
|
+
readonly stale: boolean;
|
|
64
|
+
readonly url: string;
|
|
65
|
+
readonly body: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** One comment on the pull request itself, not anchored to a line. */
|
|
69
|
+
export interface PrIssueComment {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
readonly author: string;
|
|
72
|
+
readonly isBot: boolean;
|
|
73
|
+
readonly createdAt: string;
|
|
74
|
+
/** A bot edits its summary comment in place, so this — not `createdAt` — dates what it says. */
|
|
75
|
+
readonly updatedAt: string;
|
|
76
|
+
readonly url: string;
|
|
77
|
+
readonly body: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface PrActivity {
|
|
81
|
+
readonly reviews: readonly PrReviewEntry[];
|
|
82
|
+
readonly comments: readonly PrIssueComment[];
|
|
83
|
+
/** More reviews exist than one page holds. */
|
|
84
|
+
readonly reviewsTruncated: boolean;
|
|
85
|
+
/** More issue comments exist than one page holds. */
|
|
86
|
+
readonly commentsTruncated: boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type Actor = { readonly login: string; readonly __typename: string } | null;
|
|
90
|
+
|
|
91
|
+
/** GitHub answers `null` for a deleted account; the row is kept under the name GitHub shows. */
|
|
92
|
+
const loginOf = (author: Actor): string => author?.login ?? 'ghost';
|
|
93
|
+
|
|
94
|
+
/** GraphQL types an app account `Bot`; a REST-shaped login ends in `[bot]`. Either is a bot. */
|
|
95
|
+
const isBot = (author: Actor): boolean =>
|
|
96
|
+
author !== null && (author.__typename === 'Bot' || author.login.endsWith('[bot]'));
|
|
97
|
+
|
|
98
|
+
interface ActivityInput {
|
|
99
|
+
readonly reviews: {
|
|
100
|
+
readonly totalCount: number;
|
|
101
|
+
readonly nodes: readonly {
|
|
102
|
+
readonly id: string;
|
|
103
|
+
readonly state: string;
|
|
104
|
+
readonly body: string;
|
|
105
|
+
readonly submittedAt: string | null;
|
|
106
|
+
readonly url: string;
|
|
107
|
+
readonly author: Actor;
|
|
108
|
+
readonly commit: { readonly oid: string } | null;
|
|
109
|
+
}[];
|
|
110
|
+
};
|
|
111
|
+
readonly comments: {
|
|
112
|
+
readonly totalCount: number;
|
|
113
|
+
readonly nodes: readonly {
|
|
114
|
+
readonly id: string;
|
|
115
|
+
readonly body: string;
|
|
116
|
+
readonly createdAt: string;
|
|
117
|
+
readonly updatedAt: string;
|
|
118
|
+
readonly url: string;
|
|
119
|
+
readonly author: Actor;
|
|
120
|
+
}[];
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** The parsed connections as rows, oldest first — the order the conversation happened in. */
|
|
125
|
+
export function activityOf(pull: ActivityInput, headSha: string): PrActivity {
|
|
126
|
+
return {
|
|
127
|
+
reviews: pull.reviews.nodes.map((review) => ({
|
|
128
|
+
id: review.id,
|
|
129
|
+
state: review.state,
|
|
130
|
+
author: loginOf(review.author),
|
|
131
|
+
isBot: isBot(review.author),
|
|
132
|
+
submittedAt: review.submittedAt,
|
|
133
|
+
commit: review.commit?.oid ?? null,
|
|
134
|
+
stale: review.commit?.oid !== headSha,
|
|
135
|
+
url: review.url,
|
|
136
|
+
body: review.body,
|
|
137
|
+
})),
|
|
138
|
+
comments: pull.comments.nodes.map((comment) => ({
|
|
139
|
+
id: comment.id,
|
|
140
|
+
author: loginOf(comment.author),
|
|
141
|
+
isBot: isBot(comment.author),
|
|
142
|
+
createdAt: comment.createdAt,
|
|
143
|
+
updatedAt: comment.updatedAt,
|
|
144
|
+
url: comment.url,
|
|
145
|
+
body: comment.body,
|
|
146
|
+
})),
|
|
147
|
+
reviewsTruncated: pull.reviews.totalCount > pull.reviews.nodes.length,
|
|
148
|
+
commentsTruncated: pull.comments.totalCount > pull.comments.nodes.length,
|
|
149
|
+
};
|
|
150
|
+
}
|
package/src/pr-bots.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// Which review bots spoke on a pull request, and whether one of them said it did NOT review it. A
|
|
2
|
+
// rate-limited or skipped bot leaves no thread and no verdict, so its silence reads exactly like a
|
|
3
|
+
// clean review unless something reads the notice it posted instead.
|
|
4
|
+
|
|
5
|
+
import type { PrIssueComment, PrReviewEntry } from './pr-activity';
|
|
6
|
+
|
|
7
|
+
export type BotNoticeKind = 'rate-limited' | 'skipped';
|
|
8
|
+
|
|
9
|
+
export interface BotNotice {
|
|
10
|
+
readonly kind: BotNoticeKind;
|
|
11
|
+
/** The notice's own heading or first line, so a reader sees which notice without the body. */
|
|
12
|
+
readonly excerpt: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface BotSummary {
|
|
16
|
+
readonly login: string;
|
|
17
|
+
readonly reviews: number;
|
|
18
|
+
readonly comments: number;
|
|
19
|
+
/** The bot's newest review that is not itself a notice; `null` when it never reviewed. */
|
|
20
|
+
readonly lastReviewAt: string | null;
|
|
21
|
+
/** The newest "did not review" notice it posted, wherever it posted it. */
|
|
22
|
+
readonly notice: (BotNotice & { readonly at: string; readonly url: string }) | null;
|
|
23
|
+
/** A notice exists and no review of the bot's came after it: its review is missing, not clean. */
|
|
24
|
+
readonly blocked: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The notices, known by their MARKERS and never by a phrase in prose: a review that discusses
|
|
29
|
+
* "rate limit exceeded" in an upstream API is a review, not a bot refusing to give one.
|
|
30
|
+
* CodeRabbit's own HTML comment tags come first; otherwise the notice is a markdown heading
|
|
31
|
+
* (quoted or not) that BEGINS with the notice's title.
|
|
32
|
+
*/
|
|
33
|
+
const MARKERS: readonly { readonly kind: BotNoticeKind; readonly pattern: RegExp }[] = [
|
|
34
|
+
{ kind: 'rate-limited', pattern: /<!--[^>]*rate limited by coderabbit\.ai[^>]*-->/i },
|
|
35
|
+
{ kind: 'skipped', pattern: /<!--[^>]*skip review by coderabbit\.ai[^>]*-->/i },
|
|
36
|
+
];
|
|
37
|
+
const HEADINGS: readonly { readonly kind: BotNoticeKind; readonly pattern: RegExp }[] = [
|
|
38
|
+
{ kind: 'rate-limited', pattern: /^(?:rate limit exceeded|review limit reached)\b/i },
|
|
39
|
+
{ kind: 'skipped', pattern: /^review skipped\b/i },
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
/** A markdown heading line, quoted or not, as its title text; `undefined` for any other line. */
|
|
43
|
+
const headingOf = (line: string): string | undefined => {
|
|
44
|
+
const match = /^[>\s]*#{1,6}\s+(.+)$/.exec(line);
|
|
45
|
+
return match?.[1]?.replaceAll('*', '').trim();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The notice an ISSUE COMMENT states, or `null` for every ordinary body. A formal review is never
|
|
50
|
+
* passed here: whatever its body says, a submitted review is the bot having reviewed.
|
|
51
|
+
*/
|
|
52
|
+
export function botNotice(body: string): BotNotice | null {
|
|
53
|
+
const headings = body
|
|
54
|
+
.replaceAll('\r\n', '\n')
|
|
55
|
+
.split('\n')
|
|
56
|
+
.flatMap((line) => {
|
|
57
|
+
const title = headingOf(line);
|
|
58
|
+
return title === undefined ? [] : [title];
|
|
59
|
+
});
|
|
60
|
+
for (const title of headings) {
|
|
61
|
+
const rule = HEADINGS.find((candidate) => candidate.pattern.test(title));
|
|
62
|
+
if (rule !== undefined) return { kind: rule.kind, excerpt: title.slice(0, 200) };
|
|
63
|
+
}
|
|
64
|
+
const marker = MARKERS.find((candidate) => candidate.pattern.test(body));
|
|
65
|
+
if (marker === undefined) return null;
|
|
66
|
+
return { kind: marker.kind, excerpt: (headings[0] ?? '').slice(0, 200) };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface Spoken {
|
|
70
|
+
readonly at: string;
|
|
71
|
+
readonly url: string;
|
|
72
|
+
readonly notice: BotNotice | null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const newest = <T extends { readonly at: string }>(rows: readonly T[]): T | null =>
|
|
76
|
+
rows.reduce<T | null>((best, row) => (best === null || row.at > best.at ? row : best), null);
|
|
77
|
+
|
|
78
|
+
/** One row per bot that reviewed or commented, in the order each first appears. */
|
|
79
|
+
export function botsSummary(
|
|
80
|
+
reviews: readonly PrReviewEntry[],
|
|
81
|
+
comments: readonly PrIssueComment[],
|
|
82
|
+
): readonly BotSummary[] {
|
|
83
|
+
const logins: string[] = [];
|
|
84
|
+
for (const row of [...reviews, ...comments]) {
|
|
85
|
+
if (row.isBot && !logins.includes(row.author)) logins.push(row.author);
|
|
86
|
+
}
|
|
87
|
+
return logins.map((login) => {
|
|
88
|
+
const own = reviews.filter((review) => review.isBot && review.author === login);
|
|
89
|
+
const said = comments.filter((comment) => comment.isBot && comment.author === login);
|
|
90
|
+
// Issue comments only: a submitted review is the bot having reviewed, whatever it says.
|
|
91
|
+
const spoken: readonly Spoken[] = said.map((comment) => ({
|
|
92
|
+
at: comment.updatedAt,
|
|
93
|
+
url: comment.url,
|
|
94
|
+
notice: botNotice(comment.body),
|
|
95
|
+
}));
|
|
96
|
+
const lastReview = newest(own.map((review) => ({ at: review.submittedAt ?? '' })));
|
|
97
|
+
const latest = newest(spoken.filter((entry) => entry.notice !== null));
|
|
98
|
+
const notice =
|
|
99
|
+
latest?.notice == null ? null : { ...latest.notice, at: latest.at, url: latest.url };
|
|
100
|
+
return {
|
|
101
|
+
login,
|
|
102
|
+
reviews: own.length,
|
|
103
|
+
comments: said.length,
|
|
104
|
+
lastReviewAt: lastReview?.at ?? null,
|
|
105
|
+
notice,
|
|
106
|
+
blocked: notice !== null && (lastReview === null || lastReview.at <= notice.at),
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
}
|
package/src/pr-threads.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
// The GraphQL a review lives behind, and the rows it becomes. `gh pr view --comments` shows ISSUE
|
|
2
2
|
// comments; the findings a reviewer anchored to a line are `reviewThreads`, and the thread id that
|
|
3
3
|
// resolves one exists in no REST response and in no web URL — this file is where that query stops
|
|
4
|
-
// being folklore.
|
|
4
|
+
// being folklore. Reviews and issue comments ride the same document (`pr-activity.ts`).
|
|
5
5
|
|
|
6
6
|
import { t } from '@ultimat3/schema';
|
|
7
7
|
import type { GhHost } from './gh';
|
|
8
8
|
import { GhResponseInvalidError, ghGraphql } from './gh';
|
|
9
9
|
import type { GhRepo } from './gh-target';
|
|
10
|
+
import type { PrActivity } from './pr-activity';
|
|
11
|
+
import { ACTIVITY_FIELDS, ACTIVITY_SCHEMA, activityOf } from './pr-activity';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* How many threads one page holds. The query is built from it, so the report and the request can
|
|
@@ -28,6 +30,7 @@ export const REVIEW_QUERY =
|
|
|
28
30
|
'pullRequest(number:$n){number url headRefOid reviewDecision ' +
|
|
29
31
|
'commits(last:1){nodes{commit{oid committedDate}}} ' +
|
|
30
32
|
'latestOpinionatedReviews(first:20){nodes{state submittedAt author{login} commit{oid}}} ' +
|
|
33
|
+
`${ACTIVITY_FIELDS} ` +
|
|
31
34
|
`reviewThreads(first:${THREAD_PAGE}){pageInfo{hasNextPage} nodes{id isResolved isOutdated ` +
|
|
32
35
|
`path line originalLine comments(first:${COMMENT_PAGE}){totalCount ` +
|
|
33
36
|
'nodes{author{login} createdAt body}}}}}}}';
|
|
@@ -59,6 +62,7 @@ const REVIEW_RESPONSE = t.object({
|
|
|
59
62
|
}),
|
|
60
63
|
),
|
|
61
64
|
}),
|
|
65
|
+
...ACTIVITY_SCHEMA,
|
|
62
66
|
reviewThreads: t.object({
|
|
63
67
|
pageInfo: t.object({ hasNextPage: t.boolean }),
|
|
64
68
|
nodes: t.array(
|
|
@@ -118,7 +122,7 @@ export interface PrReview {
|
|
|
118
122
|
readonly stale: boolean;
|
|
119
123
|
}
|
|
120
124
|
|
|
121
|
-
export interface PrReviewReport {
|
|
125
|
+
export interface PrReviewReport extends PrActivity {
|
|
122
126
|
readonly repo: string;
|
|
123
127
|
readonly number: number;
|
|
124
128
|
readonly url: string;
|
|
@@ -201,6 +205,7 @@ export async function fetchReviewReport(
|
|
|
201
205
|
headCommittedAt: head?.committedDate ?? null,
|
|
202
206
|
reviewDecision: pull.reviewDecision,
|
|
203
207
|
decidingReview: decidingReview(reviews, pull.reviewDecision),
|
|
208
|
+
...activityOf(pull, pull.headRefOid),
|
|
204
209
|
truncated: pull.reviewThreads.pageInfo.hasNextPage,
|
|
205
210
|
threads: orderThreads(
|
|
206
211
|
pull.reviewThreads.nodes.map((thread) => ({
|