docs: define the closed public Analysis boundary

Add ADR-0069 and replace the program-only Analysis v3 shape in place with the
one public projection consumed by independent static tools: project entry and
snapshot identity, exact source, document AST, heading scope facts, anchors,
functions, calls, resources and stateful references. Update the Markdown
profile, reference and observation specs to point at the single resolver and
the same encoder/digest rule.
This commit is contained in:
cflmy committed 2026-11-25 09:39:26 +08:00
1 parent e6066e6ba9
commit 88d7cd3414
6 files changed
+1153 -444

No files matched your search

+14 -2
View File
@@ -16,7 +16,7 @@ Normative implementation:
| Resource collection and attribution | `crates/marqdo-frontend/src/resources.rs` |
| Executable payload → statement mapping | `crates/marqdo-frontend/src/map.rs` |
| `ref(...)` runtime resolution | `crates/marqdo-runtime/src/builtins_impl.rs` |
| Static link graph (`inspect --refs`) | `crates/cli/src/commands.rs` |
| Static link graph (Analysis `references`, `check --refs`, `inspect --refs`) | `crates/cli/src/document_refs.rs` |
| Cross-module call validation | `crates/marqdo-frontend/src/calls.rs` |
This file complements [`mapping.md`](mapping.md) (AST roles) and
@@ -89,7 +89,10 @@ pub struct UnitId { pub module: ModuleId, pub path: Vec<String> }
normalization. `## @exec main` has the semantic name `main`; the declaration
is never part of a `UnitId`, `FunctionId` or anchor.
* `Display` renders `<module>#<path joined by '/'>`; the root unit renders as
`<module>#`.
`<module>#`. A path segment escapes `%`, `/` and `#` as `%25`, `%2F` and
`%23`, so a single segment named `a/b` cannot collide with the two-level path
`a` -> `b`. Consumers must use the structured `UnitId.path` exposed by
Analysis and must never split a display id to recover hierarchy.
* `UnitKind` is `root`, `namespace` (`#`), `function` (`##` Exec) or `section`
(`###`+). A Knowledge H2 is an addressable knowledge unit, not a `function`.
Sections are addressable but not callable.
@@ -125,6 +128,15 @@ to units (`crates/marqdo-frontend/src/units.rs::github_slug`):
Internal ids stay canonical, so a heading rename is a link-breaking change
but never changes the canonical unit path.
## 2.5 One document-link resolver
Analysis `references`, `check --refs` and `inspect --refs` use one pure
resolver over an explicit catalog (`spec/analysis.md` §5). It never loads a
module, binds a call or accesses the network. Ordinary Analysis uses only the
loaded modules; the `--refs` checks may add directly referenced local files to
a separate catalog for existence/anchor verification. The retired
`commands.rs::resolve_link` algorithm does not exist.
## 3. Front matter imports
Imports exist only as an explicit YAML mapping in the document's front matter