Skip to content

Commit 00dcc28

Browse files
authored
Merge branch 'main' into docs/sql-bulk-not-null-column
2 parents 58c1849 + 386dcf4 commit 00dcc28

29 files changed

Lines changed: 2321 additions & 1278 deletions

custom-words.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ cryptominer
1818
CTAP2
1919
deinitializer
2020
deinitializers
21+
deprioritized
22+
diffable
2123
dockerized
2224
dotfile
2325
F-Droid
@@ -32,6 +34,7 @@ Hulud
3234
Hyperscale
3335
iframes
3436
inet
37+
ingestibility
3538
initialisms
3639
IntelliJ
3740
Iterm
@@ -41,10 +44,12 @@ jumpcloud
4144
keychain
4245
keypair
4346
keyserver
47+
Kroki
4448
Kubebuilder
4549
LDIF
4650
libmagic
4751
LLDB
52+
Lucidchart
4853
Mailcatcher
4954
minio
5055
MVVM
@@ -76,6 +81,7 @@ roadmaps
7681
rollout
7782
rollouts
7883
Rspack
84+
rustdoc
7985
rustup
8086
sandboxed
8187
SARIF
@@ -91,6 +97,7 @@ Sourcery
9197
sqlcmd
9298
struct
9399
structs
100+
Structurizr
94101
subfolders
95102
subprocessor
96103
toolset
@@ -102,6 +109,7 @@ typesafe
102109
udeps
103110
unsynchronized
104111
WCAG
112+
weweave
105113
Xcodes.app
106114
xcworkspace
107115
xmldoc
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
adr: "0033"
3+
status: Accepted
4+
date: 2026-07-16
5+
tags: [clients, mobile, server, sdk]
6+
---
7+
8+
# 0033 - Adopt Mermaid diagram standard
9+
10+
<AdrTable frontMatter={frontMatter}></AdrTable>
11+
12+
## Context and problem statement
13+
14+
Architecture diagrams are scattered across tools and formats with no organizational standard:
15+
Draw.io XML, Lucidchart embeds, ad hoc Mermaid, and images committed without source. The same system
16+
is drawn differently in different spaces with no mechanism to keep representations consistent and
17+
diagrams rot because nothing connects them to the systems they describe. Finally, AppSec's
18+
Engagement Model requires system representations that today are rebuilt from scratch per review.
19+
20+
A prior initiative reached proof of concept on Structurizr, a dedicated C4 modeling platform, with
21+
an on-prem instance and SSO integration underway. SecOps eventually raised concerns about its
22+
maintenance posture and missing compliance documentation which caused a re-evaluation of the choice.
23+
Also, hosting a separate platform added operational overhead. Finally, experience with the PoC
24+
showed that structurizr and all modeling tools' central promise -- one model producing many
25+
audience-specific views -- requires substantial rework per audience in practice.
26+
27+
## Considered options
28+
29+
- **Status quo:** every team picks its own tool.
30+
- **Structurizr (self-hosted):** shared C4 model platform; deprioritized for the reasons above.
31+
- **IcePanel:** visual C4 SaaS; no diagrams-as-code model for version control.
32+
- **draw.io as the standard:** strongest native Confluence app, but stores XML in attachments and
33+
has no GitHub-native rendering.
34+
- **Mermaid with defined conventions:** text in Markdown, GitHub-native rendering, macro support on
35+
Confluence, and zero infrastructure.
36+
37+
## Decision outcome
38+
39+
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:
43+
44+
1. Diagrams are Mermaid source text, nothing else: as Mermaid code blocks, or, if in Confluence, via
45+
Macro Pack's Mermaid diagram in text-input mode.
46+
2. Any Mermaid diagram type that fits.
47+
3. A diagram lives in the doc it illustrates, not a separate file.
48+
4. Every diagram carries a perspective caption: audience, intent, and scope.
49+
5. A diagram answers one question at one altitude. Anything larger requires multiple diagrams.
50+
6. C4 is shared vocabulary only. No C4 tooling is adopted.
51+
7. A diagram is owned by whoever owns the doc it lives in.
52+
8. A diagram updates with the change it depicts. AI instruction files carry the obligation of
53+
establishing a standing safeguard.
54+
55+
### Positive consequences
56+
57+
- Diagram sources are diffable, reviewable in PRs, readable by AI agents, and free of hosted
58+
platforms and new vendors.
59+
- One notation and one vocabulary across repos, the contributing site, and Confluence, with a
60+
mechanical ingestibility test (`GET /wiki/api/v2/pages/{id}?body-format=storage` returns the raw
61+
Mermaid) guarding the Confluence path.
62+
- Mermaid encourages small, single-purpose, and digestible diagrams, which rule 5 codifies.
63+
64+
### Negative consequences
65+
66+
- **rustdoc does not render Mermaid**; crate READMEs embedded via `include_str!` show the raw source
67+
as a plain code block. This is accepted. If rendering ever becomes necessary,
68+
[aquamarine](https://github.com/mersinvald/aquamarine) is the chosen path in inline mode only. It
69+
is not adopted now because it adds a proc-macro dependency to the security-critical SDK workspace
70+
for cosmetic gain.
71+
- **Macro Pack authoring is slow.** Macro Pack is the standard for now. If authoring friction
72+
warrants a replacement, trial weweave's "Mermaid Charts & Diagrams" (runner-up: the official
73+
Mermaid Chart app) and gate any adoption on the storage-format ingestibility test above.
74+
- **Mermaid's C4 diagram types are experimental** and auto-layout limits complex diagrams. Rule 5
75+
keeps each diagram inside what auto-layout handles well, and rule 2's open-ended diagram types
76+
provide the fallback.
77+
- **A rendered diagram shared as an image loses its perspective**, since the caption attaches in the
78+
doc rather than inside the Mermaid source (embedding was tested and fails to render on Macro
79+
Pack). This is accepted.
80+
81+
### Plan
82+
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.
89+
90+
The remaining adoption work is delegated to its owners:
91+
92+
- The architecture team authors the initial system context and container diagrams for the site's
93+
Architecture section, since none exist today, and validates the standard end to end with a pilot
94+
domain diagram set.
95+
- Owning teams add perspective captions to the converted site diagrams and to the existing in-repo
96+
Mermaid diagrams, since the conversion was faithful to originals that carried none.
97+
- The Autofill team redraws the overlay architecture and messaging diagrams as several purpose-built
98+
diagrams, because the current pair crams a whole subsystem into one picture and cannot be
99+
converted mechanically. The overlay SVGs remain on the site as a tracked deviation until the
100+
replacements ship. The team also refreshes the Collecting Page Details deep dive, whose content
101+
predates Manifest v3, and re-derives its diagrams afterward.

