Skip to content

fix(serve): render sequence/mapping field values structurally, not Rust Debug (REQ-107)#338

Merged
avrabe merged 1 commit into
mainfrom
fix/req-107-field-value-rendering
May 29, 2026
Merged

fix(serve): render sequence/mapping field values structurally, not Rust Debug (REQ-107)#338
avrabe merged 1 commit into
mainfrom
fix/req-107-field-value-rendering

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 29, 2026

Summary

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 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; the String arm keeps its linkify-source-refs behaviour.

Tests

  • sequence_of_mappings_renders_structurally_not_debug — asserts structured markup AND that no Sequence [ / Mapping { / String( / Number( debug tokens leak.
  • scalar_field_values_render_plainly — bool/number/null.

Test plan

  • render::artifacts::tests (5 pass, 2 new)
  • CI

Fixes: REQ-107

🤖 Generated with Claude Code

…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>
@github-actions
Copy link
Copy Markdown

📐 Rivet artifact delta

No artifact changes in this PR. Code-only changes (renderer, CLI wiring, tests) don't touch the artifact graph.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 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
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit e3e198b into main May 29, 2026
22 of 40 checks passed
@avrabe avrabe deleted the fix/req-107-field-value-rendering branch May 29, 2026 17:08
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