symbolKey stable identity field
Platform spec ADR
symbolKey stable identity field
Spec standingStandard
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
| Section id | Required | Found |
|---|---|---|
what-this-feature-specifies | yes | yes |
implementation-anchors | yes | yes |
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
Context
Section titled “Context”Schema v4 already carries qualifiedName, refItemId, and compiler-derived signatures. Cross-package workspace doc runs and registry consumers still need a stable, package-qualified string that does not depend on recomputing module paths or splitting display names—especially when the same logical symbol can appear under different dense ItemId values during per-unit resolve.
Decision
Section titled “Decision”Add optional field symbolKey on each ApiDocItem (JSON camelCase) for schema v4 emitters:
| Rule | Requirement |
|---|---|
| Presence | Emit only when qualified_name(resolution, item.id) succeeds (registry-backed exportable symbol) |
| Omission | Non-exportable rows (parameter, synthetic rows, unresolved collect) must omit the field |
| Value | Same encoding as SymbolRegistry / symbol_to_string (package prefix + :: segments) |
qualifiedName | Unchanged; legacy recompute + fallback remains for display and tree labels |
| Graph edges | refItemId stays the primary type-link and parent graph edge; symbolKey is parallel stable identity |
Emitters must not copy qualifiedName into symbolKey when the registry has no symbol for the row.
Consumers may index and resolve @ref targets by exact symbolKey before suffix heuristics on qualifiedName.
Packed library artifacts: pckg must validate symbolKey when present (D-TOOL-PCKG-0005).
Consequences
Section titled “Consequences”- Rust type:
ApiSymbolKeynewtype inapi_snapshot.rs(transparent JSON string). - CLI:
beskid docsetssymbolKeyfrom registry lookup only. - Older artifacts without
symbolKeyremain valid; field is additive on v4.
Verification anchors
Section titled “Verification anchors”compiler/crates/beskid_analysis/src/doc/api_snapshot.rscompiler/crates/beskid_cli/src/commands/doc.rscompiler/crates/beskid_analysis/src/doc/refs.rscompiler/crates/beskid_pckg/src/api_doc.rs