docs/architecture/clients/data-model.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,24 @@ This document describes the internal data model used by the different client app
88
several dedicated models to represent our data layer. With a slightly complicated data
99
transformation pipeline.
1010

11-
```kroki type=plantuml
12-
@startuml
13-
skinparam componentStyle rectangle
14-
component [""<Domain>""] as Domain
15-
component [""<Domain><Modifier>""Request] As Request
16-
component [""<Domain>""Response] as Response
17-
component [""<Domain>""View] as View
18-
component [""<Domain>""Export] as Export
19-
component [""<Domain>""Data] as Data
20-
21-
[Response] -r-> [Data]
22-
[Data] <-r-> [Domain]
23-
[Domain] -r-> [Request]
24-
[Domain] <--> [View]
25-
[Domain] <--> [Export]
26-
[Export] -r-> [View]
27-
@enduml
11+
```mermaid
12+
---
13+
config:
14+
layout: elk
15+
---
16+
flowchart LR
17+
Response["&lt;Domain&gt;Response"]
18+
Data["&lt;Domain&gt;Data"]
19+
Domain["&lt;Domain&gt;"]
20+
Request["&lt;Domain&gt;&lt;Modifier&gt;Request"]
21+
Export["&lt;Domain&gt;Export"]
22+
View["&lt;Domain&gt;View"]
23+
Response --> Data
24+
Data <--> Domain
25+
Domain --> Request
26+
Domain <--> Export
27+
Domain <--> View
28+
Export --> View
2829
```
2930

3031
## Domain

docs/architecture/clients/index.md

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,44 +33,40 @@ For readability, ubiquitous app dependencies to `common` are hidden.
3333

3434
:::
3535

36-
```kroki type=plantuml
37-
@startuml
38-
skinparam BackgroundColor transparent
39-
skinparam componentStyle rectangle
40-
skinparam linetype ortho
41-
42-
title Simplified Package Diagram
43-
44-
component "Bitwarden License" {
45-
component "Bit Web"
46-
}
36+
```mermaid
37+
---
38+
title: Simplified Package Diagram
39+
---
40+
flowchart TB
41+
subgraph license ["Bitwarden License"]
42+
BitWeb["Bit Web"]
43+
end
4744
48-
component apps {
49-
component "Web Vault"
50-
component "Desktop"
51-
component "Browser Extension"
52-
component "CLI"
53-
}
45+
subgraph apps
46+
WebVault["Web Vault"]
47+
Desktop["Desktop"]
48+
BrowserExtension["Browser Extension"]
49+
CLI["CLI"]
50+
end
5451
55-
component libs {
56-
component "Common"
57-
component "Angular"
58-
component "Node"
59-
}
52+
subgraph libs
53+
Common["Common"]
54+
Angular["Angular"]
55+
Node["Node"]
56+
end
6057
61-
[Bit Web] --> [Web Vault]
62-
[Bit Web] --[norank]> [Angular]
58+
BitWeb --> WebVault
59+
BitWeb --> Angular
6360
64-
[Web Vault] --> [Angular]
61+
WebVault --> Angular
6562
66-
[Browser Extension] --> [Angular]
63+
BrowserExtension --> Angular
6764
68-
[CLI] --> [Node]
65+
CLI --> Node
6966
70-
[Angular] --> [Common]
67+
Angular --> Common
7168
72-
[Desktop] --> [Angular]
69+
Desktop --> Angular
7370
74-
[Node] --> [Common]
75-
@enduml
71+
Node --> Common
7672
```

