Diagnostics & report tool

This commit is contained in:
Dandaedre 2026-09-05 19:02:47 +02:00
parent 7e31d7aae3
commit 49162bea55
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
12 changed files with 2781 additions and 2 deletions

19
.gitignore vendored Normal file
View File

@ -0,0 +1,19 @@
# Generated reports
/build/
/report.pdf
# Typst temporary and backup files
*.typst-backup
*.typ~
# Editor files
*.swp
*.swo
*~
.idea/
.vscode/
# Operating-system metadata
.DS_Store
Thumbs.db
Desktop.ini

View File

@ -1,3 +1,97 @@
# report
# Beffroi Reports
Corporate reporting with typist
Create consistent technical PDF reports from readable, version-controlled YAML.
Typst handles the layout, while each report remains easy to edit, review, and
diff in Git.
## Quick overview
### Requirements
- [Typst](https://typst.app/) available as `typst`
- Bash and standard Unix command-line utilities
No additional Typst packages are required.
### Create and render a report
1. Copy an existing file in `reports/`, or start with the
[minimal boilerplate](docs/examples.md#minimal-report).
2. Edit the YAML content.
3. Render it:
```bash
./render.sh reports/my-report.yaml
```
The PDF is written to `build/my-report.pdf`. To render every report recursively:
```bash
./render.sh --all
```
Set the report's purpose explicitly:
```yaml
report_type: technical # Investigation, engineering review, or handoff
# report_type: briefing # Concise findings for stakeholders
```
See [Report types](docs/writing-reports.md#report-types) for the distinction.
Every report must include an author and date, and may select a theme:
```yaml
theme: default # Also available: cic, eridani
metadata:
Date: "2026-09-05"
Author: "Your Name"
```
Compilation stops with an actionable error if `metadata.Date` or
`metadata.Author` is absent or empty.
You can also invoke Typst directly:
```bash
typst compile \
--input report=reports/my-report.yaml \
report.typ \
build/my-report.pdf
```
### Project layout
```text
report.typ Typst entry point
model.typ Shared layout and YAML renderer
render.sh Convenience build script
assets/ Logos and other static assets
reports/ Authoritative YAML report sources
build/ Generated PDFs
docs/ Detailed documentation and examples
```
## Detailed guides
- [Writing reports](docs/writing-reports.md) — field reference, content blocks,
report types, status values, and authoring guidance.
- [Examples and boilerplate](docs/examples.md) — complete minimal and full
reports ready to copy and adapt.
- [Advanced setup](docs/advanced-setup.md) — nested archives, customization,
YAML themes, automation, and Git policy.
## Core principle
YAML files are the authoritative report sources. Keep content and report state
in YAML, and keep visual presentation in `model.typ`. For example, prefer
`severity: high` over fields that specify colors or fonts.
Generated PDFs are reproducible artifacts suitable for email, handoff,
printing, tickets, and archival. Whether they are committed to Git is a project
policy; see [Generated PDF policy](docs/advanced-setup.md#generated-pdf-policy).
## License
See [LICENSE](LICENSE).

BIN
assets/beffroi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

164
docs/advanced-setup.md Normal file
View File

@ -0,0 +1,164 @@
# Advanced setup
The default setup has no external Typst dependencies. These options are useful
when the report archive or build process grows.
## Nested report archives
`./render.sh --all` searches `reports/` recursively. Reports can therefore be
organized by year, month, customer, or project:
```text
reports/
├── 2026/
│ ├── incidents/
│ │ └── api-latency.yaml
│ └── handoffs/
│ └── 2026-09-05.yaml
templates/
└── incident.yaml
```
To avoid rendering template YAML during `--all`, keep reusable templates
outside `reports/`, for example in a top-level `templates/` directory.
## Customize branding and layout
- Replace `assets/beffroi.png` with your logo, or update the `logo` argument in
`report.typ`.
- Change colors, typography, spacing, and components in `model.typ`.
- Keep report-specific content out of the Typst model so historical YAML files
remain reusable with later design changes.
After a model change, rebuild every report to check for regressions:
```bash
./render.sh --all
```
## Themes
A report selects its theme by name:
```yaml
theme: eridani
```
All themes live in the top-level `themes.yaml` registry. The built-in choices
are `default`, `cic`, and `eridani`. To add one, copy an existing mapping, give
it a new key, and adjust its values:
```yaml
my_theme:
label: "My Theme"
font: "DejaVu Sans"
mono_font: "DejaVu Sans Mono"
ink: "#22262b"
muted: "#66707a"
line: "#d7dce1"
paper_soft: "#f5f7f8"
accent: "#34495e"
info: "#385f7a"
warning: "#8a671c"
critical: "#7a3030"
success: "#356344"
```
Color values use hexadecimal RGB notation. Fonts must be installed wherever
the report is compiled; keeping the supplied DejaVu families is the most
portable option for this repository. After editing `themes.yaml`, compile at
least one representative report with each affected theme.
### Image sources
Typst's `image` function accepts a local file path or image bytes; it does not
download an image from an HTTP or HTTPS URL during compilation. Store required
images under `assets/` and commit them so local and CI builds remain
reproducible. Remote URLs can still be printed as clickable links, but cannot be
used directly as image sources.
## Renderer permissions
If the script is not executable after cloning:
```bash
chmod +x render.sh
```
Alternatively, run it without changing permissions:
```bash
bash render.sh reports/my-report.yaml
```
## Continuous integration
A minimal CI job only needs to install Typst and execute:
```bash
./render.sh --all
```
Treat any non-zero exit code as a failed build. Pin the Typst version in CI if
reproducible output is important, and use the same version locally when changing
`model.typ`.
For a lightweight local pre-commit check:
```bash
./render.sh --all
git diff --check
```
## Generated PDF policy
Choose one policy and apply it consistently:
1. **Build artifacts:** Ignore `build/`; PDFs are regenerated locally or in CI.
2. **Versioned archive:** Commit PDFs beside each YAML change for immediate
access and an immutable rendered snapshot.
This repository uses the build-artifact approach. Its `.gitignore` contains:
```gitignore
build/
```
PDFs intentionally stored outside `build/` remain trackable.
## Typical Git workflow
```bash
git pull
$EDITOR reports/2026/new-report.yaml
./render.sh reports/2026/new-report.yaml
git add reports/2026/new-report.yaml
git commit -m "Add incident report"
git push
```
Omit the copy step if you start from the boilerplate in
[Examples and boilerplate](examples.md).
## Troubleshooting
### `typst` was not found
Install Typst and ensure `typst --version` works in the same shell used to run
the renderer.
### Report not found
Run the command from the repository root, or pass an absolute path. The renderer
accepts paths relative to either the current directory or repository root.
### YAML fails to parse
Check indentation, quote values containing punctuation, and use spaces rather
than tabs. Start from a known-good file in
[Examples and boilerplate](examples.md) if necessary.
### A report renders without a section
Check the field name and nesting against [Writing reports](writing-reports.md).
Optional empty or missing fields are intentionally omitted.

146
docs/examples.md Normal file
View File

@ -0,0 +1,146 @@
# Examples and boilerplate
Copy one of these files into `reports/`, rename it, and replace the example
values. Both examples use only fields supported by the current renderer.
## Minimal report
```yaml
id: "REP-2026-001"
organization: "Example Organization"
theme: default
title: "Short report title"
subtitle: "Optional context"
report_type: briefing
status: open
severity: info
metadata:
Date: "2026-09-05"
Author: "Your Name"
summary: >
State the situation, its impact, and the most important next step.
actions:
- title: "First next step"
status: pending
text: >
Describe the action and its expected result.
closing: >
Record the current state or handoff point.
```
Save it as `reports/my-report.yaml`, then run:
```bash
./render.sh reports/my-report.yaml
```
## Complete technical report
```yaml
id: "INC-2026-001"
organization: "Example Organization"
theme: cic
title: "Service Interruption Investigation"
subtitle: "Incident analysis and shift handoff"
report_type: technical
status: open
severity: high
metadata:
Date: "2026-09-05"
Author: "Your Name"
Service: "Example API"
Environment: "Production"
Owner: "Operations"
summary: >
The API is available but intermittently slow. Database connection exhaustion
is the strongest current lead. No permanent data loss has been observed.
timeline:
- time: "09:15"
event: "Alert received"
notes: "Latency exceeded the five-second threshold."
- time: "09:22"
event: "Initial mitigation"
notes: "One unhealthy application instance was removed from rotation."
findings:
- title: "Connection pool saturation"
severity: high
status: confirmed
evidence: >
Pool utilization remained at 100 percent during each latency spike.
assessment: >
Requests are waiting for database connections. Query duration and pool
sizing both need review.
- title: "No evidence of data loss"
severity: info
status: confirmed
evidence: >
Record counts and replication checks are consistent across nodes.
assessment: >
Continue monitoring, but recovery work can prioritize availability.
sections:
- title: "Operational precautions"
content:
- type: bullets
items:
- "Avoid schema changes during diagnosis."
- "Record exact timestamps for new latency spikes."
- type: callout
title: "Escalation condition"
kind: critical
text: "Escalate immediately if replication lag exceeds five minutes."
- title: "Diagnostic procedure"
content:
- type: steps
items:
- "Capture application and database metrics."
- "Correlate slow requests with query duration."
- "Test a pool-size adjustment in staging."
- type: subsection
title: "Useful command"
content:
- type: code
text: "systemctl status example-api"
actions_title: "Next-shift plan"
actions:
- title: "Capture a diagnostic bundle"
status: pending
text: "Collect logs and metrics covering the next occurrence."
commands:
- "journalctl -u example-api --since '1 hour ago'"
- title: "Validate mitigation in staging"
status: pending
text: "Load-test the proposed connection-pool configuration."
closing: >
Service is operational with intermittent degradation. The next priority is
to capture a complete occurrence and validate the pool adjustment in staging.
```
## Windows command example
Single quotes are convenient for Windows paths because backslashes remain
literal:
```yaml
actions:
- title: "Repair Windows components"
status: pending
commands:
- "DISM /Online /Cleanup-Image /RestoreHealth"
- "sfc /scannow"
- 'type C:\Windows\Logs\CBS\CBS.log'
```
See [Writing reports](writing-reports.md) for the field reference and
[Advanced setup](advanced-setup.md) for customization and automation.

178
docs/writing-reports.md Normal file
View File

@ -0,0 +1,178 @@
# Writing reports
Reports are YAML files stored under `reports/`. The filename determines the PDF
filename, while the YAML determines its content.
## Top-level fields
| Field | Purpose | Required |
| --- | --- | --- |
| `title` | Main report heading | Recommended |
| `id` | Report or ticket identifier | No |
| `organization` | Name displayed in the header | No |
| `subtitle` | Context below the title | No |
| `report_type` | Report purpose: `technical` or `briefing` | Recommended |
| `theme` | Visual theme: `default`, `cic`, or `eridani` | No; defaults to `default` |
| `status` | Overall workflow state | No |
| `severity` | Overall urgency | No |
| `metadata` | Key/value facts; must contain `Date` and `Author` | **Yes** |
| `summary` | Executive summary callout | No |
| `timeline` | Chronological event table | No |
| `findings` | Evidence and assessments | No |
| `sections` | Free-form structured content | No |
| `actions_title` | Custom heading for the action plan | No |
| `actions` | Ordered work items and commands | No |
| `closing` | Current state or handoff point | No |
Missing optional fields are simply omitted from the PDF. Compilation fails when
the required `metadata.Date` or `metadata.Author` value is missing or empty and
prints the YAML needed to fix it.
## Theme
Select one of the built-in visual themes at the top level:
```yaml
theme: cic
```
- `default` — neutral, understated corporate styling.
- `cic` — a sharper corporate space-operations/cyberpunk palette.
- `eridani` — a rugged, grass-and-earth palette.
The default is used when `theme` is omitted. An unknown name stops compilation
and lists the available themes. See [Advanced setup](advanced-setup.md#themes)
to customize or add themes.
## Report types
Classify reports by their purpose, not merely whether they are internal or
external:
| Type | Use it for | Typical content |
| --- | --- | --- |
| `technical` | Investigation, engineering review, and shift handoff | Detailed evidence, commands, timelines, hypotheses, and operational precautions |
| `briefing` | Sharing verified findings with customers, managers, or other stakeholders | Concise impact, confirmed findings, decisions, ownership, and next steps |
```yaml
report_type: technical
```
A technical report may still be shared when appropriate, and a briefing may be
internal. The distinction describes depth and purpose rather than access
control. The renderer displays `Technical report` or `Stakeholder briefing` as
a badge near the title.
Avoid putting secrets, credentials, personal data, or unnecessarily sensitive
infrastructure details in either type. Classification does not provide security
or redact content.
## Status and severity
Typical workflow states are `open`, `pending`, `confirmed`, and `resolved`.
Typical severity values are `info`, `medium`, `high`, and `critical`.
The renderer also recognizes `warning`, `ok`, and `success` when choosing badge
and callout colors. Values are case-insensitive, but lowercase keeps YAML files
consistent.
## Metadata
Metadata accepts arbitrary labels and values:
```yaml
metadata:
Date: "2026-09-05"
Author: "Your Name"
Device: "DESKTOP-EXAMPLE"
Owner: "Operations"
Ticket: "INC-1234"
```
Quote dates and identifier-like values so YAML does not reinterpret them.
`Date` and `Author` are required with exactly this capitalization.
## Timeline and findings
```yaml
timeline:
- time: "09:15"
event: "Alert received"
notes: "Monitoring detected repeated storage timeouts."
findings:
- title: "Storage controller timeout"
severity: high
status: confirmed
evidence: >
The system log contains three controller resets within ten minutes.
assessment: >
The storage path is the leading cause and needs focused testing.
```
Use `evidence` for observations and `assessment` for interpretation. Keeping
them separate makes technical conclusions easier to review.
## Free-form sections
Each item in `sections` has a title and a list of content blocks:
```yaml
sections:
- title: "Investigation notes"
content:
- type: text
text: "A short paragraph."
- type: bullets
items:
- "First observation"
- "Second observation"
- type: steps
items:
- "Collect logs"
- "Reproduce the failure"
- type: callout
title: "Caution"
kind: warning
text: "Back up important data before destructive testing."
- type: code
text: "journalctl --since '30 minutes ago'"
- type: subsection
title: "Nested detail"
content:
- type: text
text: "Subsections can contain the same block types."
```
Supported block types are `text`, `bullets`, `steps`, `callout`, `code`, and
`subsection`. Unknown types render a warning instead of being silently discarded.
## Actions
```yaml
actions_title: "Next steps"
actions:
- title: "Collect system logs"
status: pending
text: "Export the relevant events and attach them to the ticket."
commands:
- "journalctl --since today > system.log"
- "dmesg > kernel.log"
```
`commands` is a list, so an action can contain zero, one, or several commands.
## Authoring tips
- Use `>` for prose that should wrap into one paragraph.
- Quote Windows paths and values containing YAML punctuation.
- Keep evidence factual and put conclusions in `assessment`.
- Use metadata for short facts, not long explanations.
- Render after editing to catch malformed YAML and layout problems early.
For complete files, continue to [Examples and boilerplate](examples.md).

733
model.typ Normal file
View File

@ -0,0 +1,733 @@
// =============================================================================
// BEFFROI REPORT MODEL
// =============================================================================
//
// Generic corporate report renderer.
//
// Expected use:
//
// typst compile \
// --input report=reports/report.yaml \
// report.typ report.pdf
//
// =============================================================================
// -----------------------------------------------------------------------------
// ----- Helpers
// -----------------------------------------------------------------------------
#let dict-get(dict, key, default) = {
if key in dict {
dict.at(key)
} else {
default
}
}
#let as-content(value) = {
if value == none {
[]
} else {
str(value)
}
}
#let theme-color(theme, key) = rgb(str(dict-get(theme, key, "#000000")))
#let severity-color(theme, value) = {
let value = lower(str(value))
if value == "critical" or value == "high" {
theme-color(theme, "critical")
} else if value == "warning" or value == "medium" {
theme-color(theme, "warning")
} else if value == "ok" or value == "success" or value == "resolved" {
theme-color(theme, "success")
} else {
theme-color(theme, "info")
}
}
#let report-type-label(value) = {
let value = lower(str(value))
if value == "technical" {
"Technical report"
} else if value == "briefing" {
"Stakeholder briefing"
} else {
str(value)
}
}
#let badge(
body,
color: none,
) = {
box(
inset: (x: 5pt, y: 2pt),
radius: 2pt,
fill: color.lighten(85%),
stroke: 0.6pt + color.lighten(45%),
text(
size: 7.5pt,
weight: "bold",
fill: color,
upper(str(body)),
),
)
}
#let metadata-line(theme, label, value) = {
if value != none and str(value) != "" {
stack(
spacing: 1.5pt,
text(
size: 8.5pt,
fill: theme-color(theme, "muted"),
weight: "bold",
)[#label],
text(
size: 8.5pt,
fill: theme-color(theme, "ink"),
)[#as-content(value)],
)
}
}
#let section-title(theme, body) = {
block(
above: 1.1em,
below: 0.55em,
width: 100%,
)[
#text(
size: 13pt,
weight: "bold",
fill: theme-color(theme, "accent"),
)[#body]
#v(2.5pt)
#line(
length: 100%,
stroke: 0.7pt + theme-color(theme, "line"),
)
]
}
#let subsection-title(theme, body) = {
block(
above: 0.8em,
below: 0.35em,
)[
#text(
size: 10.5pt,
weight: "bold",
fill: theme-color(theme, "ink"),
)[#body]
]
}
#let callout(
theme,
body,
title: none,
kind: "info",
) = {
let color = severity-color(theme, kind)
block(
width: 100%,
inset: 8pt,
radius: 2pt,
fill: color.lighten(91%),
stroke: (
left: 2.5pt + color,
top: 0.5pt + color.lighten(65%),
right: 0.5pt + color.lighten(65%),
bottom: 0.5pt + color.lighten(65%),
),
)[
#if title != none {
text(
size: 9pt,
weight: "bold",
fill: color,
)[ #title ]
v(3pt)
}
#body
]
}
#let code-block(theme, body) = {
block(
width: 100%,
inset: 7pt,
radius: 2pt,
fill: rgb("#f2f3f4"),
stroke: 0.5pt + theme-color(theme, "line"),
)[
#text(
font: dict-get(theme, "mono_font", "DejaVu Sans Mono"),
size: 8.2pt,
fill: theme-color(theme, "ink"),
)[
#body
]
]
}
// -----------------------------------------------------------------------------
// ----- Generic content renderer
// -----------------------------------------------------------------------------
#let render-block(theme, block-data) = {
let kind = dict-get(block-data, "type", "text")
if kind == "text" {
par[
#as-content(dict-get(block-data, "text", ""))
]
} else if kind == "bullets" {
let items = dict-get(block-data, "items", ())
list(
tight: true,
..items.map(item => [#as-content(item)]),
)
} else if kind == "steps" {
let items = dict-get(block-data, "items", ())
enum(
tight: false,
..items.map(item => [#as-content(item)]),
)
} else if kind == "callout" {
callout(
theme,
[#as-content(dict-get(block-data, "text", ""))],
title: dict-get(block-data, "title", none),
kind: dict-get(block-data, "kind", "info"),
)
} else if kind == "code" {
code-block(
theme,
as-content(dict-get(block-data, "text", "")),
)
} else if kind == "subsection" {
subsection-title(
theme,
as-content(dict-get(block-data, "title", "")),
)
for child in dict-get(block-data, "content", ()) {
render-block(theme, child)
v(0.4em)
}
} else {
callout(
theme,
[
Unknown report block type:
#raw(str(kind))
],
title: "Renderer warning",
kind: "warning",
)
}
}
// -----------------------------------------------------------------------------
// ----- Findings
// -----------------------------------------------------------------------------
#let render-findings(theme, findings) = {
for finding in findings {
let title = dict-get(finding, "title", "Finding")
let severity = dict-get(finding, "severity", "info")
let status = dict-get(finding, "status", none)
let evidence = dict-get(finding, "evidence", none)
let assessment = dict-get(finding, "assessment", none)
block(
width: 100%,
breakable: false,
inset: 8pt,
stroke: 0.5pt + theme-color(theme, "line"),
radius: 2pt,
)[
#grid(
columns: (1fr, auto, auto),
gutter: 5pt,
align: (left, center, center),
text(
weight: "bold",
size: 10pt,
fill: theme-color(theme, "ink"),
)[#title],
badge(
severity,
color: severity-color(theme, severity),
),
if status != none {
badge(
status,
color: severity-color(theme, status),
)
} else {
[]
},
)
#if evidence != none {
v(5pt)
text(
size: 8pt,
weight: "bold",
fill: theme-color(theme, "muted"),
)[EVIDENCE]
v(2pt)
text(
size: 9pt,
fill: theme-color(theme, "ink"),
)[#as-content(evidence)]
}
#if assessment != none {
v(5pt)
text(
size: 8pt,
weight: "bold",
fill: theme-color(theme, "muted"),
)[ASSESSMENT]
v(2pt)
text(
size: 9pt,
fill: theme-color(theme, "ink"),
)[#as-content(assessment)]
}
]
v(6pt)
}
}
// -----------------------------------------------------------------------------
// ----- Timeline
// -----------------------------------------------------------------------------
#let render-timeline(theme, entries) = {
let rows = (
(
table.header(
[Time],
[Event],
[Notes],
),
)
)
for entry in entries {
rows.push(
(
[#as-content(dict-get(entry, "time", ""))],
[#as-content(dict-get(entry, "event", ""))],
[#as-content(dict-get(entry, "notes", ""))],
),
)
}
table(
columns: (22mm, 1.1fr, 2fr),
inset: 5pt,
stroke: 0.45pt + theme-color(theme, "line"),
fill: (x, y) => {
if y == 0 {
theme-color(theme, "paper_soft")
} else {
none
}
},
align: (left, left, left),
..rows.flatten(),
)
}
// -----------------------------------------------------------------------------
// ----- Action plan
// -----------------------------------------------------------------------------
#let render-actions(theme, actions) = {
for (index, action) in actions.enumerate() {
let title = dict-get(action, "title", "Action")
let status = dict-get(action, "status", "pending")
let body = dict-get(action, "text", none)
let commands = dict-get(action, "commands", ())
grid(
columns: (8mm, 1fr, auto),
gutter: 5pt,
align: (center, left, center),
box(
width: 6mm,
height: 6mm,
radius: 50%,
fill: theme-color(theme, "accent"),
align(center + horizon)[
#text(
size: 7pt,
weight: "bold",
fill: white,
)[
#(index + 1)
]
],
),
text(
size: 10pt,
weight: "bold",
fill: theme-color(theme, "ink"),
)[
#title
],
badge(
status,
color: severity-color(theme, status),
),
)
if body != none {
block(
inset: (left: 13mm, top: 3pt),
)[
#text(
size: 9pt,
fill: theme-color(theme, "ink"),
)[
#as-content(body)
]
]
}
for command in commands {
block(
inset: (left: 13mm, top: 4pt),
)[
#code-block(theme, as-content(command))
]
}
v(8pt)
}
}
// -----------------------------------------------------------------------------
// ----- Header / Footer
// -----------------------------------------------------------------------------
#let report-header(theme, report, logo) = {
let organization = dict-get(report, "organization", "Beffroi")
let report-type = dict-get(report, "report_type", none)
let descriptor = if report-type == none {
"Report"
} else {
report-type-label(report-type)
}
grid(
columns: (1fr, auto),
align: (left, right + horizon),
[
#text(
size: 7.5pt,
weight: "bold",
fill: theme-color(theme, "muted"),
)[
#organization — #descriptor
]
],
image(
logo,
height: 8mm,
fit: "contain",
),
)
v(3pt)
line(
length: 100%,
stroke: 0.5pt + theme-color(theme, "line"),
)
}
#let report-footer(theme, report) = {
let id = dict-get(report, "id", none)
grid(
columns: (1fr, auto),
align: (left, right),
text(
size: 7pt,
fill: theme-color(theme, "muted"),
)[
#if id != none {
[Report #id]
}
],
text(
size: 7pt,
fill: theme-color(theme, "muted"),
)[
Page #context counter(page).display()
],
)
}
// -----------------------------------------------------------------------------
// ----- Main model
// -----------------------------------------------------------------------------
#let report-model(
report: (:),
theme: (:),
logo: "assets/beffroi.png",
body,
) = {
set page(
paper: "a4",
margin: (
top: 20mm,
bottom: 18mm,
left: 20mm,
right: 20mm,
),
header: context report-header(theme, report, logo),
footer: context report-footer(theme, report),
)
set text(
font: dict-get(theme, "font", "DejaVu Sans"),
size: 9.5pt,
fill: theme-color(theme, "ink"),
lang: "en",
)
set par(
justify: false,
leading: 0.58em,
spacing: 0.55em,
)
// ---------------------------------------------------------------------------
// Title block
// ---------------------------------------------------------------------------
let title = dict-get(report, "title", "Report")
let subtitle = dict-get(report, "subtitle", none)
let report-type = dict-get(report, "report_type", none)
let status = dict-get(report, "status", none)
let severity = dict-get(report, "severity", none)
block(
width: 100%,
below: 12pt,
)[
#text(
size: 22pt,
weight: "bold",
fill: theme-color(theme, "accent"),
)[
#title
]
#if subtitle != none {
v(3pt)
text(
size: 11pt,
fill: theme-color(theme, "muted"),
)[
#subtitle
]
}
#if report-type != none or status != none or severity != none {
v(7pt)
if report-type != none {
badge(
report-type-label(report-type),
color: theme-color(theme, "accent"),
)
h(4pt)
}
if status != none {
badge(
status,
color: severity-color(theme, status),
)
}
if status != none and severity != none {
h(4pt)
}
if severity != none {
badge(
severity,
color: severity-color(theme, severity),
)
}
}
]
// ---------------------------------------------------------------------------
// Metadata
// ---------------------------------------------------------------------------
let metadata = dict-get(report, "metadata", (:))
if metadata.len() > 0 {
block(
width: 100%,
below: 7pt,
inset: 8pt,
fill: theme-color(theme, "paper_soft"),
stroke: 0.5pt + theme-color(theme, "line"),
radius: 2pt,
)[
#grid(
columns: (1fr, 1fr),
row-gutter: 6pt,
column-gutter: 10pt,
..metadata
.pairs()
.map(pair => metadata-line(
theme,
pair.at(0),
pair.at(1),
))
)
]
}
// ---------------------------------------------------------------------------
// Executive summary
// ---------------------------------------------------------------------------
let summary = dict-get(report, "summary", none)
if summary != none {
section-title(theme, "Executive summary")
callout(
theme,
[#as-content(summary)],
kind: dict-get(report, "severity", "info"),
)
}
// ---------------------------------------------------------------------------
// Timeline
// ---------------------------------------------------------------------------
let timeline = dict-get(report, "timeline", ())
if timeline.len() > 0 {
section-title(theme, "Timeline")
render-timeline(theme, timeline)
}
// ---------------------------------------------------------------------------
// Findings
// ---------------------------------------------------------------------------
let findings = dict-get(report, "findings", ())
if findings.len() > 0 {
section-title(theme, "Findings")
render-findings(theme, findings)
}
// ---------------------------------------------------------------------------
// Arbitrary sections
// ---------------------------------------------------------------------------
let sections = dict-get(report, "sections", ())
for section in sections {
section-title(
theme,
as-content(
dict-get(section, "title", "Section"),
),
)
for block-data in dict-get(section, "content", ()) {
render-block(theme, block-data)
v(0.45em)
}
}
// ---------------------------------------------------------------------------
// Action plan
// ---------------------------------------------------------------------------
let actions = dict-get(report, "actions", ())
if actions.len() > 0 {
section-title(
theme,
dict-get(report, "actions_title", "Action plan"),
)
render-actions(theme, actions)
}
// ---------------------------------------------------------------------------
// Closing state
// ---------------------------------------------------------------------------
let closing = dict-get(report, "closing", none)
if closing != none {
section-title(theme, "Current state")
callout(
theme,
[#as-content(closing)],
title: "Stopping point",
kind: dict-get(report, "severity", "info"),
)
}
}

143
render.sh Executable file
View File

@ -0,0 +1,143 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
REPORT_DIR="${ROOT_DIR}/reports"
BUILD_DIR="${ROOT_DIR}/build"
ENTRYPOINT="${ROOT_DIR}/report.typ"
usage() {
cat <<'EOF'
Usage:
./render.sh PATH
./render.sh --all
Examples:
./render.sh reports/2026-09-04-clevo-handoff.yaml
./render.sh --all
Outputs PDFs into:
./build/
Requirements:
- typst must be available in PATH
EOF
}
die() {
echo "error: $*" >&2
exit 1
}
check_dependencies() {
command -v typst >/dev/null 2>&1 \
|| die "'typst' was not found in PATH."
}
render_report() {
local input="$1"
[[ -f "$input" ]] \
|| die "report not found: $input"
case "$input" in
*.yaml|*.yml)
;;
*)
die "unsupported report format: $input (expected .yaml or .yml)"
;;
esac
local filename
local basename
local output
filename="$(basename -- "$input")"
basename="${filename%.*}"
output="${BUILD_DIR}/${basename}.pdf"
mkdir -p "$BUILD_DIR"
echo "Rendering: $input"
echo " -> $output"
(
cd "$ROOT_DIR"
# Pass the report path relative to the repository root when possible.
local report_path="$input"
if [[ "$input" == "$ROOT_DIR/"* ]]; then
report_path="${input#"$ROOT_DIR/"}"
fi
typst compile \
--input "report=${report_path}" \
"$ENTRYPOINT" \
"$output"
)
echo "Done: $output"
}
render_all() {
[[ -d "$REPORT_DIR" ]] \
|| die "report directory not found: $REPORT_DIR"
mkdir -p "$BUILD_DIR"
local found=0
while IFS= read -r -d '' report; do
found=1
render_report "$report"
done < <(
find "$REPORT_DIR" \
-type f \
\( -name '*.yaml' -o -name '*.yml' \) \
-print0 |
sort -z
)
if [[ "$found" -eq 0 ]]; then
echo "No YAML reports found in $REPORT_DIR"
return 0
fi
echo
echo "All reports rendered successfully."
}
main() {
check_dependencies
[[ $# -eq 1 ]] || {
usage
exit 1
}
case "$1" in
--all)
render_all
;;
-h|--help)
usage
;;
*)
# Accept paths relative to either:
# - the current working directory
# - the repository root
if [[ -f "$1" ]]; then
render_report "$(realpath "$1")"
elif [[ -f "${ROOT_DIR}/$1" ]]; then
render_report "$(realpath "${ROOT_DIR}/$1")"
else
die "report not found: $1"
fi
;;
esac
}
main "$@"

48
report.typ Normal file
View File

@ -0,0 +1,48 @@
#import "model.typ": report-model
#let report-file = sys.inputs.at("report", default: none)
#if report-file == none {
panic(
"Missing report input.\n" +
"Usage: typst compile --input report=reports/foo.yaml report.typ foo.pdf"
)
}
#let report = yaml(report-file)
#let metadata = report.at("metadata", default: (:))
#if "Author" not in metadata or str.trim(str(metadata.at("Author", default: ""))) == "" {
panic(
"Missing required report field: metadata.Author.\n" +
"Add this to the report YAML:\n\n" +
"metadata:\n Author: \"Your name\""
)
}
#if "Date" not in metadata or str.trim(str(metadata.at("Date", default: ""))) == "" {
panic(
"Missing required report field: metadata.Date.\n" +
"Add this to the report YAML:\n\n" +
"metadata:\n Date: \"YYYY-MM-DD\""
)
}
#let themes = yaml("themes.yaml")
#let theme-name = lower(str(report.at("theme", default: "default")))
#if theme-name not in themes {
panic(
"Unknown report theme: \"" + theme-name + "\".\n" +
"Set theme to one of: " + themes.keys().join(", ") + ".\n" +
"Example: theme: default"
)
}
#let theme = themes.at(theme-name)
#show: report-model.with(
report: report,
theme: theme,
logo: "assets/beffroi.png",
)

