Skip to content

test(media): remove personal transcript dependency from unit suite #641

Closed

Description

@Juliusolsson05

Summary

The unit suite is not self-contained: imageAttachment.test.ts requires a personal Claude transcript at an absolute path under ~/.claude/projects. When that local corpus file is absent, the repository-wide test command fails even though the checked-in fixture and implementation are unchanged.

Impact

A clean checkout or worktree can report a red full suite for reasons unrelated to its diff. This weakens CI/local verification because contributors must distinguish product regressions from unavailable private corpus data.

Expected behavior

Checked-in automated tests either use repository-owned fixtures or skip/report external corpus validation explicitly when the referenced source session is unavailable.

Actual behavior

The corpus-wide invariant calls existsSync on the absolute source-session path and fails when this file is missing:

/Users/juliusolsson/.claude/projects/-Users-juliusolsson-Desktop-Development-klay/c0c60d3d-681f-4457-b5c8-bf58745625de.jsonl

Reproduction

  1. Ensure the cited personal transcript is absent.
  2. Run NODE_ENV=test npx vitest run --project unit src/providers/shared/renderer/protocols/media/imageAttachment.test.ts.
  3. Observe atp-codex-image-inside-claude-transcript cites a missing session.

Environment

  • Branch: unchanged main at 116aecc9
  • Platform: macOS
  • Observed: 2026-08-26
  • Vitest project: unit

Resolution conditions

The media fixture contract remains traceable without making the ordinary unit suite depend on one developer's private filesystem. The intended corpus-audit behavior and its unavailable-data behavior are both covered.

Relationships

Discovered while verifying the managed personal skills feature. That feature does not touch the media protocol, fixture census, or transcript corpus.

Activity

  1. Juliusolsson05 commented on Sep 20, 2026

    @Juliusolsson05
    OwnerAuthor

    Fixed by PR #1084 (3c40d415, 2b79c146, c1370041, 897ea538) and never closed.

    imageAttachment.test.ts no longer imports homedir or existsSync at all. The deterministic tier now asserts only self-contained properties — malformedCitations(allFixtures()) is empty, every fixture has a census row and a proves line, the citation is a well-formed path:line, and the corpus count is pinned — so it cannot fail because of what is or is not in one developer's provider history.

    The traceability half moved behind an opt-in: imageAttachment.live.test.ts, gated by AGENT_CODE_LIVE_IMAGE_CORPUS=1 through describe.skipIf, with **/*.live.test.ts excluded from the unit project and npm run test:live:image-corpus as the entry point.

    The part worth recording, because it is the subtler half of this bug: c1370041 changed unreachableCitations to match on provider directory segments rather than the extractor's own home. Without that, the live suite would have passed vacuously on every machine except the one that wrote the fixtures — which is worse than not having it, since a green run would have meant nothing. imageAttachment.test.ts:267-277 now pins that property deterministically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions