Repository navigation
add by tag reports success when block downloads fail #6084
Description
Describe the bug
hyperframes add <tag> --json returns ok: true and exits 0 even when every block download fails. It also reports success when only some blocks install. Scripts and coding agents therefore cannot use either the JSON status or exit code to detect an incomplete installation, and JSON mode drops the individual failure reasons.
Minimal reproduction
From a built repository checkout, save this as repro-tag.mjs in the repository root:
import "./packages/cli/scripts/test-home.mjs";
import { mkdtempSync, writeFileSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
process.env.HYPERFRAMES_NO_TELEMETRY = "1";
const project = mkdtempSync(join(tmpdir(), "hf-tag-repro-"));
process.once("exit", () => rmSync(project, { recursive: true, force: true }));
writeFileSync(join(project, "hyperframes.json"), JSON.stringify({
registry: "https://tag-repro.example.com/registry",
paths: { blocks: "compositions", components: "components", assets: "assets" },
}));
// Valid registry metadata, followed by a missing HTML payload.
globalThis.fetch = async (input) => {
const path = new URL(input).pathname;
if (path.endsWith("/registry.json")) return Response.json({
name: "repro", homepage: "https://example.com",
items: [{ name: "broken", type: "hyperframes:block" }],
});
if (path.endsWith("/blocks/broken/registry-item.json")) return Response.json({
name: "broken", type: "hyperframes:block", title: "Broken", description: "Repro",
tags: ["sample-tag"], dimensions: { width: 1920, height: 1080 }, duration: 3,
files: [{ path: "broken.html", target: "compositions/broken.html", type: "hyperframes:composition" }],
});
return new Response("not found", { status: 404 });
};
process.argv = ["bun", "hyperframes", "add", "sample-tag", "--dir", project, "--json", "--no-clipboard"];
await import("./packages/cli/src/cli.ts");The fixture supplies valid registry metadata and an HTTP 404 for the block's HTML. Only HTTP responses are synthetic: CLI dispatch, tag resolution, downloading, filesystem writes and process exit handling are the real implementation. The repository's test-home helper and a temporary project keep cache/config/project writes isolated. No network or clipboard access is needed.
Steps to reproduce
- Use main at
10c724bf555f8355199bd89db1a02fc159909dc9(version 0.8.186) with the repository dependencies and packages built. - Run
bun repro-tag.mjsand inspect the process exit status.
Expected behavior
The command exits nonzero and reports ok: false, identifying the failed block and the HTTP 404 cause. When some blocks install, it retains those successful files and still reports the failures.
Actual behavior
Exit code: 0. No block HTML is installed. Stdout:
{"ok":true,"tag":"sample-tag","installed":[],"warnings":[]}With one failed and one successful block, the process still exits 0 with ok: true; only the successful item appears in installed.
Environment
- Hyperframes CLI 0.8.186; current-main base
10c724bf555f8355199bd89db1a02fc159909dc9. - Linux x86_64, Node 26.11.1, Bun 1.4.1, Citty 0.2.2. The repository pins Bun 1.4.4; the reproduction and tests used the already-installed 1.4.1.
- Reproduced through
packages/cli/src/cli.ts, including its real process exit boundary. - Full workspace build/typecheck is limited by missing installed inspector/AWS dependencies; focused command/installer/resolver tests run successfully. No packages were installed for this investigation.
Additional context
The tag loop catches each installation error, suppresses it in JSON mode, then calls tagAddJson, which always returns ok: true. No failure reaches the root command boundary.
#4432 preserves warnings from successful installs; #648 and open #5256 concern manifest refresh during discovery. This failure happens after discovery, while installing files. I have a focused fix prepared that preserves successful installs and reports each failure.
Activity