8000 feat(browser): add incomingRefs to BrowserWriteTransaction (#925) by adityamukho · Pull Request #927 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

feat(browser): add incomingRefs to BrowserWriteTransaction (#925) - #927

Merged
adityamukho merged 1 commit into
v3from
feat/925-browser-incoming-refs
Nov 29, 2026
Merged

adityamukho merged 1 commit into
v3from
feat/925-browser-incoming-refs

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Summary

Adds BrowserWriteTransaction.incomingRefs(target, maxLinks, maxRecords), the browser form of the bounded incoming-reference lookup of write transactions (#924). Part of #925.

  • Synchronous. Returns { status: 'complete', links, recordsExamined } or { status: 'exhausted', budget, recordsExamined }, typed as a discriminated union on status. An exhausted result has no links.
  • Budgets are exact integer numbers in 0..=2^32-1; anything else, and an invalid UUID, is API-017. A finished transaction or closed database is API-018.
  • It shares one code path, db::incoming_refs, with the native transactions and does not build the staged read view.
  • It is a read: it stages nothing, takes no tx_count, starts no flush and still answers after a failed IndexedDB flush.

Behaviour change: a user function that calls execute, commit, rollback or incomingRefs on the transaction running it now gets INT-001. Before, the existing methods failed with wasm-bindgen's recursive-borrow error. The methods take shared receivers behind a per-transaction guard.

No native API, file-format, WAL, grammar, error-code or dependency change.

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (requires migration or version bump)
  • Documentation / tests only

Size

Artifact Base Branch
Native dist binary, Rust 1.99.1 (gate 1,280,000) 1,252,144 1,252,144
Native dist binary, Rust 1.100.0 1,254,416 1,254,416
Browser wasm-bindgen _bg.wasm, Rust 1.94.0 1,103,687 1,111,681 (+7,994)

Tests

Firefox: 103 main-thread and 136 dedicated-worker tests pass. Native: 2,190 passed, 0 failed, 23 ignored. wasm32-wasip1: 1,233 passed. Clippy (native, wasm32 browser, wasm32-wasip1) and fmt are clean. Chrome and Safari were not run locally. Details: docs/testing/925-browser-incoming-refs.md.

Notes for reviewer

  • wasm.yml gains a step that type-checks the generated declarations (tests/browser/incoming_refs.ts).
  • Design: docs/superpowers/specs/2026-11-29-925-incoming-ref-parity-design.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01H2a7QnK1UQ7thygqxPzRfQ

BrowserWriteTransaction.incomingRefs(target, maxLinks, maxRecords) exposes
the bounded incoming-reference lookup of write transactions (#924) in the
browser. It shares db::incoming_refs with the native transactions and
returns a plain object discriminated by status, with exact 32-bit budgets.

The transaction methods now take shared receivers behind a per-transaction
guard, so a user function that calls back into its own transaction gets
INT-001 instead of wasm-bindgen's recursive-borrow error.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H2a7QnK1UQ7thygqxPzRfQ
@codecov
codecov Bot commented Nov 29, 2026
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.32258% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/db.rs 90.32% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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

0