[PR #7455] [CLOSED] test(apple): give the inventory fixture a root entry kind that matches its format #7848

Closed
opened 2026-11-05 01:48:06 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7455
Author: @XiaoBinGan
Created: 10/27/2026
Status: ❌ Closed

Base: main ← Head: fix/apple-fixture-root-entry-kind


📝 Commits (1)

  • 87eb840 test(apple): give the inventory fixture a root entry kind that matches its format

📊 Changes

1 file changed (+10 additions, -1 deletions)

View changed files

📝 src/domain/apple/appleApplication.test.ts (+10 -1)

📄 Description

Summary

Eight cases in src/domain/apple/appleApplication.test.ts fail on main inside parseArtifactInventoryEvidence with "Artifact root occurrence does not match its manifest representation". The cause is the test's own fixture: it always writes "file" as the root occurrence's entry kind, even when it builds the inventory with rootFormat = "directory", and d1c88fab1 added a reader check that rejects exactly that contradiction.

Problem and expected behavior

d1c88fab1 (fix(artifacts): validate partial inventory root identity) added to validateInventoryPage:

if (
  occurrence.artifact_id !== manifest.root_artifact_id ||
  occurrence.artifact_format !== manifest.root_format ||
  occurrence.parent_occurrence_id !== null ||
  occurrence.entry_kind !==
    (manifest.root_format === "directory" ? "directory" : "file")
)
  throw new ArtifactInventoryValidationError(
    "Artifact root occurrence does not match its manifest representation",
  );

The pure-projection fixture in the test builds the root occurrence with a hard-coded kind:

const nodes = new Map([[rootId, node(rootSha, rootFormat)]]);
const occurrences = [occurrence(".", "file", rootId, rootFormat)];

Every call with rootFormat = "directory" therefore produces an inventory the reader must reject, and the projection under test never runs.

Measured on a clean checkout of upstream/main:

src/domain/apple/appleApplication.test.ts
main as-is 8 failed, 31 passed
with this change 39 passed

This is a fixture defect, not a product one. src/artifacts/inventory/ArtifactGraphConstruction.ts derives the same field from the format, which is the value the reader now requires:

entry_kind: metadata.format === "directory" ? "directory" : "file",

Expected: the fixture's inventory satisfies the root-identity contract its own reader enforces. Actual: it declares a directory root as a file entry, so eight cases throw before projection.

Change and scope

One expression in the inventoryEvidence fixture helper, plus a two-line comment naming the invariant. The root occurrence's entry_kind now derives from rootFormat the way ArtifactGraphConstruction derives it. No assertion, expectation, production source, or other fixture changes.

Intentionally not included: the reader check itself. d1c88fab1 intends to reject a root whose declared kind contradicts its format, and production code cannot currently emit that shape, so relaxing the check would remove a real guard to accommodate a bad fixture.

Contract and boundary impact

  • Semantic owner and earliest changed stage: none in production. Only the test fixture that feeds parseArtifactInventoryEvidence changes; the reader and its consumers are untouched.
  • Contribution scope fit and linked maintainer decision: not applicable. Test-only correction of a fixture that no longer satisfies the contract its own reader enforces.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: the fixture now produces a root occurrence whose declared kind matches its manifest, which is what the contract requires; no claim in the assertions changes.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): none.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: the existing eight failing cases are the regression coverage — they exercise the root-identity contract through the projection and now pass. No new test was needed; the fixture was the defect.
  • Base reproduction or other evidence: on unmodified upstream/main, npx vitest run src/domain/apple/appleApplication.test.ts reports 8 failed | 31 passed (39), all eight with ArtifactInventoryValidationError: Artifact root occurrence does not match its manifest representation. With the fixture change, 39 passed.
  • User-visible CLI/MCP output (if applicable): none changed.
  • Remaining proof gaps: none for the invariant being restored. The production path was not re-measured beyond reading ArtifactGraphConstruction, because this change does not touch it.

For boundary fixes: not applicable. No filesystem, process, or provider boundary is involved.

For evidence-bearing changes: not applicable. No observed, derived, or inferred claim is added or altered; only a fixture's own consistency is corrected.

Validation performed

  • node node_modules/vitest/vitest.mjs run src/domain/apple/appleApplication.test.ts on upstream/main — 8 failed, 31 passed
  • node node_modules/vitest/vitest.mjs run src/domain/apple/appleApplication.test.ts with this change — 39 passed
  • node node_modules/vitest/vitest.mjs run --project domain with this change — 8637 passed, 0 failed
  • npx oxfmt --check src/domain/apple/appleApplication.test.ts — exit 0

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Test-only.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none. Test-only.

Author readiness

