Skip to content

docs(tasks): a comment in an empty container used as a key is dropped - #29

Merged
adammharris merged 1 commit into
mainfrom
agent/backlog-file-a-comment-in-an-empty-key-container-is-dropped
Nov 7, 2026
Merged

adammharris merged 1 commit into
mainfrom
agent/backlog-file-a-comment-in-an-empty-key-container-is-dropped

Conversation

@adammharris

Copy link
Copy Markdown
Member

Files a task for a defect in the canonical form. Nothing else changes: no code, and the task stays open for a fix on its own branch.

What

In canonical text, a line comment after the opening bracket of an empty container that is a mapping key is lost:

$ printf '{\n  [ // why\n  ]: 1\n}\n' > k.txt
$ fig get -i canonical k.txt -o canonical
{
  []: 1
}

The parser makes that comment the key's trailing comment. An inline container leaves its trailing comment to whoever writes its line, and for an entry that is the value's anchor, so nothing prints it. {[//\n]:1} is the smallest input, and it fails fig_fuzz::canonical_round_trip.

Why it is worth a task

Reach is narrow: canonical text is opt-in, YAML keeps the comment (on the value), and the JSON family refuses such a key. It is filed because a comment is lost silently, which is what canonical_round_trip exists to catch, and because this input may be the next nightly Fuzz failure on #13. That part is a guess, and the task says so.

How it was verified

  • Reproduced at 17e31b5 through canonical_round_trip and through the CLI built with --features canonical.
  • All 11,827 inputs from Fuzz run 42239902099, including its crash, pass at 17e31b5, so this is not that crash. That run predates the one-line container fix.
  • A throwaway mutator over that corpus hit this input once in 319 million tries.
  • A throwaway printer fix, not on any branch, cleared each failing input. With it, cargo test -p fig-core (215 passed) and cargo test -p fig-fuzz passed, and 427 million more mutations found nothing. The full gate was not run against it.
  • This change is documents only, so no build gate applies. prov check reports nothing for the new task. Its remaining findings are all in .config/prov.yaml, which this PR does not touch.

@adammharris
adammharris merged commit 8fbbe78 into main Nov 7, 2026
10 checks passed
@adammharris
adammharris deleted the agent/backlog-file-a-comment-in-an-empty-key-container-is-dropped branch November 7, 2026 06:42
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.

1 participant