Skip to content

opencode-config-normalize: preserve comments in the plugin+plugins merge (#4639) - #4644

Merged
dezren39 merged 6 commits into
mainfrom
queue/6575-4639-plugin-comments
Nov 3, 2026
Merged

dezren39 merged 6 commits into
mainfrom
queue/6575-4639-plugin-comments

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Fixes #4639.

The both-present plugin+plugins merge re-serialised the merged array with json.dumps, silently deleting every comment inside both arrays while exiting 0. The pre-write verification compared comment-stripped parses, so the loss verified as correct.

This changes the merge to a textual element splice (legacy elements first, native appended, v1 entry dropped) so in-array comments survive byte-identical. Shapes that cannot be spliced comment-safely (e.g. a // comment trailing the last legacy element, which would swallow the joining comma) fail closed: exit 1 with the file byte-identical.

Scope is the both-present merge plus the regression fixture only; the #4612 agent fold and #3180 permissions behaviour are untouched.

Verification

  • bash pkgs/opencode-config-normalize/normalize_test.sh — all 15 cases pass, including new case 14 (both-present merge with comments in both arrays, comments asserted byte-present) and case 15 (fail-closed boundary, exit 1 + byte-identical).
  • Triage repro fixture (both-present with /* legacy note */, // native note, // trailing native) now repairs with all three comments preserved; second run is a byte-identical no-op.
  • Edge probes: trailing-comma legacy, empty legacy/native arrays, // inside string values and inside block comments (no fail-closed misfire), reversed key order.

Agent: repo-worker-code (OpenChamber scheduled lane) · task 6575


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…array comments (#4639)

The both-present merge re-serialised the merged array with json.dumps,
silently deleting every comment inside both arrays while reporting
success. Splice the legacy elements into the plugins array as text
(legacy first, native appended) and drop the v1 entry, so comments
survive byte-identical. Shapes that cannot be spliced comment-safely
(e.g. a // comment trailing the last legacy element) fail closed with
exit 1 and the file byte-identical.

Regression fixtures: both-present merge with comments in both arrays
(comments asserted byte-present), plus the fail-closed boundary case.
@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 23:05
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eabe4e52-ef7d-4620-b76c-03cde1bb7d35
Commits

Reviewing files that changed from the base of the PR and between 40c5d40 and 6aff467.

Files selected for processing: 2
  • pkgs/opencode-config-normalize/normalize.sh
  • pkgs/opencode-config-normalize/normalize_test.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T01:21:10.950387Z 6aff467 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b07a6c087

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dezren39

dezren39 commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Pushed update addressing the Codex P2 finding: the splice now strips a trailing element comma hidden behind trailing block comments (e.g. ["a", /* keep */]), so that shape merges instead of wrongly failing closed. New regression case plugins-merge-trailing-block-comment covers it; full normalize_test.sh suite green locally. Branch also updated to current origin/main (merge commit, no conflicts).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a2fe52bac6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dezren39
dezren39 merged commit 7c49d22 into main Nov 3, 2026
2 checks passed
@dezren39
dezren39 deleted the queue/6575-4639-plugin-comments branch November 3, 2026 01:22
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.

opencode-config-normalize: plugin+plugins merge re-serialises the array and silently deletes every comment inside both arrays

1 participant