Human owner: @XiaoBinGan

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/7455 **Author:** [@XiaoBinGan](https://github.com/XiaoBinGan) **Created:** 10/27/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/apple-fixture-root-entry-kind` --- ### 📝 Commits (1) - [`87eb840`](https://github.com/morluto/rea/commit/87eb84010560e7d4b51d220f14400fa261ea6b93) test(apple): give the inventory fixture a root entry kind that matches its format ### 📊 Changes **1 file changed** (+10 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/apple/appleApplication.test.ts` (+10 -1) </details> ### 📄 Description ## Summary Eight cases in `src/domain/apple/appleApplication.test.ts` fail on `main` inside `parseArtifactInventoryEvidence` with "Artifact root occurrence does not match its manifest representation". The cause is the test's own fixture: it always writes `"file"` as the root occurrence's entry kind, even when it builds the inventory with `rootFormat = "directory"`, and `d1c88fab1` added a reader check that rejects exactly that contradiction. ## Problem and expected behavior `d1c88fab1` (*fix(artifacts): validate partial inventory root identity*) added to `validateInventoryPage`: ```ts if ( occurrence.artifact_id !== manifest.root_artifact_id || occurrence.artifact_format !== manifest.root_format || occurrence.parent_occurrence_id !== null || occurrence.entry_kind !== (manifest.root_format === "directory" ? "directory" : "file") ) throw new ArtifactInventoryValidationError( "Artifact root occurrence does not match its manifest representation", ); ``` The pure-projection fixture in the test builds the root occurrence with a hard-coded kind: ```ts const nodes = new Map([[rootId, node(rootSha, rootFormat)]]); const occurrences = [occurrence(".", "file", rootId, rootFormat)]; ``` Every call with `rootFormat = "directory"` therefore produces an inventory the reader must reject, and the projection under test never runs. Measured on a clean checkout of `upstream/main`: | | `src/domain/apple/appleApplication.test.ts` | | --- | --- | | `main` as-is | 8 failed, 31 passed | | with this change | 39 passed | This is a fixture defect, not a product one. `src/artifacts/inventory/ArtifactGraphConstruction.ts` derives the same field from the format, which is the value the reader now requires: ```ts entry_kind: metadata.format === "directory" ? "directory" : "file", ``` Expected: the fixture's inventory satisfies the root-identity contract its own reader enforces. Actual: it declares a directory root as a file entry, so eight cases throw before projection. ## Change and scope One expression in the `inventoryEvidence` fixture helper, plus a two-line comment naming the invariant. The root occurrence's `entry_kind` now derives from `rootFormat` the way `ArtifactGraphConstruction` derives it. No assertion, expectation, production source, or other fixture changes. Intentionally not included: the reader check itself. `d1c88fab1` intends to reject a root whose declared kind contradicts its format, and production code cannot currently emit that shape, so relaxing the check would remove a real guard to accommodate a bad fixture. ## Contract and boundary impact - Semantic owner and earliest changed stage: none in production. Only the test fixture that feeds `parseArtifactInventoryEvidence` changes; the reader and its consumers are untouched. - Contribution scope fit and linked maintainer decision: not applicable. Test-only correction of a fixture that no longer satisfies the contract its own reader enforces. - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: the fixture now produces a root occurrence whose declared kind matches its manifest, which is what the contract requires; no claim in the assertions changes. - Target selection, authority, upstream behavior, and cleanup details (if applicable): none. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none. Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible. - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: the existing eight failing cases are the regression coverage — they exercise the root-identity contract through the projection and now pass. No new test was needed; the fixture was the defect. - Base reproduction or other evidence: on unmodified `upstream/main`, `npx vitest run src/domain/apple/appleApplication.test.ts` reports `8 failed | 31 passed (39)`, all eight with `ArtifactInventoryValidationError: Artifact root occurrence does not match its manifest representation`. With the fixture change, `39 passed`. - User-visible CLI/MCP output (if applicable): none changed. - Remaining proof gaps: none for the invariant being restored. The production path was not re-measured beyond reading `ArtifactGraphConstruction`, because this change does not touch it. For boundary fixes: not applicable. No filesystem, process, or provider boundary is involved. For evidence-bearing changes: not applicable. No observed, derived, or inferred claim is added or altered; only a fixture's own consistency is corrected. ## Validation performed - `node node_modules/vitest/vitest.mjs run src/domain/apple/appleApplication.test.ts` on `upstream/main` — 8 failed, 31 passed - `node node_modules/vitest/vitest.mjs run src/domain/apple/appleApplication.test.ts` with this change — 39 passed - `node node_modules/vitest/vitest.mjs run --project domain` with this change — 8637 passed, 0 failed - `npx oxfmt --check src/domain/apple/appleApplication.test.ts` — exit 0 ## Compatibility, safety, and release - Breaking changes or migration steps: none. Test-only. - Real Hopper/Ghidra, browser, or OS coverage: not applicable. - Package or release metadata impact: none. - Security, privacy, process, or containment review: none. Test-only. ## Author readiness Human owner: @XiaoBinGan - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-05 01:48:06 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7848
No description provided.