Repository navigation
Description
Problem or Motivation
devops uses no chart library (0 imports). The project review report (#4720) needs figures that follow the design spec of #4735 in both themes. #4720 keeps no color mapping of its own and reads vega_config(mode) of the design module. No dashboard or report shows an SLO, an error budget or a burn rate today.
Proposed Solution & Architectural Design
- Add an optional extra
reportwith altair 6.3.0 and vl-convert-python. Use one vl-convert-python pin with feat(roadmap): render the project review as an HTML page #4720. design.vega_config(mode)maps the token JSON of feat(design): add the design tokens and their build #4738 to the Vega-Lite config keys: fonts, font sizes, stroke widths, the category range (data.cat.1todata.cat.3), the cividis ramp and the diverging ramp. The config holds no literal color and no literal size.- Register
devops-lightanddevops-darkwithalt.theme.register. render_svg_pair(chart)writes a light SVG and a dark SVG, with text kept as text. A page switches them with the same selectors as the tokens.- The design module holds the 3 series dash arrays (solid,
6 3,8 3 2 3) and the reference dash2 2, which no series uses. - Add builders for the figures of rule C12 of
docs/DESIGN.md:- burn rate: the 1 h series against its 14.4x page line (2 % of the budget), the 6 h series against its 6x page line (5 % of the budget), and the 1x budget-pace line; y from 0, unit "x"; never a 1 h series against the 6x line (SRE workbook, Table 5-8);
- error budget: the budget left (%) over the window from 100 %, with a dashed even-burn line to 0 % at the window end;
- golden signals in book order: latency (s; p50, p95 and p99 as cividis steps 5, 7 and 9), traffic (reqps), errors (percentunit, with the SLO line), saturation (percentunit, with the limit line);
- toil: stacked columns of hours per week from zero, 3 categories plus "Other", with labeled totals.
- Threshold labels sit at the left end inside the plot. Every aggregate states n and the window; p99 needs n of 100 or more and p95 n of 20 or more, else the figure prints "low sample" and the n.
Target Subsystem
The src/devops_cli/design/ package (charts in code).
Existing Tool Considered
Vega-Lite takes the whole theme as one config object. Altair (BSD-3-Clause) writes Vega-Lite, and vl-convert-python (BSD-3-Clause) renders static SVG with no browser. matplotlib is not added, because no target needs it. Custom code: the token-to-config map (about 35 lines) and the figure builders. Cost: about 120,000 tokens and 0.5 day.
Acceptance Criteria
- A test renders the burn-rate figure in both themes. The SVGs hold only token colors, text of 12 px or larger, y from 0, one page line for each window, and threshold labels at the left end.
- A test asserts that the dash arrays of the design module equal
docs/DESIGN.md. - A warm render of one figure takes less than 1 s.
Dependencies
- feat(design): add the design tokens and their build #4738 (the token JSON and
docs/DESIGN.md).
Source: #4735
Alternatives check of 2026-11-26: covers.
Tool: vega/altair (https://github.com/vega/altair), BSD-3-Clause, last activity 2026-11-17, maintained.
Reason: Searches returned no other chart tool, and the facts confirm Altair writes Vega-Lite specs with named themes while vl-convert-python renders static SVG without a browser, so the pair covers the chart and render need.
Covers:
- Declarative Vega-Lite chart specs written from Python
- Named Altair themes applied to every chart
- One Vega-Lite config object for fonts, sizes and ranges
- Static SVG output through vl-convert, text kept as text
Lacks:
- Token-to-Vega-Lite config map from the design tokens
- Burn-rate, error-budget, golden-signal and toil builders
- Sample-size gate and left-end threshold labels
Proposed design
Problem statement
The project review report of #4720 has no figures, and devops has no chart library. The report must show the SLO, the error budget, the burn rate, the golden signals and toil in both themes, from the design tokens. This issue adds an optional report extra and the devops_cli.design.charts module. The module builds token-driven Altair charts and returns a light SVG and a dark SVG.
Acceptance criteria
Requirement: Token-driven Vega-Lite config
devops_cli.design.charts.vega_config(mode) SHALL build the Vega-Lite config from tokens(mode) and MUST hold no literal color and no literal size.
Scenario: Config values come from the tokens
- WHEN The test calls
vega_config('light')andvega_config('dark'), collects each color and each size value, and readstokens(mode). - THEN Each color equals a
color-*token of its theme, each size equals afont-size-*,chart-font-size-*orchart-stroke-*token converted to px, and each font size is 12 or more.
Requirement: Category range and ramps
The config SHALL set the categorical range to color-data-cat-1 to color-data-cat-3 and the sequential and diverging ranges to the 9 token steps of the theme.
Scenario: The ramps follow the theme
- WHEN The test reads the range entries of
vega_config('light')andvega_config('dark'). - THEN The category range holds the 3 category tokens in order, the sequential range holds
color-data-seq-1tocolor-data-seq-9, the diverging range holdscolor-data-div-1tocolor-data-div-9, and the dark sequential range reverses the light one.
Requirement: Registered Altair themes
The module SHALL register the Altair themes devops-light and devops-dark with alt.theme.register and MUST give each the config of its mode.
Scenario: Each registered theme applies
- WHEN The test enables
devops-lightand thendevops-darkand builds a bar chart with no explicit config. - THEN Each chart spec holds the background, the font and the ranges of
vega_config(mode)for its theme.
Requirement: Light and dark SVG pair
render_svg_pair(chart) SHALL return one light SVG and one dark SVG of the same chart and MUST keep text as text.
Scenario: Text stays text
- WHEN The test renders a chart that has a title and an axis title.
- THEN Each SVG parses as XML, holds
<text>elements for the title and the axis title with the same strings, and holds no<image>element.
Requirement: Rendered SVG uses only token colors and sizes
Each rendered SVG SHALL hold only color values and font sizes that come from the tokens of its theme.
Scenario: The burn-rate SVG holds only tokens
- WHEN The test renders the 30-day burn-rate figure in both themes and parses each SVG.
- THEN Each color value, normalized to lowercase 6-digit hex, equals a
color-*token of its theme or isnoneortransparent, and eachfont-sizevalue is 12 or more.
Requirement: Render through vl-convert-python
The render SHALL pass the chart spec to vl_convert.vegalite_to_svg and MUST start no browser and make no network request.
Scenario: The render calls vl-convert
- WHEN The test replaces
vl_convert.vegalite_to_svgwith a spy and callsrender_svg_pair. - THEN The spy receives the spec of each theme once, the call returns both SVG strings, and the test observes no subprocess call and no network request.
Requirement: Series and reference dash arrays
Each line series SHALL take its dash array from SERIES_DASHES and each reference line SHALL take REFERENCE_DASH.
Scenario: The burn-rate marks use the module patterns
- WHEN The test builds the burn-rate chart and reads the
strokeDashof each line and rule mark. - THEN The 1 h and 6 h series take
SERIES_DASHES[0]andSERIES_DASHES[1], each page line and the pace line takeREFERENCE_DASH, and the module values equal the table ofdocs/DESIGN.md.
Requirement: Burn-rate figure
The burn-rate builder SHALL draw the 1 h series against its page line and the 6 h series against its page line, with y from 0 and the unit x, and MUST NOT draw the 1 h series against the 6x line.
Scenario: Each window has one page line
- WHEN The test builds the 30-day burn-rate figure.
- THEN The figure holds a 14.4 page line for the 1 h series, a 6 page line for the 6 h series and one 1x pace line, the y domain starts at 0, the y title is
Burn rate (x), and no 1 h series uses the 6x line.
Requirement: Error-budget figure
The error-budget builder SHALL draw the budget left in percent from 100 % over the window and MUST add a dashed even-burn line to 0 % at the window end.
Scenario: Even burn reaches 0 at the window end
- WHEN The test builds the 30-day error-budget figure.
- THEN The y domain is 0 to 100, the y title is
Error budget left (%), and one dashed line runs from 100 % at the window start to 0 % at the window end.
Requirement: Golden signals in book order
The builders SHALL produce latency, traffic, errors and saturation in that order, with the units s, reqps, percentunit and percentunit.
Scenario: Latency uses the ramp steps
- WHEN The test builds the four golden-signal figures.
- THEN The builders are named in the order latency, traffic, errors and saturation; latency holds p50, p95 and p99 in
color-data-seq-5,color-data-seq-7andcolor-data-seq-9; errors holds the SLO line; saturation holds the limit line; and each y axis title ends with its unit.
Requirement: Toil figure
The toil builder SHALL draw stacked columns of hours per week from 0, with 3 categories plus Other and a labeled total on each column.
Scenario: Each week shows its total
- WHEN The test builds the toil figure for 8 weeks.
- THEN The chart holds 4 stacked bar series in the fixed order, the y domain starts at 0 with the title
Toil (h), and each of the 8 columns holds a text mark with its total.
Requirement: Threshold labels at the left end
Each reference line SHALL carry a direct label at the left end inside the plot and MUST give the label a 3 px halo in the background token.
Scenario: A page line label stays inside the plot
- WHEN The test builds the burn-rate figure and reads the text marks of the reference lines.
- THEN Each page line and the pace line has a text mark at the left edge of the plot area, inside it, and each text mark has a 3 px stroke in the background token.
Requirement: Sample-size gate
Each aggregate SHALL state n and the window, and the figure MUST print low sample with n when p99 has n below 100 or p95 has n below 20.
Scenario: A low sample hides p99 and p95
- WHEN The test builds the latency figure with n of 10, 50 and 150.
- THEN At n of 10 the figure draws p50, draws no p95 and no p99, and holds the text
low samplewith10; at n of 50 it draws p50 and p95 and no p99, withlow sampleand50; at n of 150 it draws p99.
Requirement: Optional report extra
pyproject.toml SHALL provide an optional extra report that installs altair==6.3.0 and a pinned vl-convert-python.
Scenario: The report extra installs the pinned tools
- WHEN The check runs
uv sync --locked --extra reportand thenuv run python -c 'import altair, vl_convert; print(altair.__version__)'. - THEN The sync resolves the extra, both imports succeed, and the command prints
6.3.0.
Requirement: Base package without the extra
Importing devops_cli.design SHALL work without the optional report extra and MUST not import altair or vl_convert.
Scenario: The base package imports with the optional tools blocked
- WHEN The test installs an import blocker for
altairandvl_convertand importsdevops_cli.design. - THEN The import succeeds,
tokens('light')returns the light token dict, andaltairandvl_convertare absent fromsys.modules.
Existing Tool Considered
vega/altair (https://github.com/vega/altair) with vl-convert-python gives the verdict covers in the alternatives check of 2026-11-20 in the issue body. That block lists what the tools cover and what they lack. A person adopted the tool in a reply to the check. This issue writes the missing token-to-config map and the C12 builders, at a written cost of about 120,000 tokens and 0.5 day.
Key questions
- The alternatives check found that
https://github.com/vega/altaircovers this item. Adopt the tool, or keep the item and give the reason.: Adopt vega/altair with vl-convert-python, as the person replied. AGENTS.md rule 3 requires an open tool before new code. (best practice) [sources: AGENTS.md, docs/DESIGN.md]- Chosen: Adopt vega/altair with vl-convert-python. The person adopted it, AGENTS.md rule 3 requires an open tool first, and the block gives
covers. - Rejected: Build the chart renderer in the project. It rebuilds scales, axes, legends and SVG text at a written cost of about 120,000 tokens and 0.5 day.
- Rejected: matplotlib. It has no Vega-Lite config object and no named theme, and the design spec does not name it.
- Chosen: Adopt vega/altair with vl-convert-python. The person adopted it, AGENTS.md rule 3 requires an open tool first, and the block gives
- Where does the chart code live, and how does it keep the optional dependency out of the base package?: In
src/devops_cli/design/charts.py.src/devops_cli/design/__init__.pykeepstokens,SERIES_DASHESandREFERENCE_DASHand imports no optional tool.charts.pyimports Altair and vl-convert. (best practice) [sources: pyproject.toml, src/devops_cli/design/init.py, docs/DESIGN.md]- Chosen: A
devops_cli.design.chartssubmodule. The base package keeps no import of an optional tool, and the chart code has one home. - Rejected: The functions in
devops_cli.design.__init__. A module-level Altair import breaksdevops_cli.design.tokensfor a base install without thereportextra. - Rejected: A lazy import in
devops_cli.design.__init__. It hides the optional edge and makes the import test indirect.
- Chosen: A
- How does the config turn the rem and px token strings into Vega-Lite numbers?: The map converts each length token to a number: multiply a rem value by 16, and drop the px suffix. A 0.75rem font token becomes 12, and a 1.5px stroke token becomes 1.5. The 16 px root is the base of the token scale. (best practice) [sources: design/tokens/base.tokens.json, src/devops_cli/design/tokens-base.json, docs/DESIGN.md]
- Chosen: Convert to a number in px at map time. Vega-Lite config takes numbers for
fontSizeandstrokeWidth, and the value still comes from a token. - Rejected: Pass the token strings through. Vega-Lite expects a number for
fontSizeandstrokeWidth, so a rem or px string is not valid. - Rejected: Hard-code the px numbers in the map. It adds literal sizes, which the issue forbids.
- Chosen: Convert to a number in px at map time. Vega-Lite config takes numbers for
- Which Vega-Lite config keys does the map fill?:
fontfromfont-family-sans;fontSize,title.fontSize,axis.labelFontSize,axis.titleFontSizeandlegend.labelFontSizefrom thechart-font-size-*tokens;strokeWidthfromchart-stroke-data;axis.gridWidthfromchart-stroke-grid;rule.strokeWidthfromchart-stroke-reference;backgroundfromcolor-bg;title.color,axis.labelColorandlegend.labelColorfromcolor-fgandcolor-fg-muted;axis.domainColorfromcolor-border-strong;axis.gridColorfromcolor-border; and the ranges from the data tokens. No key holds a literal color or size. (best practice) [sources: docs/DESIGN.md, src/devops_cli/design/tokens-base.json, src/devops_cli/design/tokens-light.json]- Chosen: Map every config key from a token. It follows C4, C6, C7 and C8 and keeps the config free of literals.
- Rejected: Map only the colors and leave the sizes to Altair defaults. The defaults are not the 12 px floor and the 1.5 px and 1 px strokes of the spec.
- Does the sequential and diverging range use the Vega scheme name or the 9 token steps?: The 9 token steps of each theme, as an explicit array. The named
cividisscheme has one order, anddocs/DESIGN.mdreverses the sequential ramp in the dark theme. (best practice) [sources: docs/DESIGN.md, src/devops_cli/design/tokens-light.json, src/devops_cli/design/tokens-dark.json]- Chosen: The 9 token steps as an array. It follows the theme reversal that
docs/DESIGN.mdstates. - Rejected: The Vega scheme
cividis. The scheme has one order, so the dark theme would not reverse. - Rejected: The Grafana name
continuous-cividis. It is a Grafana setting, not a Vega-Lite range.
- Chosen: The 9 token steps as an array. It follows the theme reversal that
- Where do the series and reference dash arrays come from?: From
SERIES_DASHESandREFERENCE_DASHofdevops_cli.design. DTCG has no dash token, so the module holds them, andtests/design/test_design_spec.pycompares them with the table ofdocs/DESIGN.md. (best practice) [sources: src/devops_cli/design/init.py:24, src/devops_cli/design/init.py:26, tests/design/test_design_spec.py, docs/DESIGN.md]- Chosen: The module constants.
docs/DESIGN.mdsays the module holds them, and the existing test compares them with the table. - Rejected: New DTCG tokens. DTCG has no dash type, so the build cannot write them.
- Chosen: The module constants.
- How does the report page switch the light and the dark SVG?:
render_svg_pairreturns both SVG strings and adds no CSS. The report page of feat(design): add the shared report stylesheet and layout #4754 inlines the pair and hides one with the token selectors::rootfor light,:root:not([data-theme="light"])inside@media (prefers-color-scheme: dark)for the system dark theme, and:root[data-theme="dark"]for an explicit dark theme. (best practice) [sources: docs/DESIGN.md, src/devops_cli/design/tokens-light.css, src/devops_cli/design/tokens-dark.css, src/devops_cli/design/tokens-dark-explicit.css]- Chosen: Two SVGs and the page token selectors. It is the report rule of
docs/DESIGN.mdand reuses the selectors of the token CSS. - Rejected: One SVG with
prefers-color-schemeCSS inside. A rendered SVG holds fixed colors, and the chart library cannot change them. - Rejected: A
<picture>element with two sources.docs/DESIGN.mduses<picture>for Markdown charts, not for the inline report SVG.
- Chosen: Two SVGs and the page token selectors. It is the report rule of
- How does the render keep text as text?:
vl_convert.vegalite_to_svgwrites SVG<text>elements. The module passes the spec with inline data and no remote URL, so vl-convert uses its embedded renderer and needs no browser, Node.js or network request. (best practice) [sources: docs/DESIGN.md]- Chosen: vl-convert SVG output. It writes text elements and needs no browser or Node.js.
- Rejected: Raster PNG output.
docs/DESIGN.mdneeds an SVG pair and a text layer.
- What sample-size gate do the aggregate figures use?: Each aggregate states n and the window. The figure hides p99 when n is below 100 and p95 when n is below 20. It prints
low samplewith n. (best practice) [sources: docs/DESIGN.md]- Chosen: The gate at 100 and 20. Rule C9 of
docs/DESIGN.mdgives these numbers. - Rejected: No gate. Rule C9 forbids a p99 at a low n.
- Chosen: The gate at 100 and 20. Rule C9 of
- Where does the dependency pin live, and how does it stay one pin with feat(roadmap): render the project review as an HTML page #4720?: This issue adds the optional extra
reportinpyproject.tomlwithaltair==6.3.0and onevl-convert-pythonpin. feat(roadmap): render the project review as an HTML page #4720 reuses the extra and adds no second pin. The pin follows the project rule: the newest release that passes the tests, with no minimum release age. (best practice) [sources: pyproject.toml, docs/DESIGN.md, CONTRIBUTING.md]- Chosen: One extra in this issue. The body says to use one pin with feat(roadmap): render the project review as an HTML page #4720, and feat(roadmap): render the project review as an HTML page #4720 reads
vega_configfrom this module. - Rejected: An extra in each issue. Two extras with different pins conflict in
pyproject.toml.
- Chosen: One extra in this issue. The body says to use one pin with feat(roadmap): render the project review as an HTML page #4720, and feat(roadmap): render the project review as an HTML page #4720 reads
- Does the proposal keep the 1 s warm-render limit as an acceptance criterion?: No. The proposal replaces the wall-clock limit with a check that the render passes the spec to
vl_convert.vegalite_to_svgonce for each theme.docs/TESTING.mdforbids a test that bounds elapsed wall-clock time from above, because a loaded machine fails correct code. (best practice) [sources: docs/TESTING.md, .ast-grep/rules/test-elapsed-upper-bound.yml]- Chosen: A spy on the render call. It is stable on a loaded runner and it proves the renderer.
- Rejected: The 1 s wall-clock limit. A shared CI runner breaks the limit at random, and the project rule forbids it.
- Does this issue still depend on feat(design): add the design tokens and their build #4738?: No. feat(design): add the design tokens and their build #4738 is archived, and its token sources, flat JSON and CSS are in
design/tokens/andsrc/devops_cli/design/. The tokens anddocs/DESIGN.mdare in the tree, so this issue has no open dependency. [sources: openspec/changes/archive/2026-11-11-4738-add-the-design-tokens-and-their/proposal.md, src/devops_cli/design/tokens-light.json, src/devops_cli/design/tokens-base.json, docs/DESIGN.md] - Which functions and constants of the design module does this issue read?:
tokens(mode),SERIES_DASHESandREFERENCE_DASHofdevops_cli.design. The chart module addsvega_config(mode),render_svg_pair(chart)and the C12 builders. [sources: src/devops_cli/design/init.py:24, src/devops_cli/design/init.py:26, docs/DESIGN.md] - Do the Grafana service dashboards already show an SLO, an error budget and a burn rate?: Yes.
src/devops_cli/grafana/service_dashboard.pybuilds the four SLO tiles, the burn rate and the error budget, and the golden signals for each service dashboard.docs/DESIGN.mdrecords that layout. The gap is the project review report of feat(roadmap): render the project review as an HTML page #4720, which has no chart library and no figures. [sources: src/devops_cli/grafana/service_dashboard.py, docs/DESIGN.md]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.design, and .github/labels.yml declares no scope/design label. Add the label to the file to give the scope to this item.It is a planned dependency for #4720 but is not a blocking defect.It enables the report charts that #4720 needs but is infrastructure for one consumer.The body estimates about 120,000 tokens and 0.5 day of work.Both work on report charts with design tokens, but the candidate provides the vega_config and figure builders while #4720 renders the project review HTML page that consumes them.devops-cli-service commentedon Nov 14, 2026
Alternatives check: covers
Reason: The searches found that Altair is an open, maintained Python chart library that writes Vega-Lite specs and registers named themes with
alt.theme.register, and that vl-convert-python renders Vega-Lite to static SVG with no browser — the exact chart library and renderer the issue proposes, and the issue body already namesaltair 6.3.0andvl-convert-pythonas the tools to add. Only the project-specific token-to-config map and figure builders remain as custom code, which the issue already accounts for.Tool: altair (https://pypi.org/project/altair)
Covers:
Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 15, 2026
Owner question: The alternatives check found that https://pypi.org/project/altair covers this item. Adopt the tool, or keep the item and give the reason. (a person decides)
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 20, 2026
The result in the alternatives block of the issue body changed. Before this check:
covers, tool https://pypi.org/project/altair. A person decides what the new result means for the item.Searches (5)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 20, 2026
Owner question: See the first point of Open questions in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
dan-petty commentedon Nov 24, 2026
Adopt the tool: vega/altair. AGENTS.md rule 3 requires using an open tool before building.
10 remaining items
fix(design): defer chart extra imports and clear CI checks (#4758)
chore(main): release 0.237.0 (#7611)
devops-cli-service commentedon Nov 28, 2026
Released in v0.237.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.237.0
devops-cli-service commentedon Nov 28, 2026
Live since 2026-11-28 18:38 UTC