fix(serve): render sequence/mapping field values structurally, not Rust Debug (REQ-107)#338
Merged
Merged
Conversation
…st Debug (REQ-107)
User-reported: an artifact field whose value is a sequence of mappings
rendered as the Rust Debug form —
Sequence [Mapping {"kind": String("e"), "page_id": String("e"),
"version": Number(2), "section": String("eee")}]
— because the field-rendering catch-all arm did
`html_escape(format!("{other:?}"))`.
Add `render_field_value(&serde_yaml::Value) -> String`: scalars as
plain text, sequences as `<ul class="field-seq">`, mappings as nested
`<dl class="field-map">`. Recursive, so a sequence-of-mappings (the
reported shape) renders as a readable list of key/value blocks. Used
by the artifact-detail extra-fields loop in place of the Debug
fallback; the String arm keeps its linkify-source-refs behaviour.
Tests:
- sequence_of_mappings_renders_structurally_not_debug — asserts the
structured markup AND that no `Sequence [` / `Mapping {` / `String(`
/ `Number(` debug tokens leak.
- scalar_field_values_render_plainly — bool/number/null.
Fixes: REQ-107
Refs: REQ-007
Verifies: REQ-107
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
📐 Rivet artifact deltaNo artifact changes in this PR. Code-only changes (renderer, CLI wiring, tests) don't touch the artifact graph. |
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: fec2eef | Previous: 120431c | Ratio |
|---|---|---|---|
link_graph_build/10000 |
36676946 ns/iter (± 3259200) |
29672123 ns/iter (± 763040) |
1.24 |
validate/10000 |
20284365 ns/iter (± 2316420) |
14184336 ns/iter (± 601363) |
1.43 |
diff/10000 |
9833980 ns/iter (± 804723) |
7925753 ns/iter (± 91416) |
1.24 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
User-reported: an artifact field whose value is a sequence of mappings rendered as the Rust
Debugform —— because the field-rendering catch-all did
html_escape(format!("{other:?}")).Fix: add
render_field_value(&serde_yaml::Value) -> String— scalars as plain text, sequences as<ul class="field-seq">, mappings as nested<dl class="field-map">, recursive. The artifact-detail extra-fields loop uses it instead of the Debug fallback; theStringarm keeps its linkify-source-refs behaviour.Tests
sequence_of_mappings_renders_structurally_not_debug— asserts structured markup AND that noSequence [/Mapping {/String(/Number(debug tokens leak.scalar_field_values_render_plainly— bool/number/null.Test plan
render::artifacts::tests(5 pass, 2 new)Fixes: REQ-107
🤖 Generated with Claude Code