Repository navigation
fix(frontmatter): preserve skill metadata when assigning dashboard targets - #973
Conversation
|
@codex review |
Codex Review Summary: ✅ CompletedThis 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. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Thanks @salmonumbrella. The CRLF fix alone is worth having: today a dashboard target on a CRLF skill buries the whole old header. We also found no corruption: every output we tried (LF, CRLF, BOM, flow and block metadata, aliases, U+2028/U+0085, comments) decoded correctly with the body intact, and the unsafe ones were refused. Could you change a few things before we merge?
|
…sals Use shared delimiter, key-span and offset handling to splice only target entries and verify decoded metadata and body before writing. Preserve no-op clears, classify uneditable files separately from I/O, and report named, localized folder outcomes without counting unchanged files.
5d66a71 to
30f72b2
Compare
|
@runkids Could you re-review Locally, |
Review follow-up for the dashboard target writer. A request that changes nothing rewrote the file anyway: setting a target to its current value reformatted the list, and clearing targets in a file without a header added an empty one. Both now return the file as it is, so a folder batch reports those files as unchanged. Metadata with non-string keys refused every edit, including removing a legacy top-level targets key that sits outside it. Only edits inside metadata are refused now. A refusal gave the remedy but not the cause. The error now ends with the reason, and still matches ErrTargetFrontmatter. The batch endpoint logged "ok" when files failed, which hid failures in the operation log. It now logs "partial" or "error" with the failure count and the first error. The error code becomes target_frontmatter, in line with the other codes. Dashboard toasts are built from translated templates instead of joined strings, so word order and punctuation follow each locale, and the docs list the layouts the dashboard refuses.
|
Thanks @salmonumbrella, merged. The re-review of Before merging I pushed one follow-up commit to your branch, 2101b9e, plus a merge of
One sentence in the PR description no longer holds: a file with no recognized closed header still takes the legacy writer path when you set targets, but clearing targets it does not have is now a no-op. |
This PR's own commits: b271e5f..30f72b2
Type
proposals/only — see CONTRIBUTING.md)approvedlabel)What changed
Dashboard target assignment no longer round-trips a closed skill or agent YAML header. It uses the shared delimiter walker, key spans and YAML node positions. The writer verifies the body and decoded values before it writes. CRLF, BOM, key order, unrelated metadata spellings and adjacent comments are preserved in supported layouts.
Clearing absent targets in a recognized header leaves the file untouched, including when metadata is an alias, empty or non-mapping. Clearing the last explicit target removes its otherwise empty metadata mapping. Setting targets on non-mapping metadata replaces it. A skill edit also removes the legacy top-level targets field; an agent edit works on the top-level field.
A requested edit is refused when it cannot be shown safe. Examples include aliased metadata with targets that must change, fully indented block roots, mixed-key metadata that must be edited, and flow target values with source spellings the editor cannot bound exactly. Comments on the entry being replaced or removed may change. Files with no recognized closed header still take the legacy writer path.
Skill and agent PATCH return 422 with an actionable error code for file refusals; ordinary I/O failures remain server errors. Folder operations warn with affected names and real update/failure counts, including when no edits succeed. Older batch clients still receive the existing string errors. The dashboard translates file guidance in all 11 locales.
Why
Assigning a dashboard target could silently change a skill. On a CRLF file, readers lost the name, description and all metadata. On LF files, the full-map round trip turned
012into octal 10, gave date-only values a time, and could give an invalid expiry a valid UTC offset.Usage
No usage change.
Checklist
make check) — for code changesTesting
make checkpassed in the devcontainer on the exact candidate tree, including Go unit/integration and all 159 Herdr checks.Linked Issue
Builds on merged #970: #970
Refs #894
Refs #449