View File

@ -0,0 +1,161 @@
id: "BEF-2026-09-04-001"
organization: "SOGEB"
title: "System Stability Investigation"
subtitle: "PC Specialist / Clevo — Diagnostic progress & shift handoff"
report_type: technical
theme: default
status: "open"
severity: "high"
metadata:
Date: "2026-09-04"
Device: "DESKTOP-SAU019H"
Model: "PC Specialist / Clevo NH5x_NH7x_HHx_HJx_HKx"
Motherboard: "CLEVO NHxxHJHK"
BIOS: "Insyde 1.07.07TPCS1"
OS: "Windows 11 Pro"
Author: "Maximilien Rigaut"
summary: >
Device remains unstable but bootable. No root cause has been proven.
The strongest active lead is the combination of repeated NVMe controller
errors and spontaneous hard freezes. Fast Startup failure and Windows
component-store corruption are independently confirmed. The original
NVRAM/TPM issue remains unresolved.
timeline:
- time: "~16:30"
event: "Firmware warning"
notes: "First boot or NVRAM reset condition detected."
- time: "~16:53"
event: "Shutdown failure"
notes: "Normal shutdown hung; forced power-off required."
- time: "Later"
event: "Restart test"
notes: "Restart completed normally."
- time: "Later"
event: "Full shutdown test"
notes: "Shutdown bypassing Fast Startup completed normally."
- time: "<17:23"
event: "System freeze"
notes: "Freeze occurred before additional configuration changes."
- time: "~17:25"
event: "System freeze"
notes: "Second freeze/hang observed."
findings:
- title: "Fast Startup failure"
severity: "high"
status: "confirmed"
evidence: >
Kernel-Boot Event 29: Windows failed fast startup with
error status 0xC000007B.
assessment: >
Keep Fast Startup disabled during diagnosis. May explain shutdown
behaviour but not spontaneous freezes.
- title: "Repeated NVMe controller errors"
severity: "high"
status: "open"
evidence: >
stornvme Event 11 repeatedly reports a controller error on
\Device\RaidPort2.
assessment: >
High-priority lead because errors coexist with hard freezes.
SMART/Windows Healthy status does not exclude intermittent controller,
PCIe, firmware or power-management problems.
- title: "Windows component store corruption"
severity: "medium"
status: "confirmed"
evidence: >
DISM /CheckHealth reports that the component store is repairable.
assessment: >
Repair Windows before interpreting additional Windows-level failures.
- title: "TPM / Measured Boot failure"
severity: "medium"
status: "open"
evidence: >
TPM-WMI Event 1040 reports a critical pre-attestation health-check
failure.
assessment: >
Exact failed check remains to be extracted from the MeasuredBoot JSON.
sections:
- title: "Initial symptom"
content:
- type: text
text: >
Firmware displayed: "A first boot or NVRAM reset condition has
been detected."
- title: "Operational precautions"
content:
- type: bullets
items:
- "Ensure important data has a current backup."
- "Avoid unnecessary forced shutdowns."
- "Do not flash the BIOS during the current diagnostic phase."
actions_title: "Next-shift battle plan"
actions:
- title: "Disable Fast Startup"
status: "pending"
text: >
Disable Windows Fast Startup for the duration of the investigation.
- title: "Repair Windows component store"
status: "pending"
text: >
Run the following commands from an elevated terminal and record
their final output.
commands:
- "DISM /Online /Cleanup-Image /RestoreHealth"
- "sfc /scannow"
- title: "Establish clean stability checkpoint"
status: "pending"
text: >
Reboot normally, avoid unrelated software changes, and use the machine
normally while recording exact timestamps for new freezes or hangs.
- title: "Correlate future freezes"
status: "pending"
text: >
Inspect events approximately five minutes before and after any new
incident, with particular attention to stornvme Event 11.
- title: "Investigate NVMe path"
status: "pending"
text: >
Identify the physical device behind RaidPort2, inspect native NVMe
health and firmware, and review PCIe/NVMe power-management behaviour.
- title: "Inspect Measured Boot report"
status: "pending"
text: >
Analyse the TPM pre-attestation diagnostic file.
commands:
- 'C:\WINDOWS\Logs\MeasuredBoot\0000000053-0000000000.json'
- title: "Test NVRAM retention"
status: "pending"
text: >
Once Windows and storage stability are better characterised, verify
that BIOS time and settings survive a full unpowered shutdown.
closing: >
Machine is unstable but bootable. Primary next-shift priorities are:
repair Windows, keep Fast Startup disabled, establish a clean checkpoint,
and correlate any additional freeze with storage-controller activity.

41
themes.yaml Normal file
View File

@ -0,0 +1,41 @@
default:
label: "Default"
font: "DejaVu Sans"
mono_font: "DejaVu Sans Mono"
ink: "#22262b"
muted: "#66707a"
line: "#d7dce1"
paper_soft: "#f5f7f8"
accent: "#34495e"
info: "#385f7a"
warning: "#8a671c"
critical: "#7a3030"
success: "#356344"
cic:
label: "CIC"
font: "DejaVu Sans"
mono_font: "DejaVu Sans Mono"
ink: "#17212b"
muted: "#526777"
line: "#b9d8df"
paper_soft: "#eef7f8"
accent: "#086f83"
info: "#007f95"
warning: "#a86712"
critical: "#a12e4b"
success: "#19765b"
eridani:
label: "Eridani"
font: "DejaVu Sans"
mono_font: "DejaVu Sans Mono"
ink: "#282c22"
muted: "#68705a"
line: "#c8cbb9"
paper_soft: "#f3f2e8"
accent: "#536b3f"
info: "#526e61"
warning: "#8a6829"
critical: "#813f32"
success: "#49683a"