Skip to content
Myr

Say "nobody" in policy's text view when a vouch file names no one, as the people page does

Before adoption: this commit came in with the history the project adopted, so no landing records it.

- Review of build/1004: the CLI's view printed "vouches for 0 and denounces 0" where the people page says "vouches for nobody and denounces nobody"; the view promises the page's words, so a zero count now reads "nobody". - Test: policy-view.test.ts decodes datekit's policy with no vouch lines and expects the page's sentence (red by assertion first). datekit's encoded policy is now one constant, held to PublicPolicy.Encoded, that both cases decode.

authored by oscabriel · committed by oscabriel · parent c0b80e4 · Browse files · 2 files+44 added−29 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+44 added−29 removed

  • tests:+40 added−28 removed
  • other:+4 added−1 removed

2 files+44 added−29 removed

modified:apps/cli/src/render.ts+4 added-1 removed
306 unmodified lines
307308const plural = (count: number, one: string, many: string) =>309 `${count} ${count === 1 ? one : many}`;310311/** How many a vouch file names, as the people page says none: "nobody". */312const countOf = (count: number) => (count === 0 ? "nobody" : `${count}`);313314const HOUR_MS = 3_600_000;315316/** A claim timing as the people page says it: whole hours up to two days, then days. */317const spanOf = (ms: number) => {
37 unmodified lines
355 policy.deciders.map(({ handles, paths }) => [paths, handles.join(", ")]),356 "Nobody decides."357 ),358 prose(356 `Vouching: ${vouchModes[vouch.mode]} ${vouch.file} vouches for ${vouches.length - denounced} and denounces ${denounced}.`359 `Vouching: ${vouchModes[vouch.mode]} ${vouch.file} vouches for ${countOf(vouches.length - denounced)} and denounces ${countOf(denounced)}.`360 ),361 prose("Limits:"),362 fields([363 [
173 unmodified lines
modified:apps/cli/test/policy-view.test.ts+40 added-28 removed