carrick 0.3.127 → 0.3.129

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.
@@ -256,6 +256,8 @@ export const InferRequestSchema = BaseRequestSchema.extend({
256
256
  source_file: z.string().min(1),
257
257
  }))
258
258
  .optional(),
259
+ // Declared below with the library claims; read lazily (carrick#2674).
260
+ server_claims: z.lazy(() => ServerClaimsSchema).optional(),
259
261
  });
260
262
  export const HealthRequestSchema = BaseRequestSchema.extend({
261
263
  action: z.literal('health'),
@@ -364,7 +366,15 @@ const ClaimSlotSchema = z
364
366
  key: z.string().min(1).optional(),
365
367
  })
366
368
  .strict();
367
- const BoundNameSchema = z.object({ bound: z.enum(['maker', 'scope']) }).strict();
369
+ const BoundNameSchema = z.object({ bound: z.enum(['maker', 'scope', 'key']) }).strict();
370
+ /** Procedure routers (#2474 R6a): where a router member takes its procedures, and how nested keys join. */
371
+ const CollectsSchema = z
372
+ .object({
373
+ arg: z.number().int().nonnegative(),
374
+ key: z.string().min(1).optional(),
375
+ join: z.string().min(1),
376
+ })
377
+ .strict();
368
378
  /**
369
379
  * Label structure v2 (carrick#2434). The schema takes the shape only: which
370
380
  * method word, side or export a field names is the verifier's per-check
@@ -391,6 +401,7 @@ const RequestAtSchema = z
391
401
  path: z.array(z.string().min(1)).optional(),
392
402
  url: z.array(z.string().min(1)).optional(),
393
403
  method: z.array(z.string().min(1)).optional(),
404
+ body: z.array(z.string().min(1)).optional(),
394
405
  })
395
406
  .strict();
396
407
  const ClaimOnSchema = z.enum(['export', 'instance', 'both']);
@@ -426,7 +437,8 @@ const LibraryClaimSchema = z.discriminatedUnion('kind', [
426
437
  .object({
427
438
  kind: z.literal('scope'),
428
439
  member: z.string().min(1),
429
- name: ClaimSlotSchema,
440
+ // Exactly one of `name` and `collects`: the verifier's verdict (#2474 R6a).
441
+ name: ClaimSlotSchema.optional(),
430
442
  path: MemberPathSchema.optional(),
431
443
  on: ClaimOnSchema.optional(),
432
444
  of: z.string().min(1).optional(),
@@ -436,6 +448,7 @@ const LibraryClaimSchema = z.discriminatedUnion('kind', [
436
448
  runs: ClaimSlotSchema.optional(),
437
449
  yields: YieldsSchema.optional(),
438
450
  mounts: ClaimSlotSchema.optional(),
451
+ collects: CollectsSchema.optional(),
439
452
  })
440
453
  .strict(),
441
454
  z
@@ -494,6 +507,36 @@ const LibraryCheckSchema = z
494
507
  claim: LibraryClaimSchema,
495
508
  })
496
509
  .strict();
510
+ /**
511
+ * The server-framework claims an `infer` request reads handler parameters
512
+ * through (carrick#2674). Each check is read on its own by
513
+ * `settledServerChecks`: a refused one is dropped, never the request.
514
+ */
515
+ const ServerClaimsSchema = z
516
+ .object({
517
+ from_dir: z.string().min(1),
518
+ scan_root: z.string().min(1).optional(),
519
+ checks: z.array(z.unknown()),
520
+ type_packages: z.record(z.string().min(1), z.array(z.string().min(1))).optional(),
521
+ })
522
+ .strict();
523
+ /**
524
+ * The checks of an `infer` request's server claims the library-check schema
525
+ * takes, and how many it refused (carrick#2674). A refused claim reads
526
+ * nothing; the others still do.
527
+ */
528
+ export function settledServerChecks(checks) {
529
+ const settled = [];
530
+ let refused = 0;
531
+ for (const check of checks) {
532
+ const parsed = LibraryCheckSchema.safeParse(check);
533
+ if (parsed.success)
534
+ settled.push(parsed.data);
535
+ else
536
+ refused += 1;
537
+ }
538
+ return { checks: settled, refused };
539
+ }
497
540
  export const VerifyLibraryClaimsRequestSchema = BaseRequestSchema.extend({
498
541
  action: z.literal('verify_library_claims'),
499
542
  from_dir: z.string().min(1),