Skip to content

Prepare native Reader contract-scoped reads - #63

Open
callumalpass wants to merge 50 commits into
mainfrom
next/new-sdk
Open

callumalpass wants to merge 50 commits into
mainfrom
next/new-sdk

Conversation

@callumalpass

Copy link
Copy Markdown
Contributor

Scope

Source-only native Reader read foundation; existing Connect web/extension/native-shell runtime remains unchanged. Historical Reader #60 is untouched.

  • NextReaderRecords consumes public SDK describe, pages and get directly, requires explicit qualified Reader source/annotation beta1 semantic digests, admits only actual implementing type/field mappings, and returns genuine SDK views/native values.
  • Metadata pages avoid body reads; incomplete/changing-cut/duplicate/changed-provider results refuse without cursor restart. Full source reads preserve actual body/document and require revision consistency, captured UUID/path and unchanged provider bindings. Pending/protected native state is retained, never labelled saved.
  • No native writes, SDK/session/lease engine, legacy protocol shim or auth/setup glue. Core-domain repository/UI composition is still required.
  • Pin release-qualified older data-only SDK804/d43204b6 archive, verified SHA256 and matching lock SHA512. No held SDK807/browser/session intake.
  • docs/new-sdk.md records remaining source/annotation/view/session writes, portable extension auth, Files and distinct persisted native mutation/transfer phase recovery requirements. Live factory/setup/trust/runtime inputs and semantic digest qualification remain blockers.

Validation

Node22: frozen install, pnpm check (strict lint, format, architecture, all workspace types/tests) and production workspace build PASS. New read suite 29 tests PASS; connect package 160 tests / 35 files, core110 and Reader401 plus scripts/other workspace suites pass.

Owned fresh Chromium PDF-touch runner with strict loopback ephemeral Vite port: handle drag/extension/crossing/autoscroll and mobile adjusted highlight persistence across reload PASS; owned browser/server closed. Disposable/intercepted fixtures only, not native parser, sign-in, manifest install, custody, runtime or LAB acceptance. Production generated manifests match the existing committed files after build.

Please review this bounded read-only/data-contract foundation. This draft is not a completed Reader native port or launch/deploy authorization.

@callumalpass

Copy link
Copy Markdown
Contributor Author

BLOCK 1c1bbc0 — one-pass read-only foundation review of all nine paths.

One correctness delta in NextReaderRecords: both read() and metadata() await assertProviders() and then return/yield without checking the original caller signal again. Cancellation can occur after the provider's internal signal check but before this outer promise continuation. Two typed reviewer regressions, using only the public describe recheck and caller AbortController, reproduce a full-source result and metadata page delivered after cancellation.

Fence delivery with the original signal immediately after the final awaited recheck/before return or yield. Keep the original native identity, binding/cut/revision checks and error; no read restart, replacement signal, SDK/session/setup/UI rewrite, or second whole-app/browser matrix requested. Please add the narrow regressions on this same draft PR.

Independent unchanged-head checks: Node22 frozen install, focused new adapter 29 tests PASS, all workspace project typechecks, SDK804 archive SHA256 matching release provenance and lock SHA512, diff check PASS. Two additional reviewer abort regressions are RED with all existing29 still PASS; their project typecheck also PASS. SDK/controlled protocol evidence only, not native parser/runtime/LAB/sign-in/extension qualification.

Reviewed exact semantic beta1 contract pins, native provider mappings and values/state, full-source UUID/path/SHA witnesses, bounded cursor pages/no restart, duplicate/cut/binding refusal, borrowed client ownership and no writes. Existing web/extension/shell remains unchanged. No source ACK yet.

@callumalpass

Copy link
Copy Markdown
Contributor Author

Addressed the requested two-path cancellation delta in 8107c1d, same draft PR. Both metadata and full-source delivery now check the original caller signal immediately after the final awaited provider recheck, before map/yield or return. Reproduced both typed reviewer regressions RED on 1c1bbc0, now GREEN with all existing cases: 31 focused tests PASS, actual connect project typecheck and strict repository lint/format/architecture PASS, diff check PASS. No replacement signal/restart, SDK/session/setup/UI rewrite or second whole-app/browser matrix. SDK804 pin unchanged; please confirm only this requested delta.

@callumalpass

Copy link
Copy Markdown
Contributor Author

ACK 8107c1d

Requested two-path delta only confirmed: the original caller signal is checked directly after the final awaited provider recheck, before metadata mapping/yield and full-source return. No replacement signal, restart, session/setup/UI or SDK pin change. This resolves BLOCK6099359533.

Original one-pass nine-path review and independent 29 focused tests/all-workspace project types/archive provenance/diff checks stand. Owner two regressions RED→GREEN, 31 focused/connect types/strict lint-format-architecture/diff checks attributed; no second whole matrix.

Read-only source foundation ACK only. Shared session/setup, native parser/runtime/Files, extension and complete application integration, release and live-operation approval remain separate.

@callumalpass

Copy link
Copy Markdown
Contributor Author

Qualified corrected SDK561 delta pushed at b9eaf73 over cancellation-fix source-ACK 8107c1d. Verified archive SHA256/SHA512; 6 dependency/archive/metadata/lock/docs paths only, implementation untouched. Whole strict check (lint/format/architecture/all workspace types/tests), workspace build/frozen install PASS; focused31, Connect162, Reader401. Production extension manifest regenerated unchanged. Request clients narrow delta only; no runtime/auth/setup/Files/extension enablement or new browser matrix. Integration next/new-sdk; main PR review vehicle only.

@callumalpass

Copy link
Copy Markdown
Contributor Author

ACK b9eaf73

Single-pass requested SDK561 delta: Delta only from 8107: qualified561 dependency/lock/provenance/docs. Reader implementation, original cancellation fences and read-only caller behavior are unchanged. Owner whole check/build/actual workspace types, focused31 and frozen install attributed; no second matrix.

Independent exact committed archive SHA256/SHA512, package/lock/provenance consistency and diff check PASS (638609 bytes, source561501d0). Evidence: .coord/scratch/clients-apps-sdk561-pin-check.json and the corresponding clients-*-sdk561-delta.diff.

Source/package ACK only. No SDK814 intake, native-runtime/default-backend switch, main cutover, browser/LAB/custody or operation acceptance. No autonomous merge/deploy.

@callumalpass
callumalpass marked this pull request as ready for review October 10, 2026 17:16
@callumalpass

Copy link
Copy Markdown
Contributor Author

Coordinator1742 authorised qualified SDK814 successor pin-only intake. Clean/pushed exact000b09202d2c3f0b3efc5b6423da3dd86e4fd30c over ACKb9eaf73; 6 package/lock/archive/metadata/docs paths only, implementation/tests untouched. Archive8cbc82fb SHA256/SHA512 independently verified. Whole strict check/all workspace types/tests, workspace build, frozen PASS; production extension manifest regenerated unchanged. Request one clients pin-only pass; working pages/get unchanged, native factory/setup still blocked. No native atomic read/People/ops/runtime enablement; main PR review-only.

@callumalpass

Copy link
Copy Markdown
Contributor Author

ACK 000b092

Single-pass requested SDK814 successor pin-only delta from prior ACKed SDK561 head. Exactly six package/lock/provenance/docs/archive add-delete paths; no app implementation/tests/session/lease/read/write/backend/UI change or helper-alias rewrite. Independent exact committed archive SHA256/SHA512, qualified8cbc source, package/lock/provenance coherence and diff PASS. Owner full checks/build/frozen installs attributed; no unchanged source re-review, SDK repack or new matrix.

Existing source ACKs stand. Source/package only: not a native snapshot, People/native Files producer compatibility, per-app trust/origin/custody/operations, session/runtime/backend enablement or main cutover. Editor697 unchanged/no extra PR. Evidence .coord/scratch/clients-apps-sdk814-pin-check.json and clients-*-sdk814-pin.diff.

@callumalpass

Copy link
Copy Markdown
Contributor Author

Co1807 authorised batched qualified SDK816 pin-only update: exact6a501e4af1a1ff032bc1928c9cb47e72a41a7dbd over SDK814 ACK000b092. Six pkg/lock/archive/metadata/docs paths only; app source/tests untouched. Qualified9ab SHA256ab4d…+SHA512 verified. Whole strict check/allworkspace types/tests/build/frozen PASS; production extension manifest unchanged. Request one clients pin-only pass, no unchanged-code re-review. Native factory/setup still unpublished; no default-runtime/People/cutover/deploy claim.

@callumalpass

Copy link
Copy Markdown
Contributor Author

ACK 6a501e4

Single requested six-path SDK816 pin delta from the prior SDK814 ACK. Package/lock/docs/provenance and delete8cbc/add9ab archive only; no app source/tests/adapter/session/backend/UI/People/default-runtime change. Independently verified committed660679B archive SHA256/SHA512, exact source9ab provenance, package-lock paths and diff. Owner frozen/wholechecks/actualtypes/build evidence attributed, not repeated. Prior unchanged-code ACK stands; no new SDK/native/browser matrix, factory/People/nativeFiles producer qualification, runtime/main cutover or deployment authorization.

Vendor the SDK563 dev archive and its original beta129 connect-protocol
dependency (d765e675c3da) under packages/connect/vendor as ordinary file
dependencies of @mdbase-reader/connect, the only package through which
Reader apps reach an SDK. SHA256/SHA512 match the release manifest. Dev
intake, not release-qualified; the Connect SDK remains the default.
Dev intake, not release-qualified. Adds the SDK collection selection and
files.grant; the public application entry types are unchanged.
The archive carries the live MdbaseConnect entry and the native runtime
assets. It is a dev intake and not release-qualified.
nativeReaderCollection builds Reader's existing repositories over a public
SDK connection's borrowed records client and files. Reads, cursor and contract
queries, CAS writes and uploads map onto the native API. A write keeps its
mutation ID and reports saved only after it is confirmed. Otherwise it
surfaces operation_outcome_unknown with the original request_id, which can be
recovered. Unsupported features are refused, not emulated. Every await is
fenced by isCurrent(). directAccess becomes optional, and the reading
workspace is split out so either runtime can render it.
readerSdk() is the page's one MdbaseConnect, declared from the unchanged
bundled manifest. Builds with VITE_MDBASE_ENV=lab lazily render SdkReaderRoot
over it, and staging and production keep ConnectReader because the SDK refuses
production. SdkReaderRoot leaves sign-in, selection, approval and setup to the
SDK and opens the workspace only for a current READY connection. An unapproved
or invalid link offers approval or chooseAnother. Vite keeps the SDK out of dev
pre-bundling and emits ES workers. The build is blocked inside the SDK bundle
(an unshipped sqlite3-worker1.mjs).
This cut fixes the SDK's Vite packaging. Worker bundles now share the build's
file names, so the SDK Worker and its native assets are emitted once and the
LAB hookup builds.
Contract reads by path now use getContract. Contract creates, updates and
deletes use the SDK's contract options and read back through getContract.
As in prod Connect, a contract view has no body, and a contract update
refuses body changes. File descriptors take mediaType from the replica.
The contract test is skipped: the SDK's MemoryReplica does not serve
contract records yet.
…test

MemoryReplica now serves contract-scoped records, so the contract read and
update test runs against a declared MemoryContract.
…ible states

A settled readiness problem, incompatible collection, unchecked or retired
READY state no longer shows endless Opening. Blocked, readiness and
incompatible snapshots show the SDK's shared title and copy with its one
suggested action; unchecked offers Check again and retired offers another
collection. Raw problem codes are never shown.
Set up now opens a review instead of calling configure(). It shows the
SDK plan's summary and its plain per-change messages, and only Confirm
applies that exact plan. Cancel leaves the collection untouched. If the
collection changed during the review, setup_changed plans it again for
a fresh review. When every conflict can be resolved with Reader's
version, the review offers that choice. The connect package re-exports
isMdbaseError and MdbaseSetupPlan, plus mdbaseError for tests.
… shows refusals

Only setup_changed proves nothing was written. An unconfirmed outcome
re-assesses and shows the fresh state; other errors use describeError copy.
A plan with nothing to review keeps the plain configure() path. The plan's
refusal message is shown.
Host MdbaseConnect in the side panel, settings and welcome pages through
the @mdbase-reader/connect native bridge; the MV3 service worker never
loads the SDK. Connection screens follow the SDK's application snapshot
with describeError copy and its one recovery action. Clipping and import
write through the native collection for the collection the user picks.

The extension manifest is now a web app manifest with homepage,
redirect_uris and installation_origins for the extension origin (the Web
Store ID, plus an unpacked LAB build's ID via MDBASE_EXTENSION_DEV_ID).
host_permissions add the CP and LAB log origins; extension pages allow
wasm. The worker marks saved pages from the index the panel keeps; the
open panel counts and draws highlights. The device-code and direct-access
flows are removed.
The SDK now runs once, in an offscreen document (reason WORKERS) the
service worker creates on demand. The side panel, settings and welcome
pages and the service worker reach it over a typed RPC on a same-origin
BroadcastChannel (structured clone keeps capture bytes), behind the same
application and ReaderConnectedCollection interfaces. Sign-in opens from
the page whose action started it. A Web Lock held for the host's lifetime
tells clients when Chrome closes it: in-flight calls fail with a restart
message and clients recreate the host and resubscribe.

This restores page status without the panel open (index, saved-page
badge with highlight counts, on-page highlights, rebuilt on demand) and
removes the busy state when several extension pages are open.
- An already-aborted signal never dispatches: the client refuses to
  encode it and re-checks after waiting for the host.
- dispose settles this context's pending calls (and aborts them on the
  host) without closing the shared SDK owner.
- Results and callbacks are accepted only from the host the call went
  to; adopting a new host and a late host-gone both settle the old
  host's calls with the restart outcome (check your last change).
- The host serves an explicit allowlist of application commands and
  Reader's public repository commands, not reflected methods.
- No invented SDK status: the last snapshot stays as the SDK sent it and
  hostAvailable() reports the restart; snapshots and application answers
  are validated before use.
- An unknown body-write request is treated as possibly pending, so the
  SDK's recovery reads the outcome back instead of a fresh retry.

