Repository navigation
CLI: chtypes prune removes superseded builds of a line from a cache #494
Description
Activity
- addedenhancementNew feature or requestNew feature or request
on Oct 6, 2026 Planned after 2.0.0, as a 2.1.0 candidate. This is additive: binding-level API or CLI, no ABI change. The v2 lock freezes the ABI fingerprint, not the binding surface, so additions like this ship as 2.x minor releases, as 1.1.0 did for 1.x. It stays off the 2.0.0 critical path.
- addedv2-pre-lockMust land before the v2 ABI lock (it may reveal an ABI need)Must land before the v2 ABI lock (it may reveal an ABI need)and removed
on Oct 9, 2026 Correction: this moves BEFORE the v2 lock. It is no longer a 2.1.0 candidate. The rule now: every applicable item lands before the ABI locks, even one that looks ABI-neutral, because doing it can reveal an ABI need (a fetch-only call may want a C-ABI entry or argument). It is scheduled after the registry-lock fix (#491) and the production fetch channel, which touch the same code.
Done in #609 (merged into
v2at 98f0ba4). Every CLI now haschtypes prune [--line L] [--keep N] [--dry-run] [--cache] [--strict]. For each line, it removes the builds that newer verified builds of that line supersede and keeps the newest N (default 1). It removes each build's unpacked entry, its record, its blobs and itsindex.jsonentry together.- stdout:
pruned <version> <platform> <dir>per build. A dry run printswould-prune …; a build something holds printsin-use …and is kept. - stderr: the summary,
chtypes: pruned|would prune <n> build(s) under <root>. - In-use safety: the cache had no in-use signal, so v2: a fetch-only registry call (#492), chtypes resolve (#493) and chtypes prune (#494), in all four bindings #609 adds one, the same in all four bindings (fetch guide §1, "In use"). A registry takes
flock(LOCK_SH)on an entry'sverified.jsonfor every build it opens or fetches, and keeps it until the process exits. Prune takesflock(LOCK_EX|LOCK_NB)and keeps any build it can't lock. Builds fetched withchtypes fetchalone are not held. - It never touches another fingerprint's or another channel's records.
The shared cases
prune-{keep-newest, keep-two, line, dry-run, in-use, system-dirs-never, foreign-fingerprint-untouched, v1-channel-sees-all}are in both corpora and pass in all four bindings. Go also has a cross-process test. Follow-up: #610, one retry bound for theindex.jsonrewrite. It ships in the next 2.0.0-dev release.- stdout:
Ask (from a downstream consumer).
chtypes prune [--line <line>] [--keep N] [--dry-run]in every binding's CLI. It removes builds of a line that a newer verified build of the same line supersedes, keeping the newest N (default 1).index.jsonentry, consistently.jqonindex.jsonplusrm), which is exactly the kind of out-of-SDK layout knowledge that drifts.--dry-runprints what would go;🤖 Generated with Claude Code