Skip to content

fix(cli): diagram in the canonical smoke matrix; scoped machine-output console redirect - #1655

Merged
Shashankss1205 merged 1 commit into
mainfrom
fix/diagram-inventory-console-leak
Aug 19, 2026
Merged

Shashankss1205 merged 1 commit into
mainfrom
fix/diagram-inventory-console-leak

Conversation

@Shashankss1205

Copy link
Copy Markdown
Collaborator

Follow-up to #1650: the canonical-CLI inventory test flagged cgc diagram as never smoke-run. Registering it exposed a genuine leak in the machine-output stderr redirect — Console.file's getter materializes the transient captured stream, so save/restore via the property pinned the helper console to a closed file and poisoned later in-process invocations. The redirect now saves/restores Console._file (the real dynamic state), scoped to the service-init window.

CLI + complexity + diagram integration files: 25 passed, including the ordering case that reproduced the leak. Unit suite green.

…p the machine-output console rebind leaking a captured stream

The canonical inventory test caught that 'cgc diagram' was never smoke-run;
adding it exposed a real leak in the #1333/#1287 stderr redirect: reading
console.file MATERIALIZES the current (possibly CliRunner-captured, soon
closed) stream, so saving and 'restoring' it pinned the helpers console to
a dead file and every later in-process invocation raised 'I/O operation on
closed file'. The dynamic state lives in Console._file (None while the
console follows sys.stdout live); the redirect now saves/restores that,
scoped to the service-init window only.
@vercel

vercel Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
code-graph-context-pack Ready Ready Preview Aug 19, 2026 8:03pm

@github-actions

Copy link
Copy Markdown
Contributor

Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ

@Shashankss1205
Shashankss1205 merged commit 6bcb081 into main Aug 19, 2026
16 of 19 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog tasks to Done in CGC Progress Board Aug 19, 2026
@Shashankss1205
Shashankss1205 deleted the fix/diagram-inventory-console-leak branch August 19, 2026 20:03
@github-actions

Copy link
Copy Markdown
Contributor

🔍 PR Code Graph Analysis

fix(cli): diagram in the canonical smoke matrix; scoped machine-output console redirect (#1655)

📊 Interactive Visualization

View the blast radius graph: PR Reviewer Dashboard

📦 Artifacts

The graph JSON has been uploaded as a build artifact: pr-code-graph-1655


Generated by CodeGraphContext using FalkorDB Lite

Shashankss1205 pushed a commit that referenced this pull request Sep 24, 2026
)

`main.py` had a single module-level `Console(stderr=True)`, so every `analyze` command rendered its result table to stderr while init chatter went to stdout — the split was inverted for exactly the commands whose job is emitting data. `cgc analyze callers X > out.txt` captured a banner and no table.

Adds a separate `analyze_result_console = Console()` and routes the result prints across the ten `analyze_*` commands through it. Empty-result notices move with the tables (a script reading stdout still needs to see that the query ran); argument-validation errors stay on stderr.

Leaves the #1650/#1655 `_file` save/restore mechanism untouched — verified no `.file` materialization leak via the unmodified CliRunner and complexity-CI suites.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — 8630f9ce Deployed Aug 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant