BizMap graph schema (v0.17.1)¶
bizmap scan writes bizmap.graph.json. The graph is fully deterministic: every
node and edge is produced from source text (SQL, tree-sitter ASTs, comments, or
an explicit bizmap.yaml override). There is no LLM in the loop. List
attributes (unresolved, unresolved_http, unresolved_calls, candidates,
…) are sorted so identical input is byte-identical across PYTHONHASHSEED
values except generated_at.
Top-level object¶
| Field | Type | Meaning |
|---|---|---|
version |
string | Graph format version ("0.17.1"). |
generated_at |
string | UTC timestamp. |
schema |
object | Reconstructed database schema (schema.tables). |
nodes |
array | Graph nodes (see below). |
edges |
array | Graph edges (see below). |
repo |
string? | Scan-root name (bizmap.yaml name:). |
database |
string? | Shared-database key. Matching values share table/collection ids on merge. |
repos |
array? | Repo names included in a merged registry graph. |
repo_roots |
object? | Repo name → its directory. Inside a git work tree (repo_roots_base: git) the path is relative to the git root, like diff paths, so per-repo scans + registry merge equal the joint scan. Outside git (repo_roots_base: scan) it is relative to the scan path (. for each separately scanned repo, so merge == joint does not hold there and bizmap impact --prefix is needed). |
repo_roots_base |
string? | git or scan: what repo_roots is relative to. |
services |
object? | Service name → base URL, used to match HTTP client calls. |
queues |
object? | Queue name → consumer hint, copied from bizmap.yaml for rematch. |
unresolved_http |
array? | Unmatched outbound HTTP calls (url, method, keys, from, reason). reason is one of target_not_scanned (URL fully composed but no matching route in scanned repos), base_unknown (path known, base not resolvable), path_dynamic (path not composable), client_unknown. Stderr counts this list and prints per-reason totals. |
skipped |
object? | How many paths the scan left out, per reason: generated_dirs, generated_files, gitignored. |
skipped_paths |
object? | The same paths, per reason, sorted (at most 200 per reason; skipped has the full count). In a merged graph each path is prefixed with repo:. |
warnings |
array? | Non-fatal scan notes (for example Go import-path suffix fallback when go.mod is missing). Printed by bizmap scan. |
schema.tables.<name>¶
{
"columns": {
"status": { "type": "TEXT", "nullable": false, "default": "'pending'" }
},
"foreign_keys": [
{ "name": "orders_user_id_fkey", "columns": ["user_id"], "ref_table": "users", "ref_columns": ["id"] }
],
"rls": true,
"policies": [
{ "name": "orders_tenant_select", "command": "SELECT", "role": "app_user" }
]
}
Nodes¶
Every node has id and type. Extra fields depend on type.
type |
id pattern |
Extra fields |
|---|---|---|
entrypoint |
entrypoint:http:METHOD:/path or entrypoint:<kind>:<key> |
kind (http | scheduled_job | firestore | celery_task | worker | pubsub | cloud_task | firebase_http | firebase_call), method, path, symbol, why, evidence, optional confidence, candidates, unresolved (const path not in the scan), optional unresolved_calls, optional collection / event, optional dynamic_table / dynamic_table_unknown (flag/count when a reachable origin writes table:unknown; never a reach edge) |
function |
function:<qualname> |
name, package, optional import_path, language, why, evidence, optional end_line (last line of the definition) and start_line (first line, when it differs from evidence.line; for an inline route handler evidence.line is where the registration call starts — in a chain like new Hono().post(a).post(b) or router.route('/x').get(a), the chain's first line — and start_line/end_line are the handler function's own lines), optional parent (enclosing factory/function for members and route closures), optional role (schema for Alembic/migrations), optional http_calls (stashed client URLs for registry rematch), optional queue_events, optional unresolved_queues (a publish whose topic is an env var without a value — {kind, env, evidence} — or one of several Go publisher instances — {kind, candidates, evidence}; see Queue names), optional unresolved_calls (interface/protocol with no scanned implementer), optional unresolved_http, optional route_literals (JS/TS API-looking path strings {path, method?, evidence} kept for registry rematch), optional params (the parameters in order: [{name, type?, optional?}], [] when there are none) and returns (the return type's text) — see below |
table |
table:<name> |
name; optional db (database the code reaches it through, see Data flow), db_candidates, same_as, external (system catalogs / storage.* / vault.* / auth.*), kind (external_relation | unresolved_relation), dropped (still referenced after DROP TABLE), candidates (dynamic/unknown), rls, policies |
view |
view:<name> |
name, kind (view | unresolved_relation), optional materialized |
column |
column:<table>.<column> |
table, name, data_type, nullable, optional why |
db_trigger |
db_trigger:<name> |
name, table, timing, events, function, evidence; optional columns (the UPDATE OF col, … list, present only when the trigger has that clause) |
collection |
collection:<name> |
name (Firestore collection: the last collection of its path, so customers/{id}/notes is collection:notes, as in Python); optional path (the full path with {} for ids, from JS/TS) / paths, db (firestore:<project\|default>), same_as |
queue |
queue:<kind>:<name> |
kind (celery | rq | cloud_tasks | pubsub | firestore | topic), name, optional env (the env var the name came from, see Queue names). queue:pubsub:<topic> ids are never repo-qualified: a topic is the same in every repo of a joint scan or registry merge. |
On a merged registry graph, function / entrypoint / queue ids are prefixed
with the repo (catalog/function:db.create_order). Table, column, view,
collection, and db_trigger ids stay unprefixed when every contributing
graph declares the same database.
Go qualname is always the directory path relative to the scan root plus the
type and method (cmd/server.main, controllers/orders.Handler.Create,
internal/services/appointments.Service.Run). Functions also store the full
Go import path.
params / returns are the function's own signature text, read from the code
(Go, Python, TypeScript; plain JavaScript gives the names only). A type is the
code's text with whitespace collapsed, at most 120 characters (cut with …);
type is absent for a parameter without annotation and returns for a
function without a return type. Go leaves the receiver out (it is in the name)
and writes a variadic as ...string; Python leaves self / cls and the bare
* / / out and keeps *args / **kwargs; defaults are not kept; a
destructured TS/JS parameter is named by its pattern ({ page, size }). Both
fields are optional: older graphs stay valid.
{"id": "function:src.api.orders.ordersClient.get", "type": "function",
"params": [{"name": "id", "type": "string"}, {"name": "opts", "type": "{ expand?: boolean }", "optional": true}],
"returns": "Promise<Order>"}
why is copied only from a comment or docstring immediately above the function,
or from bizmap.yaml. BizMap never invents business intent.
HTTP entrypoints that cannot be bound to a single handler (name collision, no
type information) keep confidence: unknown and list candidates instead of
picking an arbitrary match.
Edges¶
type |
From | To | Meaning |
|---|---|---|---|
calls |
function |
function |
Intra-project call (handler → service → repository). Interface dispatch uses inferred and may list candidates. supabase.rpc calls function:sql.<name>. |
reads |
function / entrypoint / db_trigger |
column, table, or collection |
SQL, ORM, or Firestore reads this data. |
writes |
function / entrypoint / db_trigger |
column, table, or collection |
SQL, ORM, or Firestore writes this data. A JS/TS Firestore write has fields (the keys of the object written). |
triggers |
entrypoint or db_trigger (or a collection writer, or a queue) |
function / entrypoint |
HTTP route / ticker job / DB trigger / Firestore writer invokes a function. queue:pubsub:<topic> -> entrypoint with via: push_subscription: a Pub/Sub push subscription delivers the topic to that route (see Firestore in JS/TS). |
calls_http |
function |
entrypoint |
HTTP client URL matched a scanned route (same repo or via services: env/host/URL). |
enqueues |
function |
queue |
Celery/RQ/Cloud Tasks/Pub/Sub produce site. JS/TS pubsub.topic(t).publishMessage({ json }) / publishJSON(obj) has fields (the message keys). |
derives_from |
view |
table or view |
View (or materialized view) is defined from these base relations. |
feeds |
table / view |
table or collection |
Values read from one table are written to the other (often in another database). See Data flow. |
Column-level reads/writes are emitted only when the SQL names columns.
SELECT * and INSERT without a column list are table-level (unless
bizmap scan --expand-star, which expands SELECT * at the SQL origin only).
Call-graph propagation to callers and HTTP/job entrypoints is always
table-level, so a star query is not copied as every column to every caller.
Every edge has:
{
"id": "writes:function:repository.Repo.InsertOrder->column:orders.status",
"type": "writes",
"from": "function:repository.Repo.InsertOrder",
"to": "column:orders.status",
"confidence": "exact",
"evidence": { "file": "repository/repository.go", "line": 112, "symbol": "repository.Repo.InsertOrder" }
}
Optional via records how an edge was derived: a write propagated through a
database trigger (db_trigger:NAME), or route_literal on a calls_http edge that was matched
from an API-looking string literal (see below) rather than a traced client.
A read/write copied from the function that runs the SQL up to its callers and
entrypoints carries derived: "call"; edges without derived are the
function's own access. Direct writes carry ops, the SQL operations they
come from (["INSERT"], ["UPDATE"], ["DELETE"]; an upsert gives both
INSERT and UPDATE). A DB trigger fires only on a direct write whose ops
match its events (and, for UPDATE OF col, that writes one of those
columns); its effect is a table-level writes with
via: db_trigger:NAME on the firing function, and also derived: "call" on
its callers and entrypoints.
Optional situation is a list of const/iota names observed at call sites
(for example audit.AppointmentCanceled) so bizmap why can say when a
column is written.
Route literals (calls_http with via: route_literal)¶
Front-end clients are often built through layers static analysis cannot
follow (DI containers, registries, factories of factories). As a fallback,
every JS/TS string or template that looks like an API path — '/orders/' +
id, `${base}/orders/${id}` — is recorded on its enclosing function and
matched against scanned routes, in the same repo or across a joint scan:
- Navigation and non-API strings are ignored: route registration arguments,
navigate()/router.push()/redirect(),<Link to>and other JSX attributes,path:/href:/to:object keys, comparisons andstartsWith(), arrays of paths, imports, and asset files (/logo.png). - Only when the call's base is unknown. If a traced client call for the
same path has a concrete base (env var placeholder or absolute URL), the
literal is ignored: that call is either matched to its service or stays
unresolved_http(target_not_scanned). The discarded candidates are kept on the function asroute_literal_skipped(reason: base_knownwith the base and service, orreason: ambiguous). - A same-length template match is accepted. A suffix match (the client base
carried
/api/v1) needs 2+ literal segments or a method hint from the surrounding call (.get(...),fetch(url, { method: 'POST' }),{ url, method }). - The edge is created only when exactly one route matches, and never to a route registered in the same file. Ambiguous literals link to nothing.
- A bare
fetch('/x')is page-relative and only links within its own repo. - A function that only returns the path (a path helper) is never the origin; a call to it at an HTTP call site is the literal of the calling function.
- If the call's base resolves to a scanned service and exactly one route of
that service matches, the edge is
inferred. - Otherwise edges are
heuristicwithmatch: full|suffix; the matchingunresolved_httpentry is dropped.
SQL by reference (via: sql_reference / sql_key, Python)¶
SQL kept in a module constant or dict and handed to an executor the
detectors cannot resolve (dependency injection, a service object, a generic
runner) is attributed to the function that names it:
QUERIES["top"], QUERIES.get("top"), queries.QUERIES["top"],
SALES_SQL, sql.SALES_SQL. A string argument equal to the key of exactly
one SQL dict entry (store.named("sales_by_day"), keys with _/./-/:
and 5+ characters, not inside logging calls) counts as via: sql_key.
These reads/writes are inferred and propagate to entrypoints like any other.
They are skipped when the function already executes that SQL, or reaches a
function that does through the call graph, so exact edges stay exact.
Data flow between tables (feeds)¶
feeds says a function copies values from one table into another, for
example a service that reads pedidos in the orders database and upserts
resumo_pedido in the summary database. It is a text pass over the function
bodies the detectors already located; it never changes their reads /
writes edges, and a graph with no such copy is unchanged (apart from db).
{
"id": "feeds:table:pedidos->table:resumo_pedido",
"type": "feeds",
"from": "table:pedidos",
"to": "table:resumo_pedido",
"confidence": "exact",
"evidence": { "file": "sync/orders.go", "line": 21, "symbol": "sync.SyncOrders" },
"via": [
{ "path": ["function:sync.SyncOrders"], "confidence": "exact",
"evidence": { "file": "sync/orders.go", "line": 21, "symbol": "sync.SyncOrders" } }
],
"via_total": 1,
"column_map": [
{ "from": "pedidos.valor_centavos", "to": "resumo_pedido.total",
"fn": "function:sync.SyncOrders", "confidence": "exact",
"evidence": { "file": "sync/orders.go", "line": 21, "symbol": "sync.SyncOrders" } }
]
}
A feeds edge is only created when a value is seen going from the read
to the write:
| How | confidence |
|---|---|
In one function: the rows of SELECT id, valor FROM pedidos (Go rows.Scan(&a, &o.Total), QueryRow(...).Scan; JS/TS const { rows } = await a.query(...), for (const p of rows), (await a.query(...)).rows[0]; Python cur.execute(...) then fetchone() / fetchall() / for row in cur, row["valor"], row.valor, row[1]) reach the arguments of an INSERT / UPDATE / upsert, a Firestore set / update / add, or an ORM write the detectors saw on that line (upsert({ update: { total: p.valor } })). Struct / object literals, assignments and lists (append, push) are followed. INSERT … SELECT and UPDATE … FROM map in one statement (unqualified columns with a single table in FROM belong to it), also in a SQL function body (CREATE FUNCTION), even when the detectors recorded only the write. |
exact |
Through calls in the same service: a reader passes the value to a writer (s.writeSummary(ctx, o)), or a writer uses what a reader returns (orders, _ := repo.ListPaid(ctx)), up to 2 calls deep; Celery / RQ task.delay(...) to the task. |
heuristic (edge; a column passed through unchanged stays exact) |
From a Firestore document: fs.collection("orders").document(id).get().to_dict(), snap.data(), s.to_dict() for s in ….stream(), getDoc(doc(db, 'orders', id)), a trigger's event.data.after.data(). Its fields are the source "columns" (orders.customerId, case kept, no schema needed); snap.id, event.params.<id> and the id passed to .document(id) are orders.__id__. |
as above |
Through a queue: the producer publishes a message built from the source (queue.publish('pedido-pago', { orderId: o.id })), the consumer of the same topic (subscribe / consume / process / BullMQ Worker) writes the message's fields. Also across repos in a joint scan or registry merge. emit / on events only link inside one repo. |
heuristic |
via: up to 5 paths (functions, and the queue for a queue hop), strongest first;via_totalcounts every path.column_map:{from, to, fn, confidence, evidence}per mapped column.exactwhen the value goes through unchanged (in one function, or passed through calls as it is);heuristicthrough a queue or a transformation.transform: truewhen an expression or function is in between (sum(valor),date_trunc('month', criado_em),Math.round(p.valor * 100),decimal.NewFromFloat(o.Valor));pathfor a value that crossed calls or a queue;fieldfor the message field of a queue hop.match: "name"(heuristic) is used only when a row was copied whole and no column path was seen: columns with the same name on both sides (notid/created_at/updated_at).__id__is a Firestore document's id. Like any identifier copied into an identifier column, it is a reference: a flow made only of ids is not afeeds; next to other fields it is mapped (orders.__id__ -> order_summary.order_id).- Never invented: a column that is not in the source (or destination)
table's schema is never mapped (a Firestore collection has no schema: a
field read from its document counts) — a plpgsql parameter or
DECLAREvariable inINSERT … SELECT found, store, s.name FROM stores sis notstores.found; a column only inWHEREis not mapped; a function that reads A and writes B with no value in common (a permission check, a lookup) creates nothing; a copy into the same table, a flow made only of identifiers into identifier columns (users.id -> orders.user_id), or only into columns declared as foreign keys to the source, is a reference, not afeeds. - Queue producers and consumers keep what they publish / write per message
field on the function node (
dataflow_out/dataflow_in), so aregistry mergecan link them across repos. When a topic has no queue node yet, aqueue:topic:<name>node (kind: topic) is added.
Database identity (db)¶
Table ids do not change: db is an attribute. It is set on a table / view
when the code says which connection reaches it, and left out otherwise (the
table is in the repo's database, as before):
- a connection built from a DSN env var or config field —
sql.Open("pgx", os.Getenv("ORDERS_DATABASE_URL")),pgxpool.New(ctx, cfg.OrdersDatabaseURL),new Pool({ connectionString: process.env.SUMMARY_DATABASE_URL }),create_engine(settings.ORDERS_DATABASE_URL),psycopg2.connect(os.environ["X"])— is named after the variable (ORDERS_DATABASE_URL→orders_db; a bareDATABASE_URLnames nothing), or bydatabases:inbizmap.yaml. Only a variable that looks like a DSN (…_URL,…_URI,…_DSN,…_CONNECTION) names a database:DB_SCHEMA,DB_HOST,DB_USER,DB_PASSWORDdo not.DB_NAME(orPGDATABASE,POSTGRES_DB) given to the connector with a literal default (os.getenv("DB_NAME", "orders")) uses that default; - each SQL edge's call (
src.QueryContext,b.query,cur.execute, throughcursor()/BeginTx/connect()/with … asaliases) picks the connection; - a repo with exactly one named connection puts on it the tables its code
reads or writes (a table only in the schema gets no
db); - a table reached through two connections gets
db_candidatesinstead; - Firestore clients (
firestore.NewClient,getFirestore(),firestore.client()) put collections onfirestore:<project>(a literal project id) orfirestore:default.
In a merged graph, the same table name with the same db in two repos gets
same_as (the other node ids) on each node; nodes are not merged.
Firestore in JS/TS and Pub/Sub push¶
A text pass over the JS/TS files that import Firestore (firebase/firestore,
firebase-admin, @google-cloud/firestore) or Cloud Functions, attributed to
the function the JS detector found around each call:
- web modular SDK:
getDoc/getDocs/onSnapshot/getCountFromServerread,setDoc/updateDoc/addDoc/deleteDocwrite, oncollection(db, …),doc(db, …),query(…),collectionGroup(db, …), or a reference kept in a variable (doc(ordersRef, id));batch.set(ref, …),tx.get(ref); - admin / server SDK chains:
db.collection('x').doc(id).get()/.where(…).get()read,.set / .update / .delete / .create / .addwrite; - the collection from a literal, a constant of the file or an exported one (
ORDERS_COLLECTION), a multi-segment path (collection(db, 'drawings', id, 'versions')→collection:versions), an enum or object member (Collections.Customers), or a template path (`customers/${id}/notes`→collection:notes,path: customers/{}/notes). A name passed to a helper's parameter (listAll('customers')→collection(db, path)) puts the access on the caller, withviathe helper. Callers and their entrypoints get the access withderived: call, as with SQL. - Cloud Functions triggers (
onDocumentWritten('orders/{orderId}', …),functions.firestore.document('orders/{id}').onWrite(…)) becomeentrypoint:firestore:<collection>:<event>(as in Python), triggering a handler function that reads the collection; itsevent.data.after.data()is the document. pubsub.topic('t').publishMessage({ json })→enqueues queue:pubsub:t.
A push subscription (Pub/Sub delivering a topic to an HTTP route) lives in
deploy config, not in code. bizmap reads it from push_subscriptions: in
bizmap.yaml (see configuration) and
from gcloud pubsub subscriptions create … --topic=T --push-endpoint=URL in
shell / YAML / Makefile files of the repo (also in comments and across \
line continuations; $VAR/path, $(…)/path and full URLs match by path), and adds triggers
queue:pubsub:<topic> -> entrypoint (via: push_subscription). The route's
handler then receives the message (its first parameter; methods on it,
json.loads(base64.b64decode(…)) and Pydantic model_validate(…) keep it
the message), so in a joint scan or registry merge the trigger → topic →
route → write path becomes a feeds (heuristic). Message fields match the
written attribute by name ignoring case and _ (customerId /
customer_id) or a Pydantic Field(alias="…").
Firestore and Pub/Sub in Go¶
A text pass over the Go files that import cloud.google.com/go/firestore or
cloud.google.com/go/pubsub (v1 or v2), attributed to the Go function around
each call:
- Firestore:
client.Collection("x").Doc(id).Get / Set / Update / Delete / Create,.Documents(ctx).GetAll(),.Where(…), a reference kept in a variable,tx.Get(ref)/tx.Set(ref, …)→reads/writes collection:x(writes withfields).snap.DataTo(&d)makesdthe document: its struct'sfirestore:"…"tags name the fields, sod.CustomerIDis the document fieldcustomerIdinfeeds. References built in a loop (refs[i] = c.Collection("x").Doc(id), thenc.GetAll(ctx, refs)orbatch.Update(refs[i], …)) count, and the collection can be a struct field set once in its constructor (Collection(r.collection)with&Repo{collection: "customers"}). Files of a package that imports Firestore in another file count too. A reference passed straight to a local helper (updateFields(ctx, c.Collection("x").Doc(id), f),rawQuery(ctx, c.Collection("x").Where(…)),arrayUpdate(ctx, ref, …)) is a write when the helper writes through that parameter, else a read, on the caller;refs = append(refs, …Doc(id))is a reference too. A document read in one function and written to SQL in another (a Firestore repository returning the struct, a Postgres repository writing it) still givesfeeds(heuristic, as SQL → SQL across calls); the id the caller passes toDoc(id)maps as__id__. - Pub/Sub, direct:
client.Topic(t).Publish(ctx, &pubsub.Message{Data: b})and v2client.Publisher(t).Publish(…)→enqueues queue:pubsub:<t>. - Pub/Sub through a wrapper: a constructor that passes its parameter (or
each element of a slice parameter) to
.Publisher(x)/.Topic(x)(NewPublisher(ctx, project, []string{cfg.OrderTopic})). Each call of the constructor is an instance with its own topics. bizmap follows the instance from where it is built through assignments,pubs[k] = p, struct literals (&Announcer{pub: pub}),s.pub = puband call arguments into the callee's parameters (alsoif p, err := NewPublisher(…); err != nil { … } else { annPub = p }: each:=is its own variable, so two such blocks are two instances), soa.pub.Publish(…)inAnnouncerpublishes only to the topics of the instance given toNewAnnouncer, andSend(ctx, pub, payload)to those of the instances its callers pass. Publishers built in a loop from a map (topics := map[Kind]string{…},NewPublisher(…, []string{topics[k]}),pubs[k] = p) are one instance per key;pubs[KindOrder]picks one. - Only a call with the wrapper's own
Publishsignature counts (Publish(ctx, []byte, map[string]string): same number of arguments, the payload not aMessage), on a value that holds an instance or whose type is the wrapper or an interface declaring that signature.store.Publish(ctx, id)(a domain verb) adds nothing. A wrapper built with several topics publishes to all of them (one edge each). When the receiver could be any of several instances (an unknown map key, a publisher interface no instance reaches), noenqueuesedge is added: the function lists the topics inunresolved_queues({kind: pubsub, candidates: [...]}): only topics of instances that reach that receiver (the topic map's values forr.f.pubs[k]). A publisher-typed receiver no instance reaches gets{kind: pubsub, reason: instance_unknown}, never the topics of other instances. - The instance is followed through setters (
a.refunds, a.refundPub = r, pub), struct fields of fields (r.f.pubs[k]), maps copied into a field (f.pubs[k] = p), packages imported under an alias (invoicesint.New(p)), and a package variable holding the topics (var Topics = []string{…}passed asreports.Topics: one edge per topic). - The topic comes from a literal, a package constant, or a config field filled
by
getEnv("X", "def"),os.Getenv("X")or anenv:"X" envDefault:"y"tag; the queue node then hasenv: X.os.Getenv("X")without a default takes the default the same variable has elsewhere in the repo (the config package), thenenv:inbizmap.yaml. fieldsof the enqueue are the message's: thejson:"…"tags of the struct passed tojson.Marshal, or a map literal's keys. The dataflow follows the struct back through helpers (build(id, d)), aScan(&row.ID, …)of a SQL read, or a Firestore document, also into a[]bytefield of another struct passed toPublishin another function (Build(row)→Send(ctx, pub, payload)), so a Go publisher and a push route in another repo givefeeds(collection:orders -> table:order_summary, ororders_mirror -> order_summarywhen Go re-reads its own table).
SQL built by a function, and interface calls in closures¶
- A Go function returning write SQL text (
return "INSERT INTO orders_mirror (" + strings.Join(names, ", ") + …, also throughfmt.Sprintf) is a SQL builder; a call passing its result toQueue(pgx.Batch),Exec,Query… iswrites table:orders_mirror(confidence: inferred,via: <builder>), table level since the columns are built at run time. A literal write passed tobatch.Queue(…)is a write as well. - A collection never takes the schema columns of a SQL table with the same
name (
collection:ordersandtable:orders), so a document id (__id__) or field is never dropped as "not a column". A type assertion (normalize(snap.Data()).(map[string]any)) keeps the value. x.M(…)on a closure parameter whose type is an interface (func(ctx context.Context, tx models.OrderMirrorTx) error { … }) getscallsto the one type that implements every method of that interface (via: interface).- The dataflow follows both: a Firestore document read in a closure, mapped
by a helper and written through the built SQL gives a table-level
feeds collection:orders -> table:orders_mirror(heuristic, nocolumn_map).
Queue and topic names¶
- A queue node is only created for a name that looks like one
(
[A-Za-z0-9][A-Za-z0-9._~%+-]*, up to 255 characters). An expression ({live[:10]},a or b) never becomes a node. - Python Pub/Sub:
publish/publish_messagecount only on aPublisherClient()/PublisherAsyncClient()(a variable, an attribute set in__init__, or a closure variable). The topic comes fromclient.topic_path(project, topic)withtopica literal, a module constant, a parameter default (topic: str = "invoice-ready"kept inself.topic_path), oros.environ.get("X", "default"); both branches ofa if c else client.topic_path(…)are tried. - rq:
enqueuecounts only on aQueue("name", …)receiver (Queue()isdefault); the edge hastask(the function or dotted path enqueued). Any other.enqueue(…)/.publish(…)(a parameter, a repository method,self.publishof a class that is not a client) adds nothing. - A queue node is never created without a name (
queue:pubsub:queue). - A name from an env var with no default and no value in
bizmap.yamlenv:gives no node: the function lists it inunresolved_queues([{kind, env, evidence}]).
Confidence¶
| Value | When |
|---|---|
exact |
Fully static SQL (string literals / const concatenation, including cross-package pkg.Const) parsed by sqlglot, or a route/job registration whose handler resolved via type. |
inferred |
Call-graph propagation (table-level), SELECT * (table-level, or columns with --expand-star), INSERT without a column list, interface/object dispatch to a structural implementer or constructor-assigned type, or a writer of table T also writing what a trigger on T writes. |
heuristic |
A weaker signal than a traced call: a JS/TS path literal matched to a single route while its client/base could not be followed (via: route_literal). |
unknown |
Dynamically built SQL ("UPDATE t SET " + col or "UPDATE "+table+" SET"), unparsed SQL, an unresolvable route path ({otherpkg.PendingPath}/setup, with unresolved: true), or an ambiguous handler (candidates listed, no arbitrary pick). FROM-less SELECT is not unknown: it emits no table edge. |
When the same edge is observed twice, the highest confidence is kept
(exact > inferred > heuristic > unknown).
Services and cross-repo HTTP¶
When a client URL's base resolves to a services: entry (by env var
placeholder, host, or URL prefix) and the graph spans several repos, it only
matches routes of that service's repo (the entry's repo:, else its key).
If that service was not scanned, nothing matches and the call stays
unresolved_http with reason: target_not_scanned and service: <name>; it
never falls through to a same-path route in another repo.
Schema replay¶
DDL files (prefer schema.sql, then **/migrations/**, then other *.sql) are
applied in order. Supported PostgreSQL constructs:
CREATE TABLE IF NOT EXISTSALTER TABLE ... ADD COLUMN IF NOT EXISTS/DROP COLUMNALTER TABLE ... ADD/DROP CONSTRAINT(includingFOREIGN KEY)DO $$ ... $$blocks (innerALTER/CREATEis applied)CREATE TRIGGER+CREATE FUNCTION(quoted / schema-qualified pg_dump identifiers; plpgsql body scanned forINSERT/UPDATE/DELETE/SELECTafter comments, string literals, DECLARE variables, and INTO targets are stripped). Function bodies are re-analyzed after the full replay soCREATE FUNCTIONthat appears beforeCREATE TABLEstill records those tables.EXECUTE format('UPDATE %I ...')is treated as dynamic SQL.CREATE VIEW/CREATE MATERIALIZED VIEW(and Alembicop.executeof the same) asviewnodes withderives_fromedgesDROP TABLE(the table is markeddropped: truewhen it is still referenced)ALTER TABLE ... ENABLE ROW LEVEL SECURITYCREATE POLICY ... ON table(name, command, role,USING/WITH CHECK)- Alembic Python revisions (
op.create_table,add_column,drop_*,execute) applied indown_revisionorder; those functions arerole: schemaand listed bywhyas defined/altered by, not runtime writers
Table nodes are created for reconstructed DDL tables and for system catalogs
(pg_roles, pg_catalog.*, information_schema.*, pg_*, storage.*,
vault.*, auth.*) marked external (kind: external_relation).
Relations named in FROM/JOIN/INSERT/UPDATE that are not in DDL become
unresolved_relation nodes (views on read, tables on write) with edges, so
a route still shows reads view X. CTE / subquery / LATERAL aliases
(l, r, l.x, files.file_id), SQL keywords, and PL/pgSQL keywords /
DECLARE'd variables are never tables. FROM-less SELECT (SELECT now())
touches no table. Dynamic table names ("UPDATE "+t+" SET", %I holes)
always become table:unknown with confidence unknown and candidates
when determinable, and stay on the origin function only. HTTP/job
entrypoints that can reach that origin get dynamic_table: true and
dynamic_table_unknown (count), never a reads/writes edge to
table:unknown. Concat/helper holes ({helper(o)}) are not columns.
Overrides (bizmap.yaml)¶
Uncertain bits can be completed manually. bizmap.yaml is loaded from
--config path, else the scan root, else the git toplevel. Top-level
exclude globs skip files (seed/demo trees) inside the scan root;
bizmap scan --exclude GLOB (repeatable) is merged with that list.
expand_star: true expands SELECT * the same way as the CLI flag.
--profile prints parse / resolve / sql / propagate timings to stderr.
name: catalog
database: platform
services:
catalog: http://catalog.internal
billing:
url: http://billing.internal
env: BILLING_URL
queues:
ingest: ingest
jobs: on_jobs
# entrypoint id or route — links a producer without an extracted http_url
# jobs-queue: entrypoint:http:POST:/jobs/drain
repos:
- catalog
- worker
constants:
PathPrefix: /api/v1
shared.Base: /items
exclude:
- cmd/seed
- demo/
expand_star: false
overrides:
columns:
inventory.qty:
why: "On-hand units; decremented when an order item is inserted."
writers:
- symbol: repository.Repo.InsertOrder
confidence: inferred
Mermaid¶
bizmap scan --mermaid writes an entrypoint → table rollup (readable on
large graphs). A multi-repo / joint scan also draws calls_http edges
between services (function or entrypoint in repo A → entrypoint in repo B),
one subgraph per repo. --mermaid-focus TABLE shows functions, columns,
views, and entrypoints around one table or view. --mermaid-limit N caps
node count.
bizmap scan prints HTTP unmatched by reason: … then
N unresolved HTTP calls (ENV, host, …) after the graph write when client
URLs did not match a scanned route or services: entry. Each entry has a
reason: target_not_scanned, base_unknown, path_dynamic, or
client_unknown. The same list is stored as top-level unresolved_http
(and on each caller) so the count matches the graph. Declare the missing
env/host in services: to resolve them. bizmap registry merge re-runs
HTTP/queue matching from stored http_calls.