Skip to content

Tl 08 inbound - #22

Merged
SJAryan merged 7 commits into
mainfrom
tl-08-inbound
Nov 8, 2026
Merged

SJAryan merged 7 commits into
mainfrom
tl-08-inbound

Conversation

@AnkithaThomas

Copy link
Copy Markdown
Collaborator

TL-08 (part 1): Live Photon check-ins → SpacetimeDB

What it does

  • npm run live: polls Photon for messages from the enrolled test sender, binds them to H17 (BRIDGE_SENDER_HOUSEHOLD), extracts equipment runtime and calls A's ingestCheckin. Resumes from a saved cursor; dedupes by provider message ID.
  • npm run replay -- fixtures/h17-checkin.json: same ingest path, clearly labeled REPLAY, never sends messages.
  • extract.ts: deterministic runtime extraction (ranges, single values, hours). A phone battery % alone → clarification question; nothing usable → review, runtime unset.
  • Replies: one clarification question or a short receipt, with idempotency key per inbound message. No ETA; ETAs come only from committed jobs (TL-05).

Tests: 32/32 pass, covering extraction cases, H17 text → 30–60 min, unenrolled sender ignored, replay twice → one effective ingest and no replies.

Setup: run npm install at repo root as well (stdb.ts uses root spacetimedb + src/module_bindings), start local SpacetimeDB per SETUP.md, fill the new BRIDGE_* and SPACETIMEDB_* vars from .env.example.

Not yet (part 2, after TL-05): send confirmed ETA from the committed job; delivery status tracking/reconciliation.

Part of TL-08

AnkithaThomas and others added 7 commits November 7, 2026 19:31
- inbound.ts: one ingest path for live and replay; replays never reply
- extract.ts: deterministic runtime extraction (range, bounds, % -> clarify, none -> review)
- tests: H17 fixture text -> 30/60, phone % -> needs_clarification,
  no runtime -> needs_review with no reply, unenrolled sender ignored,
  replay twice -> one effective ingest and zero replies
- stdb.ts: subscription onError takes one ctx arg; reject with ctx.event

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… extraction keeps upper bounds and ignores elapsed durations
Durations are judged by their own clause (split on but/however/although/
while/;/,/and the|my). Phone, laptop and other personal-device clauses are
dropped; equipment runtime stated as unknown, or device-only numbers, now
return needs_clarification with runtime unset. The "recorded ... of backup"
receipt is only sent for kind "runtime"; clarification asks what the
equipment's (e.g. oxygen concentrator's) battery display shows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
processOutbox acts only on the current bridge_outbox snapshot and sends
only the newest jobVersion per jobId. Lower versions and failed intents
that left the view are marked obsolete for good. A failed ETA is retried
at most 3 times and never later than 2 minutes after its first attempt;
after that it is marked expired and logged for reconciliation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The bridge cannot read job status, and bridge_outbox still returns rows
for jobs that have moved on, so a retried ETA could arrive after
delivery. A refused send is now recorded as needs_reconciliation, logged
once (key only, no numbers) and never resent. Legacy "failed" records
are treated the same. Newest-version, vanished-row and accepted-never-
resent behavior is unchanged. README explains why.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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