Skip to content

Text diff and advisor commands ignore failed output writes #92

Description

@DivyamTalwar

The text diff/advisor renderers ignore their final writer result, and the corresponding commands can return success when the destination did not accept the report. Silent short writes are also accepted. This differs from #63's MCP response-loop failure handling.

Reproduced on upstream 9e41414abed05f10ad7ff2fbe7662a5172f151f7 through the actual Cobra diff command backed by a temporary SQLite history store: an output writer returning a sentinel error leaves the command error nil. The advisor caller reproduces the same defect using only a backend-result seam, with its output-error return deliberately swallowed as a negative control.

I would like to fix this by returning the original write error (or io.ErrShortWrite) from both renderers and propagating it through the actual command paths. Existing root handling maps execution failures to exit 3. Successful text output and the JSON contract are unchanged.

Focused command/renderer regressions pass twenty repetitions under race, including empty/large/reset-only reports, original errors, silent short writes and normal output. Full affected suites, committed-HEAD gate/six-target builds and the full race suite pass.

Overlap: #64 changes the reset-only path in the same diff renderer. It is an independent correctness fix, not a duplicate. Whichever lands second must return the shared writer error from the reset-only branch; no #64 implementation is included here.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions