Skip to content

feat(sync): add the structured document adapters - #989

Merged
ctawiah merged 1 commit into
mainfrom
ctawiah/sync-structured-adapters-3bbf
Nov 9, 2026
Merged

ctawiah merged 1 commit into
mainfrom
ctawiah/sync-structured-adapters-3bbf

Conversation

@ctawiah

@ctawiah ctawiah commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Context

JSON, YAML, and TOML sources need exact scalar edits and clear read-only rules.

What changes

  • Add the JSON adapter with a span-tracking parser. Objects and arrays keep the indentation of the text that they replace.
  • Add the YAML adapter on the shared YAML tree. A plain scalar keeps its full span, also when it contains a comma or a bracket.
  • Add the TOML adapter with scalar and string-family updates.

Design notes

  • Anchors, aliases, merge keys, block scalars, multi-line plain scalars, and arrays of tables are read-only.
  • Duplicate keys fail before any edit.

Review focus

  • Does a plain YAML scalar with a comma get the right span?
  • Do the fuzz tests cover the string codecs?

Verification

  • make build
  • go test ./...
  • golangci-lint run ./...

Related changes

  1. refactor(sync): remove Phase 1 source references #1005: Phase 1 reference removal
  2. feat(sync): add projection and problem core #987: projection and problem core
  3. feat(sync): add the adapter core and the Markdown adapter #988: adapter core and Markdown
  4. This PR: structured adapters
  5. feat(sync): add the Python adapter #991: Python adapter
  6. feat(sync): add the TypeScript and JavaScript adapters #992: TypeScript and JavaScript adapters
  7. feat(sync): add source descriptor storage #993: descriptor storage
  8. feat(sync): compile and publish repository sources #994: compile and publish
  9. feat(sync): detach descriptor-backed sources #1003: descriptor detach
  10. feat(sync): prepare repository source links #997: link preparation
  11. feat(sync): integrate repository sources with planning and link #995: planning and link
  12. feat(sync): add the link commands #998: link commands

🤖 Generated with Claude Code


Note

Overview
Adds JSON, YAML, and TOML sync adapters in structured/ that build adapter.Node trees with exact byte spans for targeted scalar edits, registered via init() alongside existing formats.

Shared adapter core: EncodeJSON skips HTML escaping; large integers beyond float64 precision stay read-only with original text (ExactInteger, container propagation in JSON); positional IDs, Node.Clone(), and richer reference error messages via annotateProblem.

JSON: Custom parser tracks spans, rejects duplicates/malformed input, preserves indentation on rewrite, and treats empty arrays as values (not null).

YAML: Thin wrapper over yamltree with multi-document read-only rules; yamltree now preserves &/< in quoted strings and splits integer vs float write semantics.

TOML: Header/array-table/inline/dotted-key graph with structural read-only tables but writable scalars; string family encoders; arrays of tables and oversized numbers read-only.

Extensive tests (including TOML string fuzz) and sample testdata.

Reviewed by Cursor Bugbot for commit 57aea94. Bugbot is set up for automated code reviews on this repo. Configure here.

@ctawiah
ctawiah added this pull request to stack #1000 October 30, 2026 20:15
@ctawiah
ctawiah force-pushed the ctawiah/sync-structured-adapters-3bbf branch from d42e0c2 to d69f62d Compare October 31, 2026 00:05
@ctawiah
ctawiah force-pushed the ctawiah/sync-structured-adapters-3bbf branch from d69f62d to 40c351d Compare November 2, 2026 02:26
@ctawiah
ctawiah force-pushed the ctawiah/sync-structured-adapters-3bbf branch from 40c351d to f18fe65 Compare November 3, 2026 00:29
@ctawiah ctawiah changed the title feat(sync): add structured document adapters feat(sync): add the structured document adapters Nov 3, 2026
@ctawiah
ctawiah removed this pull request from stack #1000 November 3, 2026 00:32
@ctawiah
ctawiah added this pull request to stack #1004 November 3, 2026 00:34
@ctawiah
ctawiah removed this pull request from stack #1004 November 3, 2026 00:53
@ctawiah
ctawiah added this pull request to stack #1006 November 3, 2026 00:53
@ctawiah
ctawiah force-pushed the ctawiah/sync-structured-adapters-3bbf branch 2 times, most recently from ad0d76d to 9bf515c Compare November 4, 2026 19:25
@ctawiah
ctawiah force-pushed the ctawiah/sync-structured-adapters-3bbf branch from 9bf515c to 44efbf9 Compare November 4, 2026 19:46
@ctawiah
ctawiah force-pushed the ctawiah/sync-structured-adapters-3bbf branch 2 times, most recently from 4c22725 to 406910d Compare November 4, 2026 22:26
@ctawiah
ctawiah force-pushed the ctawiah/sync-structured-adapters-3bbf branch 4 times, most recently from a371381 to 8a8bc57 Compare November 6, 2026 22:13

@cursor cursor 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.

Stale Bugbot comment from a previous run.

@ctawiah
ctawiah force-pushed the ctawiah/sync-structured-adapters-3bbf branch 3 times, most recently from 95dec01 to 398ef81 Compare November 6, 2026 23:53

@cursor cursor 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.

Stale Bugbot comment from a previous run.

@ctawiah
ctawiah force-pushed the ctawiah/sync-structured-adapters-3bbf branch 10 times, most recently from 4e5300e to d542b78 Compare November 7, 2026 04:33

@cursor cursor 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.

Stale Bugbot comment from a previous run.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8757695. Configure here.

Add the JSON, YAML, and TOML adapters. Each scalar has an exact byte span. Objects and arrays keep the layout of the text that they replace. Anchors, aliases, merge keys, block scalars, and arrays of tables are read-only.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

2 participants