fix(slice-05): BundleInspector provenance + compatibility render tests (guard B1 repair on 1b9f15ee) (OPR.0.3.2.5)

Repairs guard BLOCKING-CONCERN B1 on qitem-20260518213433-9342533e /
1b9f15ee: my prior handoff body claimed BundleInspector had no
existing .test.tsx and that adding one would require a new
QueryClient harness — both claims were false. The file is at
packages/ui/test/bundle-inspector.test.tsx and already uses the
QueryClient + fetchMock harness pattern. Guard discriminator
showed: disabling both new provenance/compatibility render gates
still passed 7/7 focused tests, proving the new render paths were
silently uncovered.

This is the SECOND lazy-claim incident in two consecutive checkpoints
(prior B2 on f7c5a477 was identical class: claimed bundlePath
assertions that didn't exist). The internalization of the banked
addendum needs reinforcement: BEFORE making claims about test
existence in a handoff body, actually grep with multiple casing/
separator patterns (kebab-case, snake_case, camelCase) AND confirm
by listing the test directory. A naive case-sensitive find for
"*BundleInspector*" misses "bundle-inspector.test.tsx" entirely.

Fix applied (mirrors guard's fix recipe):
- packages/ui/test/bundle-inspector.test.tsx: 3 new tests added to
  the existing BundleInspector describe block:
  - "renders provenance block with all fields when manifest carries
    provenance": fetchMock response with all 8 Item-1 provenance
    fields; asserts provenance-block testid + per-field testids/text
    for createdAt, sourceHost, authorSession, sourceRigName+
    sourceRigId, daemonVersion+cliVersion versions line, notes
  - "renders compatibility block with all fields when manifest
    carries compatibility": fetchMock response with all 3 Item-2
    compatibility fields; asserts compatibility-block + per-field
    testids/text for minDaemonVersion, minCliVersion, schemaVersion
  - "does NOT render provenance or compatibility blocks when manifest
    omits them (backward compat)": reuses INSPECT_RESPONSE (no
    blocks); asserts manifest-summary renders + provenance-block
    and compatibility-block are NOT in DOM (queryByTestId is null)

Verified locally:
- 10/10 bundle-inspector focused suite green (was 7/7 in guard's
  baseline; +3 new tests)
- Discriminator confirmed: changing both render gates from
  result.manifest.provenance / result.manifest.compatibility to
  false && result.manifest.provenance / false && result.manifest.
  compatibility causes 2/10 tests to fail (provenance render + compat
  render specifically); backward-compat test stays green (correctly
  asserts non-presence which non-rendering also satisfies);
  restoring returns 10/10
- packages/ui typecheck unchanged from prior commit
- Coherence + audit-every-layer unchanged

Pre-commit discipline applied: git diff --cached --stat verified
+99/0 on the one test file BEFORE commit.

Diff: 1 file, +99 / 0 lines. No source files modified.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This commit is contained in:
mvschwarzandClaude Opus 4.7 committed 2026-05-18 14:36:48 -07:00
1 parent 1b9f15ee91
commit f8bf875c84
1 file changed
+99
@@ -117,6 +117,105 @@ describe("BundleInspector", () => {
});
});
// Item 5 / slice-05 Checkpoint 6.1 / guard B1 repair: provenance block renders
// when manifest carries it. Discriminator: false && result.manifest.provenance
// gate must fail this test.
it("renders provenance block with all fields when manifest carries provenance", async () => {
const responseWithProvenance = {
manifest: {
name: "with-prov",
version: "0.1.0",
rigSpec: "rig.yaml",
packages: [{ name: "pkg", version: "1.0", path: "packages/pkg" }],
provenance: {
createdAt: "2026-05-18T12:00:00Z",
sourceHost: "test-host.local",
authorSession: "velocity-driver@openrig-velocity",
sourceRigId: "01H000000000000000PROV001",
sourceRigName: "openrig-velocity",
daemonVersion: "0.3.2",
cliVersion: "0.3.2",
notes: "fixture for B1 repair",
},
},
digestValid: true,
integrityResult: { passed: true, mismatches: [], missing: [], extra: [], errors: [] },
};
fetchMock.mockResolvedValueOnce({ ok: true, json: async () => responseWithProvenance });
const qc = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
render(<QueryClientProvider client={qc}><BundleInspector /></QueryClientProvider>);
act(() => { fireEvent.change(screen.getByTestId("bundle-path-input"), { target: { value: "/tmp/with-prov.rigbundle" } }); });
act(() => { fireEvent.click(screen.getByTestId("inspect-btn")); });
await waitFor(() => {
expect(screen.getByTestId("provenance-block")).toBeTruthy();
expect(screen.getByTestId("provenance-createdAt").textContent).toContain("2026-05-18T12:00:00Z");
expect(screen.getByTestId("provenance-sourceHost").textContent).toContain("test-host.local");
expect(screen.getByTestId("provenance-authorSession").textContent).toContain("velocity-driver@openrig-velocity");
expect(screen.getByTestId("provenance-sourceRigName").textContent).toContain("openrig-velocity");
expect(screen.getByTestId("provenance-sourceRigName").textContent).toContain("01H000000000000000PROV001");
expect(screen.getByTestId("provenance-versions").textContent).toContain("daemon 0.3.2");
expect(screen.getByTestId("provenance-versions").textContent).toContain("cli 0.3.2");
expect(screen.getByTestId("provenance-notes").textContent).toContain("fixture for B1 repair");
});
});
// Item 5 / slice-05 Checkpoint 6.1 / guard B1 repair: compatibility block renders
// when manifest carries it. Discriminator: false && result.manifest.compatibility
// gate must fail this test.
it("renders compatibility block with all fields when manifest carries compatibility", async () => {
const responseWithCompat = {
manifest: {
name: "with-compat",
version: "0.1.0",
rigSpec: "rig.yaml",
packages: [{ name: "pkg", version: "1.0", path: "packages/pkg" }],
compatibility: {
minDaemonVersion: "0.3.2",
minCliVersion: "0.3.2",
schemaVersion: 1,
},
},
digestValid: true,
integrityResult: { passed: true, mismatches: [], missing: [], extra: [], errors: [] },
};
fetchMock.mockResolvedValueOnce({ ok: true, json: async () => responseWithCompat });
const qc = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
render(<QueryClientProvider client={qc}><BundleInspector /></QueryClientProvider>);
act(() => { fireEvent.change(screen.getByTestId("bundle-path-input"), { target: { value: "/tmp/with-compat.rigbundle" } }); });
act(() => { fireEvent.click(screen.getByTestId("inspect-btn")); });
await waitFor(() => {
expect(screen.getByTestId("compatibility-block")).toBeTruthy();
expect(screen.getByTestId("compatibility-minDaemonVersion").textContent).toContain("0.3.2");
expect(screen.getByTestId("compatibility-minCliVersion").textContent).toContain("0.3.2");
expect(screen.getByTestId("compatibility-schemaVersion").textContent).toContain("v1");
});
});
// Item 5 / slice-05 Checkpoint 6.1 / guard B1 repair: backward-compat — bundle
// without provenance or compatibility blocks does NOT render those sections.
// Pre-Item-1/Item-2 bundles install/inspect unchanged.
it("does NOT render provenance or compatibility blocks when manifest omits them (backward compat)", async () => {
// INSPECT_RESPONSE has no provenance + no compatibility — reuse it
fetchMock.mockResolvedValueOnce({ ok: true, json: async () => INSPECT_RESPONSE });
const qc = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
render(<QueryClientProvider client={qc}><BundleInspector /></QueryClientProvider>);
act(() => { fireEvent.change(screen.getByTestId("bundle-path-input"), { target: { value: "/tmp/bc.rigbundle" } }); });
act(() => { fireEvent.click(screen.getByTestId("inspect-btn")); });
await waitFor(() => {
// Manifest summary still renders (regression baseline)
expect(screen.getByTestId("manifest-summary")).toBeTruthy();
});
// New blocks must NOT be present
expect(screen.queryByTestId("provenance-block")).toBeNull();
expect(screen.queryByTestId("compatibility-block")).toBeNull();
});
// T6: Error state
it("shows error on inspect failure", async () => {
fetchMock.mockRejectedValueOnce(new Error("network error"));