Repository navigation
fix(frontmatter): do not add a header over one the writer cannot locate - #988
Merged
Merged
Conversation
Readers accept frontmatter the writers cannot locate: an unclosed block, indented --- lines, or a block below other text. The dashboard target writer and the list TUI's manual-only toggle treated such a file as having no frontmatter and put a new header on top. Every reader then saw only the new header, so the skill lost its name, description and every other field without any warning. Both writers now refuse and leave the file unchanged, and say which layout to fix. A file with no frontmatter at all, including one that only has horizontal rules in its body, still gets a new header. A target edit that asks for what the readers already see stays a no-op. The dashboard editor did the same on a body-only save: it wrapped the text in an empty header. It now saves the text as written until the form is edited. SetFrontmatterValue keeps adding a header. Its one caller renames a fresh copy inside a target during sync, and an error there fails the whole sync.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type
proposals/only — see CONTRIBUTING.md)approvedlabel)Linked Issue
No issue. Found while reviewing #973.
What was wrong
Readers accept frontmatter that the writers cannot locate:
---is missing;---lines are indented;Three writers treated such a file as having no frontmatter and put a new header on top. Every reader then used the new header and ignored the old one, so the skill lost its description and every other field without any warning.
Setting a target in the dashboard on this
SKILL.md:returned 200 and wrote:
After that the dashboard listed the skill with no description.
Fix
RewriteFrontmatterList): the file is left unchanged and the request returns 422target_frontmatter. The message names the layout to fix.listTUI (ToggleFrontmatterFlag, themkey): the file is left unchanged and the TUI shows the reason.Both Go writers share one check,
hidesHeader. It refuses when the writer saw an opening---that never closes, or when the block the readers locate decodes to a non-empty YAML mapping.Behavior changes
mtoggle on a file with one of the three layouts above is refused. Onmainit reported success.mainonly clearing targets that no reader saw was.---horizontal rules around prose.Tests
internal/utils:TestRewriteTargetsRefusesUnclosedHeaderfails onmain. Its header is unclosed and is not valid YAML.TestFrontmatterEntryPoints_DelimiterRules: the four rows for indented, misplaced and unclosed delimiters pinned the second header. They now expect the refusal.TestToggleFrontmatterFlag_RefusesHeaderItCannotLocatefails onmain.TestRewriteTargetsLeavesNoOpUntouchedhas two new rows. The one with a header below other text fails onmain. The one that clears an unclosed header passes onmainand guards that case against the new refusal.TestRewriteTargetsAddsHeaderAboveHorizontalRulespasses onmaintoo. It guards a file with horizontal rules against the new refusal.ui/src/lib/frontmatter.test.ts: a body-only save of a file with an unclosed header returns the text as written.Checks
make checkpasses in the devcontainer image on this commit.Dashboard:
format:check,typecheck,lint:typed(0 errors) and the full Vitest run (121 files, 1017 tests) pass. They ran before the rebase onto refactor(skillignore): replace the memoized negation search with a loop #984–fix(agents): list agents in .agentignore'd folders as disabled #987, which do not touchui/.python3 scripts/ai-context.py checkpasses.End to end with
skillshare ui -gandPATCH /api/resources/<name>/targets, comparing a binary built frommainat 115b50a with this branch:SKILL.mdmain---linesNot run:
mkey and the editor save were not driven by hand. The unit tests above cover the functions they call.Not covered
SetFrontmatterValuestill adds a header. Its one caller rewrites the name in a fresh copy inside a target during sync, and an error there fails the whole sync. It never edits the source file. A comment in the code says so.---as a horizontal rule and has no second---is refused. Readers already treat all of it as frontmatter.key: valueblock between two---rules below other text is refused. Readers treat it as frontmatter.---lines, whose block is also not valid YAML still gets a second header. It needs two malformed traits at once, and a wider check would refuse ordinary agent files that use horizontal rules.Checklist
make check) — for code changes