Skip to content

feat(design): add the shared report stylesheet and layout #4754

Done

Description

@dan-petty

Problem or Motivation

devops writes no HTML today (0 writers). The one agent HTML artifact uses its own fonts (Archivo, Source Sans 3 and JetBrains Mono), its own palette and its own breakpoints (720 px and 560 px). The project review report (#4679, #4720) and agent HTML artifacts have no shared layout.

Proposed Solution & Architectural Design

  • Add src/devops_cli/design/css/report.css (about 170 lines) that reads only token variables. It has: a byline; numbered captions ("Figure N-M." below a figure, "Table N-M." above a table and outside its scroll box); tables with rules only (a 2 px rule under the header, 1 px rules under rows, no vertical rules, no fills); SLO tiles; status marks as inline SVG shapes with a word (circle with a check "OK", triangle with "!" "Warn", hexagon with "x" "Fail", square with "i" "Info"); margin notes in a 15rem column at 75rem and wider, inline on a phone; scroll boxes for tables, code and charts (tabindex=0, role=region, a label); a theme toggle through data-theme.
  • report_css() in the design module returns the token CSS of feat(design): add the design tokens and their build #4738 plus report.css, so a page can inline both (9.3 KB of token CSS, 3.8 KB gzip).
  • A small HTML template with the report outline: title; byline (version or period, commit, UTC time); a summary of 3 to 5 sentences with numbers; numbered sections with figures and tables; a postmortem section (summary, impact with n, timeline in UTC, root causes and trigger, resolution and detection, action items, lessons learned) when the period has an incident; an appendix "Method and data".
  • A knowledge-base page tells agents to inline the same CSS in HTML artifacts and to load the fonts through Google Fonts (the artifact CSP allows only that font host).
  • The ast-grep rule "no color literal in hand-written CSS" covers report.css. feat(docs): build the docs site theme from the design tokens #4745 adds the rule; if this item merges first, this item adds it.

Target Subsystem

The src/devops_cli/design/ package and the knowledge base.

Existing Tool Considered

The layout model of Tufte CSS 1.9.0 (MIT): reading column, margin notes, full-width figures. The file itself is not used (fixed colors, a fixed font, no custom properties). The report outline takes traits of the Distill template (byline, figure widths, appendix) and no Distill code (not maintained since 2020). Jinja2 (in use) renders the template. Custom code: CSS that reads only tokens. Cost: about 120,000 tokens and 0.5 day.

Acceptance Criteria

  • The ast-grep rule finds 0 color literals in report.css.
  • A rendered sample report passes a headless browser check: no sideways page scroll at 400 px and 1280 px, chart text 12 px or larger, captions outside the scroll boxes, both themes, 0 console errors.
  • A test asserts that report_css() holds the token CSS and report.css.

Dependencies

Source: #4735

Alternatives check of 2026-11-26: partly.
Tool: edwardtufte/tufte-css (https://github.com/edwardtufte/tufte-css), MIT, last activity 2026-06-24, maintained.
Reason: Searches found Tufte CSS, the only maintained MIT stylesheet with the report's reading column, margin notes and full-width figures; it has no token variables, theme switch, numbered captions, status marks, scroll boxes or report template, so it covers the layout model only.

Covers:

  • Reading column with margin notes and full-width figures
  • CSS-only styling with no script
  • Rules-only booktabs-style table rules

Lacks:

  • No CSS custom properties; fixed colors and one font
  • No data-theme switch or second palette
  • No numbered captions, SLO tiles or status marks
  • No scroll boxes or report outline template

Proposed design

Problem statement

devops-cli writes no shared HTML report today. The one agent HTML artifact uses its own fonts, palette and breakpoints. The project review report and agent artifacts have no shared layout. This change adds a token-driven report.css, a report_css() bundle and a Jinja2 report outline. The live browser layout check is deferred because playwright is absent.

Acceptance criteria

Requirement: Token-only stylesheet

src/devops_cli/design/css/report.css SHALL use only token CSS variables for each color, font, size, space and width.

Scenario: No color literal

  • WHEN uv run pytest tests/design/test_report_css.py::test_no_color_literal runs the css-color-literal ast-grep rule over src/devops_cli/design/css/report.css.
  • THEN The rule reports 0 findings.

Requirement: Inline CSS bundle

devops_cli.design.report_css() SHALL return the four token CSS files in cascade order and then report.css, in one string.

Scenario: Bundle holds both parts

  • WHEN uv run pytest tests/design/test_report_css.py::test_bundle_order calls report_css().
  • THEN The string ends with the text of report.css, and the :root block, the @media (prefers-color-scheme: dark) block and the :root[data-theme="dark"] block come before it in that order.

Requirement: Report outline

The Jinja2 template SHALL render a title, a byline with version or period, commit and UTC time, a summary, numbered sections, an appendix "Method and data", and a postmortem section only when the period has an incident.

Scenario: Postmortem only with an incident

  • WHEN uv run pytest tests/design/test_report_template.py::test_postmortem_only_with_incident renders the template with a period that has no incident, and again with a period that has one.
  • THEN The first page has no postmortem section and the second page has one, and both pages hold the title, the byline, the numbered sections and the appendix.

Requirement: Rules-only tables and captions

A table SHALL have a 2 px rule under its header, a 1 px rule under each body row, no vertical rule and no fill, and its caption SHALL sit above the table and outside its scroll box.

Scenario: Table markup

  • WHEN uv run pytest tests/design/test_report_template.py::test_table_markup parses the rendered sample report and reads report.css.
  • THEN Each table sits in an element with tabindex="0" and role="region", its Table N-M. caption is the previous sibling of that element, and report.css holds the 2 px header rule and 1 px row rule with no vertical rule or fill.

Requirement: Status marks

A status mark SHALL be an inline SVG shape with a word: a circle with a check for "OK", a triangle with "!" for "Warn", a hexagon with "x" for "Fail" and a square with "i" for "Info".

Scenario: Each status mark

  • WHEN uv run pytest tests/design/test_report_template.py::test_status_marks renders a sample report with each status.
  • THEN Each status shows the named SVG shape and its word.

Requirement: SLO tiles

An SLO tile SHALL show a 36 px number and a status mark with a word.

Scenario: SLO tile

  • WHEN uv run pytest tests/design/test_report_template.py::test_slo_tile renders a sample report with an SLO tile.
  • THEN The tile holds the class for a 36 px number and a status mark.

Requirement: Scroll boxes for code blocks

The template SHALL put each code block in a scroll box with tabindex="0", role="region" and a label.

Scenario: Code block scroll box

  • WHEN uv run pytest tests/design/test_report_template.py::test_code_scroll_box renders a sample report with a code block.
  • THEN The code block sits in an element with tabindex="0", role="region" and an aria-label.

Requirement: Margin notes and breakpoints

report.css SHALL use breakpoint.md (40rem) and breakpoint.lg (75rem) for each @media width, and SHALL place margin notes in a 15rem column at 75rem and wider and inline below that width.

Scenario: Margin note media query

  • WHEN uv run pytest tests/design/test_report_css.py::test_margin_note_column reads report.css.
  • THEN Each @media width is 40rem or 75rem, a media query at 75rem sets the margin note column to 15rem, and the base rule places margin notes inline.

Requirement: Theme attribute

The template SHALL set data-theme on <html> when the render context gives a theme, and omit it otherwise.

Scenario: Theme attribute

  • WHEN uv run pytest tests/design/test_report_template.py::test_theme_attribute renders the template with and without a theme.
  • THEN The page with a theme has data-theme="light" or data-theme="dark" on <html>, and the page without a theme has no data-theme attribute.

Requirement: Fonts link

The template SHALL include a link to the Google Fonts css2 API for Source Serif 4, Source Sans 3 and Source Code Pro with display=swap.

Scenario: Google Fonts link

  • WHEN uv run pytest tests/design/test_report_template.py::test_fonts_link parses the rendered sample report.
  • THEN The page holds a <link> to https://fonts.googleapis.com/css2 with the three families and display=swap.

Requirement: Agent guideline

The guideline page SHALL tell an agent to inline report_css() in each HTML artifact and to load the Source faces from Google Fonts.

Scenario: Guideline content

  • WHEN uv run pytest tests/invariants/test_guidelines.py::test_agent_html_artifacts reads docs/guidelines/agent-html-artifacts.md.
  • THEN The page names report_css(), the Google Fonts css2 API and display=swap, and docs/guidelines/index.md links to the page.

Existing Tool Considered

The alternatives check of 2026-11-26 gives the verdict partly for Tufte CSS (https://github.com/edwardtufte/tufte-css), MIT, maintained. The check block in the issue body lists what it covers and lacks. The change builds its own token-driven report.css and a Jinja2 report outline to supply the missing token variables, data-theme switch, numbered captions, status marks, scroll boxes and template. Cost: about 120,000 tokens and 0.5 day to write, keep and fix.

Key questions

  • How does the layout check run without Playwright?: Defer the live browser check to a new issue. The main change uses static tests: the css-color-literal ast-grep rule, a unit test for report_css(), a template render test, a table and caption parse test, a breakpoint test, and a guideline test. The deferred issue adds playwright and the Chromium install. (best practice) [sources: docs/DESIGN.md]
    • Rejected: Add Playwright as a dependency in this item. The return says playwright is absent from pyproject.toml and the workspace. A browser install in CI is test infrastructure, not the report stylesheet.
    • Chosen: Defer the live browser check to a new issue. The rest of the change is workable with static tests. The deferred issue can add Playwright and the browser check.
  • Where does report_css() live, and which CSS does it return?: Add src/devops_cli/design/report.py with report_css(). It reads the built files as package data with importlib.resources and returns tokens-base.css, tokens-light.css, tokens-dark.css, tokens-dark-explicit.css, then report.css, in that order. (best practice) [sources: docs/DESIGN.md]
    • Rejected: Build the CSS text from devops_cli.design.tokens(mode). The Style Dictionary build already writes the CSS. A second writer drifts from it.
    • Chosen: Concatenate the built CSS files in cascade order. The token build stays the only writer of the token CSS, and the page inlines one string.
  • Where does the report template live, and how does a page render it?: Add src/devops_cli/templates/report.html.j2 and render it with Jinja2 from an Environment on the package template folder, with autoescape on. (best practice) [sources: docs/DESIGN.md]
    • Rejected: Build the HTML with Python string templates. The repository keeps its templates in src/devops_cli/templates/, and Jinja2 escapes the values.
    • Chosen: A Jinja2 template in src/devops_cli/templates/. It matches the template folder that the repository uses, and Jinja2 is in use.
  • Which breakpoints, widths and margin-note column does report.css use?: Use the token widths: size.measure (40rem) for reading text, size.wide (60rem) for figures and tables, size.full (72rem) for the frame and size.margin (15rem) for margin notes. Use breakpoint.md (40rem) and breakpoint.lg (75rem). The margin notes get their column at 75rem and sit inline below it. (best practice) [sources: docs/DESIGN.md]
    • Rejected: Keep the 720 px and 560 px breakpoints of the existing agent artifact. docs/DESIGN.md sets the breakpoints to 40rem and 75rem, and a test compares each @media width with the tokens.
    • Chosen: Use breakpoint.md and breakpoint.lg. The token values match the design spec and the existing test.
  • Which fonts does the report load, and through which host?: Load Source Serif 4 for reading text, Source Sans 3 for headings, tables and captions, and Source Code Pro for code, from the Google Fonts css2 API with display=swap. End each stack with system fonts. (best practice) [sources: docs/DESIGN.md]
    • Rejected: Keep the artifact fonts Archivo, Source Sans 3 and JetBrains Mono. docs/DESIGN.md names the Source family, and Archivo and JetBrains Mono are not tokens.
    • Chosen: Load the three Source faces from Google Fonts. The design spec names them, and the artifact CSP allows that host.
  • How do tables, captions and status marks look?: A table has a 2 px rule in color.fg under its header, a 1 px rule in color.border under each body row, no vertical rule and no fill. "Table N-M." sits above the table and outside its scroll box, and "Figure N-M." sits below the figure. A status mark is an inline SVG shape with a word: a circle with a check for "OK", a triangle with "!" for "Warn", a hexagon with "x" for "Fail" and a square with "i" for "Info". (best practice) [sources: docs/DESIGN.md]
    • Rejected: Use a status font glyph. Rule T6 says a web font does not have all mark glyphs.
    • Chosen: Inline SVG shape with a word, and rules-only tables. Rules T2 and T6 say so, and color is never the only sign of a state.
  • How do the scroll boxes and the phone layout work?: Tables, code blocks and static SVG charts scroll in their own box with tabindex="0", role="region" and a label. A chart keeps size.chart-min (40rem), so its 12 px text does not shrink. Under 40rem the page is one column, the margin notes sit inline, and the page never scrolls sideways. (best practice) [sources: docs/DESIGN.md]
    • Rejected: Let the page scroll sideways on a phone. The design spec says the page never scrolls to the side.
    • Chosen: One scroll box for each table, code block and chart. Rule T7 and the phone rule give the box its attributes and keep the captions outside it.
  • Does this item add a theme toggle script?: No. The token CSS files already switch on data-theme, so the template writes data-theme on <html> when a page sets it, and the system theme applies otherwise. The change adds no script, because the CSP of an agent artifact is set outside this item. (best practice) [sources: docs/DESIGN.md]
    • Rejected: Add an inline toggle script to the template. It needs script-src, and the CSP of agent artifacts is set outside this item.
    • Chosen: Switch on data-theme only, with no script. The three token CSS files already hold the selectors for both themes.
  • Does this item change the ast-grep rule css-color-literal?: No. The rule already rejects a color literal in the hand-written CSS of src/devops_cli/design/css/, so it covers report.css. Add the rule in this item only when the repository has none at implementation time. (best practice) [sources: docs/DESIGN.md]
  • Where does the page for agents go?: Add docs/guidelines/agent-html-artifacts.md and link it from docs/guidelines/index.md. It tells an agent to inline report_css() in each HTML artifact and to load the Source faces from Google Fonts. A guideline applies to each managed project, and the docs site publishes it. (best practice) [sources: CONTEXT.md, docs/guidelines/index.md]
    • Rejected: Add a section to docs/KNOWLEDGE_BASE.md. That page describes the knowledge base, and a rule for managed projects belongs in docs/guidelines/.
    • Chosen: A guideline under docs/guidelines/. CONTEXT.md defines a guideline as a rule for each managed project, and the docs site publishes it.
  • What does the report outline hold, and where do the charts stay?: Title; byline with version or period, commit and UTC time; a summary of 3 to 5 sentences with numbers; numbered sections with figures and tables; a postmortem section (summary, impact with n, timeline in UTC, root causes and trigger, resolution and detection, action items, lessons learned) only when the period has an incident; and an appendix "Method and data". Charts stay in feat(design): render report charts from the design tokens #4758, and the stylesheet gives them a scroll box and token colors only. (best practice) [sources: docs/DESIGN.md, docs/guidelines/sre.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4738

Moved to new items

#7616

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    status/new
    value/medium
    effort/medium
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: none. The title has the scope design, and .github/labels.yml declares no scope/design label. Add the label to the file to give the scope to this item.
    • Priority: P2-Medium. It enables other report work but does not block a release or fix a defect.
    • Value: Medium. It gives all HTML reports a consistent layout and theme, which users see in every report.
    • Effort: Medium. The body estimates about 120,000 tokens and 0.5 day of work.
    • Related: feat(roadmap): render the project review as an HTML page #4720, which asks for a different change. Both concern the HTML report look, but the candidate adds the shared CSS and template while #4720 renders one specific project review page.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Reason: The searches found Tufte CSS, an open and maintained stylesheet (MIT, not archived) whose layout model — reading column, sidenotes/margin notes, full-width figures — is exactly the part of the need the issue itself cites. It does not cover the rest of the need: it uses fixed colors and a fixed font with no CSS custom properties, so it cannot serve as the token-driven stylesheet, and it has no report template, theme toggle, numbered captions, SLO tiles, status marks or scroll boxes. No other library was found that covers the whole shared report stylesheet and layout, so Tufte CSS covers only a part.

    Tool: edwardtufte/tufte-css (https://github.com/edwardtufte/tufte-css)

    • License: MIT
    • Last activity: 2026-06-24
    • Maintained: yes

    Covers:

    • Reading-column layout model
    • Sidenotes and margin notes set beside the text
    • Full-width figures and graphics tightly integrated with the text

    Lacks:

    • Reads only token variables / CSS custom properties; Tufte CSS uses fixed colors and a fixed font with no custom properties
    • Theme toggle through data-theme
    • Numbered figure/table captions and rules-only table styling
    • SLO tiles and status marks as inline SVG shapes with a word
    • Scroll boxes for tables, code and charts (tabindex=0, role=region, a label)
    • The HTML report template/outline (byline, numbered sections, postmortem, appendix)

    Tools considered:

    Searches run:

    • Tufte CSS margin notes stylesheet maintained alternative, results: 5
    • CSS framework report layout design tokens margin notes tables, results: 5
    • HTML report CSS library theme toggle status badges tables design tokens open source, results: 5
    • open source HTML report stylesheet library margin notes sidenotes theme switch, results: 5
    • Tufte CSS custom properties CSS variables fork design tokens, results: 5

    Sources:

    Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.

  6. added
    status/ready
    and removed
    status/new
    on Nov 15, 2026
  7. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at e5dfddb (see proposed design in issue body).

  8. added
    owner/service
    and removed
    owner/service
    on Nov 25, 2026
  9. 10 remaining items

  10. added
    status/new
    and removed
    status/ready
    on Nov 28, 2026
  11. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  12. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  13. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 28, 2026
  14. removed
    status/in-review
    owner/agent
    on Nov 28, 2026
  15. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-28 20:38 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions