Skip to content

Commit 359f5fc

Browse files
committed
docs: state the polyglot id rule in the neo4j section
`:Artifact`, `:ConfigKey` and `@external` ids omit the `/java/` segment and are shared merge targets across sibling analyzers over the same app; code nodes carry it and stay this analyzer's. Names the consequence the prefix-scoped snapshot wipe already has for a cross-language edge into a shared `:Artifact`.
1 parent b260660 commit 359f5fc

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,25 @@ the same repository lands on the same nodes instead of a per-language duplicate.
242242
`SCHEMA_VERSION` is stamped onto the `:JApplication` node of every emitted graph.
243243

244244
Every node id starts with `can://<app>/` — `can://<app>/java/…` for code, `can://<app>/artifact/…`
245-
for build manifests and config keys — so `can://<app>` is a prefix of every node the application
246-
emits, which is what the destructive statements scope on. (`:Package` is the exception: it is keyed
247-
on a `pkg:` purl, sits under no application, and no wipe reaches it.) `:JApplication` is keyed on
248-
that id, not on the free-text `--app-name`, so the root is addressable by the same id its
245+
for build manifests and config keys, `can://<app>/@external/…` for library symbols — so
246+
`can://<app>` is a prefix of every node the application emits, which is what the destructive
247+
statements scope on. (`:Package` is the exception: it is keyed on a `pkg:` purl, sits under no
248+
application, and no wipe reaches it.) `:JApplication` is keyed on that id, not on the free-text
249+
`--app-name`, so the root is addressable by the same id its
249250
descendants are prefixed with. The id is derived from `--app-name` (`can://<app-name>`), so it does
250251
**not** disambiguate two services analyzed under the same name — those still merge onto one root.
251252
Give each service its own `--app-name` if they share a database.
252253

254+
**Polyglot ids.** The `/java/` segment is what makes a code node this analyzer's. Three id families
255+
deliberately omit it and are therefore **language-neutral, shared merge targets**: `:Artifact`,
256+
`:ConfigKey` and `@external` symbols. A sibling analyzer over the same `<app>` mints byte-identical
257+
ids for them, so a `pom.xml`, a config key or `java.util.Map#get` is *one* node in a merged graph
258+
rather than a per-language duplicate. That sharing is the point, and its cost is accepted: two
259+
analyzers' notions of a library symbol are not necessarily the same thing, and merging them says
260+
they are. The consequence for writes: because these shared nodes sit inside `can://<app>/`, a Cypher
261+
snapshot's prefix wipe rebuilds them, so a cross-language edge into a shared `:Artifact` is dropped
262+
by one analyzer's snapshot and restored on the other's next push.
263+
253264
**Configuration reads.** `DEFINES_CONFIG` says which artifact declares a key; `J_USES_CONFIG` says
254265
which code reads one. Its source is whichever node the read was attributed to — a `:JBodyNode` for
255266
a call site (`System.getenv("X")`, `env.getProperty("X")`), or the `:JField` / `:JCallable` /

0 commit comments

Comments
 (0)