Skip to content

fix(query): a graph source that can't serve a query says why, and registration refuses one that never could - #2190

Merged
aaj3f merged 28 commits into
mainfrom
fix/graph-source-without-mapping
Nov 3, 2026
Merged

aaj3f merged 28 commits into
mainfrom
fix/graph-source-without-mapping

Conversation

@aaj3f

@aaj3f aaj3f commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Graph sources: typed refusals instead of "Ledger not found" and empty answers

Fixes #2188.

A registered graph source that can't serve a query used to fall through to the ledger lookup ("Ledger not found") or to an empty genesis graph (0 rows, exit 0), depending on the route. The invariant this PR holds: a registered source that can't serve a query fails with a typed error naming the cause, on every route and both surfaces, and registration refuses a source that could never be queried.

A stored record is resolved at two independent points: the R2RML probe has_r2rml_mapping (the direct-target fallback, dataset member classification, GRAPH inside a ledger query) and the view resolver resolve_graph_source_address (target, FROM / FROM NAMED, the server routes, build_dataset_view). Mutation testing showed each is the only guard on some route (query_dataset reaches only the resolver; GRAPH <gs> in a ledger query reaches only the probe), so both now go through one classifier, served_mapping_of / require_readable (fluree-db-api/src/graph_source/).

Query time (direct target, FROM, FROM NAMED, GRAPH, the server query routes, SPARQL and JSON-LD; materialize too):

  • A stored Iceberg source with no mapping, or whose mapping defines no rr:TriplesMap → 409 err:db/GraphSourceUnmapped. It used to answer "Ledger not found" as a target and 0 rows through FROM / FROM NAMED / GRAPH.
  • A BM25 / vector / geo index named where a graph is read → 400 err:db/GraphSourceNotAGraph, naming the documented form (an f:graphSource pattern with the source ledger as the dataset; geo says to query its source ledger). One undocumented form that answered by accident, query_connection_with_bm25 with the index as from, is now refused; nothing in db uses it, and the documented form has a regression test.
  • A mapped source whose reader isn't compiled in, or a graph-source type this version doesn't recognize → 501 err:db/GraphSourceUnsupported.
  • GRAPH ?g with ?g bound from data to such a source → no rows for that binding (SPARQL's answer for a graph outside the dataset); the query doesn't fail. A constant GRAPH <source> gets the refusal.
  • A mapped record whose config can't be parsed → 500, no longer read silently as "no mapping".
  • Streaming NDJSON terminal codes: graph_source_unmapped, graph_source_unsupported, graph_source_not_a_graph.

Registration:

  • fluree iceberg map requires --r2rml; POST /v1/fluree/iceberg/map requires r2rml (400 "an R2RML mapping is required: send r2rml…"), and its response's mapping fields are always present.
  • A mapping that defines no rr:TriplesMap is refused with a 400 at Iceberg, SQL and Delta registration ("check that the rr: prefix is http://www.w3.org/ns/r2rml# …"). The Iceberg and Delta validate endpoints report it as compiled_ok: false.
  • connection_tested now means every mapped table loaded the way a query loads it, in every catalog mode: REST, Glue and S3 Tables through loadTable, Direct by resolving its metadata. At most 8 loads at once, stopping at the first failure, within a 10 s budget, and it never fails registration. A mapping-defined REST source no longer always reports false (it used to load the default.default placeholder). Glue and S3 Tables registration now calls the AWS catalog. A re-registration with the same config can be answered from the catalog caches (60 s in memory / 300 s pointer).
  • CLI Connection: reads "verified" or "not verified (…)" in every mode; Python warns in every mode when not verified.

Rust API (breaking):

  • Removed Fluree::create_iceberg_graph_source and IcebergCreateResult (they registered only mapping-less sources), IcebergCreateConfig::from_mode's has_mapping argument, and CatalogModeError::MissingTable.
  • New QueryError variants GraphSourceUnmapped { graph_source_id, empty_mapping }, GraphSourceUnsupported { graph_source_id, family, cause }, GraphSourceNotAGraph { graph_source_id, index, remedy }, and QueryError::is_unreadable_graph_source(). Exhaustive matches break at compile time on purpose.

Docs: graph-sources/iceberg.md, graph-sources/README.md (the routing diagram showed FROM <search-index> reaching the BM25 engine; nothing implements that), concepts/graph-sources.md, overview.md, query/datasets.md, api/endpoints.md, api/errors.md, cli/iceberg.md, cli/server-integration.md.

Follow-up: #2189 (in peer proxy storage mode no graph source resolves at all; that needs a transaction-server endpoint and a decision about exposing source configs to peers, so it isn't in this PR).

Tests

  • SPARQL and JSON-LD twins for every route above, in it_iceberg_local_fs, grp_graphsource (it_graph_source_bm25, it_graph_source_vector, it_graph_source_unbuilt_reader) and the server's grp_query. Positive guards against over-reach: the documented BM25 form still answers, mapped sources still answer, and re-registering an unmapped source under the same name repairs it.
  • Registration: CLI (local and --remote), the server route (missing and blank r2rml), the empty-mapping refusal in both typo shapes, and the probe against a wiremock catalog (a mapping-defined REST source verifies through /tables/people, never default; a refused table reports not verified and still registers; a delayed catalog hits the budget; a 4-table mapping resolves its secret once).
  • Non-vacuity: each guard was removed on its own on committed code and its test failed with the original symptom, e.g. without the resolver check FROM answers 0 bindings, without the probe check the target says "Ledger not found: …", and without the warm-up the secret resolver is called 4 times instead of 1. The data-bound GRAPH ?g test was first written as a plain join and passed with the fix reverted, because the planner evaluates that block with ?g unbound; it now binds ?g first (subquery and OPTIONAL forms), and all 16 evaluations were confirmed to run bound.
  • it_graph_source_unbuilt_reader only compiles in a build without iceberg, which CI never builds (nextest runs --all-features); it passes locally with cargo test -p fluree-db-api --test grp_graphsource. A unit test of the same decision runs in CI.
  • Locally: fmt, cargo clippy --workspace --all-targets --all-features -D warnings, the no-iceberg api build and the wasm32 gate are clean; query lib 1700, api lib 1242 (843 default), the integration targets above, server, CLI and SHACL suites pass, and the Python suite on a rebuilt wheel passes 373.

aaj3f added 16 commits October 26, 2026 18:45
Nothing consumes an Iceberg record without a mapping: queries and
materialize both need it, and only info, list and drop touch such a
record. Registration is the only place that state is created, so remove
every way to create it:

- `Fluree::create_iceberg_graph_source` registered only mapping-less
  sources. It is removed with `IcebergCreateResult`; its one non-test
  caller here was the CLI's mapping-less branch. Its test is folded into
  the R2RML registration test it duplicated.
- `IcebergCreateConfig::from_mode` loses its `has_mapping` flag, and
  `CatalogModeError::MissingTable` the only case that produced it: a
  source's tables now always come from its mapping.
- `POST /iceberg/map` takes `r2rml` as a required field, as the SQL and
  Delta routes do: a 400 when it is absent. The response's mapping fields
  are always present.
- `fluree iceberg map` requires `--r2rml` at the argument parser, for
  local and remote registration alike.

Records stored before this keep existing; querying one is the typed
GraphSourceUnmapped refusal.
…error

An Iceberg graph source registered without an R2RML mapping has nothing
to answer a query from, but every query route read it as "not a mapped
source": the R2RML probe and the genesis-view resolver both reduced the
record to a yes/no. A query targeting it fell through to the ledger
lookup and answered "Ledger not found"; FROM / FROM NAMED resolved it to
an empty genesis graph and answered no rows with no error; GRAPH <source>
in a ledger query matched nothing.

One classifier, `served_mapping_of`, now decides for every route: a
mapped record with no mapping is `QueryError::GraphSourceUnmapped`
(`err:db/GraphSourceUnmapped`), and a config that does not parse is an
internal error rather than "no mapping". The R2RML probe
(`has_r2rml_mapping`: the direct-target fallback, dataset member
classification, GRAPH patterns) and the genesis-view resolver
(`resolve_graph_source_address`: direct target, FROM, FROM NAMED, the
server's query routes) both call it, so the refusal depends neither on
which layer a route reaches first nor on whether the graph-source
providers are attached. `compiled_mapping` uses it too, so materialize
reports the same cause.

HTTP 409, as for a dropped source (GraphSourceRetracted) and a
merge-on-read table: the request is well formed; the stored source's
state conflicts with it, and registering the source again with a mapping
clears it.
Registration tested a REST catalog connection, non-fatally, and reported
it as `connection_tested`, but never looked at a Direct location, so a
mistyped `--table-location` first surfaced on the first query.

After publishing a Direct source, resolve each mapped table's current
metadata through the query path's own resolution (`load_table_context`:
a warehouse root's per-table directory, the local-root guard,
version-hint or metadata listing). It reads table metadata only, never a
manifest or data file. A failure is logged and reported as
`connection_tested: false`; registration still succeeds, as it does for
an unreachable REST catalog, whose failure is now logged too.

The CLI reports "not verified" for a REST or Direct table it could not
reach and keeps "not tested" for Glue and S3 Tables, whose catalog is
first called at query time; the Python binding warns for Direct as it
does for REST.
Three pages said an Iceberg source could be registered without a mapping
(`graph-sources/iceberg.md`, `api/endpoints.md`,
`cli/server-integration.md`) while `cli/iceberg.md` said `--r2rml` was
required. Correct them to the behaviour now enforced: `r2rml` is required,
`table` is optional in every mode, and the map response always carries
the mapping fields. Describe the Direct-mode connection check beside the
REST one, and the CLI's "not verified" wording.
A build without the `iceberg` feature has no reader for a mapped graph
source, yet a record of one (registered by a build that had the reader,
in a shared nameservice) still resolved to a genesis view: FROM and
FROM NAMED answered no rows with no error, and a direct target answered
"Ledger not found". A build with `iceberg` but not `sql` or `delta` did
the same for SQL and Delta records, through the R2RML probe as well.

The genesis-view resolver now refuses through `require_readable`, which
is `served_mapping_of` with the iceberg reader and, without it, the
build's reader check alone; `served_mapping_of` makes the same check
first, so the probe refuses an unbuilt SQL or Delta family too. Without
`iceberg` the direct target's not-found path asks the same check before
reporting a missing ledger.

The refusal is `QueryError::GraphSourceUnsupported`
(`err:db/GraphSourceUnsupported`, HTTP 501), naming the source, its
family and the feature the build lacks: no request can supply a reader
the deployment was built without. The compiled readers are a value
(`SourceReaders`), so the decision is tested in every build, including
CI's all-features run; the end-to-end test exists only in a build
without `iceberg`.
Registration's connection check had a probe per mode. REST loaded the
source's own `table` through the catalog before publishing; a source
whose tables come from its mapping has none, so it loaded the
`default.default` placeholder and reported `connection_tested: false`
for every such source, however healthy its catalog. Direct resolved
each mapped table after publishing; Glue and S3 Tables were never
checked.

One probe now serves every mode. After publishing, it runs the query
path's own `load_table_context` for each table the mapping names: the
catalog's `loadTable` (with SecretRef hydration and the shared catalog
client) for REST, Glue and S3 Tables, and metadata resolution at the
location for Direct. It reads table metadata only, at most eight loads
at once, and stops at the first failure, which it logs. It still never
fails registration. `test_iceberg_connection` and the Direct-only probe
are removed.

