Repository navigation
fix(config): keep the comments of a key the command removed - #528
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 878be2396f
ℹ️ 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".
| setUpdates((prev) => updatesLeft(prev, plan, response)); | ||
| const failed = failureText(t, response); | ||
| const failedTargets = (response.result?.results ?? []).filter((r) => r.status === 'failed').map((r) => r.target); | ||
| set(p.name, failed ? { status: 'failed', note: failed, failed: failedTargets.length && failedTargets.length < p.targets.length ? failedTargets : undefined } : { status: 'done', note: undefined }); |
There was a problem hiding this comment.
Preserve skipped batch updates as skipped
When the server deliberately skips an update target—for example because a native marketplace disappeared or a Codex plugin is disabled—Apply returns a skipped outcome without setting response.failure. This branch therefore marks the entire plugin as done, and the dialog reports it as updated even when none or only some of its targets changed. Inspect the returned outcomes and keep the batch item skipped or partially failed instead of treating every failure-free response as successful.
Useful? React with 👍 / 👎.
| export function updatesPending(updates: Updates, inventory?: PluginInventory): UpdatePick[] { | ||
| const targets = targetMap(inventory?.targetDefinitions); | ||
| return Object.entries(updates) | ||
| .map(([name, u]) => ({ name, targets: Object.keys(u).filter((target) => targets[target]?.operations.includes('update')) })) |
There was a problem hiding this comment.
Remove stale update picks when their bindings disappear
After a check finds an update, the user can remove that plugin through its supported row menu; the inventory refreshes, but updates is retained and this filter only checks target capabilities. The removed plugin consequently remains in pendingUpdates, keeps the header on “Update”, and produces a permanently retryable plugin package ... not found failure when selected. Filter against the current package and binding (and its current selection state) so inventory mutations invalidate stale check results.
Useful? React with 👍 / 👎.
A comment on a removed key moved nowhere and was lost. It now sits in front of the next surviving key, or on the last entry of its section. Adds the config_keeps_comments runbook that drives `target` set and remove over a file full of comments. Refs #525
… the orphans Prepending the orphaned comments first made the key look commented, so its own head comment was skipped and lost.
56cf7ee to
5735485
Compare
|
Rebuilt the branch on main with only the two config commits: two unrelated |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5735485143
ℹ️ 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".
| } | ||
| } | ||
| if j+1 >= len(cur.Content) { | ||
| orphaned = joinComments(orphaned, allComments(old.Content[i]), allComments(old.Content[i+1])) |
There was a problem hiding this comment.
Keep removed mapping comments in source order
When a removed final mapping entry has both an inline value comment and a trailing foot comment, such as # BEGIN\nmode: merge # note\n# END, yaml.v3 associates the foot comment with the key while leaving the inline comment on the value (parser logic). Collecting every key comment before every value comment therefore emits these as BEGIN, END, note, which can invert marker blocks or other order-sensitive annotations. Gather a mapping pair's head/inline/foot comments in their original presentation order instead.
Useful? React with 👍 / 👎.
Codex review: the key's foot comment comes after the value's line comment in the file, so it must come after it in the orphaned block.
|
Fixed: a removed entry's comments are gathered as key head, key line, value comments, key foot, so |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ffd3e615b5
ℹ️ 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".
| for _, c := range n.Content { | ||
| out = joinComments(out, allComments(c)) |
There was a problem hiding this comment.
Traverse nested mapping pairs in presentation order
When a removed entry contains a nested mapping, this generic child traversal still processes each key's foot comment before the paired value's comments. For example, in removed:\n # BEGIN\n child: value # note\n # END, yaml.v3 stores # END on the nested child key, so allComments produces BEGIN, END, note. Although pairComments fixes the outer removed pair, it does not fix mappings encountered recursively; traverse every mapping node pairwise with the same key-head/key-line/value/key-foot ordering to avoid breaking nested marker blocks.
Useful? React with 👍 / 👎.
…ntry's comments Codex review: a nested key's foot comment was emitted before its value's line comment.
|
Fixed: |
Why
#526 kept comments on keys that survive a write. A comment on a key the command removed (for example
target remove universal) was still lost. No comment should be dropped (#525).What
copyCommentscollects the comments of removed mapping keys and list items, including every comment inside the removed subtree, and puts them in front of the next surviving entry. A trailing orphan goes on the last entry's foot comment, since yaml.v3 prints a container's own foot comment after the following key.ai_docs/tests/config_keeps_comments_runbook.md: a config with 11 comments (head, inline, odd spacing, nested, list items, trailing),targetset then remove, every comment asserted after each step. 5/5 in a fresh ssenv.Refs #525
Verification
make checkin the devcontainer passes. Runbook 5/5.