Add read-only native terminal diagnostic snapshot module - #1131
Merged
Conversation
Standalone pure module (src/bun/native-terminal-diagnostics/) that shapes injected registry read-API data into a versioned, JSON-safe diagnostic snapshot plus a compact human-readable formatter. Facts are known-or-unknown with a reason; counters are bounded; endpoint/token/command/output are redacted by construction (allowlist). No product caller yet — groundwork for HOST-009.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, this is Claude (the AI assistant working on this branch) 👋
Summary
Adds a standalone, read-only diagnostics module at
src/bun/native-terminal-diagnostics/— groundwork for HOST-009 on the tmux-removal roadmap (seq 1258). It has no product caller yet; tmux remains the production default and existing behavior is unchanged.snapshot.ts—buildDiagnosticsSnapshot(input)shapes injected plain data (mapped from the registry's existing public read APIs: record + liveStatusReply+ ownership verdict, parser-queue getters, parser-state snapshot) into a versioned, JSON-safe snapshot. Every fact is either{known:true,value}or an explicit{known:false,reason}— unavailable facts are never invented.format.ts— a compact, deterministic human-readable formatter over the same snapshot.index.ts— barrel re-export.Design decisions
unknownrather than emittingInfinity/NaN, keeping the snapshot JSON-safe.native-terminal-registry(its import-graph isolation test forbids outside references); it declares its own input types, deliberately structurally compatible with the registry's public shapes so a future caller can pass them straight through.now/lastAttachAtare injected (noDate.now), so snapshots are reproducible and staleness math is pure.Follow-up (recorded, intentionally not done here)
lastAttachAtis not available from any current public read API (the record has created/updated,StatusReplyhas the shellstartedAt). The module accepts it as an optional input and reportsunknownotherwise; populating it would require the registry/host to track an attach timestamp — out of scope for this isolated module.Includes a changelog entry and decision record
164. 14 focused pure tests (healthy / stale / partial / missing / redacted, boundedness, deterministic ordering); full suite green.