Skip to content

fix: fall back when GCF encoding fails - #1539

Merged
Shashankss1205 merged 1 commit into
CodeGraphContext:mainfrom
tomatotomata:codex/gcf-json-fallback-1518
Aug 2, 2026
Merged

Shashankss1205 merged 1 commit into
CodeGraphContext:mainfrom
tomatotomata:codex/gcf-json-fallback-1518

Conversation

@tomatotomata

Copy link
Copy Markdown
Contributor

Summary

  • catch failures from the optional GCF encoder and preserve the documented JSON fallback
  • log the failure at debug level with the traceback for diagnosis
  • add a regression test covering an encoder that raises

This follows the scoped behavior described in #1518. Successful GCF output and the missing-package fallback remain unchanged.

Validation

  • PYTHONPATH=src PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest tests/unit/tools/test_gcf_encoder.py -q (8 passed, 2 skipped because gcf-python is not installed)
  • python -m compileall -q src tests/unit/tools/test_gcf_encoder.py
  • git diff --check

The default local pytest plugin set has an unrelated pytest-recording / pytest-vcr conflict, so the focused test was rerun with third-party plugin autoload disabled.

Closes #1518

@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

@tomatotomata is attempting to deploy a commit to the shashankss1205's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Shashankss1205 Shashankss1205 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally: trial-merged onto main with #1540 and #1541 — full suite green (1063 passed, 7 skipped).

Correct fix for #1518. The try/except is scoped tightly around encoder(result) so only encode-time failures fall through, and exc_info=True at debug level keeps the traceback recoverable without noise. The added test forces a failing encoder rather than mocking the fallback, which is the right way to prove it. Thanks!

@Shashankss1205
Shashankss1205 merged commit 5ab7eac into CodeGraphContext:main Aug 2, 2026
1 check failed
@github-project-automation github-project-automation Bot moved this from Backlog tasks to Done in CGC Progress Board Aug 2, 2026
Shashankss1205 added a commit that referenced this pull request Aug 2, 2026
Bug-fix release. Since 0.5.4 on PyPI:

- fix(indexer): record non-code files on the SCIP path so `cgc index`
  stops reporting a partial index forever (#1565, #1566)
- fix(parsers): capture PHP imports rather than trait uses (#1522, #1563)
- fix(parsers): recover Python annotated parameters — 40.3% of parameters
  were being dropped — and Go grouped imports (#1520, #1521, #1561)
- fix(graph): always sanitize bundle filenames (#1517, #1541)
- fix(cli/mcp): read import aliases from the IMPORTS relationship (#1515, #1540)
- fix(cli/mcp): fall back to JSON when GCF encoding fails (#1518, #1539)

Co-authored-by: Claude Fable 5 <[email protected]>
@Shashankss1205 Shashankss1205 added gssoc:approved GSSoC validation: counts toward scoring level:intermediate GSSoC difficulty: 35 pts contributor / 20 mentor mentor:Shashankss1205 GSSoC mentor attribution: credits reviewing mentor quality:clean GSSoC quality: x1.2 contributor / +5 mentor type:bug GSSoC type bonus: bug labels Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC validation: counts toward scoring level:intermediate GSSoC difficulty: 35 pts contributor / 20 mentor mentor:Shashankss1205 GSSoC mentor attribution: credits reviewing mentor quality:clean GSSoC quality: x1.2 contributor / +5 mentor type:bug GSSoC type bonus: bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug(cli/mcp): GCF encode failures propagate instead of falling back to JSON, turning a successful tool call into an internal error

2 participants