The CLI reports "verified" or "not verified (...)" in every mode, and
the Python binding warns in every mode, naming the catalog or location.
Folding every catalog mode into one registration probe reworded the
binding's REST warning, which its own test (and any caller) matches on:
"could not reach the catalog". Catalog modes keep that text; Direct
keeps its own.

Glue and S3 Tables registrations are now probed too, so with no
reachable AWS catalog they warn rather than register silently. The
tests that register them offline now expect that warning, and their
comment no longer says registration reads no catalog.
An index graph source (BM25, vector, geo) has no triples. Its searches
find it by the `f:graphSource` id in their own pattern, with the source
ledger as the dataset, and nothing reads it as a graph. Yet it resolved
like one: triple patterns over FROM <index>, FROM NAMED + GRAPH, or
GRAPH <index> inside a ledger query answered 0 rows with no error; as
the query target it answered "Ledger not found"; and a search with the
index as the dataset failed with "No BM25 snapshot ... at t=0" through
query_from, and answered only through query_connection_with_bm25, by
accident.

`refuse_index_source` now refuses it, by the nameservice's own kind
(`GraphSourceKind::Index`, which also files unrecognized types), at both
resolution points: the genesis-view resolver (target, FROM, FROM NAMED,
server routes, build_dataset_view) and the R2RML probe (GRAPH in a
ledger query, the target's fallback). Builds without `iceberg` refuse at
the resolver and on the target's not-found path; with no probe there,
GRAPH <index> in a ledger query is still an IRI naming no graph.

The refusal is `QueryError::GraphSourceNotAGraph`
(`err:db/GraphSourceNotAGraph`, HTTP 400). The request is wrong and the
index is fine, as with `R2rmlUnsupportedPattern`. The message names the
kind and the form to use: an f:graphSource pattern with the source
ledger as the dataset for BM25 and vector; the source ledger for geo,
which no f:graphSource pattern searches. The documented form keeps
answering, pinned by the new test.

Tests that used an index as a stand-in dataset member move to a mapped
source: the fromNamed guard test (now iceberg-gated, as no source can be
a member without that reader) and the time-pin refusal, now asserted on
a SQL source. Docs: the README routing diagram showed FROM <index>
reaching the BM25 engine, which nothing implements; overview.md and
datasets.md now say an index is not a dataset member.
The R2RML loader compiles a mapping with no rr:TriplesMap to an empty
mapping without error: an `rr:` prefix missing its trailing `#`, or a
misspelled class, parses as other triples. Such a mapping registered
with `mapping_validated: true` and `triples_map_count: 0`, the validate
dry-run called it clean, and every query of the source answered no
rows.

- Registration (Iceberg, SQL and Delta, through `register_r2rml_mapping`)
  refuses it with a 400 naming the likely cause.
- `compiled_mapping`, the compile step every query of a mapped source
  goes through, refuses a stored one before caching it, as
  `GraphSourceUnmapped` (409) with `empty_mapping: true` and its own
  message.
- `validate_r2rml` reports it as a compile error.
- The registration probe no longer falls back to loading the source's
  own table when the mapping names none: for a catalog source that
  table is the `default.default` placeholder, which is never to be
  loaded. A mapping that could not be read now loads nothing and
  reports `connection_tested: false`.
The registration probe loaded a mapping's tables with no overall
deadline. A slow catalog, or a mapping over a warehouse naming dozens of
tables at 1-3 s per loadTable, could hold a map request open past a
gateway's own deadline (API Gateway's is 29 s, and solo's map Lambda sits
behind one).

