Skip to content

fix(api): a governed graph source honors its model's override control - #2455

Merged
bplatz merged 6 commits into
mainfrom
fix/graph-source-model-override-control
Nov 21, 2026
Merged

bplatz merged 6 commits into
mainfrom
fix/graph-source-model-override-control

Conversation

@aaj3f

@aaj3f aaj3f commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Summary

A graph source registered with a model ledger (Iceberg, SQL or Delta, --model / "model") is
governed by the policies in that model. Its policy configuration is built from the source's
registration: the model's default graph is its policy source and schema source, and the
registration supplies default_allow. That configuration always carried the default override
control, which allows overrides. So whatever the model's owner configured, a request could replace the source's policy
defaults with its own identity, policy class, inline policy, or default-allow. A native ledger's own
f:overrideControl refuses exactly those overrides.

A governed graph source now honors its model's override control. The configuration a source
presents takes the override control of the model ledger's resolved f:policyDefaults, read at
the model's head the same way a query of the model resolves it. merge_policy_opts then applies it with no
special-casing, so f:OverrideNone and f:IdentityRestricted govern request overrides of a
source exactly as they govern a native ledger. That includes the server-verified identity check.

This matters because of an existing rule that applies to native ledgers and sources alike: a
request identity to which the policy rules assign no f:policyClass selects no rules, and
default-allow alone then decides what it reads. A native ledger owner can stop a request from
choosing that with f:overrideControl. Until now, a model owner could not do the same for the
sources the model governs.

Behaviour

  • Model with no f:overrideControl: behaves exactly as before. Overrides are allowed (the
    default), and the test pins every cell of that column.
  • Model with f:OverrideNone: a request's identity, policy class, inline policy or
    default-allow: true no longer replaces the source's policy defaults. The source keeps its
    registered default_allow (fail-closed when unset), as a native ledger keeps its own.
  • Model with f:IdentityRestricted: only a server-verified identity in f:allowedIdentities
    may override, as on a native ledger.
  • Unaffected: an identity whose f:policyClass the model assigns, and the root policy context,
    read the same under every override control.
  • Only the override control is inherited. No other setting of the model's config is
    taken (field table below).
  • Model ledger that does not exist: the override control falls back to the default. The
    source's policies can't be read from a missing model either, so a governed request fails there
    as before. Any other error reading the model's config fails the request.

Policy defaults: what a source takes from its model

PolicyDefaults field Taken from the model? Would taking it change answers for an existing model that sets it?
override_control (f:overrideControl) yes Only for models that set it. Before this change it had no effect on their sources; now it governs them. This is the intended change.
default_allow (f:defaultAllow) no; comes from the source's registration, as before Yes. A model that sets it would open (true) or close (false) its sources for requests that leave default-allow unset, and would override a registration's default_allow. Not taken.
policy_class (f:policyClass) no Yes. It would change which rules apply: anonymous requests would use the model config's classes instead of the f:AccessPolicy baseline, and an identity with no class would get them instead of its own assignment. Not taken.
policy_source (f:policySource) no; a source's policy source stays the model's default graph Yes. It would move where the source's rules are read from. Not taken.

Breaking changes for embedders

  • A graph source whose model ledger's config sets f:overrideControl on f:policyDefaults now
    enforces it. Requests that relied on overriding such a source's policy defaults (an identity,
    policy class, inline policy, or default-allow) get the source's defaults instead, unless the
    override control permits the server-verified identity. Models without f:overrideControl are
    unaffected.
  • Resolving a governed source's view now reads the model ledger's config (it's cached, like any
    ledger config read). An error reading an existing model's config fails the request instead of
    being ignored.
  • No public API change.

Tests

In fluree-db-api/tests/it_iceberg_policy.rs:

  • a_governed_source_honors_its_model_override_control. The model holds a deny on
    ex:Person (an f:AccessPolicy), a grant of ex:name to ex:ReaderPolicy, and an identity
    assigned that class. It is tested with three override controls. Sources are Iceberg and SQL;
    surfaces are JSON-LD and SPARQL, each direct and as a named graph (from-named /
    FROM NAMED). Rows (of 5):

    Caller no override control f:OverrideNone f:IdentityRestricted(admin)
    anonymous 0 0 0
    default-allow: true 0 0 0
    unknown identity 0 0 0
    unknown identity + default-allow: true 5 0 0
    unknown identity + default-allow: true, server identity admin 5 0 5
    known identity (class assigned) 5 5 5
    known identity + default-allow: true 5 5 5
    root policy context 5 5 5
  • a_governed_source_and_its_native_twin_agree_under_override_control. For every request
    that carries an identity, each source answers as a native ledger that holds the same
    policies and identity, under the same override control in its own config. Requests without
    an identity are not compared: a native ledger selects no stored policy for them, while a
    model applies its access policies, and that difference predates this change.

  • Non-vacuous. With the inheritance reverted, both tests fail on exactly the bold cells:
    the source returns 5 rows where the native twin and the expectation give 0.

Gates

At abe405c54 (this branch merged with main at 0824793ba), on a dedicated Linux box:

  • cargo nextest run --workspace --all-features --no-fail-fast --locked: 16477 run, 16477 passed, 46 skipped. The first attempt was stopped by the linker running out of memory, not by a test; the counts are from the re-run with --build-jobs 12 --test-threads 16.
  • cargo test --workspace --all-features --doc --locked: pass.
  • it_iceberg_policy (26/26, the 2 new tests included) and grp_policy (148/148), iceberg+sql+native.
  • harness_coverage (2/2).
  • fluree-sql-bridge: fmt, clippy and cargo test against MySQL 8 and Postgres 16. The live-bridge lane passed: it_sql_pushdown_lane, it_sql_graph_source and it_sql_set_semantics (live_bridge), each over SQLite, Postgres and MySQL bridges.
  • cargo clippy --workspace --all-features --all-targets -- -D warnings and cargo clippy --all-targets -- -D warnings: clean.
  • wasm32 clippy, both lanes (engine stack, and parse layer with no default features): clean.
  • testsuite-sparql: cargo test and clippy pass.
  • cargo fmt --all -- --check in all three workspaces (root, testsuite-sparql, fluree-sql-bridge): clean.
  • Non-vacuity at the merged head: with the inheritance reverted, both new tests fail (0/2).

A graph source registered with a model ledger presents a policy config
synthesized from its registration: the model's default graph as its policy
and schema source, and the registration's default-allow. Its override
control was always the default, so a request could replace the source's
policy defaults (an identity, a policy class, an inline policy,
default-allow) whatever the model's owner configured, where a native
ledger's own f:overrideControl would refuse it.

The synthesized config now takes the override control of the model
ledger's resolved policy defaults, read at the model's head, so a model
with f:OverrideNone or f:IdentityRestricted governs request overrides of
its sources as a native ledger governs its own; merge_policy_opts applies
it unchanged, server-verified identity check included. Every graph-source
kind resolves its view through the one function that builds this config.
A model that sets no override control keeps the default (overrides
allowed), and no other setting of the model's config is taken.
@aaj3f aaj3f added bug Something isn't working as expected breaking-change Backwards-incompatible change; drives the Breaking Changes release-notes section P1 Next up: wrong results, live user pain, unblocks area:iceberg Iceberg catalogs/credentials, R2RML, virtual datasets, materialize area:query Query execution, planning, fast paths, overlay, result formatting labels Nov 18, 2026

@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. Please review the inline comments before merging.

model.as_deref(),
config.as_mut().and_then(|c| c.policy.as_mut()),
) {
policy.override_control = Box::pin(self.model_override_control(model)).await?;

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.

Optional: this reads the model at its head during view resolution, while wrap_policy reads the model's rules at the head its ResolveCtx captures later. Seeding the view's cross_ledger_resolved_heads with the head read here would keep both on one version.

Comment thread docs/graph-sources/iceberg.md Resolved
…s its class

f:OverrideNone stops a request's policy-class, inline policy and
default-allow from replacing a governed source's defaults, but its identity
still selects the class the model assigns it, as on a native ledger.
@bplatz
bplatz merged commit 27c9ba2 into main Nov 21, 2026
13 checks passed
@bplatz
bplatz deleted the fix/graph-source-model-override-control branch November 21, 2026 17:16
bplatz added a commit that referenced this pull request Nov 21, 2026
Brings #2453 (a GRAPH scope's columns leave as they are when nothing
decodes), #2455 (a governed graph source honors its model's override
control), #2467 (R2RML scan join emit; iceberg top-k read budget) and
#2468 (vector identity follow-up: the whole-graph distinct-object count
counts vectors by value, a cold identity-table build fetches its arena
in one round, and the build stops on cancellation).

Conflicts:
- fast_count.rs: main's vector count on next's lead walk.
  count_distinct_lead_groups_inner tallies vector-only leaflets apart
  from the rest, and the NumBig liveness helpers take an ArenaRange (a
  store's NumBig o_types, or the vector o_type alone), so they serve
  count_distinct_vector_objects as main's generalized helpers do.
  count_distinct_objects_for_predicate takes next's tracker and main's
  cancellation, as do its callers in fast_predicate_scalar_agg.rs and
  fast_whole_graph_agg.rs.
- fast_group_count_firsts.rs: next's pooled-graph guard with main's
  answer_or_decline.
- o_type.rs: next's NumBig wording plus main's paragraph on arena
  contents.
- fluree_ext.rs: next's SourcePolicy and model-instance check, with
  main's async config and the model's override control.
- core lib.rs: main's MemoryCharge re-export; annotation_index has no
  home on next.
- Cargo.toml, regression-budget.json: both benches.

Ports:
- vector.rs: register_missing asks ContentStore::get_local whether a
  shard is resident; next has no resolve_cached_bytes, and a shard's
  cid is not optional.
- Tests: the residency vector arena stores its shards through
  write_test_shard_in, and BinaryIndexStore::empty() takes no
  directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:iceberg Iceberg catalogs/credentials, R2RML, virtual datasets, materialize 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 P1 Next up: wrong results, live user pain, unblocks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants