Repository navigation
Migrate direct YAML parsing to the maintained fork - #618
Open
Pal Lakatos-Toth (pallakatos) wants to merge 7 commits into
Open
Pal Lakatos-Toth (pallakatos) wants to merge 7 commits into
Pal Lakatos-Toth (pallakatos) wants to merge 7 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Pal Lakatos-Toth (pallakatos)
requested review from
Johnson Shi (johnsonshi) and
Lachlan Evenson (lachie83)
as code owners
November 12, 2026 08:19
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace the repository conformance tool's normal serde_yaml dependency with serde-saphyr, preserving rendered/static Kubernetes manifest values and failing explicitly on invalid manifests. Keep legacy parsing as a test oracle only for this tool.\n\nRetain customer runtime parsers: differential tests reproduce leading-zero and tag incompatibilities that would make a blind substitution breaking. No AGT/kube pins, runtime parser code, MSRV or audit exceptions change. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Migrate controller YAML parsing and router rule counting to the YAML Organization fork, with differential coverage for signed-policy bytes, legacy scalars, tags, aliases, streams, errors and policy counts. Keep AGT's serde_yaml context type and all upstream dependencies unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Restore the YAML value model and stream API while preserving fail-closed malformed input handling and differential tests. Remove the separate saphyr dependency and compare tags, non-string keys, scalars and rendered manifests against the legacy parser. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Summary
Partial progress toward removing unmaintained
unsafe-libyaml; the dependency is not fully removed.serde_yamlto the YAML Organization's maintained yaml_serde 0.10.7, using Cargo's documentedserde_yamlpackage alias. Migrate the router's policy-rule counting parser to the same fork. AGT policy loading, enforcement, and the router's AGT context retain legacyserde_yaml::Value: AGT 4.1's public policy API requires that exact type. No mesh/transport changes or compatibility shim.serde_yaml/unsafe-libyaml. The public RustValuetype nevertheless has a new crate identity, so callers of this unpublished library must use the fork's type. Malformed manifests now fail explicitly instead of silently disappearing from the report. The previously evaluatedserde-saphyrand its transitive packages are removed.01, tags, boolean-like scalars, aliases, literal merge keys, duplicate keys, invalid UTF-8, malformed inputs and multi-document streams. Compare actual egress parsed endpoints, compiled canonical JSON bytes and digest against the legacy parse; verify tools profiles preserve signed raw bytes and digests. Existing canonical golden/negative and router policy-decision tests also pass.yaml_compatibility_policy_counts_and_decisions_preserve_legacy_numeric_versionstest using the realGovernance::load_policies_from_dirandGovernance::evaluatepath. For both legacy unquotedversion: 1andversion: 1.0, it asserts one rule loads, listedshell:rmis denied, and a differentshell:lsaction is allowed. This protects current pinned-AGT behavior only; it does not change production semantics or imply compatibility with a future AGT parser.01, tags, aliases, merge keys and non-string keys. Installed Helm must render successfully; only an absent Helm skips the rendered corpus, while static coverage always runs.Fork provenance and boundaries:
yaml_serde0.10.7 declares Rust 1.82 andlibyaml-rs0.3.0 declares Rust 1.60. The fork graph uses existingindexmap,itoa,ryu,serde, plus newlibyaml-rs(which has no normal dependencies). Compared to main, onlyyaml_serdeandlibyaml-rsare new; no existing package versions were upgraded. Scoped tests pass on Rust 1.88.yaml_serde0.10.7 tag andlibyaml-rs0.3.0 tag: all 29 and 20 Rust files respectively have matching Git blob hashes. Provenance caveat: the published libyaml-rs archive embeds VCS revision66d8ae3d348b328ef2159e3dc0bc53f1deb4c3a2, which upstream GitHub does not resolve, rather than release-tag commite95b9a3e83bfb00728162c82e61e393c393929d1. The reproducible reconstruction below demonstrates identical release content but does not establish how or why the history differs. Crate archives are Cargo-registry checksum verified. The fork is still libyaml translated into unsafe Rust, not a memory-safety rewrite;libyaml-rsis an upstream-maintained fork of archived unsafe-libyaml and its current release history is limited.libyaml-rs0.3.0 and all 40yaml_serde0.10.7 packaged source, original manifest, metadata, documentation and script files to their corresponding Git blobs at the public release tags. It excluded Cargo-generated.cargo-ok,.cargo_vcs_info.json,Cargo.lockand normalizedCargo.toml, and mappedCargo.toml.origto the taggedCargo.toml. The normalized manifests explicitly disable build scripts;libyaml-rshas no normal dependencies. This strengthens file-content provenance only.git cat-file commit e95b9a3e83bfb00728162c82e61e393c393929d1 | sed 's/1773254475 -0700/1773254376 -0700/g' | git hash-object -t commit --stdinoutputs exactly the embedded66d8ae3d348b328ef2159e3dc0bc53f1deb4c3a2. Only the author/committer timestamps change from 2026-03-11T18:41:15Z to 18:39:36Z; treeae0644733858560d7def952b0241593059ef1ca0, parent243f22a105eda9a8612b9b4cbfc81f13a5714bad, identities and messageRelease 0.3.0remain identical. The public crates.io index record records publication at 18:39:38Z and checksum2e126dda6f34391ab7b444f9922055facc83c07a910da3eb16f1e4d9c45dc777, matching Cargo.lock. This explains how the embedded SHA can identify the same release tree; it is not proof of how/why history changed, verified publisher identity, a signed attestation, or current upstream availability of that object.from_reader, the fork exposes the underlying I/O error viaError::source(), whereas the old crate returns no source. Display text is unchanged. The production paths changed here usefrom_str, notfrom_reader; tested malformed-input diagnostics and locations match.Remaining paths and upstream blockers:
unsafe-libyaml 0.2.11still comes through kube-client 3.1.0, AGT agentmesh 4.1.0 pinc3f75d508348a45df9dad7a929d1e137e1df80c0, and the router's directserde_yamlrequired for AGT context values. Controller normal graph retains it through kube, not through its own parser. Retain both existing advisory exceptions; this is an informational unmaintained advisory, not a demonstrated exploit.serde_yaml; its merged migration targets pending Rust 5.0.0, Rust 1.89 and changed public policy types (migration contract). No unreleased upstream pin or restored mesh fork.Related Issues
Relates to #595 (partial; not fixed or closed by this PR). Independent of #594 and #596. Do not merge as part of this work.
Type of Change
Checklist
make test)make lint)Testing
Local validation at final head
125a53588e3ea256c5a9ab270336b4d0635e5853:cargo test --locked --offline -p kars-inference-router governance::tests::yaml_compatibility_policy_counts_and_decisions_preserve_legacy_numeric_versions— passed; both unquoted numeric versions exercise the real loader/evaluator and assert one loaded rule, deny forshell:rm, and allow forshell:ls.cargo fmt --all -- --check,git diff --check,./ci/check-loc.sh, andbash ci/security-audit-required.sh— passed; the test remains within the source LOC cap and no gates or production behavior changed.cargo test --locked --offline --workspace --quiet— passed at prior headfa815df4, 2,238 tests, 3 documentation examples ignored.cargo +1.88.0 test --offline -p kars-controller yaml_compatibility— passed, 9 tests. Previous runtime commit54a93a57also passedcargo +1.88.0 test --locked --offline -p kars-controller policy_canonical::(102 tests) andcargo +1.88.0 test --locked --offline -p kars-controller helm_drift::(18 tests); these production paths did not change subsequently.cargo +1.88.0 test --offline -p kars-cncf-conformance— passed, 4 differential/negative tests and 17 criterion tests; Helm-rendered comparison ran.cargo test --offline -p kars-inference-router governance::tests::— passed, 19 tests including old/new rule-count comparison and AGT allow/deny decisions at runtime commit54a93a57; router production code did not change subsequently.cargo clippy --locked --offline -p kars-controller -p kars-inference-router -p kars-cncf-conformance --all-targets --all-features -- -D warnings— passed.cargo deny check advisories bans licenses sources— passed with existing warnings; exceptions retained.bash ci/check-copyright-headers.sh— passed.cargo tree --locked --offline -p kars-cncf-conformance --edges normalandcargo tree --locked --offline -i unsafe-libyaml --edges normal— confirmed the fork-only conformance normal graph and remaining kube/AGT/router paths above.cargo +1.88.0 check --locked --offline --workspace— fails on the pre-existing baseline: agentmesh/agentmesh-mcp, cedar-policy, aes and other already-locked dependencies require 1.89.GitHub CI at previous head
fa815df4ac24e025df47b326619b49559c9694fa: all 40 checks passed (CI run):cargo build --release --workspace— passed.cargo nextest run --workspace --release --no-fail-fast— passed, 2,238 tests, 0 skipped.cargo clippy --all-targets --all-features -- -D warnings— passed.make test-e2e— passed in Kind; chaos fault-injection checks also passed.security-audit-required, dependency review, RustSec, cargo-deny, CodeQL, secret scanning and other repository gates — passed.At superseded intermediate head
1e37e156,ci-gates/locfailed because the separate test pushed a 1,229-line source file over its 1,200-line cap. The test was consolidated into the existing compatibility test; the local LOC gate passes at final head125a53588e3ea256c5a9ab270336b4d0635e5853. Final-head GitHub CI at125a53588e3ea256c5a9ab270336b4d0635e5853: all 40 checks passed (run), including 2,238 release tests, Kind E2E (98 passed/0 failed), chaos checks, and all six benchmark groups within +25%. No prior-head CI result is presented as current-head validation.Updated cross-PR integration evidence:
git merge-treefor #618 at125a53588e3ea256c5a9ab270336b4d0635e5853and #620 atc47251ce14e1a0777caaf94c779a9c94404eab39reports oneCargo.lockconflict in the controller dependency list; the isolated resolution retains bothx509-certandyaml_serde. Locked/offline metadata contains onlycrypto-bigint 0.7.11(no0.5.5). WithCARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0 CARGO_BUILD_JOBS=2, 45 targeted tests passed: 9 controller YAML, 3 signed OCI, 21 conformance, 10 OAuth compatibility, 1 preinstalled-provider, and 1 governance numeric-policy regression. Pairwise virtual merges with Headlamp headc9fe3f82are clean. This is targeted evidence, not exhaustive compatibility; no actual branch was merged.Full local
make test,make lint, release build and E2E were not run; release build and Kind E2E ran in CI at the final head. AKS/live-customer validation was not run. #595 remains open until all unsafe-libyaml paths are removed.