Skip to content

Commit 98b7f2d

Browse files
committed
chore(supervisor): cut comments back to contracts
1 parent d123940 commit 98b7f2d

1 file changed

Lines changed: 3 additions & 22 deletions

File tree

  • apps/supervisor/src/workloadServer

apps/supervisor/src/workloadServer/index.ts

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,6 @@ interface DefaultEventsMap {
5353
[event: string]: (...args: any[]) => void;
5454
}
5555

56-
/**
57-
* checkpointDeleteRequests counts the delete requests this supervisor makes, and every reason it
58-
* decides not to: `sent`, `disabled`, `no_client`, `not_applicable`, `not_terminal`, `no_claims`,
59-
* `no_project_ref`, `http_error`.
60-
* Without the negative outcomes, "no deletes are happening" is indistinguishable from the feature
61-
* being switched off - and with no lifecycle expiry, that difference is leaked storage.
62-
*/
6356
const checkpointDeleteRequests = new Counter({
6457
name: "checkpoint_delete_requests_total",
6558
help: "Checkpoint delete requests attempted at run completion, by outcome",
@@ -199,9 +192,8 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
199192
* we still verify + record metrics but attach no header (so the platform never scopes). Only
200193
* enforce fails a request, and only for a present-but-invalid token; absent and legacy ids pass.
201194
*
202-
* `claims` are returned whenever the token verifies, in either mode. They are for addressing a
203-
* run's own resources locally (e.g. its checkpoint storage) - never for scoping the platform,
204-
* which is why environmentId above stays gated on enforce.
195+
* `claims` are returned on any valid token, for local use only - never to scope the platform,
196+
* which is why environmentId stays gated on enforce.
205197
*/
206198
private async authorizeWorkloadRequest(
207199
req: IncomingMessage
@@ -230,18 +222,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
230222

231223
/**
232224
* reclaimCheckpoints asks the checkpoint service to delete a finished run's checkpoint storage.
233-
*
234-
* Called only after the reply has been sent, so it never delays the runner - the same shape the
235-
* suspend route uses. Every early return is counted: nothing reclaims storage behind this, so a
236-
* silently skipped request leaks it, and silence must not look like success.
237-
*
238-
* This covers runner-driven completion only. A run that dies without posting one - killed pod,
239-
* OOM, node loss, platform-side expiry - is finalised on the platform, which the worker never
240-
* hears about, so those are not reclaimed here and are not reclaimable from this side.
241-
*
242-
* `RUN_PENDING_CANCEL` is terminal too - a run cancelled mid-execution never restores - so it is
243-
* reclaimed alongside `RUN_FINISHED`. Retries are deliberately excluded: the prefix is run-level,
244-
* so a retry's checkpoints are cleaned by the final completion.
225+
* Must be called after the reply is sent: it never delays the runner.
245226
*/
246227
private async reclaimCheckpoints(
247228
req: IncomingMessage,

0 commit comments

Comments
 (0)