Question
A third copy of the ensure_ascii + surrogate-pair escaping survives #315 in the dl renderer's pretty formatter for --ls --json. That build collapsed the other two (core's json.rs and the metadata store's) into one shared write_ensure_ascii, but left this one deliberately: sharing it needs a new pub item on devlaunch-core, which moves a public-API snapshot — off-limits until Split the API snapshots lands so the snapshot files move once.
Scope it as the whole formatter, not just the escaper. The review of PR #345 measured the actual residue: render.rs:196-295 and metadata.rs:1015+ are two near-identical ~100-line indent=2 formatters that each delegate to serde_json::ser::PrettyFormatter, so the escaping is only the smaller half of what is duplicated. Exporting one pub formatter (or one pub document-writing fn) costs the same single pub line the escaper alone would have cost, and retires the duplicated layout delegation as well. PythonPretty has exactly one production caller — python_json_document at render.rs:180, reached only from commands.rs:225 — so the surface being replaced is small and fully known.
Red-first at the shared seam, and add the pin the other two got. Same principle as #315: a legitimate difference stays (this document is indented, the compact one is on one line); what must not stay is two copies of one fact.
Note the ordering trap: doing this before #338 merges would move a public-API snapshot twice, which is exactly what that ticket exists to prevent.
Question
A third copy of the
ensure_ascii+ surrogate-pair escaping survives #315 in the dl renderer's pretty formatter for--ls --json. That build collapsed the other two (core'sjson.rsand the metadata store's) into one sharedwrite_ensure_ascii, but left this one deliberately: sharing it needs a newpubitem ondevlaunch-core, which moves a public-API snapshot — off-limits until Split the API snapshots lands so the snapshot files move once.Scope it as the whole formatter, not just the escaper. The review of PR #345 measured the actual residue:
render.rs:196-295andmetadata.rs:1015+are two near-identical ~100-lineindent=2formatters that each delegate toserde_json::ser::PrettyFormatter, so the escaping is only the smaller half of what is duplicated. Exporting onepubformatter (or onepubdocument-writing fn) costs the same singlepubline the escaper alone would have cost, and retires the duplicated layout delegation as well.PythonPrettyhas exactly one production caller —python_json_documentatrender.rs:180, reached only fromcommands.rs:225— so the surface being replaced is small and fully known.Red-first at the shared seam, and add the pin the other two got. Same principle as #315: a legitimate difference stays (this document is indented, the compact one is on one line); what must not stay is two copies of one fact.
Note the ordering trap: doing this before #338 merges would move a public-API snapshot twice, which is exactly what that ticket exists to prevent.