Skip to content

feat(pj_base): attach_source_record runtime-host slot for the M3 source cache (0.28.0) - #189

Merged
facontidavide merged 5 commits into
mainfrom
feat/attach-source-record
Sep 5, 2026
Merged

feat(pj_base): attach_source_record runtime-host slot for the M3 source cache (0.28.0)#189
facontidavide merged 5 commits into
mainfrom
feat/attach-source-record

Conversation

@facontidavide

@facontidavide facontidavide commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Adds the SDK interface for the host-managed source cache: a provider calls attachSourceRecord(descriptor_json) at download start to identify the request being ingested. The host owns capture, caching, and restore; this PR adds the declaration slot and C++ wrappers.

The optional attach_source_record tail slot is exposed through both DataSourceRuntimeHostView and DatasetIngestHostView.

  • Calls run on the stream thread. The host copies and stores descriptor bytes verbatim, derives its own cache digest, and scopes the record by the provider id from the binding. The dataset is implicit in the ingest context.
  • The last attachment before the context's first push_message wins. Byte-identical repeats before ingestion are idempotent; any attachment after ingestion begins is an error.
  • The host bounds and parses the descriptor, rejects unknown fields, and may stage the record until the ingest transaction commits so a refill or reload does not discard it. Rejection never affects ingestion and is not a trust verdict.
  • Matching is byte-exact. Descriptors identify requests, contain no credentials, and leave parser policy to the layout.
  • PJ_HAS_TAIL_SLOT gates older hosts, with an explicit wrapper error indicating that attachment is unavailable.

SDK version: 0.27.1 → 0.28.0. The runtime-host vtable grows from 104 to 112 bytes, with the new slot at offset 104; the ABI baseline is unchanged. Hosts using designated initializers may need an explicit .attach_source_record = nullptr when adopting the new headers.

Also includes the provider-job watchdog startup synchronization fix. The changelog, C++ documentation, guides, and test error example now agree with the ABI contract.

Validation: 85/85 SDK tests passed in the reviewed RelWithDebInfo build and in Debug+ASAN after the documentation changes. Pre-commit checks passed.

facontidavide and others added 5 commits September 3, 2026 22:45
One provider->host call, stated once at download start: the canonical
descriptor JSON of the reproducible request a source answers. The host
copies the bytes and derives the record identity itself (the plugin never
supplies an identity, per the descriptor_import doctrine), enabling the
host-driven transparent source cache. Byte-identical re-attach is
idempotent; different bytes fail; failure is a contract failure, never a
trust verdict, and never affects ingest. Old hosts read as no-caching via
PJ_HAS_TAIL_SLOT; the C++ wrapper reports the absence explicitly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The record is stored verbatim and keyed on the host's own digest (an
internal keyspace — never required to agree with a provider identity
scheme); the unspoofable datum is the provider id, taken from the binding.
Refusal is allowlist-semantics (unknown fields are an error), not a field
denylist. Last attach before the first push_message wins and the host may
stage the record until its ingest transaction commits, so a replacing
reload or in-place refill never silently loses it. Thread tag matches
push_message ([stream-thread]). DatasetIngestHostView gains the forward;
guide/architecture docs list the slot; tests add the unbound-host and
short-struct_size-with-stale-pointer gates.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@facontidavide
facontidavide merged commit 100fef2 into main Sep 5, 2026
7 checks passed
@facontidavide
facontidavide deleted the feat/attach-source-record branch September 5, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant