Repository navigation
Expand file tree
/
Copy pathvalidate.ts
More file actions
1253 lines (1206 loc) · 67.8 KB
/
Copy pathvalidate.ts
File metadata and controls
1253 lines (1206 loc) · 67.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
import { Args, Command, Flags } from '@oclif/core';
import { dirname } from 'node:path';
import chalk from 'chalk';
import { ZodError } from 'zod';
import {
ObjectStackDefinitionSchema,
normalizeStackInput,
lintUnknownAuthoringKeys,
lintUnknownStackKeys,
formatUnknownAuthoringKey,
stackConversionsOf,
type ConversionNotice,
} from '@objectstack/spec';
import { loadConfig, namedExportRejectionHints } from '../utils/config.js';
import { refuseUnbuiltStack } from '../utils/stack-provenance-refusal.js';
import { lowerCallables } from '../utils/lower-callables.js';
import { authoringRuleUnionStack } from '../utils/stack-collections.js';
// [#18677] The per-package half of the author-time rule run, shared with
// `os compile` — ⛔ the loop is not re-written here; see that module's header.
import { artifactPackages, runPerPackageAuthoringRules } from '../utils/artifact-packages.js';
import { stackFilterJudge } from '../utils/authoring-filter-judge.js';
import { runAuthoringRules, splitBySeverity, authoringRulesFor } from '@objectstack/lint';
import { resolveJsxGateManifest, printJsxGateNotices } from '../utils/sdui-manifest.js';
import { preflightDeclaredCapabilities, renderCapabilityMessage } from '../utils/capability-preflight.js';
import { collectAndLintDocs, type DocIssue } from '../utils/collect-docs.js';
import { collectSeedFiles } from '../utils/bundle-seed-files.js';
import { collectConnectorSpecFiles } from '../utils/bundle-connector-spec-files.js';
import { judgeSeedRecordValues } from '../utils/seed-record-values.js';
import {
printHeader,
printKV,
printSuccess,
printError,
printStep,
formatConversionNotice,
printAuthoringRuleErrors,
authoringFindingDetailLines,
type AuthoringRuleFinding,
printDocIssueErrors,
JSON_FULL_LIST_REMEDY,
createTimer,
formatZodErrors,
collectMetadataStats,
printMetadataStats,
printWarning,
printBulletList,
emitJson,
isExitSignal,
errorCodeFields,
isReportedError,
} from '../utils/format.js';
import { checkProtocolVersionGap } from '../utils/protocol-version-gap.js';
import {
checkDependencyRanges,
formatDependencyRangeDiagnostic,
type DependencyRangeDiagnostic,
} from '../utils/dependency-range-check.js';
import { readSpecReleaseChanges } from '../utils/spec-release-changes.js';
// [#14553] The navigation-contribution group check, shared with `os compile`.
// Reports; never refuses — the runtime still relocates, deliberately.
import { findNavGroupDiagnostics } from '../utils/nav-contribution-groups.js';
import type { NavContributionGroupDiagnostic } from '@objectstack/objectql';
// [#18024] The permission-set name-collision check, shared with `os compile`.
// Reports; never refuses — the runtime still drops the foreign set, correctly
// (ADR-0086 D4); what was missing was the author hearing about it.
import {
findPermissionSetNameCollisions,
formatPermissionSetNameCollisions,
} from '../utils/permission-set-name-collisions.js';
import type { PermissionSetNameCollisionDiagnostic } from '@objectstack/plugin-security';
// [#20331] The boot registrar's divergent view-container `name` refusal, walked
// over the parsed stack the way the load path registers it. The verdict is
// `@objectstack/objectql`'s; see the module header.
import { findViewContainerNameRefusals } from '../utils/view-container-names.js';
// [ADR-0146 D2, #28410] The override write gate's author-time half: the publish
// door's own judge, walked over the artifact's packages.
import { findOverrideDeclarationRefusals } from '../utils/override-declarations.js';
import { findExtensionFieldSuffixRefusals } from '../utils/extension-field-suffix.js';
// [ADR-0146 D10, second rule] The field-patch target check's walk; the verdict
// is the marketplace install door's own judge.
import { findFieldPatchTargetRefusals } from '../utils/field-patch-targets.js';
// A field `picklist` that names no picklist the stack declares — refused, or
// reported when the declaring package depends on packages outside the stack.
// Walked the way the load path registers, like the refusal above.
import { judgePicklistReferences, picklistRefusalHeading, printPicklistReferenceNotices } from '../utils/picklist-references.js';
export default class Validate extends Command {
static override description =
'Validate ObjectStack configuration against the protocol schema, CEL expressions, and widget bindings (no artifact emitted)';
static override args = {
config: Args.string({ description: 'Configuration file path', required: false }),
};
static override flags = {
strict: Flags.boolean({ description: 'Treat warnings as errors' }),
json: Flags.boolean({ description: 'Output results as JSON' }),
};
async run(): Promise<void> {
const { args, flags } = await this.parse(Validate);
const timer = createTimer();
if (!flags.json) {
printHeader('Validate');
}
// [#12047] THE ADVISORY LISTS THIS RUN HAS COMPUTED SO FAR, hoisted out of
// the `try` so that EVERY `emitJson` exit can read them — not the terminal
// success payload alone.
//
// The defect: all five failure exits published strictly less than the run
// had already computed. Two carried `ruleAdvisories` and nothing else; the
// other three carried no advisory list at all. The text face prints these
// blocks ending `— re-run with --json for the full list`, so an author
// whose tree failed a LATER gate was told to re-run with `--json` and got
// a payload without the withheld entries in it — the "the remedy named is
// unreachable" shape of #11643 and #11391.
//
// The strongest instance is the parse-failure exit. `unknownKeyWarnings`
// is computed PRE-parse (see its own note below) precisely so the finding
// survives an unrelated schema error — and then that exit dropped it
// anyway, defeating the one hoist that existed to prevent exactly this.
//
// Maintainer ruling 2026-08-25 on #11772, inherited here under the
// same-family rule: every failure exit carries the lists the run has
// ALREADY COMPUTED, so `warnings` means the same thing on every exit and a
// machine consumer has exactly one way to read it. Option 2 — carry them
// only where the text face printed them, making the payload's SHAPE depend
// on how far the run got — was rejected as the hardest contract to
// declare. Option 3 (weaken the pointer) was rejected as making the
// product worse.
//
// ⛔ CARRYING, NOT COMPUTING. Every list stays computed at exactly the step
// that owns it; these bindings only make the value visible to the exits
// DOWNSTREAM of that step. An exit that runs before a given step therefore
// still reports that list empty, and that is the honest reading of "what
// the run has already computed". Hoisting a computation earlier so an
// early exit looks fuller would be option 2 wearing option 1's clothes,
// and it would change what the command costs on its failure paths too.
//
// ⛔ `structuralWarnings` is the member that is measured, not assumed. It
// is computed LAST — below every one of the five failure exits — so it
// rides `warningsSoFar()` as an empty list on all of them, and the only
// exit that can ever see it non-empty is the success payload. It is a
// member of the same class as the other four (a non-blocking advisory
// about the stack, gated by `--strict`, already in the success payload's
// `warnings`); it differs only in WHEN it becomes available, which is the
// same axis `docWarnings` and `capProviderWarnings` already differ on. It
// is included here rather than special-cased so the order lives at ONE
// site — ⛔ do not "fix" its emptiness by moving its computation up.
//
// ORDER IS THE SUCCESS PAYLOAD'S, stated ONCE here and read by that
// payload too — the "one list cannot drift from itself" idiom this file
// has already had to apply three times. The spread used to be written out
// at the payload, so a seventh exit could have been added with a different
// member order and nothing would have caught it.
// Typed off `splitBySeverity` rather than by naming `AuthoringFinding`: the
// #4409 import scan (packages/lint/src/authoring-rule-wiring.test.ts) reads
// every symbol this file names from `@objectstack/lint` and strips `type `
// rather than exempting it, and `splitBySeverity` — which produces this
// list — is already ratcheted there. Binding the annotation to the producer
// is also the tighter statement: the list cannot disagree with the function
// that fills it.
let ruleAdvisories: ReturnType<typeof splitBySeverity>['advisories'] = [];
let capProviderWarnings: Array<{ token: string; message: string }> = [];
let unknownKeyWarnings: string[] = [];
let docWarnings: DocIssue[] = [];
let structuralWarnings: string[] = [];
// [#14553] Computed HERE as well as in `os compile`, not only there. The
// #11727 residue pin asserts that nothing rides in build's `warnings` that
// validate does not also report, and the two commands being one wall with
// two doors is the #4409 / #4463 discipline this list already follows.
let navGroupWarnings: NavContributionGroupDiagnostic[] = [];
// [#18024] Computed HERE as well as in `os compile`, and for the same
// reason the line above it gives: the #11727 residue pin asserts that
// nothing rides in build's `warnings` that validate does not also report.
let permissionSetCollisionWarnings: PermissionSetNameCollisionDiagnostic[] = [];
// [#20113] The JSX gate's parse-level notice: empty, or ONE `info` record
// saying `kind:'html'` pages were checked at parse level only because no
// SDUI component manifest resolved, and where one was looked for. Same
// class as the two members above it — reports, never refuses, and is NOT
// in the `warnings` list `--strict` reads (see step 3), so the exit status
// of a project without a manifest is unchanged on both faces. `os compile`
// computes the identical record, so the residue pin keeps holding.
let jsxGateNotices: ReturnType<typeof resolveJsxGateManifest>['notices'] = [];
// The `info` records of a field `picklist` reference that resolves nowhere
// in the stack while the declaring package depends on packages outside it
// (step 2d). Same class as the notice above — reports, never refuses, and
// is NOT in the `warnings` list `--strict` reads: the reference may be
// right, and `--strict` failing on it would refuse a correct stack. `os
// compile` computes the identical records, so the residue pin keeps holding.
let picklistReferenceNotices: ReturnType<typeof judgePicklistReferences>['notices'] = [];
// ADR-0141 D2 author side (step 3e): the `dependencies` findings the
// install ADMITS — an in-artifact range mismatch, or a co-delivered entry
// whose range or sibling version cannot be read. Same class as the nav and
// permission-set lists: reports, never refuses, NOT in `--strict`'s list,
// and `os compile` computes the identical records.
let dependencyRangeWarnings: DependencyRangeDiagnostic[] = [];
const warningsSoFar = () => [
...ruleAdvisories,
...docWarnings,
...unknownKeyWarnings,
...capProviderWarnings,
...structuralWarnings,
// [#14553] APPENDED, and the position is load-bearing. #12047's
// `the order lives at ONE site` pin matches the five members above as
// CONTIGUOUS source text — that is how it proves the order is defined
// once rather than re-spelled per exit. Slotting a sixth member (or even
// a comment) between them breaks that match, so a new member goes on the
// end and the pin keeps guarding exactly what it was written to guard.
// ⛔ Do not "fix" that pin by loosening its regex.
...navGroupWarnings,
// [#18024] APPENDED for the same reason, one member later.
...permissionSetCollisionWarnings,
// [#20113] APPENDED for the same reason, one member later again.
...jsxGateNotices,
// APPENDED for the same reason, one member later again.
...picklistReferenceNotices,
// APPENDED for the same reason, one member later again.
...dependencyRangeWarnings,
];
// [commit 79cf692b0] The ADR-0087 D2 conversion notices, hoisted for the SAME reason
// and under the SAME ruling as the five lists above — one field over. The
// notices were computed at step 2 (below) and reached the terminal SUCCESS
// payload alone, so all five failure exits dropped a list already in hand.
//
// ⛔ CARRYING, NOT COMPUTING — and here that is a pure SCOPE change. This is
// the same `const` array the `onConversionNotice` sink pushes into, moved
// above the `try` only so the catch-all exit can read it. `normalizeStackInput`
// still runs at exactly step 2, so a run that throws in `loadConfig` — above
// it — reports `[]` honestly, exactly as `warningsSoFar()` does there,
// unless what it threw is a stack producer's refusal: that carries the
// conversions the producer applied before refusing, which the run HAS
// already computed, and the catch-all folds them (#20583).
//
// ⛔ NOT FOLDED INTO `warningsSoFar()`, in either direction. The two fields
// are separate on the success payload by an explicit decision recorded at
// that call site: the text face folds these notices into its `⚠` block (so
// `--strict` gates on them) while the payload carries them under their own
// key with their structured `conversionId`/`retiresIn` fields intact — the
// one advisory class that carries an EXPIRY. Whether the two should become
// one field is an open question this change was explicitly not given the
// authority to settle, so the shape is mirrored, not merged.
//
// No `conversionsSoFar()` wrapper: `warningsSoFar()` exists because five
// producers had to be concatenated in ONE stated order. This list has three
// fillers, and each pushes into this ONE array in the order the run reaches
// it — step 1b folds the record the stack producer left on the default
// export (`loaded.stackConversions`), step 2's own pass appends what it
// converts on the merged stack, and the catch-all folds the record a
// producer's REFUSAL carries when the load threw one (so on that run the
// other two never ran) — so reading the binding directly already is the
// "a list cannot drift from itself" idiom the wrapper was built to buy.
const conversionNotices: ConversionNotice[] = [];
try {
// 1. Load configuration
if (!flags.json) printStep('Loading configuration...');
const loaded = await loadConfig(args.config);
const { config, absolutePath, duration, namedExports } = loaded;
// 1a. [#20367 ruling B] One authoring shape: refuse a default export no
// stack producer built, BEFORE any other judgement — the `STACK_*`
// cross-field refusals run inside `defineStack` only, so an unbuilt
// export would otherwise pass this door unjudged. Throws into the
// catch-all below (`--json`: `error` + `code`, exit 1), the same
// envelope a `defineStack` refusal raised at load reaches.
refuseUnbuiltStack(loaded);
// 1b. The ADR-0087 D2 conversions the PRODUCER applied. `defineStack`
// converts at load (either mode), so the stack this door received is
// already canonical and step 2's pass below has nothing of it left to
// convert: without this fold `conversions` read `[]` and `--strict`
// passed on every `defineStack` config carrying a retiring spelling.
// Read by `loadConfig` off the default export before its named-export
// merge (`stackConversionsOf`, beside the provenance mark). ⛔ Folded,
// never recomputed: a second conversion pass here would disagree with
// what was loaded. After 1a, so a refused export reports none.
conversionNotices.push(...loaded.stackConversions);
if (!flags.json) {
printKV('Config', absolutePath);
printKV('Load time', `${duration}ms`);
}
// 2. Normalize map-formatted stack definition and validate against schema.
// The ADR-0087 D2 conversion layer runs here (inside normalizeStackInput);
// surface each applied conversion as a non-blocking deprecation notice so
// the author knows the source still carries an old-shape key that will
// retire from the load path in a future major. What it can still find
// after step 1b is what the producer never saw: a key `loadConfig`
// merged onto the stack from a NAMED export of the config module.
if (!flags.json) printStep('Validating against ObjectStack Protocol...');
// The sink is declared above the `try` (see its note there); the CALL that
// fills it stays right here, at the step that owns it.
const normalized = normalizeStackInput(config as Record<string, unknown>, {
onConversionNotice: (n) => conversionNotices.push(n),
});
// [#3786] Keys `ObjectSchema` / `FieldSchema` do not declare, and so drop
// silently. PRE-parse for the same reason the registry's `normalized`-tier
// rules are: the parse is what strips them, so `result.data` no longer
// carries the key the author actually wrote. Computed here rather than
// down in the warnings section so the `--json` path reports it too — the
// "computed, then discarded" shape this file already had to fix once.
//
// The item walk reads the package-union stack (#22238): a multi-package
// `preserve` artifact carries its collections only in `packages[]`, so
// the top level alone held no item to walk. The stack-key lint stays on
// the top level on purpose: it judges the envelope's own keys, and a
// package body is a closed shape the parse refuses an unknown key on.
unknownKeyWarnings = [
...lintUnknownStackKeys(normalized as Record<string, unknown>, ObjectStackDefinitionSchema),
...lintUnknownAuthoringKeys(authoringRuleUnionStack(normalized as Record<string, unknown>), ObjectStackDefinitionSchema),
].map(formatUnknownAuthoringKey);
// 2b. [#16544] Lower inline `function` handlers (Hook.handler, action
// `target`, top-level `functions`) to a metadata `body` + string ref
// BEFORE the parse — the same `lowerCallables` call `os build` makes
// at its step 2b and `os lint` makes in `lintConfig`, not a copy.
//
// Every rule in the `hook-body-*` / `hook-api-update-readonly-*`
// family opens on `body.language === 'js'`. A hook authored as
// `handler: async (ctx) => { … }` carries no `body`, so on the
// un-lowered stack the whole family returned before reading
// anything, and this command passed (exit 0, no finding) a stack
// `os build` refuses with `hook-api-update-readonly-field` — the
// #3782 / #4409 class one door over, on the shape the reference app
// uses for 39 of 39 hooks. The body-authored control fired here all
// along, so the silence was the door, not the rule.
//
// POSITION IS LOAD-BEARING: after the two pre-parse unknown-key
// lints above, which keep reading `normalized` exactly as before,
// and before the parse, which now reads the lowered view. That is
// `compile.ts`'s lower-BEFORE-parse order exactly; its key lints sit
// AFTER its parse, so on both doors what protects the lints' input
// is non-mutation, not ordering: `lowerCallables` returns a NEW
// top-level object and never mutates its input, so `normalized` —
// the registry's `normalized` tier below, `collectMetadataStats(
// config)`, the structural advisories — is byte-for-byte what it
// was; only what the parse and the registry's `parsed` tier see
// changes.
//
// NOT A PURE NARROWING. The same pass also lowers an inline action
// `target` callable (`actions[*]`, `objects[*].actions[*]`) to a ref
// string plus `body`, and names a nameless `functions` ARRAY entry
// (`[{ handler: fn }]`) `anon_fn`. `ActionSchema.target` is
// `z.string()`, the array entry requires `name`, and
// `normalizeStackInput` touches neither, so before this step the
// un-lowered parse REFUSED both configs (`invalid_type` at
// `actions.0.target`; `invalid_union` at `functions`; exit 1) while
// `os build` accepted them all along. Both are accepted here now —
// accepted-set relaxations on this command, each measured through
// the real CLI on both sides and pinned in
// `test/lint-hook-rules-reach-handler-hooks.e2e.test.ts`. Not
// limbs: `hooks[*].handler` accepts a function un-lowered, and the
// `functions` MAP forms parse either way. Parity with the build is
// the intent, and it is declared rather than assumed because a
// sibling's acceptance is evidence of intent, not a declaration on
// this command's face.
//
// Nothing is emitted, so `lowering.functions` is unused here, and
// the extraction refusals in `bodyExtractionWarnings` are NOT
// surfaced: a handler the extractor refuses is left with no `body`
// on every door, the family stays silent on it, and the refusal is
// `os lint`'s `hook-body/*` rules' to report. Publishing it here
// would add a key to this command's `--json` payload, which is its
// own contract decision (`compile.ts` records why the key is
// build's alone). No step line is printed either: the text face is
// byte-for-byte what it was, and the docs transcripts stay true.
const lowering = lowerCallables(normalized as Record<string, unknown>);
const result = ObjectStackDefinitionSchema.safeParse(lowering.lowered);
if (!result.success) {
if (flags.json) {
await emitJson({
valid: false,
errors: (result.error as unknown as ZodError).issues,
// [#12047] The list computed at `unknownKeyWarnings` above — six
// lines up, and dropped here until now. This is the exit the card
// called the strongest instance: the hoist exists so the finding
// SURVIVES a schema error, and this payload discarded it anyway.
warnings: warningsSoFar(),
// [commit 79cf692b0] Filled by `normalizeStackInput` two statements above this
// exit — the tightest instance of that defect, and the one the commit measured.
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
console.log('');
printError('Validation failed');
formatZodErrors(result.error as unknown as ZodError);
// [#18171] …and, when one of those unrecognised top-level keys got
// there by being a NAMED EXPORT of the config module rather than a key
// the author wrote inside `defineStack()`, the rule that makes it one.
// Text face only: the `--json` branch above is untouched, so no field
// is added to a published envelope.
for (const line of namedExportRejectionHints(
(result.error as unknown as ZodError).issues,
namedExports,
)) {
console.log(chalk.dim(line));
}
this.exit(1);
}
// 2c. [#20331] The boot registrar's divergent view-container `name`
// refusal, judged here by the SAME function
// `ObjectQL.registerMetadataCollections` throws the answer of
// (`viewContainerNameRefusal`, `@objectstack/objectql`). This door
// used to pass `{ name: 'order_line', object: 'my_app_order_line',
// list: {…} }` at exit 0 while `os serve` refused the same stack at
// boot — the silent-validator shape, on the command whose whole job
// is to say what the runtime will accept.
//
// ⛔ One judge, not a second rule: not an `@objectstack/lint`
// registry member and not a re-spelling of the check. The helper
// owns only the WALK (which `views:` entries boot registers, under
// which package id); the verdict and its words are the runtime's,
// so the author reads here exactly what the server would print.
//
// Right after the parse, ahead of the rule table: this is the
// runtime's own accept set, the same class as the schema, and
// nothing below it is worth reading about a stack the server will
// not load. `os build` runs the same call at its step 3a (#20393);
// `test/validate-build-gate-parity.test.ts` holds both doors to it.
const containerNameRefusals = findViewContainerNameRefusals(result.data as Record<string, unknown>);
if (containerNameRefusals.length > 0) {
if (flags.json) {
await emitJson({
valid: false,
errors: containerNameRefusals,
// [#12047] Every exit carries the lists the run has computed so
// far — here the pre-parse ones only, and the conversion notices
// `normalizeStackInput` filled at step 2.
warnings: warningsSoFar(),
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
const n = containerNameRefusals.length;
console.log('');
printError(`The server would refuse this stack at boot (${n} view container${n > 1 ? 's' : ''})`);
printBulletList(
containerNameRefusals.map((r) => r.message),
{ noun: 'view-container refusal(s)', remedy: JSON_FULL_LIST_REMEDY },
);
this.exit(1);
}
// 2d. A field `picklist`, or a `picklistExtensions` entry's `extend`, that
// names no picklist the stack declares is REFUSED, naming the field
// (or the extension) and the list. `FieldSchema` and
// `PicklistExtensionSchema` judge the name's spelling only, so a
// misspelt reference parsed, passed this door at exit 0 and reached
// the runtime as a choice with nothing to choose — the silence a NAMED
// list exists to remove.
//
// The walk is the load path's (see `utils/picklist-references.ts`):
// each `packages[]` body's fields and extensions, or the top level's
// when there is no `packages[]`, resolved against every picklist the
// stack declares.
// A reference that resolves nowhere is refused only when the
// declaring package depends on no package outside the stack; when it
// does, the list may live there, and this command cannot read it — so
// that case is an `info` notice, printed here and carried in
// `warningsSoFar()`, never gating.
//
// Right after the parse, ahead of the rule table, for the reason
// step 2c gives. `os build` runs the same call at its step 3a-bis.
const picklistJudgement = judgePicklistReferences(result.data as Record<string, unknown>);
picklistReferenceNotices = [...picklistJudgement.notices];
if (!flags.json) printPicklistReferenceNotices(picklistReferenceNotices);
if (picklistJudgement.refusals.length > 0) {
if (flags.json) {
await emitJson({
valid: false,
errors: picklistJudgement.refusals,
// Every exit carries the lists the run has computed so far — the
// pre-parse ones and the notices above.
warnings: warningsSoFar(),
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
console.log('');
printError(picklistRefusalHeading(picklistJudgement.refusals));
printAuthoringRuleErrors(picklistJudgement.refusals, { remedy: JSON_FULL_LIST_REMEDY });
this.exit(1);
}
// 3. The author-time rule registry (#4409). Every rule the three authoring
// commands share — expressions, view shape, widget/action/filter/name
// references, SDUI styling, page sources, security posture, the CLI's
// own authoring lints — runs from ONE table, so `os validate`,
// `os build` and `os lint` hold a stack to the same bar by construction.
// Before it, each command hand-wired its own subset: 23 of 26 rules ran
// on some strict subset of the three, and `os build` — the command that
// PUBLISHES — was the weakest gate of the three.
//
// Which rules run, on which stack tier, and why any of them is scoped
// is declared in `lint/authoring-rules.ts`. Do not add a call site here.
const registered = authoringRulesFor('validate');
if (!flags.json) printStep(`Running author-time rules (${registered.length})...`);
// [ADR-0130 D4 / option B, #17069] Judged on the SAME folded stack
// `os build` judges (`compile.ts` step 3b), through the one helper
// both doors call. Under option B every definition lives in
// `packages[]` and the top level carries none, so this run's input
// was an EMPTY stack: `os validate` printed `✓ Validation passed` and
// exited 0 having judged nothing, on a stack `os build` refuses. That
// is the weakest-gate class #4409 was filed for, and the direction it
// arrived in here is the worst one — the fast inner-loop check is
// what an author runs BEFORE shipping, so its clean bill of health is
// the strongest false assurance the three commands can give.
//
// Rule INPUT only, exactly as in `compile.ts`: this command emits no
// artifact at all, and the folded stack reaches neither the metadata
// stats below nor the `--json` payload. A stack that still carries
// its collections is returned by identity, so every single-package
// project is unaffected by construction.
//
// [#20113] The SDUI manifest is resolved ONCE, and both rule runs below
// are handed the same answer. Its pages are counted over EVERY stack
// the JSX gate is handed — the union fold AND each package body the
// per-package pass judges — so html pages carried only in `packages[]`
// count beside a top-level `pages` key the fold keeps.
// With `kind:'html'` pages to check and no manifest, the gate runs at
// parse level and SAYS so — here, at its step, so the line shows on
// the failing paths below too, and in `warningsSoFar()` for `--json`.
// It stays out of the `warnings` list `--strict` reads, exactly like
// the navigation and permission-set advisories: a project with no
// manifest of its own has no remedy but to author one, so promoting
// this to a failure under `--strict` would break every such project.
// A project manifest that exists but cannot be used is REFUSED
// instead (thrown, already reported on stderr; the catch-all exits 1).
// [#20166] The project's manifest is the one beside the config this
// run was given — the directory the capability preflight below reads
// too — never the invoker's working directory.
const jsxGate = resolveJsxGateManifest(result.data as Record<string, unknown>, dirname(absolutePath));
jsxGateNotices = [...jsxGate.notices];
if (!flags.json) printJsxGateNotices(jsxGateNotices);
const parsedUnion = authoringRuleUnionStack(result.data as Record<string, unknown>);
// [#20158] The engine's own filter admission over this stack's objects —
// built lazily, driverless; see `utils/authoring-filter-judge.ts`. ONE
// judge for the union run and the per-package pass below, because the
// runtime judges every package's policies against one registry.
const judgeFilter = stackFilterJudge(parsedUnion);
const findings = runAuthoringRules('validate', {
normalized: authoringRuleUnionStack(normalized as Record<string, unknown>),
parsed: parsedUnion,
sduiManifest: jsxGate.sduiManifest,
// [#16546] Same ref set `os build` / `os lint` compute — keeps this
// door's hook write-set findings at the same `path` as the other two.
loweredHookRefs: lowering.loweredHookRefs,
judgeFilter,
});
const { errors: ruleErrors, advisories } = splitBySeverity(findings);
ruleAdvisories = advisories;
if (ruleErrors.length > 0) {
// Every failing rule reports at once. The command used to exit at the
// first failing gate, so an author with three unrelated problems fixed
// them in three round trips and could not see how deep the hole went.
if (flags.json) {
await emitJson({
valid: false,
errors: ruleErrors,
// [#12047] Was `ruleAdvisories` alone. Reading the shared site adds
// the pre-parse `unknownKeyWarnings` — computed long before this
// gate — and keeps the member ORDER identical to every other exit.
warnings: warningsSoFar(),
// [commit 79cf692b0] Computed at step 2, above this gate.
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
console.log('');
printError(`Author-time rules failed (${ruleErrors.length} issue${ruleErrors.length > 1 ? 's' : ''})`);
// [#11642] The comment above is the reason this render may not be
// silently capped: reporting every failing rule at once is the whole
// point of the block, and a cut with no notice restores a smaller
// version of the round-trip it removed. `--json` on this same exit
// publishes all of them as `errors`, so the pointer resolves.
printAuthoringRuleErrors(ruleErrors, { remedy: JSON_FULL_LIST_REMEDY });
this.exit(1);
}
// 3a-ii. [ADR-0130 D4, #18677] The SAME rule table, once per PACKAGE —
// the second half of the run above, and the half this door ran
// without.
//
// `os build` has run it since #16611; `os validate` ran the union
// fold and stopped, importing neither `artifactPackages` nor
// `packageBodyAsStack`. Every finding this pass yields is therefore
// one `os build` reported and this command structurally could not.
// Same FALSE-CLEAN direction #17069 fixed one layer up, and the worse
// door for it: the fast inner-loop check is what an author runs
// BEFORE shipping, so its clean bill of health is the strongest false
// assurance the three commands can give.
//
// ⚠️ [#18779] This step used to size that gap by quoting `compile.ts`
// step 3b-ii — "exactly the set the union could not see" — and that
// sentence was FALSE when it was copied here: the de-duplication key
// carried the POSITIONAL `path`, so a package-local finding and its
// flattened twin got two keys and the ECHO survived. Part of every
// survivor set was therefore something THIS door's own union run
// already reported. The key was corrected in
// `utils/artifact-packages.ts`; the gap this step closed is real and
// its direction is unchanged, but ⛔ do not re-derive its size from
// that sentence — it was quoted, never measured.
//
// ⛔ Not a second copy of the loop — `runPerPackageAuthoringRules` is
// the one the build door calls, so the de-duplication key, the
// severity split and the `where` prefix cannot drift between the two
// doors. That drift is the defect this step closes, one layer down.
//
// The SEVERITY MAPPING is `os build`'s, unchanged and deliberately:
// an `error` refuses (exit 1), an advisory joins `ruleAdvisories` and
// rides `warningsSoFar()`. The card asked for the asymmetry, ⛔ not
// for a severity judgement, and a per-package `error` is one
// `os build` ALREADY refuses — so this narrows `os validate` to the
// bar the command that ships already holds, never past it.
//
// Skipped entirely for a stack with no `packages[]`: one package by
// definition, already judged whole by the union run above.
const packageEntries = artifactPackages(result.data as Record<string, unknown>);
if (packageEntries.length > 0) {
if (!flags.json) {
printStep(`Running author-time rules per package (${packageEntries.length})...`);
}
const perPackage = runPerPackageAuthoringRules({
command: 'validate',
parsed: result.data as Record<string, unknown>,
unionFindings: findings,
sduiManifest: jsxGate.sduiManifest,
// [#16546] The same ref set the union run above was handed, so a
// per-package hook write-set finding reports at the same `path` the
// other two doors report it at.
loweredHookRefs: lowering.loweredHookRefs,
judgeFilter,
});
ruleAdvisories = [...ruleAdvisories, ...perPackage.advisories];
if (perPackage.errors.length > 0) {
if (flags.json) {
await emitJson({
valid: false,
errors: perPackage.errors,
warnings: warningsSoFar(),
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
console.log('');
printError(
`Author-time rules failed inside the artifact's packages (${perPackage.errors.length} issue${perPackage.errors.length > 1 ? 's' : ''})`,
);
printAuthoringRuleErrors(perPackage.errors, { remedy: JSON_FULL_LIST_REMEDY });
this.exit(1);
}
}
// 3a-iii. [ADR-0146 D2, #28410] The override write gate, at author time.
// Only the base's paired `<base>.custom` declares an override; a
// dependent's item bearing the name a package in its closure ships is
// refused (rename), and an `overrides` declaration the gate does not
// admit is refused. The verdict is the publish door's own
// (`judgeOverrideWrite`), so a green validate is a publish the door
// accepts; see `utils/override-declarations.ts` for the walk.
const overrideRefusals = findOverrideDeclarationRefusals(result.data as Record<string, unknown>);
if (overrideRefusals.length > 0) {
if (flags.json) {
await emitJson({
valid: false,
errors: overrideRefusals,
warnings: warningsSoFar(),
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
const n = overrideRefusals.length;
console.log('');
printError(`The publish door would refuse ${n} item${n > 1 ? 's' : ''} under the override write gate (ADR-0146 D2)`);
printBulletList(
overrideRefusals.map((r) => `${r.path} [${r.code}] ${r.message}`),
{ noun: 'override refusal(s)', remedy: JSON_FULL_LIST_REMEDY },
);
this.exit(1);
}
// 3a-iv. [ADR-0146 D10, #28564] The `__c` extension-field reservation,
// at author time: a field spelled `__c` only in a base's paired
// `.custom` package, and every `objectExtensions[].fields` key of a
// `.custom` pair suffixed. The verdict is the save and install doors'
// own (`judgeExtensionFieldSuffix`), so a green validate is an
// artifact they admit; see `utils/extension-field-suffix.ts`.
const suffixRefusals = findExtensionFieldSuffixRefusals(result.data as Record<string, unknown>);
if (suffixRefusals.length > 0) {
if (flags.json) {
await emitJson({
valid: false,
errors: suffixRefusals,
warnings: warningsSoFar(),
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
const n = suffixRefusals.length;
console.log('');
printError(`${n} field${n > 1 ? 's break' : ' breaks'} the \`__c\` extension-field reservation (ADR-0146 D10)`);
printBulletList(
suffixRefusals.map((r) => `${r.path} [${r.code}] ${r.message}`),
{ noun: 'extension-field refusal(s)', remedy: JSON_FULL_LIST_REMEDY },
);
this.exit(1);
}
// 3a-v. [ADR-0146 D10, second rule] The field-patch target check, at
// author time: an object extension's `fieldPatches` naming a field
// its target does not have, or an option value the field does not
// have, when the target is in this composed stack. The verdict is the
// install door's own judge (`fieldPatchTargetRefusals`), so a green
// validate is a patch the install door admits; see
// `utils/field-patch-targets.ts` for the walk.
const patchTargetRefusals = findFieldPatchTargetRefusals(result.data as Record<string, unknown>);
if (patchTargetRefusals.length > 0) {
if (flags.json) {
await emitJson({
valid: false,
errors: patchTargetRefusals,
warnings: warningsSoFar(),
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
const n = patchTargetRefusals.length;
console.log('');
printError(`${n} field patch${n > 1 ? 'es name' : ' names'} a field or option the extended object does not have (ADR-0146 D10)`);
printBulletList(
patchTargetRefusals.map((r) => `${r.path} ${r.message}`),
{ noun: 'field-patch refusal(s)', remedy: JSON_FULL_LIST_REMEDY },
);
this.exit(1);
}
// 3a-vi. [#28893] Flow region shape (ADR-0031) is judged by the rule
// table above since #29049 (`flow-region-shape-invalid`,
// `@objectstack/lint`'s `validate-flow-region-shape.ts`), so all
// three authoring commands give the engine's registration verdict.
// 3b. [#3366] Installable-provider preflight — the shift-left of the
// `serve`-time capability check. `os validate` previously only checked
// the `requires` tokens against the vocabulary (ADR-0066), never
// whether each token's provider is resolvable in the active edition. A
// token whose provider has NO installable version here (e.g. `ai` →
// @objectstack/service-ai, cloud-only) fails; absent-but-installable is
// an advisory `pnpm add` hint. Mirrors the `os build` gate exactly.
//
// Not a registry rule: it reads `node_modules`, not the stack.
// [#14553] Navigation contributions whose `group` names no group in an
// app this same compilation unit ships. Reports, never refuses: the
// runtime relocates the items to the app's top level deliberately
// (the read-time fold stays order-independent, contributions into
// optional groups keep working), so what was missing was visibility,
// not a gate. A contribution aimed at an app no package here ships is
// NOT reported — that is the supported cross-artifact case.
navGroupWarnings = await findNavGroupDiagnostics(result.data as Record<string, unknown>);
if (navGroupWarnings.length > 0 && !flags.json) {
console.log('');
printWarning(
`Navigation contributions aimed at a group the target app does not declare ` +
`(${navGroupWarnings.length}) — the items still install, RELOCATED to the app's top level`,
);
printBulletList(
navGroupWarnings.map((d) => `[${d.code}] ${d.message} Fix: ${d.fix}`),
{ noun: 'navigation-contribution diagnostic' },
);
}
// [#18024] Permission sets declared under a name another package in this
// same compilation unit already owns. Reports, never refuses, and
// ⛔ changes nothing about the skip: refusing to write into a foreign
// row is correct under ADR-0086 D4 and unchanged — the whole declared
// set is dropped at runtime and until now no door said so before the
// deployment. A name owned by a package some OTHER artifact installed
// is NOT reported: that is the cross-artifact case a build cannot see.
permissionSetCollisionWarnings =
await findPermissionSetNameCollisions(result.data as Record<string, unknown>);
if (permissionSetCollisionWarnings.length > 0 && !flags.json) {
console.log('');
printWarning(
`Permission sets declared under a name another package in this artifact owns ` +
`(${permissionSetCollisionWarnings.length}) — at runtime the ENTIRE declared set is ` +
`dropped, not merged (ADR-0086 D4)`,
);
printBulletList(
await formatPermissionSetNameCollisions(permissionSetCollisionWarnings),
{ noun: 'permission-set collision diagnostic' },
);
}
if (!flags.json) printStep('Checking that every required capability has a provider installable in this edition...');
// [#22189] Every place the stack declares `requires`: its top level, or
// each `packages[]` body, naming the package. A multi-package
// `preserve` artifact carries `requires` only in its bodies.
const capProviderPreflight = preflightDeclaredCapabilities({
requires: (config as { requires?: unknown }).requires,
packages: packageEntries,
projectDir: dirname(absolutePath),
});
const capProviderErrors = capProviderPreflight.errors;
capProviderWarnings = capProviderPreflight.warnings.map((c) => ({
token: c.token,
message: renderCapabilityMessage(c),
}));
if (capProviderErrors.length > 0) {
if (flags.json) {
await emitJson({
valid: false,
errors: capProviderErrors.map((c) => ({ token: c.token, message: renderCapabilityMessage(c) })),
// [#12047] The FATAL tokens ride `errors`; the advisory ones ride
// `warnings` beside the two lists computed before this gate. The
// two classes being separate is the whole point of the split.
warnings: warningsSoFar(),
// [commit 79cf692b0] Computed at step 2, above this gate.
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
console.log('');
printError(`Capability provider check failed (${capProviderErrors.length} issue${capProviderErrors.length > 1 ? 's' : ''})`);
for (const c of capProviderErrors) {
console.log(` • ${renderCapabilityMessage(c)}`);
}
this.exit(1);
}
// 3c. Package docs (ADR-0046) — flatness, namespace-prefixed names, the
// MDX/image ban, same-package link resolution. `os build` has always
// FAILED on a doc error (the artifact is the publish unit, so that is
// the publish lint for docs) while this command never ran it: the same
// "build rejects what validate accepts" hole #4409 found among the
// metadata rules, one gate over. It went unnoticed because the parity
// guard keyed on the `lint*`/`validate*` naming convention and this
// one is called `collectAndLintDocs`.
//
// Not a registry rule: it reads `src/docs/*.md` off disk.
if (!flags.json) printStep('Checking package docs (ADR-0046)...');
const docsResult = collectAndLintDocs(absolutePath, result.data as Record<string, unknown>);
const docErrors = docsResult.issues.filter((i) => i.severity === 'error');
docWarnings = docsResult.issues.filter((i) => i.severity !== 'error');
if (docErrors.length > 0) {
if (flags.json) {
await emitJson({
valid: false,
errors: docErrors,
// [#12047] Was `ruleAdvisories` alone, on the very exit that had
// the most computed: the doc advisories from this same call, the
// capability hints, and the pre-parse key findings were all in
// hand and none of them reached the payload.
warnings: warningsSoFar(),
// [commit 79cf692b0] Computed at step 2, above this gate.
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
console.log('');
printError(`Package docs validation failed (${docErrors.length} issue${docErrors.length > 1 ? 's' : ''})`);
// [#11642] `--json` on this same exit publishes them all as `errors`.
printDocIssueErrors(docErrors, { remedy: JSON_FULL_LIST_REMEDY });
this.exit(1);
}
// 3d. [#25779] Seed files — each `seedFile(path)` a seed record names
// must name a file under the directory holding the config, of a type
// the extension or the reference tells. `os build` refuses the same
// paths before it bundles the bytes into the artifact.
const seedFiles = collectSeedFiles(absolutePath, result.data as Record<string, unknown>);
if (seedFiles.issues.length > 0) {
if (flags.json) {
await emitJson({
valid: false,
errors: seedFiles.issues,
warnings: warningsSoFar(),
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
console.log('');
printError(`Seed file validation failed (${seedFiles.issues.length} issue${seedFiles.issues.length > 1 ? 's' : ''})`);
for (const issue of seedFiles.issues) console.log(chalk.red(` ✗ ${issue.location}: ${issue.message}`));
this.exit(1);
}
// 3d-ter. Connector spec files — the OpenAPI document a
// `provider: 'openapi'` connector names by package-relative file must
// name a JSON object under the directory holding the config. `os build`
// refuses the same references before it carries the documents into the
// artifact, where an installed copy has no package directory to read.
const connectorSpecs = collectConnectorSpecFiles(absolutePath, result.data as Record<string, unknown>);
if (connectorSpecs.issues.length > 0) {
if (flags.json) {
await emitJson({
valid: false,
errors: connectorSpecs.issues,
warnings: warningsSoFar(),
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
console.log('');
printError(`Connector spec file validation failed (${connectorSpecs.issues.length} issue${connectorSpecs.issues.length > 1 ? 's' : ''})`);
for (const issue of connectorSpecs.issues) console.log(chalk.red(` ✗ ${issue.location}: ${issue.message}`));
this.exit(1);
}
// 3d-bis. [#27259] Seed record VALUES — each value a seed record writes,
// judged by the insert write's own value verdict
// (`validateInsertValues`, `@objectstack/objectql`), so a value the
// seed load refuses (a currency written `{ value, currency }`) is
// refused here with the load's code and sentence. ⛔ One judge: the
// helper owns only the walk (`utils/seed-record-values.ts`). `os build`
// runs the same call before it bundles the seed files.
const seedValueIssues = judgeSeedRecordValues(result.data as Record<string, unknown>);
if (seedValueIssues.length > 0) {
if (flags.json) {
await emitJson({
valid: false,
errors: seedValueIssues,
warnings: warningsSoFar(),
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
console.log('');
printError(`Seed record values the seed load refuses (${seedValueIssues.length} issue${seedValueIssues.length > 1 ? 's' : ''})`);
for (const issue of seedValueIssues) console.log(chalk.red(` ✗ ${issue.location}: ${issue.message} (${issue.code})`));
this.exit(1);
}
// 3e. ADR-0141 D2, author side — every `manifest.dependencies` range of
// the packages one install act would deliver, judged by the install's
// own predicate (`utils/dependency-range-check.ts`). An `error` is
// an entry the install refuses whatever the environment holds (an
// unreadable out-of-artifact range); the in-artifact findings the
// install admits ride `warningsSoFar()`. `os build` refuses the same
// errors at the same step.
const dependencyRanges = checkDependencyRanges(result.data);
const dependencyRangeErrors = dependencyRanges.filter((d) => d.severity === 'error');
dependencyRangeWarnings = dependencyRanges.filter((d) => d.severity !== 'error');
if (dependencyRangeErrors.length > 0) {
if (flags.json) {
await emitJson({
valid: false,
errors: dependencyRangeErrors,
warnings: warningsSoFar(),
conversions: conversionNotices,
duration: timer.elapsed(),
});
this.exit(1);
}
console.log('');
printError(
`Dependency range check failed (${dependencyRangeErrors.length} issue${dependencyRangeErrors.length > 1 ? 's' : ''})`
+ ' — the install refuses every one of these',
);
for (const d of dependencyRangeErrors) console.log(chalk.red(` ✗ ${formatDependencyRangeDiagnostic(d)}`));
this.exit(1);
}
if (dependencyRangeWarnings.length > 0 && !flags.json) {
console.log('');
printWarning(
`Dependency ranges inside this artifact the install does not judge (${dependencyRangeWarnings.length})`
+ ' — a package the same artifact delivers is checked for presence only',
);
printBulletList(dependencyRangeWarnings.map(formatDependencyRangeDiagnostic), { noun: 'dependency-range diagnostic' });
}
// 4. Collect and display stats
const stats = collectMetadataStats(config);
// Protocol drift advisory (non-blocking): if the installed platform is a
// newer major than the app's declared `engines.protocol` range admits,
// point at the migration guide.
const protocolGap = checkProtocolVersionGap(config.manifest);
// The minor-resolution half of the same question. `protocolGap` is null