Repository navigation
feat: Substitute variables in markdown tiles - #3246
Conversation
🦋 Changeset detectedLatest commit: 832e069 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
| annotations, | ||
| isLive, | ||
| readOnly, | ||
| variables, |
There was a problem hiding this comment.
🔵 minor — Every tile now re-renders when any filter changes
Adding the full variables array to the tile render memo's deps rebuilds every tile's chart element, not just markdown tiles, whenever any filter selection changes. Lines 582-601 go out of their way to avoid this by serializing only the referenced variables into tileVariables. Use tileVariables for substitution (it now includes markdown references via filterReferencedVariables). Pass a stable, serialized list of variable names for the unknown-variable check.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| config.displayType !== DisplayType.Markdown | ||
| config.displayType === DisplayType.Markdown | ||
| ) { | ||
| if (config.markdown) validate(config.markdown, 'markdown'); |
There was a problem hiding this comment.
🔵 minor — MCP warns about $word prose in markdown even when the dashboard has no variables
HDXMarkdownChart deliberately skips validation when !variables?.length, because nothing is substituted and $HOME or $PATH in a runbook note is just prose. getTileVariableWarnings still validates against [], so every markdown tile with a $word gets 'unknown variable … Available variables: (none)'. Skip the markdown validation when variables.length === 0 so it matches the UI.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
PR Review
4 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 4 minor 1 posted as inline comment(s) on the changed lines. 3 listed below. Findings outside the changed lines3 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
|
E2E Test Results✅ All tests passed • 387 passed • 1 skipped • 1612s
Tests ran across 4 shards in parallel. |
Deep ReviewScope: Variable substitution in markdown tiles — Intent: Substitute dashboard variables in markdown tiles, markdown-escaping values by default so they render as plain text, flag unknown references, and update MCP validation/prompts. ✅ No critical issues found. The security posture holds: 🟡 P2 -- recommended
🔵 P3 nitpicks (4)
Reviewers (7): correctness, testing, maintainability, security, kieran-typescript, adversarial, previous-comments. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
Summary
This PR extends variable substitution to markdown tiles. By default, variables are substituted using the new
markdownformat, which escapes values for markdown. Invalid references are flagged, and MCP validation/prompts have been updated.Security: By default, variable values are markdown-escaped, and markdown tiles already block scripts and raw HTML, so no XSS can occur. Users can opt out of escaping (for example, in markdown code blocks) by using a non-markdown variable from (eg.
${var:csv}).Screenshots or video
How to test on Vercel preview
References