Skip to content

Commit 9cd1c6c

Browse files
committed
chore: trim inline comments to one-liners
1 parent 4038e6f commit 9cd1c6c

10 files changed

Lines changed: 24 additions & 51 deletions

File tree

apps/webapp/app/env.server.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -936,9 +936,7 @@ const EnvironmentSchema = z
936936

937937
INTERNAL_OTEL_LOG_EXPORTER_URL: z.string().optional(),
938938

939-
// Optional second OTLP trace exporter that receives only `deployment.*`
940-
// spans (deployment lifecycle analytics), e.g. a dedicated long-retention
941-
// Axiom dataset. The spans also still flow to the main trace exporter.
939+
// Second trace exporter receiving only `deployment.*` spans; they still flow to the main one
942940
INTERNAL_OTEL_DEPLOYMENT_EVENT_EXPORTER_URL: z.string().optional(),
943941
INTERNAL_OTEL_DEPLOYMENT_EVENT_EXPORTER_AUTH_HEADERS: z.string().optional(),
944942
INTERNAL_OTEL_METRIC_EXPORTER_URL: z.string().optional(),

apps/webapp/app/v3/deploymentTelemetry.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ export const DeploymentTelemetryAttributes = {
5858
export type DeploymentBuildPath = "local_bundle" | "native" | "depot";
5959

6060
/**
61-
* Classifies which build path produced a deployment, from its persisted
62-
* metadata. Everything that is not a native-build-server deployment falls into
63-
* the depot bucket — including rare `--local-build` deploys, whose flag is not
64-
* persisted. `externalBuildData` is NOT usable as a depot signal: init writes a
65-
* placeholder (`"-"` fields) for every path.
61+
* Everything that is not a native-build-server deployment falls into the depot
62+
* bucket, including rare `--local-build` deploys (their flag is not persisted).
63+
* `externalBuildData` is NOT a usable depot signal: init writes a placeholder
64+
* for every path.
6665
*/
6766
export function deriveBuildPath(buildServerMetadata: unknown): DeploymentBuildPath {
6867
const metadata = BuildServerMetadata.safeParse(buildServerMetadata);
@@ -90,11 +89,9 @@ export type DeploymentDurations = {
9089
};
9190

9291
/**
93-
* Derives per-phase durations from the persisted timestamp chain
94-
* (createdAt → startedAt → installedAt → builtAt → terminal). Chains are
95-
* path-shaped: depot never sets installedAt (the /progress route is
96-
* build-server-only) and PENDING-skipping deploys have queue ≈ 0 — each phase
97-
* is emitted only when both of its boundary timestamps exist and are ordered.
92+
* Timestamp chains are path-shaped (e.g. depot never sets installedAt), so
93+
* each phase is derived only when both of its boundary timestamps exist and
94+
* are ordered.
9895
*/
9996
export function deriveDeploymentDurations(
10097
timestamps: DeploymentTimestamps,

apps/webapp/app/v3/services/deployment.server.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,7 @@ export class DeploymentService extends BaseService {
483483
);
484484
}
485485

486-
// The cancel path only carries a narrow row selection, so re-fetch the full
487-
// row (post-update, status already CANCELED) for the lifecycle event.
486+
// The cancel chain only carries a narrow row selection, so re-fetch the full row
488487
#recordCanceledLifecycle(deploymentId: string) {
489488
return fromPromise(
490489
this._prisma.workerDeployment.findFirst({

apps/webapp/app/v3/services/failDeployment.server.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ export class FailDeploymentService extends BaseService {
4343

4444
const failedAt = new Date();
4545

46-
// Guarded transition: a concurrent finalize/timeout/cancel can win between
47-
// the check above and this write; the predicate makes exactly one caller
48-
// commit the terminal status (and emit the lifecycle event).
46+
// Guarded: a concurrent terminal transition can win after the check above
4947
const { count: updatedCount } = await this._prisma.workerDeployment.updateMany({
5048
where: {
5149
id: deployment.id,
@@ -67,9 +65,7 @@ export class FailDeploymentService extends BaseService {
6765
return;
6866
}
6967

70-
// Re-read after the guarded write: the row can gain phase timestamps
71-
// between the initial read and the update, and callers expect the
72-
// post-update row.
68+
// Re-read: the row can gain phase timestamps between the read and the guarded write
7369
const failedDeployment = await this._prisma.workerDeployment.findFirst({
7470
where: { id: deployment.id },
7571
});

apps/webapp/app/v3/services/finalizeDeployment.server.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,7 @@ export class FinalizeDeploymentService extends BaseService {
7171
? `${deployment.imageReference}@${imageDigest}`
7272
: deployment.imageReference;
7373

74-
// Guarded transition: a concurrent timeout/fail/cancel can win between the
75-
// status check above and this write; the predicate makes exactly one caller
76-
// commit the terminal status (and emit the lifecycle event). It also stops
77-
// a late timeout from overwriting DEPLOYED.
74+
// Guarded: stops a concurrent transition (e.g. a late timeout) from double-committing
7875
const { count: updatedCount } = await this._prisma.workerDeployment.updateMany({
7976
where: {
8077
id: deployment.id,

apps/webapp/app/v3/services/recordDeploymentLifecycle.server.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,11 @@ type EnvironmentInfo = {
4646

4747
/**
4848
* Records a deployment's terminal transition as a single wide
49-
* `deployment.lifecycle` span, backdated to span the deployment's real
50-
* lifetime (createdAt → terminal) and carrying per-phase durations as
51-
* attributes. This is THE per-deployment analytics event: build-path
52-
* comparison dashboards and monitors are built on it (the attribute contract
53-
* lives in ../deploymentTelemetry.ts).
54-
*
55-
* Call exactly once per terminal transition, only after a guarded status
56-
* write confirmed this caller won the transition. Emitted on ROOT_CONTEXT
57-
* with forceRecording so the trace sampler can never drop it. Never throws.
49+
* `deployment.lifecycle` span, backdated createdAt → terminal (attribute
50+
* contract in ../deploymentTelemetry.ts). Call exactly once, only after a
51+
* guarded status write confirmed this caller won the transition. Emitted on
52+
* ROOT_CONTEXT with forceRecording so the sampler can never drop it; never
53+
* throws.
5854
*/
5955
export function recordDeploymentLifecycle(params: {
6056
status: TerminalDeploymentStatus;
@@ -106,8 +102,7 @@ export function recordDeploymentLifecycle(params: {
106102
ROOT_CONTEXT
107103
);
108104

109-
// CANCELED is deliberately not an error: it is excluded from failure
110-
// rates and tracked as its own volume.
105+
// CANCELED is deliberately not an error: it stays out of failure rates
111106
if (isFailure) {
112107
span.setStatus({
113108
code: SpanStatusCode.ERROR,
@@ -126,9 +121,8 @@ export function recordDeploymentLifecycle(params: {
126121

127122
/**
128123
* Records a deployment's creation as a zero-duration `deployment.initialized`
129-
* event, the funnel counterpart to `deployment.lifecycle`: an initialized
130-
* deployment with no lifecycle event after a few hours is either stuck
131-
* non-terminal or hit an emission bug. Never throws.
124+
* event — the funnel counterpart to `deployment.lifecycle` for detecting
125+
* stuck deployments. Never throws.
132126
*/
133127
export function recordDeploymentInitialized(params: {
134128
deployment: Pick<

apps/webapp/app/v3/services/timeoutDeployment.server.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ export class TimeoutDeploymentService extends BaseService {
4141
const failedAt = new Date();
4242
const errorData = { message: errorMessage, name: "TimeoutError" };
4343

44-
// Guarded transition: keeps the fromStatus check atomic with the write, so
45-
// a concurrent finalize/fail/cancel can't be overwritten by a late timeout
46-
// (and exactly one caller emits the lifecycle event).
44+
// Guarded: keeps the fromStatus check atomic with the write
4745
const { count: updatedCount } = await this._prisma.workerDeployment.updateMany({
4846
where: {
4947
id: deployment.id,

apps/webapp/app/v3/tracer.server.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ class DatasourceAttributeSpanProcessor implements SpanProcessor {
9191
}
9292
}
9393

94-
// Mirrors spans whose name matches a prefix into a second exporter (e.g. the
95-
// dedicated deployment-events dataset) without removing them from the main
96-
// exporter's stream.
94+
// Mirrors name-prefixed spans into a second exporter; they still flow to the main one
9795
class SpanNamePrefixMirrorProcessor implements SpanProcessor {
9896
constructor(
9997
private readonly _inner: SpanProcessor,
@@ -392,9 +390,7 @@ function setupTelemetry() {
392390
instrumentations,
393391
});
394392

395-
// closeServer only closes express and lets the process drain, so a flush
396-
// here has time to run — without it every webapp shutdown drops the last
397-
// batch of spans (up to 1s of scheduledDelayMillis backlog).
393+
// Without this flush every shutdown drops the last batch of spans
398394
const flushOnShutdown = () => {
399395
provider.forceFlush().catch(() => {});
400396
};
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
-- Stamp the initiating CLI version on deployments at initialization
21
ALTER TABLE "public"."WorkerDeployment" ADD COLUMN IF NOT EXISTS "cliVersion" TEXT;

internal-packages/database/prisma/schema.prisma

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,8 +2265,7 @@ model WorkerDeployment {
22652265
22662266
runtime String?
22672267
runtimeVersion String?
2268-
/// CLI version that initiated the deploy (x-trigger-cli-version), stamped at
2269-
/// initialization so pre-index failures are attributable to a CLI version.
2268+
/// CLI version that initiated the deploy, stamped at initialization
22702269
cliVersion String?
22712270
22722271
imageReference String?

0 commit comments

Comments
 (0)