The probe now runs within a 10 s budget (`REGISTRATION_PROBE_BUDGET`).
When it expires the source is registered with `connection_tested: false`
and a warning saying how many of the N tables loaded. The outcome is a
`TableProbe` value, so the budget is testable with a short one.

It also builds the shared catalog client once before the fan-out. The
client cache does not coalesce concurrent misses, so up to eight loads
that each found it cold each built a client, hydrating the auth's
secrets (a resolver round trip, or a token exchange) once apiece.

The CLI's "not verified" line now covers a check that ran out of time as
well as one that failed.
A type this version does not recognize (one a newer build registered
into a shared nameservice) parses as `GraphSourceType::Unknown`, and the
nameservice files it under `GraphSourceKind::Index` by default. The
index refusal went by kind, so such a source was refused with 400
`GraphSourceNotAGraph`, which tells the caller to rewrite a query that
nothing in this build can answer.

The index refusal now goes by type (BM25, vector, geo). An unknown type
goes to the reader check, which refuses it in every build as 501
`GraphSourceUnsupported`: "graph source 'x:main' is a 'f:FutureSource'
graph source, which this build cannot read: it does not recognize that
type". The variant's `family` and `cause` fields become `Cow<'static,
str>` to carry the type name and the reason.
…as no rows

Refusing graph sources no query reads as a graph made the R2RML probe
fail for any IRI naming one. In `GRAPH ?g` with `?g` already bound, the
IRI comes from data, not from the query text: one row binding it to an
index or an unmapped source failed the whole query, though the query
named no such source.

A constant `GRAPH <source>` still refuses. For a bound variable in a
single-ledger query, a refusal of that class
(`QueryError::is_unreadable_graph_source`: unmapped or empty mapping,
index, no reader) now reads the IRI as a graph outside the dataset: no
rows for that binding, SPARQL's answer, and the query goes on. This
covers both the probe and the rewrite, which is where an empty mapping
surfaces. A nameservice fault or a scan error still fails the query.
…nd test

The data-bound GRAPH test used a plain join (`?s ex:in ?g GRAPH ?g {...}`),
which the planner evaluates by iterating the ledger's own named graphs
with `?g` unbound and joining afterwards. It never reached the bound
branch the previous commit changes: with that change reverted, the test
still passed.

The test now binds `?g` before the block runs, where the block is
correlated with the rows binding it: after a subquery, and inside
OPTIONAL, each as SPARQL and as JSON-LD. Instrumented, every GRAPH
evaluation in it now runs with `?g` bound, and reverting either half of
the change fails it.
`POST /iceberg/map` without `r2rml` was refused by the JSON parser:
"Invalid JSON: missing field `r2rml` at line 1 column N", which reads
as a malformed body. The field is now optional at the serde layer only
so that the handler can refuse a missing or blank mapping with "an
R2RML mapping is required: send `r2rml`, the mapping's Turtle content"
(400), before building anything.
The binding raises `ConflictError` for every 409, and its docstring said
retrying against the new state may succeed. That holds only for a commit
that lost a race (`expected_t` / `head_t` set), which `Ledger.transact`
retries. The binding's two retry loops already retry only a conflict on
the transaction's own commit. The other 409s (a ledger that already
exists, a dropped or unmapped graph source, a table with merge-on-read
deletes) never clear on retry. The docstring now says which is which.
Docs and comments that still contradicted this PR:

- concepts/graph-sources.md defined a graph source as anything
  addressable by name and showed `FROM <graph-source>` as a way to
  "query any graph source". It now separates mapped sources, which are
  graphs, from index sources, which a search pattern names; the
  README's "queried like regular ledgers" sentence likewise.
- Server route and resolver comments listed BM25 among sources routed
  to their engine through the dataset path; they now say such a source
  is refused.
- `from_mode`'s doc said a given `table` is what the connection test
  loads; registration loads the mapped tables, never that one.
  cli/iceberg.md's REST table still called `--table` required without a
  mapping.
- The map docs now give the 10 s registration-check budget, the empty
  mapping refusal (400; `compiled_ok: false` from validate; 409
  GraphSourceUnmapped for a stored one), and that a re-registration's
  check can be answered from the catalog caches: a loadTable response
  for 60 s in memory, its metadata pointer for 300 s on disk.
@aaj3f aaj3f added bug Something isn't working as expected breaking-change Backwards-incompatible change; drives the Breaking Changes release-notes section area:query Query execution, planning, fast paths, overlay, result formatting labels Oct 27, 2026
@aaj3f
aaj3f requested a review from bplatz October 28, 2026 18:42
@bplatz

bplatz commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

A few things, none blocking:

  1. Upgrade note in the main guide. The parenthetical in docs/graph-sources/iceberg.md (L139) about a source "registered before registration refused both" is an upgrade note, and errors.md already carries it under 409. I'd keep the main guide to the durable rule (r2rml is required, an empty mapping is refused) and move the note to the page's troubleshooting section, or just link to errors.md.

  2. The has_r2rml_mapping trait doc is out of date. It still says the method errors only when the answer can't be determined (provider.rs L198–206). It now also errors for a source no query reads as a graph (unmapped, an index, no reader in this build), and the data-bound GRAPH ?g arm depends on getting an is_unreadable_graph_source() error back from it to yield no rows instead of failing. That's part of the trait's contract now, so it should be on the trait, where other implementors (the test mocks, the ephemeral provider) will see it.

  3. "Not verified" overstates a timeout. When the 10 s budget runs out, the tables may be fine, only slow, but the CLI's text ("queries fail on a table that cannot", connection_summary) and the Python warning ("could not reach the catalog", graph_source.rs L224) both read as a failure. The Python one also fires when the catalog answered and a single table was missing. TableProbe already tells these apart in the logs; the user-facing text could say "not verified: the check ran past 10 s" for a timeout.

  4. Nits:

    • When the catalog client can't be built, the probe reports Failed with an empty table name (r2rml.rs L1226), so the warning logs table="". Naming the catalog client there would read better.
    • The CLI's two "not verified" strings end differently: "that cannot be" for Direct, "that cannot" for the catalog modes.
    • it_graph_source_unbuilt_reader never runs in CI, as the PR says. A CI step that runs grp_graphsource without iceberg would cover it; otherwise the unit test of the decision is the CI coverage, which may be enough.

@bplatz bplatz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Routing both resolution points through one classifier holds up: every route that names a source reaches one of them (constant and data-bound GRAPH, dataset members, the direct target, the no-iceberg build), native graphs are never looked up, and the documented BM25 form is untouched.

Some feedback in the comment above: a docs placement note, the has_r2rml_mapping trait contract, and the "not verified" wording on a timeout, plus nits. None blocking.

aaj3f added 4 commits October 30, 2026 08:41
The map section's parenthetical about a source registered before
registration refused a missing or empty mapping is an upgrade note, not
part of the rule. The section keeps the rule (`r2rml` is required, a
mapping that defines no `rr:TriplesMap` is refused) and points to a new
"Unmapped Sources" troubleshooting entry, which links the 409 entry in
errors.md.
… contract

`has_r2rml_mapping`'s doc said it errors only when the answer cannot be
determined. It now also errors for a source no query reads as a graph
(no mapping, an index, a family this build has no reader for), and the
data-bound `GRAPH ?g` arm depends on that error being one for which
`is_unreadable_graph_source()` holds, to yield no rows instead of
failing. The trait now states both error kinds and which one an
implementor must return; `compiled_mapping` states the same for a
mapping that defines no `rr:TriplesMap`, which the probe cannot see.
The test doubles and the ephemeral provider serve only mapped sources
they hold, so they never name an unreadable one.

`served_mapping_of`'s first line still named the index sources as its
`Ok(None)` case; they are refused before it is reached.
The registration check reported only `connection_tested: false`, and
the CLI and Python turned that into a failure: "queries fail on a table
that cannot", "could not reach the catalog". When the 10 s budget runs
out the tables may be fine, only slow, and the Python warning also
fired when the catalog answered and one table was missing.

The check's outcome is now `ConnectionCheck`, returned on
`R2rmlCreateResult::connection_check` and sent by `POST /iceberg/map`
as `connection_check` (`outcome`: `verified`, `table_failed`,
`client_failed`, `timed_out`, `no_tables`, with their fields).
`connection_tested` is unchanged and is `true` exactly for `verified`.

- A timeout reads "not verified: the check ran past 10 s (N of M
  tables loaded); the tables may only be slow".
- A table that did not load is named, with the catalog's or storage's
  reason. That reason is what separates a table the catalog does not
  have from a catalog that did not answer: both reach the probe as the
  same untyped error.
- A catalog client that could not be built is reported as that, not as
  a failed table with an empty name (the log said `table=""`).
- The CLI's Direct and catalog lines end the same way. Against a server
  that sends no `connection_check` it says the server did not say why.
- Python keeps "could not reach the catalog at" for a client that could
  not be built; a table that did not load now reads "could not load
  table '<t>' through the catalog at <uri> (<reason>)".
The previous commit gave every table that failed to load in a catalog
mode "could not load table '<t>' through the catalog at <uri>", including
a REST catalog that never answered (a refused connection). The released
warning for exactly that case is "could not reach the catalog at <uri>;
the source is registered, and queries will fail until it can be
reached", and callers match on it.

Registration now tells a catalog that answered from one that did not.
In a catalog mode, a failed table load counts as answered only with
evidence of an answer: a typed refusal (the catalog's 401/403, a catalog
that vended no credentials, a storage denial), the catalog saying it has
no such table, or any other HTTP status from a REST catalog. Anything
else is the new `catalog_unreachable` outcome: a refused connection, a
DNS or TLS failure, a timeout, and a Glue or S3 Tables call that failed
without a not-found or denied code (for example, no AWS credentials).
A not-found and a REST status reach registration as an untyped internal
error, so those two are recognized by the text their conversions render
("Table not found: ", "Catalog request failed ("); a unit test builds
each case through the real conversion so a change to that text fails it.

Python warnings:
- a catalog that did not answer, or a client that could not be built:
  the released sentence, unchanged;
- a table the catalog answered for as missing or refused: "could not
  load table '<t>' through the catalog at <uri> (<reason>)";
- a timeout: the check ran past 10 s, the tables may only be slow.

The CLI names the new outcome "the catalog did not answer".
@aaj3f

aaj3f commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @bplatz — all four folded in here (60315dbcf, 5b3a5183d, 5edc4d21e, e92d3ea85).

  1. The upgrade note moved out of the main guide: iceberg.md keeps the durable rule (r2rml is required, an empty mapping is refused) and points to a new "Unmapped Sources" troubleshooting entry, which links the 409 in errors.md.
  2. has_r2rml_mapping's contract is on the trait now: a source no query reads as a graph must come back as an error for which is_unreadable_graph_source() is true (that's what the data-bound GRAPH ?g arm turns into no rows), and "can't determine", like an unreachable nameservice, must not. compiled_mapping says the same for an empty mapping. I went through every implementor — the test mocks, the ephemeral provider and the no-op one only answer for sources they hold, and the real provider meets it through served_mapping_of, whose stale first line I fixed while I was there.
  3. "Not verified" on a timeout. The probe's outcome is now a public ConnectionCheck (Verified, NoTables, ClientFailed, TableFailed, CatalogUnreachable, TimedOut), returned on R2rmlCreateResult::connection_check and sent by POST /iceberg/map as an additive connection_check field, so the CLI and Python each say what actually happened: a timeout reads "not verified: the check ran past 10 s (N of M tables loaded); the tables may only be slow", and a catalog that answered for a missing or refused table says so with its reason. One thing I was careful about: the Python "could not reach the catalog at …" sentence is released text that callers can match on, so a catalog that genuinely didn't answer (connection refused, DNS, TLS, or a client that can't be built) keeps it word for word, and only the new cases get new wording. Telling "answered" from "didn't answer" rests on the typed refusals plus the not-found and HTTP-status texts the catalog client renders, pinned by a unit test that builds every case through the real error path, and anything it can't place falls back to the released sentence.
  4. Nits: a client that can't be built is its own ClientFailed outcome now (no more table=""), and the two CLI lines end the same way. On the CI step for it_graph_source_unbuilt_reader: I looked, and a default-features build of grp_graphsource is about five minutes of extra codegen that no CI job does today, so I'd lean on the in-library decision test as the coverage, as you suggested might be enough — happy to add the step if you'd rather have it.

aaj3f added 6 commits November 2, 2026 15:58
…out-mapping

Brings in per-source storage identities and the one graph-source
input codec (#2196), and the graph-source crawl fixes (#2199).

Every resolution keeps both PRs' behaviour; where #2196 still offered a
way to register an Iceberg source without a mapping, this branch's rule
(a source needs a mapping) wins:

- `create_iceberg_graph_source` and `test_iceberg_connection` stay
  removed. #2196's Direct storage-policy check at registration
  (`refuse_direct_storage_the_policy_refuses`) is kept, on the one
  remaining surface. Its two tests register through
  `create_r2rml_graph_source` with a mapping.
- `IcebergCreateConfig::from_connection_for` and
  `iceberg_create_from_json` take no `has_mapping` flag, and
  `CatalogModeError::MissingTable` stays removed: a catalog mode's
  tables come from its mapping.
- `POST /iceberg/map` keeps `required_mapping` (refused in words before
  the codec runs) and the response's `connection_check`. The codec's
  `ROUTE_FIELDS` list request fields; `connection_check` is a response
  field, and this branch adds no request field.
- The CLI keeps main's codec-built connection and this branch's
  required `--r2rml` and `Connection:` line; its tests name a mapping.
- Python keeps main's builder-based connection and this branch's
  per-outcome warning, with the released "could not reach the catalog"
  wording for a catalog that did not answer.
- error.rs, errors.md: both PRs' error codes and statuses.
- The docs keep #2196's connection sections and this branch's mapping
  rule and `connection_check`.
…out-mapping

Brings in #2193, #2200, #2183, #2187 and #2198. The one conflict is
it_iceberg_local_fs.rs, where this branch's unmapped-source tests and
#2198's BigQuery and merge-on-read tests were appended at the same
place; both are kept.
Since per-source storage identities, a catalog may not place a table on
this host's disk: only a Direct source reads the local filesystem. The
registration-check tests' mock catalogs answered `loadTable` with the
fixture's `file://` metadata location, so every table check was refused
as a local location from a catalog and read as unreachable. They now
answer with an `s3://` location and the metadata inline, which is all
the check reads.

`fluree iceberg map` requires `--r2rml`, so the CLI test that parses
auth flags straight through clap names one.
…chine keeps

The test gave the probe a 100 ms budget against a catalog that answers
in 600 ms and required it back within 500 ms. Building the catalog
client runs before the budget's timer can fire; alone it took 230-270 ms
here and once 1.4 s, so the test failed under load without the budget
being wrong. The catalog now takes 5 s to answer and the probe must
return within half of that, which still tells a probe that stopped at
its budget from one that waited for the answer.
…out-mapping

# Conflicts:
#	fluree-db-api/tests/it_iceberg_local_fs.rs
…equires

`iceberg map` now refuses to register without `--r2rml`, and the flag-group
tests that arrived from main still invoked it without one: clap refused all
three before they reached what they test. Each now writes a small mapping and
passes it. The seam test compares the server's stored record with the local
connection config, which carries no mapping, so it checks the stored mapping
reference separately and compares the rest.
aaj3f added 2 commits November 3, 2026 13:49
… given'

The field table marks r2rml as required, and a request without it is a
400. The validation list below it still said r2rml must parse 'when
given'.
… check

`fluree iceberg map --remote` reports the server's `Connection:` outcome
through `remote_connection_summary`. That function and the typed
`ConnectionCheck` it decodes were gated on the `iceberg` feature, but the
remote path that calls it is not. So `cargo check -p fluree-db-cli
--no-default-features` failed with E0425. No CI job builds the CLI
without default features, so nothing caught it.

