Skip to content

Preserve existing JSON formatting in automated submission PRs#588

Merged
webprofusion-chrisc merged 6 commits into
masterfrom
copilot/fix-json-formatting-issue
May 18, 2026
Merged

Preserve existing JSON formatting in automated submission PRs#588
webprofusion-chrisc merged 6 commits into
masterfrom
copilot/fix-json-formatting-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 18, 2026

Issue-template submissions were rewriting the full target JSON file, especially normalizing frameworks arrays across all entries. That created formatting churn in every generated PR and turned unrelated follow-up submissions into merge conflicts.

  • Workflow write path

    • Replaced full-file prettier.format(JSON.stringify(data)) output with source-preserving insertion logic in process-submission.yml.
    • The workflow now inserts only the new entry into the target top-level JSON array and leaves all untouched entries byte-for-byte unchanged.
  • Minimal JSON patch behavior

    • Keeps the existing file layout, including prior per-entry array formatting, instead of reformatting the entire document.
    • Preserves alphabetical insertion by name, so generated PRs remain focused to the submitted record.
  • Safety checks

    • Added validation around top-level array/object detection before writing.
    • Improved failure messaging when the target JSON structure is not the expected array-of-objects shape.
// Before
formattedData = await prettier.format(JSON.stringify(data), {filepath: filePath});
fs.writeFileSync(filePath, formattedData);

// After
const updatedSource = insertEntryIntoArraySource(source, entry, normalizedInsertIndex, data.length, targetFile);
fs.writeFileSync(filePath, updatedSource);

Copilot AI and others added 6 commits May 18, 2026 06:00
Agent-Logs-Url: https://github.com/webprofusion/OpenAudio/sessions/7e52c2b7-7fa1-4363-8530-1618aab4d3de

Co-authored-by: webprofusion-chrisc <2445502+webprofusion-chrisc@users.noreply.github.com>
Agent-Logs-Url: https://github.com/webprofusion/OpenAudio/sessions/7e52c2b7-7fa1-4363-8530-1618aab4d3de

Co-authored-by: webprofusion-chrisc <2445502+webprofusion-chrisc@users.noreply.github.com>
Agent-Logs-Url: https://github.com/webprofusion/OpenAudio/sessions/7e52c2b7-7fa1-4363-8530-1618aab4d3de

Co-authored-by: webprofusion-chrisc <2445502+webprofusion-chrisc@users.noreply.github.com>
Agent-Logs-Url: https://github.com/webprofusion/OpenAudio/sessions/7e52c2b7-7fa1-4363-8530-1618aab4d3de

Co-authored-by: webprofusion-chrisc <2445502+webprofusion-chrisc@users.noreply.github.com>
Agent-Logs-Url: https://github.com/webprofusion/OpenAudio/sessions/7e52c2b7-7fa1-4363-8530-1618aab4d3de

Co-authored-by: webprofusion-chrisc <2445502+webprofusion-chrisc@users.noreply.github.com>
Agent-Logs-Url: https://github.com/webprofusion/OpenAudio/sessions/7e52c2b7-7fa1-4363-8530-1618aab4d3de

Co-authored-by: webprofusion-chrisc <2445502+webprofusion-chrisc@users.noreply.github.com>
@webprofusion-chrisc webprofusion-chrisc marked this pull request as ready for review May 18, 2026 07:03
@webprofusion-chrisc webprofusion-chrisc merged commit 80d60fa into master May 18, 2026
2 checks passed
@webprofusion-chrisc webprofusion-chrisc deleted the copilot/fix-json-formatting-issue branch May 18, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants