Skip to content

Eight more silent 50-entry truncations in the CLI's build / validate / init printers #11642

Description

@os-zhuang

Found while fixing #11529, which was scoped by triage to the build author-time warning printer alone ("widening beyond that is not asked for"). The same silent cut exists at eight other call sites in packages/cli, and none of them was in that card's scope.

The sites

All at origin/main commit 50fb191d, all .slice(0, 50) with no line naming the remainder:

filelinelistwhat happens after
packages/cli/src/commands/compile.ts235ruleErrorsexit 1
packages/cli/src/commands/compile.ts293unknownKeyFindingsadvisory, build continues
packages/cli/src/commands/compile.ts333access-matrix driftexit 1
packages/cli/src/commands/compile.ts360docErrorsexit 1
packages/cli/src/commands/validate.ts140ruleErrorsexit 1
packages/cli/src/commands/validate.ts212docErrorsexit 1
packages/cli/src/commands/init.ts893report.advisoriesscaffold continues
packages/cli/src/commands/init.ts908report.errors

Line 217 of compile.ts is the ninth, and is the one #11529 fixes.

Why this is not just bookkeeping

Two of these are the exact defect #11529 describes, on an advisory list that does not fail the command:

  • compile.ts:293 already prints the true total in its header — Undeclared authoring keys (N) — dropped at load (#3786) — and then shows at most 50. So the output states two numbers that disagree and explains neither, which is the shape objectstack build / validate print at most 50 author-time warnings and drop the rest with no notice #11529 measured on hotcrm. These are keys that drop silently on the way to storage; an author past the cut ships metadata with the key quietly gone.
  • init.ts:893 is a scaffold-time advisory list with the same silent cut.

The six error-path sites are a weaker but real case. The code's own comment at validate.ts:126 gives the rationale the truncation undercuts:

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.

A 50-entry cut with no notice restores a smaller version of that: past 50 the author cannot see how deep the hole goes, and each round of fixes reveals a new batch that reads as fresh breakage.

Suggested shape

#11529 lands printAuthoringAdvisories in packages/cli/src/utils/format.ts, which prints a list and then names the remainder when it cut one. Whatever is decided here, the mechanism already exists in the package and these sites can adopt it rather than growing a second concept. Deliberately not proposed: new flags, verbosity tiers or paging — #11529's triage ruled that out for the warning printer and the same reasoning applies.

Not filed as a sub-issue of #11529: these sites sit outside the scope that card completes, rather than inside it.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions