Skip to content

Commit d6939b4

Browse files
committed
fill in documentation standard for adr 0034
1 parent f86488b commit d6939b4

9 files changed

Lines changed: 507 additions & 17 deletions

File tree

.claude/CLAUDE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ for full ownership details.
108108
### Architecture documentation
109109

110110
- ADRs go in `docs/architecture/adr/` with format `####-title.md`
111-
- Follow existing ADR structure (Status, Context, Decision, Consequences)
111+
- Follow the MADR structure from the template on the ADR index (`docs/architecture/adr/index.mdx`):
112+
frontmatter (`adr`, `status`, `date`, `tags`), Context and problem statement, Considered options,
113+
Decision outcome
112114

113115
## Testing before committing
114116

custom-words.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ deprioritized
2222
diffable
2323
dockerized
2424
dotfile
25+
evals
2526
F-Droid
2627
frontmatter
2728
Gitter
@@ -52,6 +53,7 @@ LLDB
5253
Lucidchart
5354
Mailcatcher
5455
minio
56+
mortems
5557
MVVM
5658
NGRX
5759
Napi
@@ -107,6 +109,7 @@ typecheck
107109
typechecks
108110
typesafe
109111
udeps
112+
ungated
110113
unsynchronized
111114
WCAG
112115
weweave

docs/architecture/adr/0033-adopt-mermaid-diagram-standard.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ audience-specific views -- requires substantial rework per audience in practice.
3737
## Decision outcome
3838

3939
Chosen option: **Mermaid with defined conventions**, published as the
40-
[diagram standard](../../contributing/diagrams.md) on the contributing site. The standard is the
41-
living reference and its rules evolve by PR without superseding this decision. This ADR is
42-
superseded only if the chosen option itself changes. A snapshot of the rules at adoption:
40+
[diagram standard](../../contributing/documentation/diagrams.md) on the contributing site. The
41+
standard is the living reference and its rules evolve by PR without superseding this decision. This
42+
ADR is superseded only if the chosen option itself changes. A snapshot of the rules at adoption:
4343

4444
1. Diagrams are Mermaid source text, nothing else: as Mermaid code blocks, or, if in Confluence, via
4545
Macro Pack's Mermaid diagram in text-input mode.
@@ -80,12 +80,12 @@ superseded only if the chosen option itself changes. A snapshot of the rules at
8080

8181
### Plan
8282

83-
The standard is published at Contributing › Diagrams, and the bulk of the contributing site's
84-
existing diagrams (PlantUML/Kroki sources, static diagram assets, and source-less images) have been
85-
converted to comply, so the site becomes the reference implementation of the standard, with the
86-
exceptions noted below. Elsewhere, legacy diagrams convert when their docs are next touched: images
87-
and non-Mermaid sources in repos become Mermaid code blocks, and Confluence attachments and images
88-
become Macro Pack's Mermaid diagram in text-input mode.
83+
The standard is published at Contributing › Documentation › Diagrams, and the bulk of the
84+
contributing site's existing diagrams (PlantUML/Kroki sources, static diagram assets, and
85+
source-less images) have been converted to comply, so the site becomes the reference implementation
86+
of the standard, with the exceptions noted below. Elsewhere, legacy diagrams convert when their docs
87+
are next touched: images and non-Mermaid sources in repos become Mermaid code blocks, and Confluence
88+
attachments and images become Macro Pack's Mermaid diagram in text-input mode.
8989

9090
The remaining adoption work is delegated to its owners:
9191

docs/architecture/adr/0034-adopt-engineering-documentation-standard.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
adr: "0034"
3-
status: Proposed
3+
status: Accepted
44
date: 2026-07-22
55
tags: [clients, mobile, server, sdk]
66
---
@@ -38,10 +38,10 @@ Confluence against a proposed routing model, confirming these gaps.
3838

3939
## Decision outcome
4040

41-
Chosen option: **one org-wide, docs-as-code documentation standard**, published as the Documentation
42-
section under Contributing on this site. The standard is the living reference. Its rules evolve by
43-
PR without superseding this decision and this ADR is superseded only if the model itself changes. A
44-
snapshot of the rules at adoption:
41+
Chosen option: **one org-wide, docs-as-code documentation standard**, published as the
42+
[Documentation section](../../contributing/documentation/index.md). The standard is the living
43+
reference. Its rules evolve by PR without superseding this decision and this ADR is superseded only
44+
if the model itself changes. A snapshot of the rules at adoption:
4545

4646
1. **Public by default**. Private content is limited to documentation about working at Bitwarden and
4747
sensitive information.
@@ -54,7 +54,7 @@ snapshot of the rules at adoption:
5454

5555
Diagrams follow the separate diagram standard adopted in
5656
[ADR-0033](./0033-adopt-mermaid-diagram-standard.md), which keeps its own living reference at
57-
Contributing › Diagrams.
57+
Contributing › Documentation › Diagrams.
5858

5959
AI instruction files are explicitly not documentation and are out of the standard's scope. Their
6060
guidance lives with the AI tooling.

docs/architecture/adr/index.mdx

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,68 @@ the thinking process and alternatives considered rather than simply stating what
7575
if an ADR doesn't cover every edge case or alternative it provides valuable context and can be
7676
refined through discussion.
7777

78+
## Format
79+
80+
ADRs follow the [MADR](https://adr.github.io/madr/) structure: a context and problem statement, the
81+
considered options, and the decision outcome with its consequences. Start from the template below.
82+
83+
Each ADR is a file named `NNNN-short-title.md` in `docs/architecture/adr/`, numbered with the next
84+
unused number. Refer to an ADR elsewhere by that number as ADR-NNNN, linking the file relatively so
85+
the reference survives a move of this section.
86+
87+
<details>
88+
<summary>ADR template</summary>
89+
90+
Delete the guidance comments before opening the pull request.
91+
92+
```text
93+
---
94+
adr: "NNNN"
95+
status: Proposed
96+
date: YYYY-MM-DD
97+
tags: [clients, mobile, server, sdk]
98+
---
99+
100+
# NNNN - Short imperative title
101+
102+
<AdrTable frontMatter={frontMatter}></AdrTable>
103+
104+
{/* Optional "## Notation" section here if the ADR relies on notation (RFC 2119
105+
keywords, symbols). Delete when unused. */}
106+
107+
## Context and problem statement
108+
109+
{/* 2–4 paragraphs. What situation forces a decision? What breaks or
110+
stays painful if we decide nothing? Link code, issues, and prior ADRs. */}
111+
112+
## Considered options
113+
114+
- **Option A:** one-line description.
115+
- **Option B:** one-line description.
116+
117+
{/* Optional per-option subsections with pros/cons when the tradeoffs
118+
need more than a line. Include "do nothing" when it is a real option. */}
119+
120+
## Decision outcome
121+
122+
Chosen option: **Option A**, because {decisive reason}.
123+
124+
### Positive consequences
125+
126+
- ...
127+
128+
### Negative consequences
129+
130+
- ...
131+
132+
### Plan
133+
134+
{/* How the decision takes effect: the follow-up work, migrations, and owners.
135+
Delete when the ADR needs no follow-up. */}
136+
```
137+
138+
</details>
139+
78140
## Status definition
79141

80142
ADRs progress through different statuses throughout their lifecycle. Understanding these statuses
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
# Component documentation
6+
7+
**Audience:** Bitwarden engineers and AI agents writing or consuming in-repo documentation.
8+
9+
Notation follows the [documentation standard's Notation](./index.md#notation). These requirements
10+
hold for every repo for as long as it lives, enforced by review and the doc-currency plugin. New
11+
repositories satisfy them at initialization by starting from
12+
[bitwarden/template](https://github.com/bitwarden/template). Existing repos converge per
13+
[Changes to this standard](./index.md#changes-to-this-standard). Additional local guidance MAY be
14+
layered on top, as each situation dictates.
15+
16+
Any component that other engineers or agents consume (that is, it exposes a public interface) MUST
17+
have an **entry point for its scope's documentation**, at every scope from a single component to the
18+
repo root. The entry point lives where the component's ecosystem surfaces documentation:
19+
20+
- At **component scope**, the entry point is the `README.md`, which registries render for packaged
21+
components (a crate, an npm package, a NuGet project). Rust crates keep the README and the rustdoc
22+
landing page one artifact with `#![doc = include_str!("../README.md")]`.
23+
- **Below component scope**, the entry point is the language's module-level documentation where it
24+
exists (`//!` in Rust), since a README there duplicates what the toolchain already owns and no
25+
tooling surfaces it. It SHOULD be lint-enforced where the language supports it (Rust's
26+
`missing_docs`).
27+
- At **container and system scopes** (a container grouping several components, the repo root), the
28+
entry point is a `README.md`, since no language ecosystem claims them.
29+
30+
Whatever its carrier, the entry point MUST contain:
31+
32+
1. **Purpose:** what problem this component solves, in 1–3 sentences.
33+
2. **Key concepts:** the domain model or invariants a consumer must know (e.g., `libs/state`'s
34+
data-loss warning on key renames; `bitwarden-crypto`'s `derive_`/`make_` naming rules).
35+
3. **Usage:** the primary entry points, with a short code sample where the API is not self-evident.
36+
4. **Gotchas / constraints:** the things that bite people (e.g., `libs/auth`'s "do not add new code
37+
here" notice). This section MUST exist when such constraints do and MUST NOT exist when they do
38+
not.
39+
40+
Documentation grows outward from the entry point of the
41+
[lowest common ancestor](./index.md#where-documentation-lives-rules-1-2) of the code it describes. A
42+
guide spanning several components therefore belongs to their parent scope:
43+
44+
1. Everything starts at the scope's entry point.
45+
2. A single topic that deserves its own document becomes a named `.md` next to the code it
46+
describes, linked from the entry point (`apps/browser/src/autofill/lifecycle.design.md` is the
47+
exemplar).
48+
3. When the scope's documentation outgrows this, it splits into a `docs/` folder (exactly that name,
49+
lowercase) at the scope root. `docs/` exists only beside the entry point it extends: at the repo
50+
root (`clients/docs/cipher-types.md` is the exemplar) or a component with its own entry point
51+
(`util/Seeder/Seeds/docs/`), never an arbitrary subdirectory.
52+
53+
Scopes layer and multiple perspectives exist. A parent scope's documentation MAY describe the same
54+
code at a higher altitude, sanding off detail the deeper docs own and linking down to them, and the
55+
same subject MAY be documented separately per audience. Both are approved. Duplication is two
56+
artifacts sharing one perspective.
57+
58+
Below component scope, reference documentation is code: doc comments on public symbols, reviewed and
59+
merged with functionality, lint-enforced where the platform supports it. Doc comments MUST follow
60+
the language's documentation norms for structure and detail. Where not enforced by the type system,
61+
doc comments MUST say what a caller needs (behavior, invariants, error cases). Repos with doc CI
62+
SHOULD fail the build on broken docs (the `sdk-internal` `cargo doc -D warnings` pattern).

docs/contributing/diagrams.md renamed to docs/contributing/documentation/diagrams.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 2
2+
sidebar_position: 5
33
---
44

55
# Diagram standard

0 commit comments

Comments
 (0)