Skip to content

chore(deps): take serde-saphyr 2.0.0 and yamled 0.0.7 - #136

Merged
any-victor merged 1 commit into
mainfrom
chore/serde-saphyr-2
Oct 17, 2026
Merged

any-victor merged 1 commit into
mainfrom
chore/serde-saphyr-2

Conversation

@any-victor

Copy link
Copy Markdown
Contributor

This moves ctl-core to serde-saphyr 2.0.0 and yamled 0.0.7. yamled 0.0.7 uses the same serde-saphyr and granit-parser majors, so Cargo.lock holds one copy of each: granit-parser 1.3.0 → 2.0.0, serde-saphyr 1.3.0 → 2.0.0, yamled 0.0.5 → 0.0.7.

Changes

  1. Alias errors. In serde-saphyr 2.0, Error::AliasError carries the error the aliased value raised as a structured error: Box<Error>. Before, it held an English msg with positions written into the text.
    • Input::message walks through nested AliasError and WithSnippet to the failing error.
    • It renders that error with ctl-core's localizer and takes its location(). When that location is Location::UNKNOWN, it falls back to the anchor's.
    • baked_positions and trailing_position are removed; they parsed positions out of the 1.x text.
  2. Localizer. Unplaced overrides the new Localizer::alias_used_at to return nothing, because Problem already carries the file's line and column.
  3. Features. serde-saphyr's new comments feature is enabled. It gates Budget::max_total_comment_bytes, max_buffered_comment_events and BudgetBreach::CommentBytes, which Limits sets and reports.
  4. Tests. A new integration test covers an alias reached through another alias. It replaces the unit test of the removed parser. The existing alias test keeps its line, column and message.
  5. yamled. ctl-core calls Document::parse, locate_nearest, Path::root/key/index and Location { line, column }, all unchanged in 0.0.7.

Compatibility

Limits::budget() now returns serde-saphyr 2.0's Budget. A caller that passes it to serde-saphyr 1.x must move to 2.0 too. The patch changeset says so. On an earlier build of this change, cargo-semver-checks 0.51.0 reported "no semver update required"; CI's semver step checks again here.

Verification

CI verifies this branch. An earlier build of the same code change passed mise run verify and mise run semver, with yamled 0.0.5 standing in for 0.0.7. Since then the branch was rebased onto 0.6.22 and took yamled 0.0.7, so CI is the proof for this head.

@kodus-hostinger

kodus-hostinger Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review

Full · 1 open

@kody review after new commits. @kody full re-reads the whole PR.

Summary

This PR upgrades ctl-core to serde-saphyr 2.0.0 for YAML reading and yamled 0.0.7 for YAML editing. It also simplifies how errors inside aliased values are reported.

Dependency changes

  • serde-saphyr moves from 1.3.0 to 2.0.0, and its comments feature is now enabled alongside deserialize. Because of this, the comment-related limits in Limits continue to apply.
  • yamled moves from 0.0.5 to 0.0.7.
  • Breaking for callers: Limits::budget() now returns serde-saphyr 2.0's Budget. Callers that pass it to serde-saphyr 1.x must also upgrade to 2.0. This is noted in the changeset, which is still marked as a patch release.

Alias error reporting

In serde-saphyr 1.3.0, an alias error arrived as pre-rendered English text with positions baked in. ctl-core had to parse those positions back out of strings like at line N, column M and (defined at line N, column M).

serde-saphyr 2.0 keeps the inner error structured, so Input::message now works with that structure directly:

  • It unwraps nested AliasError and WithSnippet layers to reach the error the aliased value actually raised. This covers an alias reached through another alias.
  • The message uses that innermost error's own serde-saphyr wording.
  • The reported position comes from the failing error's own location. If that location is unknown, it falls back to where the anchor is defined.
  • The message format is unchanged: <text> (defined at line L, column C), with the line offset by the input's preceding lines.
  • The Unplaced localizer now also suppresses serde-saphyr's "alias used at" text (alias_used_at returns an empty string), so no extra position text appears.

The baked_positions and trailing_position string-parsing helpers and their unit test are removed.

Tests

A new integration test, an_alias_reached_through_another_alias_names_the_failing_value, covers a double-alias chain (copy: *o → nested: *b → port: eighty). It checks the following:

  • The problem is reported at line 6, column 7.
  • The message is invalid u16 (defined at line 3, column 9).

Files

File Status + −
.changeset/serde-saphyr-2.md added +7 −0
Cargo.toml modified +3 −2
src/input.rs modified +25 −60
tests/input.rs modified +41 −0

Open

File Severity Finding
.changeset/serde-saphyr-2.md medium The changeset releases a breaking public-type change (serde-saphyr 2.0's Budget returned from Limits::budget()) as a patch.

History

When Pass Open
17 Oct 19:50 UTC Full 1
17 Oct 13:00 UTC Incremental 1

Inspect this review

Comment thread .changeset/serde-saphyr-2.md Resolved
serde-saphyr 2.0 keeps the error an aliased value raised as a structured
inner error instead of English text with positions baked in. ctl-core
now renders that inner error and takes its location, so the parser that
pulled positions out of the alias text goes. The comments feature keeps
the comment limits in Limits, and the localizer's alias_used_at suffix
is dropped, because Problem already carries the file's line and column.
yamled 0.0.7 moves to the same serde-saphyr and granit-parser majors, so
the graph holds one copy of each.
@any-victor
any-victor force-pushed the chore/serde-saphyr-2 branch from 9c8035c to 94a13a8 Compare October 17, 2026 19:49
@any-victor
any-victor merged commit b35fb4c into main Oct 17, 2026
3 checks passed
@any-victor
any-victor deleted the chore/serde-saphyr-2 branch October 17, 2026 19:57
vsh-changeset-version Bot added a commit that referenced this pull request Oct 17, 2026
## ctl-core 0.6.23

- ctl-core reads YAML with serde-saphyr 2.0.0 and edits it with yamled 0.0.7. `Limits::budget()` now returns serde-saphyr 2.0's `Budget`; a caller that passes it to serde-saphyr 1.x must move to 2.0 with it. The `comments` feature is on, so the comment limits in `Limits` still apply.

An error raised inside an aliased value keeps serde-saphyr's own wording and points at that value, followed by where the anchor is defined. ctl-core no longer parses positions out of the rendered alias text ([#136](#136)).
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