ConnectionCheck is plain data (serde, strings and counts) with no
iceberg dependency. It, its impl and its unit tests are now ungated, and
it is re-exported outside the iceberg block. The CLI's connection_summary,
remote_connection_summary and their two tests lose their gates too. A
client built without iceberg now reads a server's typed outcome and
doesn't drop it.

Checked: cargo check of fluree-db-cli with and without default features,
fluree-db-api --lib with and without, and fluree-db-python. The two
connection-line tests pass in both CLI configurations. clippy
--all-features -D warnings is clean on fluree-db-api and fluree-db-cli.
@aaj3f
aaj3f merged commit 4ac109f into main Nov 3, 2026
19 checks passed
@aaj3f
aaj3f deleted the fix/graph-source-without-mapping branch November 3, 2026 19:47
bplatz added a commit that referenced this pull request Nov 4, 2026
Brings #2247, #2232, #2246, #2248, #2245, #2230, #2205, #2231, #2255,
#2219, #2209, #2207, #2190, #2216, #2186, #2215, #2213, #2184, #2210,
#2206, #2198, #2187, #2183, #2200, #2193, #2199, #2196 and #2145 into next.

Resolutions:
- Novelty: main's fact-state trim (a cutoff plus a bounded sweep) and the
  dictionary's coverage watermark sit on next's graph slots and per-graph
  OrdMaps. A commit's reification links count toward coverage. Planner
  stats from segment sums decline under annotations, whose link deltas
  only the walk counts, and otherwise carry the indexed link counts.
