Skip to content

FOLLOW-UP: Thread io.Writer through ParseFile for testable warning output (from PR #173) #174

@adnaan

Description

@adnaan

Context

This follow-up task was identified during the review of PR #173.

Source PR: #173
PR Title: refactor: extract shared slug package; add ParseFile warning integration test
Suggested by: @claude[bot] (across 3 review rounds)

Task Description

The TestParseFileDuplicateAnchorWarning test captures warnings by swapping the global os.Stderr with a pipe. This works but is fragile — it's not parallel-safe and mutates global state.

A cleaner approach is to thread an io.Writer parameter through ParseFile (or preprocessAutoTasks) so the test can pass a bytes.Buffer directly. This would:

  • Make the warning output testable without global state mutation
  • Allow parallel test execution
  • Follow Go best practices for dependency injection

Original Comment

A safer pattern is to thread an io.Writer through ParseFile (or preprocessAutoTasks), so the test can pass a bytes.Buffer directly. If the API surface is not worth changing, the test should at minimum add a comment explaining why it must not run in parallel with other tests that write to stderr.


This issue was automatically created by prmonitor from PR review comments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-upFollow-up task from PR reviewfrom-reviewIssue originated from PR review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions