Skip to content

[BUG] JSON assessment output missing trailing newline #426

@jwm4

Description

@jwm4

Bug Description

All JSON assessment output paths produce files without a trailing newline. This violates POSIX conventions and causes `git diff` to show `\ No newline at end of file` on every submission to the leaderboard, as seen in PR #424.

To Reproduce

  1. Run `agentready assess `
  2. Inspect the generated `.agentready/assessment-*.json`
  3. Check: `xxd .agentready/assessment-*.json | tail -1` — the last byte is `7d` (`}`), not `0a` (`\n`)

Expected Behavior

All generated JSON files end with a trailing newline (`\n`), consistent with POSIX conventions and the behavior of tools like `jq`.

Actual Behavior

Generated JSON files end with `}` and no newline. Git diffs show `\ No newline at end of file`.

Affected Code

Four write sites, all missing a trailing newline:

File Line Pattern
`src/agentready/reporters/json_reporter.py` 34 `json.dumps(...)` passed to `_write_file()` with no `\n`
`src/agentready/reporters/aggregated_json.py` 38 `json.dump(f)` with no `f.write("\n")` after
`src/agentready/cli/main.py` 324 `json.dump(f)` with no `f.write("\n")` after
`src/agentready/cli/demo.py` 493 `json.dump(f)` with no `f.write("\n")` after

Possible Solution

  • In `json_reporter.py`: append `+ "\n"` to the `json.dumps()` result before passing to `_write_file()`
  • In the three direct `json.dump()` call sites: add `f.write("\n")` on the line after each dump

The fix should be accompanied by unit tests that assert the written file ends with `\n`.

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions