fix: keep NDJSON records on one line when indentation is requested
AF
11h ago+39+39+01234567890123456789-3-3-0123456789
Summary
Passing indent to ndjson.dumps() inserts line breaks inside each JSON object. A two-record document becomes twelve physical lines in the regression fixture and cannot be read back by the NDJSON reader. The file-writing dump() already disables indentation, so the two serialization entry points disagree.
Move the existing indentation normalization into dumps(), which is also used by dump(). Preserve other encoder options and empty input behavior. The NDJSON serialization specification requires each JSON text to occupy one line.
Validation
- This change's six cases produce 5 failures and 1 passing control on the original source. Coverage includes numeric/string indentation, nested values, escaped line breaks, encoder options, reader round trips and equality of string/file output.
- A combined fork validation branch checks the same regressions against the pinned original production sources first: 11 failures, 2 passing controls. After restoring the final sources, the new cases and existing cleaner and NDJSON partition suites report 107 passed on Python 3.12.
- Ruff check and format check pass with the repository configuration. A source-integrity check verifies that baseline probing leaves the final files unchanged.
- Validation run, complete commands and JUnit artifacts.
Checklist
- User-facing conventional-commit title.
- Maintainer: please apply the
bugcategory label.