Skip to content

feat(assets): immediate per-bind asset upload (Asset-B4 close-out)#93

Merged
th3-br41n merged 1 commit into
mainfrom
feat/asset-b4-lifecycle
Jul 3, 2026
Merged

feat(assets): immediate per-bind asset upload (Asset-B4 close-out)#93
th3-br41n merged 1 commit into
mainfrom
feat/asset-b4-lifecycle

Conversation

@th3-br41n

Copy link
Copy Markdown
Contributor

Closes out Asset-B4 — the last open item from the lazy-fetch lifecycle: an immediate per-bind upload trigger.

What

  • onAssetBound post-commit hook on the entities service: fires ONLY for asset_refs rows the reconcile created (never pre-existing ones, so a no-op property update can't re-trigger), contained per-invocation like the sibling hooks.
  • uploadBoundAssetNow in main: single-pair push via the existing uploadBoundAssetIfPending when the blob plane is live; per-pair in-flight dedupe against the connect-time drain; fail-safe logging.
  • Shared assetUploadDeps builder extracted (drain + immediate — 2 call sites, per the DRY rule).

Why the drain wasn't enough

The connect-time drain subsumes per-bind for correctness but only runs on relay state changes — an asset bound mid-session waited for the next reconnect before its bytes reached the durable node. This is the latency path.

OQ-238

Stays resolved as landed in pt.1: no separate assets.bind capability — the entity-write gate that authorized the property write authorizes the ref reconcile; serve-side access enforcement is OQ-237 (Asset-B7 territory). Docs updated in the harness plan alongside this PR.

Tests

  • +3 entities-service tests: fires once per newly-created ref on create + update; no fire for unchanged/dangling/pruned refs; a throwing hook is contained (refs + write still land). 50/50 green.
  • Workspace typecheck + biome clean.

🤖 Generated with Claude Code

A freshly-bound asset's chunks now push to the durable node the moment its
asset_refs row lands (when the blob plane is live), instead of waiting for
the next relay state change. The connect-time drain still subsumes this for
correctness; the new onAssetBound hook is the latency path. Fires only for
refs the reconcile CREATED (never pre-existing), contained per-invocation,
per-pair in-flight dedupe against the drain. Shared assetUploadDeps builder
extracted (drain + immediate = 2 call sites).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@th3-br41n th3-br41n merged commit e9375ab into main Jul 3, 2026
5 of 6 checks passed
@th3-br41n th3-br41n deleted the feat/asset-b4-lifecycle branch July 3, 2026 22:17
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