Skip to content

refactor: consolidate commit ingest, subscribe auth, and bind-twin fixtures - #1274

Draft
joepio wants to merge 7 commits into
developfrom
cursor/consolidate-ingest-subscribe-auth-88f8
Draft

refactor: consolidate commit ingest, subscribe auth, and bind-twin fixtures#1274
joepio wants to merge 7 commits into
developfrom
cursor/consolidate-ingest-subscribe-auth-88f8

Conversation

@joepio

@joepio joepio commented Aug 15, 2026

Copy link
Copy Markdown
Member

Related Issues

Follows the duplication audit in #1273. This branch includes that planning work plus the first consolidations that pass the contract.

Checklist

  • Add changelog entry linking to issue, describe API changes
  • Add or update tests if needed
  • Update docs if needed

Consolidation 1 — commit ingest + subscribe auth

  • Kind: policy-split (commit ingest) + delete-duplicate (subscribe check_read)
  • Job: apply a signed JSON-AD commit to a Db; authorize a WS subscribe.
  • Scope paths: lib/src/sync/engine.rs, lib/src/sync/ingest.rs, lib/src/sync/ws_apply.rs, lib/src/sync/mod.rs, server/src/commit_monitor.rs, server/src/handlers/commit.rs
  • Characterization tests committed before the production diff: yes (test(sync): pin replica WS commit ingest skipping write rights)
  • scripts/consolidation-measure.py --baseline exits 0: yes
Before (develop) After
Production non-blank 2358 2284 (-74)
Largest file engine.rs 1084 engine.rs 918
Public items 39 39

CommitIngestOpts::replica() still skips write-rights and timestamp. WASM applyCommit is not folded in (signature off — a fourth policy).

Remaining path: ingest_commit_json with CommitIngestOpts::{hub,peer,replica}. Subscribe handlers call authorize_read.

Consolidation 2 — bind-twins (search + server URL)

  • Kind: bind-twins
  • Job: keep Rust/TS Tantivy escape and browser/Flutter normalizeServerUrl producing the same bytes.
  • Scope paths: lib/src/client/search.rs, browser/lib/src/search.ts, browser/data-browser/src/helpers/serverUrl.ts, flutter/lib/atomic/server_url.dart
  • Shared fixtures: testdata/search-query.json, testdata/server-url.json
  • scripts/consolidation-measure.py --kind bind-twins --baseline exits 0: yes (365 → 365, no third copy)
  • Deleted the third Tantivy-escape body in file_search_repro.rs (looks up the fixture)
  • Empty server-URL input is unbound: TS returns https://, Dart returns ''. Not "fixed" here.
  • Flutter was not available in this environment; Dart tests load the same JSON the browser suite already passed.

Also

  • flutter/AGENTS.md no longer claims Loro is missing (Phase A landed).
  • Measure script accepts --kind bind-twins so a flat line count is not a failed gate.
  • CI mounts the whole testdata/ directory (JS, Rust, Flutter).
Open in Web Open in Cursor 

@cursor cursor Bot changed the title refactor(sync): one commit ingest path and one subscribe auth check refactor: consolidate commit ingest, subscribe auth, and bind-twin fixtures Aug 15, 2026
cursoragent and others added 7 commits August 18, 2026 17:49
Map duplicated logic across Rust, TypeScript, and Flutter, and classify
what should stay dual-maintained versus what should merge. Links existing
plans instead of restating them.

Co-authored-by: joepmeindertsma <joepmeindertsma@gmail.com>
A cleanup is only allowed to land if characterization tests pin the old
paths first, then scripts/consolidation-measure.py shows production lines
in scope went down. Policy-splits (same shape, different CommitOpts) are
called out so they cannot hide a behavior change.

Co-authored-by: joepmeindertsma <joepmeindertsma@gmail.com>
Flutter catch-up applies a signed commit without re-checking ACL. Hub and
peer ingest still reject the same unauthorized signer. Characterization
for folding ws_apply::apply_commit_json into ingest_commit_json.

Co-authored-by: joepmeindertsma <joepmeindertsma@gmail.com>
Fold Flutter WS apply_commit_json into ingest_commit_json via
CommitIngestOpts::replica() (signature on, rights/timestamp off). Hub and
peer keep enforcing rights. Named presets replace repeated struct
literals.

Subscribe, SubscribeDrive, and SubscribeQuery share authorize_read so
the three check_read copies cannot drift.

Measure: 2333 → 2257 production non-blank in scope; largest file
engine.rs 1084 → 918.

Co-authored-by: joepmeindertsma <joepmeindertsma@gmail.com>
Mark the two landed items in the audit and add an UNRELEASED changelog
entry so the remaining work list stays accurate.

Co-authored-by: joepmeindertsma <joepmeindertsma@gmail.com>
Rust, TypeScript, and Dart now load testdata/search-query.json and
testdata/server-url.json instead of each suite inventing the same
expected bytes. The File-picker repro looks up the escaped isA key
instead of shipping a third escape implementation. CI mounts the
whole testdata directory so new fixtures do not need a one-off file
mount. Empty server-URL input is left unbound: TS returns https://,
Dart returns empty.

Co-authored-by: joepmeindertsma <joepmeindertsma@gmail.com>
flutter/AGENTS.md still said Loro was missing; Phase A already landed.
scripts/consolidation-measure.py --kind bind-twins allows a flat
production line count so a shared fixture is not rejected as a no-op.

Co-authored-by: joepmeindertsma <joepmeindertsma@gmail.com>
@joepio
joepio force-pushed the cursor/consolidate-ingest-subscribe-auth-88f8 branch from abe4f0a to 4a8f8aa Compare August 18, 2026 15:49
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.

2 participants