Skip to content

[DRK-2597] Pin every /docs diagram SVG to the light theme - #547

Merged
baoduy merged 2 commits into
devfrom
docs/DRK-2597
Nov 25, 2026
Merged

baoduy merged 2 commits into
devfrom
docs/DRK-2597

Conversation

@baoduy

@baoduy baoduy commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Summary

Every one of the 193 diagram SVGs under docs/ now renders the light palette, whatever colour scheme the reader's OS or browser uses. Before this change, 187 were pinned dark and 6 followed the reader's colour scheme.

  • 190 SVGs were re-exported from their unchanged <name>.<type>.json sources with archify 3.0.1 (render --quality showcase --repo-root ., then the viewer's Export → SVG (light), data-format="svg-light"), driven headless in Chromium. No JSON file changed.
  • 3 SVGs were pinned, not re-rendered: docs/diagrams/dknet-domain-event-path.svg, and efcore-encryption-column-path.svg and encrypt-columns.svg in docs/DKNet.EfCore.Encryption/diagrams/. archify 3.0.1 now lays these three out differently from the committed SVG: label x positions, edge-label colour classes, and node-ui styling. A re-render would change the layout, which this ticket forbids. Those 3 files already hold both palettes and the svg[data-theme="light"] rule that archify's export writes for this purpose. So the only edit is data-theme="light" on the root <svg>. This deviates from the "JSON is the source of truth, never edit the SVG" rule for those 3 files. Their SVG and JSON already disagreed before this PR, and the next light re-export after a JSON edit brings them in line. docs/diagrams/README.md records this.
  • docs/diagrams/README.md (Regenerating an SVG, Conventions) and docs/Package-Doc-Template.md (Diagrams steps, rules, checklist) now require the Export → SVG (light) export. The README now gives a one-line check for it. The old README said to use "the same output the viewer's Export SVG button produces". That plain export follows the reader's colour scheme, and it is how the 6 OS-following diagrams got that behaviour.

Evidence

Root theme count on the committed tree:

$ for f in $(find docs -name '*.svg'); do grep -o '<svg[^>]*>' "$f" | head -1 | grep -o 'data-theme="[a-z]*"' || echo none; done | sort | uniq -c
 193 data-theme="light"
  • Rendered under a dark OS. All 193 committed SVGs were loaded in Chromium with prefers-color-scheme: dark. A file passes when its primary text is dark and its background is light or transparent. Result: light palette: 193/193. Screenshots checked: dknet-layers.svg and dknet-domain-event-path.svg (formerly OS-following) and DKNet.Fw.Extensions/diagrams/log-text.svg (formerly pinned dark).
  • Content unchanged. Each new SVG was compared with its origin/dev version after removing the <style> block, root attributes, background rect and whitespace. 190 match exactly once viewer-only metadata attributes are ignored (data-detail, data-detail-anchor, data-legend-kind, data-legend-label, data-legend-bridge). The current exporter drops those attributes, and they have no visual effect. Node, edge, label, legend and geometry are identical. In the 3 pinned files, only the root attribute changed.
  • Validation. archify validate <type> <json> --quality showcase --repo-root . passes for all 193 sources, using scratch copies that add meta.output (archify 3.x requires it, as the README notes): pass=193 fail=0.
  • Diff scope. The diff touches only docs/**/*.svg (193 files) and the two .md files. It changes no .json file and nothing outside docs/.

Merge danger

Low. The diff changes only docs assets. dknet-domain-event-path.svg has no background rect, as before, so it stays transparent over the page. On GitHub's dark page theme it shows light-palette content on a dark page. This was already true before for anyone using a light OS.

🤖 Generated with Claude Code

Re-export 190 archify SVGs with Export > SVG (light) from their unchanged JSON
sources; pin the three whose re-render drifts (dknet-domain-event-path,
efcore-encryption-column-path, encrypt-columns) with data-theme="light".
Record the light-theme export rule in docs/diagrams/README.md and
docs/Package-Doc-Template.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-authored-by: multica-agent <[email protected]>
@github-actions

Copy link
Copy Markdown

📊 Code Coverage Report

| Metric | Coverage |
|--------|----------|
| **Line Coverage** | 95.9% |
| **Branch Coverage** | 88.3% |
| **Method Coverage** | 91.2% |

**Lines:** 7096/undefined covered
**Branches:** 2979/undefined covered

📈 [View Full Coverage Report](https://github.com/baoduy/DKNet/actions/runs/45560850983)

@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.25%. Comparing base (d29ff95) to head (62493ed).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #547   +/-   ##
=======================================
  Coverage   93.25%   93.25%           
=======================================
  Files         219      219           
  Lines        7191     7191           
  Branches     1220     1220           
=======================================
  Hits         6706     6706           
  Misses        259      259           
  Partials      226      226           
Flag Coverage Δ
unittests 93.25% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@baoduy

baoduy commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Automated review gate — score 6.9 / 10 → REWORK (round 1 of 3)

Built right: 7/10 · Right thing: 9/10 · Head reviewed: e70a781c · CI: all green (build-test-coverage, test, codecov, Socket, Snyk).

The approach is right, and 192 of the 193 diagrams are done well. One diagram, docs/diagrams/dknet-domain-event-path.svg, still does not render light for a dark-mode reader. It has a light palette but no background, so on a dark GitHub page its lane headers and legend title become unreadable. For that reader this is worse than before the PR. That fails the ticket's acceptance check ("renders light whatever the reader's colour scheme"), and it is the only thing between this PR and a merge.

Score breakdown

Category Weight Score Notes
Correctness & logic 25% 10 —
Security 20% 10 Docs-only; no secrets, no workflow or package-source change
Testing & coverage 20% 10 No coverable lines (SVG + Markdown only)
Architecture & design 15% 10 —
Spec conformance 10% 6 1 blocking (below)
Style & conventions 5% 10 —
AI-slop gate 5% 10 —
Weighted 9.6
Cap 6.9 Any blocking finding. Caps beat the docs-only 9.0 floor.

Findings

[blocking] docs/diagrams/dknet-domain-event-path.svg:1 (root <svg>), :310 (first painted element): transparent canvas, so a dark-mode reader does not get a light diagram.

  • Trigger: a reader with GitHub in dark mode opens docs/Architecture.md:243, which embeds this SVG.
  • Wrong outcome: the root now pins data-theme="light", but nothing paints a background. The first painted element is <rect width="100%" height="100%" fill="url(#grid)" /> (line 310). The light palette's lane fills, lane headers ("01 / Raised in the domain" … "05 / Out of the DbContext"), grid and "Legend" title sit directly on GitHub's #0d1117. I rendered it in headless Chrome with --force-dark-mode as an <img> on a #0d1117 page: the lanes are grey slabs, and the lane headers and legend title cannot be read. The same render of the dev version was readable, because it followed the OS into its dark palette.
  • Why existing guards miss it: data-theme="light" pins the palette, not the canvas. The other 192 SVGs all paint an opaque light canvas: 190 carry <rect x="0" y="0" width=W height=H fill="#f4f5f7"/> matching their viewBox, and the 2 pinned Encryption SVGs carry a c-bg-rect. The PR's dark-OS check counted "background light or transparent" as a pass, which is looser than the ticket's "renders light whatever the reader's colour scheme".
  • Rule: DRK-2599 checks 1–2 and DRK-2598 acceptance criteria 1–2 (every SVG renders light under a dark OS; no dark rendering a dark-OS reader can get), plus DRK-2597's "consistent light theme".
  • Recommendation: add <rect x="0" y="0" width="1068" height="600" fill="#f4f5f7"/> as the first painted child, before the grid rect at line 310. This is the same canvas the 190 re-exports carry. A root style="background:#f4f5f7" would also work, but the rect keeps it identical to the others. Then adjust the docs/diagrams/README.md:45-49 note: it says the three pinned files only gained data-theme="light", which will no longer be true for this one.

[praise] The content-identity proof holds, and I re-ran it independently. With <style> removed, the element trees of 187 re-exported SVGs are identical to dev (tags, text, geometry) except for the viewer-only data-detail* / data-legend-* attributes. The 3 shared diagrams in docs/diagrams/ differ only in the background rect (class="c-bg-rect" became fill="#f4f5f7"). In the 3 pinned files, the only change is data-theme="light" on the root. No JSON changed, and nothing outside docs/ changed.

[praise] The root-cause fix in the docs is the durable part. docs/diagrams/README.md:25-37 and docs/Package-Doc-Template.md:208,222,257 now name Export → SVG (light) and explain why the plain export turns dark, and the README gives a one-line check. That stops the next regeneration from bringing dark back.

Verified

  • Root theme count, my own run at e70a781c: 193 data-theme="light". No root is dark or unthemed.
  • The light palette is unconditional in the re-exports: the last palette rule is a plain :root, svg { … } with the light values, not inside any @media. The 3 pinned files carry an svg[data-theme="light"] rule.
  • Dark-OS render (--force-dark-mode, <img> on a #0d1117 page) of dknet-layers, encrypt-columns, efcore-encryption-column-path and DKNet.Fw.Extensions/log-text shows an opaque light canvas. dknet-domain-event-path fails (above).
  • Animation is unchanged: only the 2 Encryption roots carry data-animation="trace", before and after.
  • The PR title [DRK-2597] Pin every /docs diagram SVG to the light theme and the commit carry no close words and no (MAJOR). The base is dev. No mermaid blocks were added.
  • archify validate was not re-run by the gate (archify is not installed on the gate runner). No .json source changed in this diff, so validation is unchanged from dev, and the author reports 193/193 passing.

GitHub review vote skipped: the PR author is the gate's own GitHub identity, so this is comment-only. The findings and routing are on the Multica review sub-task.

@github-actions

Copy link
Copy Markdown

📊 Code Coverage Report

| Metric | Coverage |
|--------|----------|
| **Line Coverage** | 95.9% |
| **Branch Coverage** | 88.3% |
| **Method Coverage** | 91.2% |

**Lines:** 7096/undefined covered
**Branches:** 2979/undefined covered

📈 [View Full Coverage Report](https://github.com/baoduy/DKNet/actions/runs/45561959644)

@baoduy

baoduy commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Automated review gate, re-review: score 10.0 / 10 → APPROVED, merging into dev

Built right: 10/10 · Right thing: 10/10 · Head reviewed: 62493edb · CI: all green (build-test-coverage, test, codecov/patch, codecov/project, Socket, Snyk).

Closure table (round 1 → round 2)

Round-1 finding Status Evidence
[blocking] docs/diagrams/dknet-domain-event-path.svg:1: light palette on a transparent canvas, unreadable on a dark GitHub page resolved :310 now paints <rect x="0" y="0" width="1068" height="600" fill="#f4f5f7"/> before the grid. Compared with dev, removing the root data-theme="light" and that one rect gives back the dev file byte for byte. The gate re-rendered it in headless Chrome with --force-dark-mode, as an <img> on a #0d1117 page: the canvas is opaque and light, and the lane headers "01" to "05" and the "Legend" title are readable. The README note at docs/diagrams/README.md:46-51 now records the added rect.

Score breakdown

Category Weight Score
Correctness & logic 25% 10
Security 20% 10
Testing & coverage 20% 10 (no coverable lines; SVG and Markdown only)
Architecture & design 15% 10
Spec conformance 10% 10
Style & conventions 5% 10
AI-slop gate 5% 10
Final 10.0 (no caps; docs-only floor 9.0 not needed)

Re-verified on the new head (full re-review, not only the fix)

  • Root theme count: 193 data-theme="light". No root is dark or unthemed.
  • Opaque light canvas: 191 SVGs carry a literal #f4f5f7 rect that covers the full viewBox, and 2 (the pinned Encryption files) carry c-bg-rect. None has no canvas.
  • Content identity against dev: 187 re-exports have identical element trees once <style> is removed (tags, text, geometry), apart from the viewer-only data-detail* / data-legend-* attributes. The 3 shared diagrams differ only in their background rect (class replaced by fill). The 3 pinned files differ only in their root attribute, plus the canvas rect on dknet-domain-event-path.
  • Scope: 195 files, all under docs/: 193 .svg plus docs/diagrams/README.md and docs/Package-Doc-Template.md. No .json file changed.
  • Mechanical checks:
    • Both commit titles and the PR title are clean: no close words, no (MAJOR).
    • The base is dev.
    • No mermaid blocks, no suppressions, no config or workflow files.
  • Not re-run: archify validate, because archify is not installed on the gate runner. No JSON changed, so validation is unchanged from dev. The author reports 193/193 passing.

[praise] The round-1 fix is exactly scoped: one rect and one README sentence, with a negative control in the author's own check. Together with the round-1 content-identity work and the README/template rule (Export → SVG (light)), this leaves the docs both light and protected from the next regeneration.

Release review: none (no security, supply-chain, gate-authored or owner-review trigger). GitHub approve vote skipped: the PR author is the gate's own GitHub identity, so this is comment-only.

@baoduy
baoduy merged commit 0f617e6 into dev Nov 25, 2026
7 checks passed
@baoduy
baoduy deleted the docs/DRK-2597 branch November 25, 2026 06:43
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