- Stats-view identity: the index root's id reaches the snapshot through
  next's root decoder (`decode` takes the id, as `take_snapshot_metadata`
  does). `LedgerState::load_record` has a decoding-root form beside
  `load_decoding_root`.
- Transact: #2184's parallel-relationship check runs in next's link
  cascade, counting the `rdf:reifies` links on the retracted edge that the
  transaction does not retract itself. Main's bundle `edge_reifiers` is
  dropped, and `subjects_with_prior_rows` and
  `enforce_single_target_reifiers` stay deleted. The upsert pre-check
  takes main's dictionary probe and bounded seek.
- Query: geo search resolves the graph's POST tree once at open (pooled
  graphs keep their filter), an empty manifest when there is none.
  `branch_or_none` reads the dedicated branch, and the batched joins keep
  next's pooled lanes. The stats-view key hashes the root id.
- Indexer: `apply_dict_novelty` and `compact_forward_streams` take the
  cycle's compaction budget, so the term dictionary keeps its reserved
  share. `Prefetched` holds `ContentBytes`. `relocalize_sorted_commit`
  rewrites next's 20-byte types records.
- Disk cache: main's in-flight write registration, with an empty entry
  still read as crash debris that a write replaces. The process-wide
  eviction walk stays removed.
- Graph import (#2232): fenced CAS and publishes, the seed carries the
  record's namespace and fence, 32-bit graph ids and next's loaders. An
  import into a graph of an existing ledger refuses triple terms and edge
  annotations: the splice merges no triple-term dictionary yet.
- Iceberg: `create_iceberg_graph_source` goes with main (a source needs a
  mapping); the R2RML path keeps next's `model_instance`.
- CLI: main's shared import flags without the leaflet flags; `graph
  import` routes through next's process-wide server routing, and
  `upload_source_import` serves next's `Destination`. Doc sources read a
  ledger through the command's open instance.
- Tests: sibling ledger ids become distinct names, `genesis_ledger` is
  awaited, Cypher state dumps include each relationship's `rdf:reifies`
  link, and the graph-import arena test checks the refusal instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:query Query execution, planning, fast paths, overlay, result formatting breaking-change Backwards-incompatible change; drives the Breaking Changes release-notes section bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Graph sources: a registered source that can't serve a query answers "Ledger not found" or silently returns no rows

2 participants