docs/architecture/clients/overview.md

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,28 @@ access the specific domain in the _State Service_.
3737
Below is an example how a _domain component_ and _domain service_ interacts with the _State
3838
Service_.
3939

40-
```kroki type=plantuml
41-
@startuml
42-
skinparam BackgroundColor transparent
43-
skinparam componentStyle rectangle
44-
45-
title State Service
46-
47-
component "Example Domain" {
48-
component "Components" as components
49-
50-
component "Domain Service" as domain
51-
}
52-
53-
component "State Service" as state
54-
55-
component "Storage Service" as storage
56-
component "Secure Storage Service" as secure
57-
component "Memory Storage Service" as memory
40+
```mermaid
41+
---
42+
title: State Service
43+
---
44+
flowchart TB
45+
subgraph exampleDomain ["Example Domain"]
46+
components["Components"]
47+
domain["Domain Service"]
48+
end
5849
59-
components -d-> domain : subscribe \n observable
60-
domain -> state : retrieve state
50+
state["State Service"]
6151
62-
state --> storage
63-
state --> secure
52+
storage["Storage Service"]
53+
secure["Secure Storage Service"]
54+
memory["Memory Storage Service"]
6455
65-
state --> memory
56+
components -->|"subscribe<br/>observable"| domain
57+
domain -->|"retrieve state"| state
6658
67-
@enduml
59+
state --> storage
60+
state --> secure
61+
state --> memory
6862
```
6963

7064
## Services

0 commit comments

Comments
 (0)