# Issue 7858 evidence

Issue: [#7858](https://git.cafe/pingdotgg/t3code/issues/7858).

Final verified commit: [5988add33e](https://git.cafe/pingdotgg/t3code/commit/5988add33e72f1de862e7006b01535fd755136b3), full SHA `5988add33e72f1de862e7006b01535fd755136b3`.
Base: [3b95e7831b](https://git.cafe/pingdotgg/t3code/commit/3b95e7831b).
Original implementation: [31605ffd80](https://git.cafe/pingdotgg/t3code/commit/31605ffd80).
Branch: `fix/issue-7858`. Worktree was clean before and after final verification.

## Public artifacts

- [Historical red regression log](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/1b7653975ce75093/red.log). Supplied `/tmp/issue7858-red-lead.log`, sanitized path only; not represented as a fresh red run. Two failures: 284 sessions instead of 142; partial scan cost 17 instead of 13.
- [Paired runtime transcript, full summaries and merge outputs](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/31f6edcce7d2a33d/paired-runtime-transcript.txt). Includes actual final commands/results, frozen synthetic inputs, baseline output, repaired output, controls and provenance.
- [Rebuildable temporary runtime fixture](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/28a0a00a30777e5d/runtime-fixture.ts.txt).
- [Temporary test configuration](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/3b2037cb05078962/runtime-config.ts.txt).

## What ran

Linux execution only. Production `UsageService`, transcript reader, fixed pricing and `mergeUsage` read synthetic JSONL records. Two scans read one backing directory, the second through a `.claude/projects` symlink. A real mountinfo read is redirected to an explicit synthetic WSL2 fixture; other readFile calls forward to Node's actual callback filesystem implementation. All non-Claude sources are pinned to empty fixture directories and asserted to scan zero files.

The Windows identity is a **win32 identity fixture**, not a native Windows run: Windows path, volume and hostname are fixture metadata; production `physicalSourceIdOf` generates its identity. Production `UsageService/readPhysicalSourceId` generates WSL's equal identity from the synthetic drvfs mountinfo and real directory names. Paths and volume IDs differ on purpose. The raw Linux service summaries and the explicitly transformed OS identity views are both preserved in the transcript.

Frozen clock: `2026-08-02T12:00:00Z`; timezone UTC. Three records, two sessions, 30 input tokens, 90 output tokens. Fixed input rate $0.00001/token, output rate $0.00005/token.

Same summaries, base production merge versus repaired production merge:

- Before: 4 sessions, 6 records, 240 tokens, $0.0096.
- Windows-only: 2 sessions, 3 records, 120 tokens, $0.0048.
- WSL-only: 2 sessions, 3 records, 120 tokens, $0.0048.
- Combined after: 2 sessions, 3 records, 120 tokens, $0.0048.
- Combined owner: `windows-fixture` (equal read timestamps); duplicate: `wsl-fixture` source.
- Daily cell, August 1: 120 tokens, $0.0048.
- Hourly cell, 10:00 UTC: 30 tokens, $0.0011.
- Hourly cell, 11:00 UTC: 90 tokens, $0.0037.
- Shared generated physicalSourceId: `dc0045e51909321dc97830d9ad69970b`.

Baseline merge implementation was copied verbatim with `git show 3b95e7831b:packages/shared/src/usageMerge.ts`, then called on the exact same generated summaries. It was not recreated in the harness. This comparison proves the merge behavior, while the separate service scans prove parsing and generation. The old replay without physicalSourceId is not used to claim a fix. The old real-server scan is not cross-OS proof and is not uploaded.

## Controls

- Native Linux additive: actual production scan of a separate synthetic native directory; no physicalSourceId. Combined: 4 sessions, 6 records, 240 tokens, $0.0096; no duplicates.
- Separate desktop scope additive: generated different identity; same additive totals.
- Different hostname, legitimate physical match: 2 sessions, 3 records, 120 tokens, $0.0048.
- Provider isolation: identical physical identity with different provider fixture remains additive (4 sessions, 6 records, 240 tokens, $0.0096).
- Missing identity legacy dedupe: same legacy fingerprint with identity omitted still counts once.
- Newer partial scan supplements: a real additional record creates a new hour, partial status and omitted old hour are explicit fixture inputs. Merge retains the complete old hour and adds the new one: 3 sessions, 4 records, 180 tokens, $0.0074. Both environments contribute. Existing merge regression test also covers separate daily cells and both orderings.
- Custom drvfs root contains spaces; case input differs from on-disk names. Generated identity still matches. WSL1 drvfs and WSL2 9p formats both generate the same identity. Shadow ext4 mount and native Linux return no identity.
- Missing directory → created directory: committed UsageService regression test passes. It calls the real service twice, creates the missing directory between reads, and verifies identity appears. It simulates win32 platform inputs on Linux; it is not a native Windows result.
- Desktop lifecycle: committed configuration service tests pass. They resolve primary and WSL configurations with one scope, check WSLENV forwarding, rebuild the configuration service against the same saved directory, and assert the persisted scope survives. A separate test checks preexisting WSLENV entries and flags are preserved. This is a Linux service harness with simulated win32 inputs, not an Electron launch.

## Commands and results

```sh
vp test run packages/shared/src/usageMerge.test.ts apps/server/src/usage/usageTranscriptReader.test.ts apps/server/src/usage/UsageService.test.ts apps/desktop/src/backend/DesktopBackendConfiguration.test.ts
# 4 files passed; 93 tests passed; 22.61 seconds

vp test run --config /tmp/issue7858-proof/vite.config.ts
# 1 runtime matrix test passed; 5.77 seconds

git rev-parse HEAD
# 5988add33e72f1de862e7006b01535fd755136b3

git status --short
# empty
```

The fixture's assertions verify the metrics; the transcript includes raw outputs rather than only a success statement. Floating point JSON can spell $0.0048 as `0.0048000000000000004`.

## Rebuilding

Use the final verified commit with dependencies installed. Download the fixture and config to `/tmp/issue7858-proof/runtime.test.ts` and `/tmp/issue7858-proof/vite.config.ts`. Replace the sanitized `/workspace/issue-7858` prefix in those two files with your checkout's absolute path. Symlink `/tmp/issue7858-proof/node_modules` to that checkout's `apps/server/node_modules`. From the checkout:

```sh
git show 3b95e7831b:packages/shared/src/usageMerge.ts > /tmp/issue7858-proof/base-usageMerge.ts
vp test run --config /tmp/issue7858-proof/vite.config.ts
```

Output is `/tmp/issue7858-proof/runtime.json`. The fixed fixture clock, transcripts, mountinfo, scopes and pricing are embedded in the downloadable fixture. It cleans up its synthetic input directories.

Existing committed regression tests rebuild the focused control proofs, but do not emit this complete paired runtime matrix. The extra fixture/config above are required to rebuild that exact transcript. No repository edits or commits were made by the test agent. A lead commit is only needed if maintainers want this optional additional runtime harness maintained in the repository; it is currently a public rebuildable evidence artifact, not committed scratch material.

## Scope and gaps

VISUAL MATRIX `[]`. No render implementation changed; no screenshots or recordings, and no visible differences expected. Source changes since base are confined to usage contracts, identity/merge, desktop backend configuration and focused tests. The repair commit adds recovery after a missing directory appears, desktop scope-directory initialization, test/cache isolation and source-alias consistency. The test agent changed no implementation.

Unverified natively: Windows realpath/on-disk casing and volume identity; actual WSL1/WSL2 mount output; actual desktop process spawning/restart. These are simulated inputs or focused service tests on Linux. No native cross-OS or native desktop end-to-end claim is made.

No browsers, dev servers, commits, pushes, merges, PR writes or issue writes. Only ghdrop uploads. No credentials, private transcript data or startup logs uploaded. Public artifacts were reviewed and checked against ambient secret values and common secret patterns before upload. No PR exists or was monitored.

FRICTION: model — temporary harness clock and filesystem-spy setup required correction; sanitization caught an ambient default provider path, after which all provider directories were pinned to synthetic state and zero non-Claude scans were asserted. Final proof passed; no product failure found.

## SHA-256

- red.log: `aba4ce59b3a3214b34ae3beb219049ac6e74f9db02cf4596f2741740e9a84edd`
- paired-runtime-transcript.txt: `cc88efe2543741f145cc7e6fd6f7a1ce511aa6947e28cd0648e6286b0f4e1449`
- runtime-fixture.ts.txt: `5a664f1c14bd6bea087efea57924b3b6d40261704adb23877c00c0196ecd2be2`
- runtime-config.ts.txt: `504919ede41990c15afad07d65a4ee1841937fe8073415bab1ae1f858a73dcda`