Tests use the SDK's public application fixture and a real native
collection over MemoryReplica; sdk-rpc-lifetime.test.ts is apps' RED.
Vendor the dev SDK at 48b9f094e8fcf20c77dc77d47ac4659b89544e00 (sha256 567a9e288f4913a458763a357ffc0a4685b0dbd1bbc87679942afce1dccdfb1d),
replacing 4c484d3c. Native runtime and bundled protocol unchanged.
The SDK connection screen rendered its buttons as direct children of the
layout with no gap, so they ran together. Wrap them in a wrapping flex row
with a 10px gap; each button keeps its own style.
Vendor the dev SDK at 20c347ad216f7cf0bbe7869e4759933cd7db10a1 (sha256 1ee8a6ce8d3ebc36db168eb88e1244e4e1cb5316113c809881b81a1cfcba7714),
replacing 48b9f094. Native runtime and bundled protocol unchanged.
Vendor the dev SDK at ac3bff981f4cd0e3416e1e20a550cd857a09ec55 (sha256 456c7dc2a2985f163f6fb147f7c12957b6a3cb22979fd4f20d66e460ef652dbe),
replacing 20c347ad. Native runtime and bundled protocol unchanged.
Vendor the dev SDK at 1f7b4f7a361d00fdc7d43c9efaefa19607fedf79 (sha256 dae8c7a1a2b0e502f8f8fb50fed282f5a71443a189023f349311ad9b3d703866),
replacing ac3bff98. Native runtime and bundled protocol unchanged.
Vendor the dev SDK at 8bc125252d2e01d0f98089b7612c1c39600ea14a (sha256 fada31a421436e8617f207f6b535c6f237d2a3a94d66f8622b33aaace38a1ee4),
replacing 1f7b4f7a. Native runtime and bundled protocol unchanged.
Vendor the dev SDK at cf294bdb526ea0d86ed435ab0fb7813251ede361 (sha256 d45b2da4d6dbd41fd8ace69f4de5631f6d743a961b44981e272651a3debf8853),
replacing 8bc12525. Native runtime and bundled protocol unchanged.
Vendor the dev SDK at a965bd261c4aac1c2b69d4a31c3e2226d59dd627 (sha256 01e76f1a24e27f3521c5a730c5598cd69f4caea8903195151cc9b8c583d5ccce),
replacing cf294bdb. Native runtime and bundled protocol unchanged.
Vendor the dev SDK at 5f2c3d5df5d5b0d5752998ed8ec9116695e0a141 (sha256 b36fd8a5c84c27c9c32458d401d17a9cbf2ebe779fabe33fb659b2ad6bf74e26),
replacing a965bd26. Native runtime and bundled protocol unchanged.
Vendor the dev SDK at 8b18a6c7783b00d43ee651fc10ba67a6ff1e1387 (sha256 0d4c986c17b38a456a910be0fe1033e8361d640953812ac0d244ec24f096d922),
replacing 5f2c3d5d. Native runtime and bundled protocol unchanged.
Vendor the dev SDK at 0f9a36147c7d09d9e5535257d89e3535d39d2172 (sha256 7d83150d2a7ca5d05a9a6bd66ff15c9829d2f93ba0442bc12608715385f7cd1a),
replacing 8b18a6c7. Native runtime and bundled protocol unchanged.
Vendor the dev SDK at 1dddb04cc423d07fcccedeedb0af2de2c2c6265a (sha256 e32d199f3c0839e4e7af76863599ec01954271c812fc03d1dc4e5105b6c79443),
replacing 0f9a3614. Native runtime and bundled protocol unchanged.
Vendor the dev SDK at 5710ab13d350211df9fd77a1d2ffd87df90963e0 (sha256 2fdef6dc3e50a9d3ab56ff30614bec8c201282815be593eda5c91ab3a03c8b19),
replacing 1dddb04c. Native runtime and bundled protocol unchanged.
Library row menus, the document More actions and the command palette now
offer Remove source. Reader first checks the source at its current
revision, lists the records that link to it, and deletes the source
record only after the reader confirms. Stored files and annotations stay
in the collection.
Vendor the dev SDK at 39ba2b8a7738d2e349988de35b08bdba2cda5528 (sha256 9e590da064e48f2ef66c7b78b50ce1a878cd83f6bd86c7c7d1d9147cefc092fa),
replacing 5710ab13. Native runtime and bundled protocol unchanged.
Vendor the dev SDK at 53643b299c3dd2da4145b082ee08bd8a1a04516c (sha256 593471011a33bc73c93740fd3fa3eb06a02407bb8b6f8a28e2ed0f8995038189),
replacing 39ba2b8a. Native runtime and bundled protocol unchanged.

This branch has not been deployed

No deployments
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