fix: render metric embeds on a div carrier with a readable sentence fallback#13
Merged
Conversation
…allback Closes the metric leftover from #10 (see also LightconeResearch/astra-theme#2, ecosystem notes). A produced metric embed (:::{astra} outputs.<id>) rendered as a collapsible key/value table on a 'details' carrier — a poor neutral fallback, and a node type rich themes can't sensibly key on, so the big-stat rendering never triggered even though the resolved store already carries the parsed metric. An unproduced output embed was worse: the pending admonition carried no identifier at all, so cross-references and store joins had nothing to land on. - A produced metric now renders as one div carrier (the #11 contract) bearing output-<id>, with a readable sentence fallback nested inside: "**<label>:** <value> ± <uncertainty> <unit>", built via readMetric. A JSON that isn't metric-shaped keeps the tabular fallback (wrapped in the same carrier). - An unproduced output embed (any type) wraps its Pending Output admonition in the identifier-bearing carrier div: anchors resolve and rich themes can join the store entry (label, description, provenance) before the artifact exists. - data / report types keep their current inline rendering. Tests: metric carrier test now pins the div + sentence + no-details shape; new unproduced-embed test pins the identifier + nested admonition (101/101 pass, tsc clean). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013EE6NiwH2UhVAUT6cdAQJ4
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.
Closes the metric leftover from #10 (also tracked in LightconeResearch/astra-theme#2's ecosystem notes).
Problem
The resolved store already materializes metrics (
metric: readMetric(absPath)since v0.0.6), but the embed rendering didn't hold up its end of the contract::::{astra} outputs.<id>) rendered as a collapsible key/value table on adetailscarrier — a poor neutral fallback, and a node type rich themes can't sensibly key on, so astra-theme's big-stat rendering (MetricStat) could never trigger.tagComponent'scarrierOffell back tonodes[0]for the class, but cross-references and store joins had nothing to land on, even though the store entry (label, description, full provenance) exists before the artifact does.(Side note from testing: the DESI prototype's
analyses/reconstruction/resultsis a broken symlink to NERSC scratch, which is why metrics appeared unexercisable there — worth knowing when testing locally.)Change
divcarrier (the fix: nest the decision/finding fallback inside the carrier node #11 contract) bearingoutput-<id>, with a readable sentence nested as the neutral fallback:<label>:<value> ± <uncertainty> <unit>, built viareadMetric. A JSON that isn't metric-shaped keeps the existing tabular fallback, wrapped in the same carrier.data/reporttypes keep their current inline rendering.Testing
div+ sentence + nodetails; new unproduced-embed test pins the identifier + nested admonition.vitest101/101,tscclean.6.42 ±0.31 Mpc/h+ label + provenance drawer) — the first time that component has rendered from real plugin output — and the pending embed keeps its admonition and gains the drawer. Theme-side support (adiv[class*="astra-output"]renderer bucket, inert on older plugins) is already on astra-theme main (c56c74a).🤖 Generated with Claude Code
https://claude.ai/code/session_013EE6NiwH2UhVAUT6cdAQJ4