{"file":"client/src/without.ts","version":318,"total":53,"from":1,"to":53,"lines":[{"n":1,"text":"// --without <version,...> on abso show and abso export: a version of shared with some earlier versions left out.","atom":"a2089","author":"candidates","version":186},{"n":2,"text":"// The server reads it; shared doesn't change. When a version kept builds on one left out, it is refused with","atom":"a2089","author":"candidates","version":186},{"n":3,"text":"// that chain and the wider set that works, which is never taken without being asked.","atom":"a2089","author":"candidates","version":186},{"n":4,"text":"","atom":"a2089","author":"candidates","version":186},{"n":5,"text":"import type { VersionRef, WithoutAnswer } from \"./api.ts\";","atom":"a2089","author":"candidates","version":186},{"n":6,"text":"import { type Parsed, str, UsageError } from \"./args.ts\";","atom":"a2089","author":"candidates","version":186},{"n":7,"text":"","atom":"a2089","author":"candidates","version":186},{"n":8,"text":"/** The versions --without names, sorted, or undefined without it. */","atom":"a2089","author":"candidates","version":186},{"n":9,"text":"export function withoutArg(args: Parsed): number[] | undefined {","atom":"a2089","author":"candidates","version":186},{"n":10,"text":"\tconst raw = str(args, \"without\");","atom":"a2089","author":"candidates","version":186},{"n":11,"text":"\tif (raw === undefined) return undefined;","atom":"a2089","author":"candidates","version":186},{"n":12,"text":"\tconst words = raw","atom":"a2089","author":"candidates","version":186},{"n":13,"text":"\t\t.split(\",\")","atom":"a2089","author":"candidates","version":186},{"n":14,"text":"\t\t.map((w) => w.trim())","atom":"a2089","author":"candidates","version":186},{"n":15,"text":"\t\t.filter((w) => w !== \"\");","atom":"a2089","author":"candidates","version":186},{"n":16,"text":"\tif (words.length === 0 || words.some((w) => !/^\\d+$/.test(w)))","atom":"a2089","author":"candidates","version":186},{"n":17,"text":"\t\tthrow new UsageError(`--without takes version numbers, like --without 37,38 (got ${JSON.stringify(raw)})`);","atom":"a2089","author":"candidates","version":186},{"n":18,"text":"\treturn [...new Set(words.map(Number))].toSorted((a, b) => a - b);","atom":"a2089","author":"candidates","version":186},{"n":19,"text":"}","atom":"a2089","author":"candidates","version":186},{"n":20,"text":"","atom":"a2089","author":"candidates","version":186},{"n":21,"text":"/** \"version 37\", \"versions 37 and 38\", \"versions 37, 38 and 40\". */","atom":"a2089","author":"candidates","version":186},{"n":22,"text":"export function versionsText(versions: readonly number[]): string {","atom":"a2089","author":"candidates","version":186},{"n":23,"text":"\tif (versions.length === 1) return `version ${versions[0]}`;","atom":"a2089","author":"candidates","version":186},{"n":24,"text":"\treturn `versions ${versions.slice(0, -1).join(\", \")} and ${versions[versions.length - 1]}`;","atom":"a2089","author":"candidates","version":186},{"n":25,"text":"}","atom":"a2089","author":"candidates","version":186},{"n":26,"text":"","atom":"a2089","author":"candidates","version":186},{"n":27,"text":"function ref(v: VersionRef): string {","atom":"a2089","author":"candidates","version":186},{"n":28,"text":"\treturn `  version ${v.version} by ${v.agent}: ${v.message}`;","atom":"a2089","author":"candidates","version":186},{"n":29,"text":"}","atom":"a2089","author":"candidates","version":186},{"n":30,"text":"","atom":"a2089","author":"candidates","version":186},{"n":31,"text":"/** The heading of an answer: the version and what it leaves out, one line each. */","atom":"a2089","author":"candidates","version":186},{"n":32,"text":"export function withoutHeading(answer: WithoutAnswer): string[] {","atom":"a2089","author":"candidates","version":186},{"n":33,"text":"\treturn [","atom":"a2089","author":"candidates","version":186},{"n":34,"text":"\t\t`Version ${answer.version} of shared without ${versionsText(answer.without.map((w) => w.version))}:`,","atom":"a2089","author":"candidates","version":186},{"n":35,"text":"\t\t...answer.without.map(ref),","atom":"a2089","author":"candidates","version":186},{"n":36,"text":"\t];","atom":"a2089","author":"candidates","version":186},{"n":37,"text":"}","atom":"a2089","author":"candidates","version":186},{"n":38,"text":"","atom":"a2089","author":"candidates","version":186},{"n":39,"text":"/** A refusal: which kept versions build on what is left out, and the ask that would work (`retry` writes it). */","atom":"a2089","author":"candidates","version":186},{"n":40,"text":"export function refusalText(","atom":"a2089","author":"candidates","version":186},{"n":41,"text":"\tanswer: Extract<WithoutAnswer, { ok: false }>,","atom":"a2089","author":"candidates","version":186},{"n":42,"text":"\tretry: (versions: readonly number[]) => string,","atom":"a2089","author":"candidates","version":186},{"n":43,"text":"): string {","atom":"a2089","author":"candidates","version":186},{"n":44,"text":"\tconst asked = answer.without.map((w) => w.version);","atom":"a2089","author":"candidates","version":186},{"n":45,"text":"\treturn [","atom":"a2089","author":"candidates","version":186},{"n":46,"text":"\t\t`Version ${answer.version} of shared can't leave out ${versionsText(asked)}: versions it keeps build on ${asked.length === 1 ? \"it\" : \"them\"}.`,","atom":"a2089","author":"candidates","version":186},{"n":47,"text":"\t\t...answer.dependents.flatMap((d) => [","atom":"a2089","author":"candidates","version":186},{"n":48,"text":"\t\t\tref(d),","atom":"a2089","author":"candidates","version":186},{"n":49,"text":"\t\t\t`    builds on ${d.needs.map((n) => `version ${n.version} (${n.files.join(\", \") || \"no file of its own\"})`).join(\", \")}`,","atom":"a2089","author":"candidates","version":186},{"n":50,"text":"\t\t]),","atom":"a2089","author":"candidates","version":186},{"n":51,"text":"\t\t`Leaving those out too works: ${retry(answer.suggestion)}`,","atom":"a2089","author":"candidates","version":186},{"n":52,"text":"\t].join(\"\\n\");","atom":"a2089","author":"candidates","version":186},{"n":53,"text":"}","atom":"a2089","author":"candidates","version":186}],"atoms":[{"atom":"a2089","author":"candidates","message":"","time":1792003597547,"timeIso":"2026-10-14T18:46:37.547Z","publish":{"draft":null,"version":186,"agent":"candidates","message":"Read a version of shared without some earlier versions: abso show <N> --without A,B shows what differs and abso export <dir> --version N --without A,B writes the files. The server's GET without?version=&versions= checks the set left exactly as asked: when a version it keeps builds on one left out, it refuses with that chain, the files and the wider set that works, and never widens it. Atoms keep their ids and authors; shared and its log don't change; the same ask gives the same tree hash.","time":1792004002371,"timeIso":"2026-10-14T18:53:22.371Z"}}]}