Part V · Contracts · Plate 02

Axon schema · DeltaReportV1

On this page

Axon describes the structural reach of a change. Soma uses that evidence to decide which curated concerns need checking.

Fig. 5.2.1   Writer and reader

  1. Axon · writer

    Indexes the repository and produces a change-set-bound DeltaReportV1 envelope.

  2. DeltaReportV1 · carrier

    Changed symbols, reachable entry surfaces, module dependents and index-trust evidence.

  3. Soma · reader

    Matches that structural reach against concern triggers. A report is evidence, not a passing verdict.

Note 5.2.1   Reading the report

Start with changeSet to identify the evaluated revision, then touched, downstream and modules for structural reach. Read trust and truncation information before interpreting an empty result. The authoritative schema and field definitions follow below.

Listing 5.2.1   Inspect and evaluate

In an initialized repository with the tools installed, inspect the report or run the closeout gate. These are separate commands, not a JSON pipeline:

axon index
axon delta --json
cns gate

The gate refreshes the index when present, verifies Soma's maps and checks concerns. It is structural by default; live rubric evaluation requires explicit opt-in. See installation prerequisites before trying these commands.

2. Axon ↔ Soma Connectome & Delta Contracts

2.1 SQLite Schema v18 (.axon/axon.db)

Axon materializes the repository connectome into .axon/axon.db (WAL mode, single-transaction batch replacement) read directly by Soma (crates/soma-axon):

Table Primary Key Key Columns & Contract
structural_nodes id (TEXT) node_type (file, symbol, capability-surface), file_path, language_id, symbol_name, symbol_kind, qualified_name, metadata (JSON), origin (local, pack, federated). Node IDs use canonical prefixes (file:<relPath>, symbol:php:<FQN>::<method>, symbol:ts:<relPath>:<name>, symbol:go:<pkg>.<Type>.<Method>, surface:http:<METHOD>:<path>, infra:tf:resource:<type>.<name>) with #file:<relPath> collision disambiguation.
structural_edges id (TEXT) source_node_id, target_node_id, edge_type (calls, references, imports, implements, extends, uses_trait, handled_by, renders_component, calls_surface, dispatches_event, dispatches_job, provides_service, depends_on, builds_from, provisions, federated_call, federated_reference), confidence (0.0–1.0), confidence_class (proven, lsp-proven, artifact-backed, framework-inferred, heuristic), ownership.
edge_evidence id (TEXT) edge_id, resolver, evidence_kind, file_path, line, note, payload_json.
operational_boundaries id (TEXT) kind (command, job, event, schedule), name, display_name, declaration_file, declaration_line, trust_tier (1–5).
operational_handlers id (TEXT) boundary_id, symbol_id, trust_tier. Joins operational boundaries to handling classes/methods.
operational_edges id (TEXT) source_id, target_id, edge_type (DISPATCHES, LISTENS_TO, TRIGGERS, BROADCASTS_ON), transport, trust_tier.
operational_contracts id (TEXT) boundary_id, payload_schema (JSON), trust_tier.
module_dependencies (source_module, target_module) reference_count, sample_files (JSON array), created_at.
structural_node_texts & structural_node_fts node_id (TEXT) Extracted docblocks, signatures, identifiers, and FTS5 BM25 virtual index for axon anchor-search.
structural_node_embeddings & node_embeddings (node_id, model) Persistent f32 little-endian BLOB embeddings (dims, content_hash) for hybrid neural anchor search. In linked git worktrees (git worktree add), seed_embeddings_from_main_worktree automatically seeds matching (content_hash, model) vectors from <main-worktree>/.axon/axon.db. Seeding time depends on workload and hardware.
index_metadata key (TEXT) last_indexed_commit, detected_module_boundary, detected_module_prefix, detected_modules_v1, overlay_trust_state (JSON), symbol_id_collisions_v1, surface_id_collisions_v1, lsp_enrichment_failures_v1, structural_config_fingerprint.

Schema v18 removed four tables nothing wrote or read: experts, expert_sessions, events, and knowledge_entries (with its FTS table knowledge_entries_fts). They were created by every v1 to v17 database and never populated by any organ. On the first write-open of an older database, Axon drops each group only if it is empty; a group that someone populated by hand is kept and named in index_metadata.v18_retained_tables rather than destroyed. Read-only opens (axon status, Soma) do not migrate. Soma, Engram, Cortex and Thalamus have no reader of these tables (deploy/dead-channels.sh proves it).

2.2 DeltaReportV1 JSON Contract (axon delta --json)

Soma (soma concerns check --axon axon or --delta <file>) consumes Axon's DeltaReportV1 envelope and enforces strict SHA and working-tree binding (StructuralDepth::bind):

Computed vs not computed. A field that Axon does not compute is null or absent, never 0 or [], so a reader cannot mistake "not computed" for "computed and empty". The following are NOT computed:

Path Representation
touched.evidenceEdges, touched.orphanedNodes null
touched.precision.cosmeticOnly, touched.precision.changedOutsideSymbols null
changeSet.summary.untracked null (untracked files are counted under added)
ownership, invalidatedEvidence key absent

Everything else in the report is computed. The authoritative list is the NOT_COMPUTED table and module documentation in axon/crates/axon-delta/src/lib.rs. Soma reads none of the not-computed fields and parses both shapes. One computed section can still be null: schema is null when the index predates Axon's database schema catalog (re-index to compute it), which means "not computed", not "no unresolved columns".

Mixed casing. The three test-target sections, impacted_tests, untested_surfaces and mock_only_surfaces, and every key inside their entries are snake_case, because these are the names cns gate reads (§5.6). The rest of DeltaReportV1, including schema and propContracts, is camelCase. A reader must not convert one casing to the other: downstream.symbols[].filePath and impacted_tests[].file_path are both correct.

Test targets: impacted_tests, untested_surfaces, mock_only_surfaces

Added by ivannovak/axon#30 (repository access may be required) (axon PR #34, 2d87c4b). All three top-level arrays are always present; an empty array means "computed, none found". Like the rest of the downstream walk they are bounded by downstream.budget, so when downstream.budget.truncated is true a test or surface beyond the budget is not listed.

impacted_tests[] has one entry per test file the change reaches, at its closest link, ordered by hop_distance then file_path:

Key Value
file_path Repository-relative path of the test file.
symbol_id The test symbol the walk reached, or the test's file: node when the link is file-level.
hop_distance Integer; 0 when the test file itself changed.
proximity direct (hops 0 and 1), 1-hop (hop 2) or transitive (beyond).
test_kind From the indexer's file-level test profile: mock_isolated (fakes or mocks at least one boundary), integration_or_feature (drives an HTTP request, console command or database state and fakes nothing) or unit (neither).
faked_boundaries Array of the fakes and mocks the file uses, such as Event::fake, Bus::fake, Mockery::mock or vi.mock; [] for none.
reached_via changed-file (hop 0), structural-walk, test-import (the test imports a changed or downstream symbol), http-request (it requests a downstream route) or console-command (it runs a downstream command).
via Array of node IDs from the change to the test.

untested_surfaces[] and mock_only_surfaces[] cover each downstream HTTP route, console command, job and event that no reached test executes for real. Both have entries {id, kind, hops, tests, faked_boundaries}:

axon delta --tests-only [--format paths|json] prints only these sections. --format paths (the default without --json) prints each impacted_tests[].file_path on its own line, closest first, and prints nothing when no test is reached. --format json (the default with --json) prints {base, head, impacted_tests, untested_surfaces, mock_only_surfaces, truncated}, where truncated is downstream.budget.truncated. --format requires --tests-only.

schema.unresolvedColumns

Added by ivannovak/axon#31 (repository access may be required) (axon PR #33, f9a1240). schema is {catalog, tableCount, unresolvedColumns}, or null as described above. catalog is indexed, or refolded when the change touches a schema input (SQL dump, schema.prisma, db/schema.rb, Laravel migration) and Axon folded the catalog again at head. tableCount is the number of tables in that catalog.

unresolvedColumns[] lists each reference, in a changed PHP file, to a column that a completely indexed table lacks: {table, column, tableNodeId, model, filePath, line, kind, via, symbolId, introduced, knownColumns}. tableNodeId is schema:table:<table>. kind is where the name appears (fillable, casts, guarded, hidden, visible, dates, query, write, upsert or property), via is the method or property it appears in (such as where or $fillable), symbolId is the enclosing symbol or null, and knownColumns lists the table's indexed columns. Unlike propContracts, this list also contains references that already existed at base: introduced: true marks the ones the change adds. Names that may be relations, accessors, appended attributes or aggregate counts are not reported.

propContracts

Added by ivannovak/axon#32 (repository access may be required) (axon PR #35, 1cbb2ca). propContracts is always an object {mismatches, changedContracts}. mismatches[] reports only mismatches the change introduces: present at head and absent at base. An empty array means "computed, none introduced", not "the seam is consistent".

mismatches[].kind Meaning Keys
required-prop-unsupplied A supplier of a Vue component (a parent SFC tag, a Blade mount, or an Inertia::render payload plus the shared props) stops passing a prop that the component requires and gives no default. A supplier whose payload is not a literal (a variable, a spread, v-bind="obj") is taken to supply everything. kind, component, componentPath, prop, propLine (or null), supplier, supplierPath, line
payload-key-removed A PHP payload drops a key that a Vue component consumes: a prop.key access in a component whose prop a JSON resource hydrates (contractKind: "json-resource"), or an optional page prop of that name for an Inertia page payload (contractKind: "inertia-render"; a dropped required prop is reported as required-prop-unsupplied). kind, producerPath, contractKind, target, key, line (or null), component, componentPath, prop, consumerLine

changedContracts[] lists every PHP payload in a changed file whose key set changed, with or without a consumer: {producerPath, kind, target, addedKeys, removedKeys}, where kind is inertia-render, inertia-share, view, json-response or json-resource. Payload boundaries are not delta entry surfaces, so they never appear in downstream.entrySurfaces, untested_surfaces or mock_only_surfaces.

Readers in CNS

cns gate (§5.6) reads axon delta --base <merge base> --json (with --committed-only for --head) or the caller's --delta <file>, never --tests-only. It reads only these fields, and accepts the camelCase spellings in parentheses as well:

Field Gate use
downstream.symbols[].filePath (file_path) with hops (hop_distance) == 1 {impacted_files}, added to the changed files
impacted_tests[].file_path (impactedTests[].filePath), in report order {impacted_tests}. A delta without the array (Axon before #30) is not evaluated, exit 3; an empty array expands to nothing.
untested_surfaces[] and mock_only_surfaces[] (untestedSurfaces, mockOnlySurfaces): each entry's id and kind, or the entry itself when it is a string require_integration_on_http_surface: an entry of kind http is red; require_integration_on_dispatched_surfaces: one of kind job or event. Without a kind, an id containing :http: is http and an id starting opb:job: or opb:event: is that kind. Not evaluated (exit 3) only when both arrays are absent.

The gate does not read test_kind, faked_boundaries, schema or propContracts.

The following abbreviated envelope uses a synthetic Example namespace and fictitious Billing/Reporting modules; it is not application or customer data. Ellipses indicate omitted arrays, not literal JSON values.

{
 "schemaVersion": 1,
 "changeSet": {
 "base": { "ref": "HEAD~1", "sha": "0123456789abcdef..." },
 "head": { "sha": "fedcba9876543210...", "workingTreeIncluded": false },
 "files": [
 { "path": "src/Module/Billing/Services/InvoiceService.php", "renamedFrom": null, "indexTrust": "fresh" }
 ],
 "summary": { "added": 0, "modified": 1, "deleted": 0, "renamed": 0, "untracked": null }
 },
 "touched": {
 "files": 1,
 "evidenceEdges": null,
 "orphanedNodes": null,
 "changedSymbolIds": [
 "symbol:php:Example\\Core\\Module\\Billing\\Services\\InvoiceService::calculateTotal"
 ]
 },
 "downstream": {
 "budget": { "maxDepth": 4, "maxNodes": 500, "truncated": false },
 "symbols": [...],
 "entrySurfaces": [
 {
 "id": "surface:http:GET:/admin/api/invoices/{id}",
 "kind": "http",
 "hops": 2,
 "resolvedVia": "structural-walk",
 "weakestConfidence": "proven",
 "via": [
 "symbol:php:Example\\Core\\Module\\Billing\\Services\\InvoiceService::calculateTotal",
 "symbol:php:Example\\Core\\Module\\Reporting\\Http\\Controllers\\InvoiceReportController::show",
 "surface:http:GET:/admin/api/invoices/{id}"
 ]
 }
 ]
 },
 "impacted_tests": [
 {
 "file_path": "tests/Unit/Billing/InvoiceServiceTest.php",
 "symbol_id": "file:tests/Unit/Billing/InvoiceServiceTest.php",
 "hop_distance": 1,
 "proximity": "direct",
 "test_kind": "unit",
 "faked_boundaries": [],
 "reached_via": "test-import",
 "via": [...]
 },
 {
 "file_path": "tests/Unit/Reporting/InvoiceReportControllerTest.php",
 "symbol_id": "symbol:php:Example\\Tests\\Unit\\Reporting\\InvoiceReportControllerTest::testShow",
 "hop_distance": 2,
 "proximity": "1-hop",
 "test_kind": "mock_isolated",
 "faked_boundaries": ["Mockery::mock"],
 "reached_via": "structural-walk",
 "via": [...]
 }
 ],
 "untested_surfaces": [],
 "mock_only_surfaces": [
 {
 "id": "surface:http:GET:/admin/api/invoices/{id}",
 "kind": "http",
 "hops": 2,
 "tests": ["tests/Unit/Reporting/InvoiceReportControllerTest.php"],
 "faked_boundaries": ["Mockery::mock"]
 }
 ],
 "modules": {
 "changed": ["Billing"],
 "dependents": [
 { "module": "Reporting", "referenceCount": 14 }
 ]
 },
 "schema": { "catalog": "indexed", "tableCount": 42, "unresolvedColumns": [] },
 "propContracts": { "mismatches": [], "changedContracts": [] },
 "crossRepo": {
 "symbols": [...]
 },
 "trust": {
 "overlay": "overlay-complete",
 "indexedCommit": "fedcba9876543210...",
 "staleFiles": 0,
 "absentFiles": 0,
 "warnings": []
 }
}