Skip to content

Commit 7846c7f

Browse files
committed
[plantuml tooling] add guideline on element identifiers
1 parent 1838e68 commit 7846c7f

4 files changed

Lines changed: 493 additions & 2 deletions

File tree

‎.github/skills/score-architecture/SKILL.md‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,60 @@ namespace safety_software_seooc_example {
304304

305305
---
306306

307+
## Element Identifiers
308+
309+
Every element across the `static`, `unit_design` (class), and `dynamic` (sequence) diagrams is
310+
resolved to a **canonical identifier**. Two elements are the same architecture element exactly
311+
when their identifiers match — that is how the validators link a `static` component to its
312+
`unit_design` class and to a `dynamic` sequence participant. You never write an identifier
313+
yourself; it is assembled from three inputs joined with `.`:
314+
315+
| # | Input | Comes from | Example |
316+
|---|-------|-----------|---------|
317+
| 1 | Root anchor | The Bazel package of the owning `architectural_design`/`unit_design` target (`/` → `.`) | `unit_1/docs` → `unit_1.docs` |
318+
| 2 | Internal scope | The `package`/`component`/`namespace` nesting the element is written in | `logging.Recorder` |
319+
| 3 | Leaf | The element's alias (`as X`), or its name if there is no alias | `Backend` |
320+
321+
joined: `unit_1.docs.logging.Recorder.Backend`. `::` and `.` are equivalent separators; a
322+
dotted/`::`-qualified reference (an interface binding, a class relationship, …) is always read
323+
**relative to the root anchor**, never as an absolute path.
324+
325+
**Sequence diagrams are the exception**: a participant has no nesting to draw scope from, so its
326+
identifier is read out of the **quoted label**, not the alias — the alias is only a local shortcut
327+
for drawing arrows.
328+
329+
| What you write | Identifier comes from |
330+
|-----------------|-----------------------|
331+
| `participant "backend : logging::Recorder::Backend" as Backend` | text right of the `:` |
332+
| `participant "Unit 1" as unit_1` | falls back to the **alias** (`unit_1`) |
333+
334+
If a participant represents a nested unit, write the full qualified label —
335+
`"instance : Component::Unit"` — so the identifier matches the `static` diagram. A bare prose
336+
label still parses, but if it doesn't resolve to the same identifier as the component diagram
337+
there is no parse error, only a **cross-diagram validation mismatch** (see **Active validations**,
338+
`component_sequence.md`).
339+
340+
`ExternalEndpoint` is a reserved participant name for an actor outside the described architecture;
341+
it is emitted verbatim (no root anchor, no scope) so it always matches itself across diagrams.
342+
343+
**Best practices**:
344+
- Give every architecture-relevant element an explicit `as` alias; never rely on a prose label.
345+
- Keep `architectural_design` and `unit_design` for one subsystem under the same root Bazel
346+
package — different packages get different root anchors, and their identifiers can never match.
347+
- Mirror the nesting between the `static` and `unit_design` diagrams; scope segments must be
348+
identical on both sides.
349+
- In sequence diagrams, write the full qualified label (`"instance : Component::Unit"`) once
350+
nesting is involved; use the bare alias only when the unit is top-level. Use the alias for arrows
351+
either way.
352+
- Use `ExternalEndpoint` verbatim for out-of-scope actors.
353+
- Treat identifiers as derived, not authored — to change one, change the nesting, alias, or owning
354+
Bazel package, not the identifier itself.
355+
356+
> Full rule set (root-anchor construction, qualified-reference resolution, uniqueness errors):
357+
> `plantuml/parser/docs/element-identifiers.md` (this repo) — the resolver's authoring guide.
358+
359+
---
360+
307361
## Bazel Rules — Step 2 (mechanical)
308362

309363
Do this **only after the targeted architecture is agreed with the user** (see **Workflow**). Each

‎plantuml/parser/README.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Options:
5858
| `--fbs-output-dir <DIR>` | Output directory for `.fbs.bin` FlatBuffers files | none (no output) |
5959
| `--lobster-output-dir <DIR>` | Output directory for `.lobster` traceability files | none (no output) |
6060
| `--output-stem <STEM>` | Override the file stem used to name every output file for this run, instead of deriving it from the input file's own basename. Requires exactly one input file. | none (uses the input file's basename) |
61+
| `--root-anchor <PATH>` | Identifier prefix for the resolved diagram, supplied by the owning `rules_score` target as its Bazel package | empty (no prefix) |
6162

6263
At least one of `--file` or `--folders` is required.
6364

@@ -94,3 +95,8 @@ Shared model and serialization crates are split by responsibility:
9495
schemas and serializer crates that produce `.fbs.bin` outputs.
9596

9697
For the detailed design and users Guide, see `docs/README.md` in the source tree.
98+
99+
Authoring guides:
100+
101+
- [`docs/element-identifiers.md`](docs/element-identifiers.md) — how element identifiers are constructed and how to link component, class, and sequence diagrams
102+
- [`docs/sequence-diagram.md`](docs/sequence-diagram.md) — supported sequence diagram syntax and semantics

0 commit comments

Comments
 (0)