GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(appwrite): secure mounted robot access by SloppyBobbert · Pull Request #70 · SloppyBobbert/Dosey

Conversation

@SloppyBobbert

@SloppyBobbert SloppyBobbert commented Jul 29, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Owner

Summary

  • Add server-only mounted-device access and mounted-robot restoration Functions.
  • Keep mounted anonymous accounts out of Appwrite Teams.
  • Add backend CI for tests, typechecking, and builds.
  • Align project READMEs with the target contract and current staging status.

Rollout

  • This adds an inactive backend contract; it does not activate secure claim.
  • Keep legacy Team-backed claim Functions for installed clients during compatibility.
  • The Android follow-up adds get-mounted-robot configuration and uses a separate versioned secure claim Function through the existing claim configuration key.
  • Do not dual-write mounted accounts into Teams or reactivate the legacy Team-writing deployment after retirement.

Validation

  • npm test — 122 passed
  • npm run typecheck
  • npm run build
  • Appwrite Backend CI workflow YAML parse
  • README local-link and stale-configuration checks
  • git diff --check

Summary by CodeRabbit

  • New Features

    • Added secure mounted-robot lookup, returning a linked robot’s ID and display name.
    • Added anonymous-session verification for robot pairing requests.
    • Pairing now prevents devices from being mounted to multiple robots and records access atomically.
  • Bug Fixes

    • Improved handling of pairing conflicts, duplicate access records, inactive installations, and authentication failures.
    • Preserved local app functionality during backend or authentication outages.
  • Documentation

    • Expanded setup, configuration, pairing, mounted-access, and rollout guidance.
  • Tests

    • Added comprehensive coverage for mounted access, pairing conflicts, identity verification, and request validation.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
SloppyBobbert added 4 commits July 28, 2026 19:28
@SloppyBobbert
feat(appwrite): secure mounted robot access
0c2bc27
@SloppyBobbert
fix(appwrite): make mounted eligibility pagination-safe
78b453b
@SloppyBobbert
test(appwrite): add backend rollout safeguards
5a880af
@SloppyBobbert
docs(appwrite): clarify mounted access rollout
df37c86
Copilot AI review requested due to automatic review settings July 29, 2026 02:45
Copilot AI reviewed Jul 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@SloppyBobbert, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 33 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 51f0787d-9c94-44a1-9c86-1468cea2288d

📥 Commits

Reviewing files that changed from the base of the PR and between df37c86 and 66c2d5f.

📒 Files selected for processing (12)
  • .github/workflows/appwrite-backend-ci.yml
  • backend/appwrite/src/application/mounted-robot-services.ts
  • backend/appwrite/src/entrypoints/get-mounted-robot.ts
  • backend/appwrite/src/functions/get-mounted-robot.ts
  • backend/appwrite/src/infrastructure/appwrite-errors.ts
  • backend/appwrite/src/infrastructure/appwrite-mounted-robot-access.ts
  • backend/appwrite/src/infrastructure/appwrite-pairing-persistence.ts
  • backend/appwrite/src/infrastructure/appwrite-robot-access-directory.ts
  • backend/appwrite/src/infrastructure/transactional-pairing-store.ts
  • backend/appwrite/src/runtime/mounted-robot-runtime.ts
  • backend/appwrite/test/get-mounted-robot.test.ts
  • backend/appwrite/test/transactional-pairing-store.test.ts
📝 Walkthrough

Walkthrough

This PR adds secure anonymous mounted-robot lookup, transactional mounted-access persistence, pairing conflict handling, updated Team membership checks, backend CI, and documentation describing Function configuration and rollout behavior.

Changes

Mounted access and pairing

Layer / File(s) Summary
Identity and pairing contracts
backend/appwrite/src/domain/*, backend/appwrite/src/functions/function-identity.ts, backend/appwrite/src/runtime/pairing-runtime.ts
Adds mounted-access records, anonymous identity verification, conditional runtime configuration, and bounded versioned invitation IDs.
Atomic mounted-access pairing
backend/appwrite/src/infrastructure/appwrite-pairing-persistence.ts, backend/appwrite/src/infrastructure/transactional-pairing-store.ts, backend/appwrite/src/infrastructure/appwrite-robot-access-directory.ts, backend/appwrite/src/application/pairing-services.ts
Creates or replaces mounted access transactionally, resolves pairing conflicts, rejects devices mounted to another robot, and removes Team-based mount writes.
Mounted robot lookup endpoint
backend/appwrite/src/application/mounted-robot-services.ts, backend/appwrite/src/infrastructure/appwrite-mounted-robot-access.ts, backend/appwrite/src/functions/get-mounted-robot.ts, backend/appwrite/src/entrypoints/get-mounted-robot.ts, backend/appwrite/src/runtime/mounted-robot-runtime.ts
Adds anonymous POST validation, Appwrite access and installation reads, active-installation checks, and the get-mounted-robot Function.
Validation and delivery contract
backend/appwrite/test/*, .github/workflows/appwrite-backend-ci.yml, README.md, backend/appwrite/README.md, mobile_app/*/README.md
Adds coverage for identity, endpoint, persistence, pairing, and rollback behavior; adds backend CI; documents configuration, table schemas, scopes, and rollout state.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant getMountedRobot
  participant IdentityVerifier
  participant MountedRobotService
  participant TablesDB
  Client->>getMountedRobot: POST anonymous request
  getMountedRobot->>IdentityVerifier: verifyAnonymous(headers)
  IdentityVerifier-->>getMountedRobot: account ID
  getMountedRobot->>MountedRobotService: get(account ID)
  MountedRobotService->>TablesDB: read mounted access
  MountedRobotService->>TablesDB: read robot installation
  TablesDB-->>MountedRobotService: access and installation data
  MountedRobotService-->>Client: robot identity or null
Loading

Possibly related PRs

  • SloppyBobbert/Dosey#43: Related pairing services, claim handling, and runtime foundations.
  • SloppyBobbert/Dosey#44: Related Appwrite pairing persistence changes.
  • SloppyBobbert/Dosey#46: Related identity verification and household invitation logic.

Poem

A bunny found a robot’s trail,
Through guarded doors and checks that scale.
Claims now pair, then safely bind,
While Team writes stay left behind.
CI hops green across the rail!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding secure mounted robot access in the Appwrite backend.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/appwrite-mounted-backend

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]
coderabbitai Bot reviewed Jul 29, 2026
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/appwrite-backend-ci.yml:
- Around line 30-39: Update the checkout and setup-node action references in the
workflow to the current v7 major releases, replacing their existing v4 SHA pins
with the corresponding v7 SHA-pinned versions. Preserve the existing action
inputs, including persist-credentials, node-version, cache, and
cache-dependency-path.

In `@backend/appwrite/src/application/mounted-robot-services.ts`:
- Around line 24-27: Update createGetMountedRobotHandler to return { robot: null
} when getRobotInstallation returns no installation or a non-active status,
including provisioning, instead of throwing. Keep exceptions reserved for
genuine invariant violations and preserve the existing service-result handling
for active installations.

In `@backend/appwrite/src/domain/household-invitation.ts`:
- Around line 37-40: Before adopting the new hash input in
householdInvitationId, verify the historical ID contract, including whether it
used unnormalized robotId plus invitedEmail separated by a newline. Preserve
compatibility by continuing to resolve existing invitation rows generated under
the legacy contract during replacesInvitation(previousId) and subsequent
replacements, or provide the required migration before switching formats.

In `@backend/appwrite/src/functions/get-mounted-robot.ts`:
- Around line 20-22: Update the request-body validation in get-mounted-robot so
undefined or null bodyJson values are treated as valid empty bodies, while still
returning invalid_request for non-empty objects. Guard the isEmptyObject check
with an explicit absent-body condition.

In `@backend/appwrite/src/infrastructure/appwrite-pairing-persistence.ts`:
- Around line 465-470: The duplicated isNotFound 404 predicate should be
centralized in a shared infrastructure helper to keep Appwrite error semantics
consistent. In
backend/appwrite/src/infrastructure/appwrite-pairing-persistence.ts#L465-L470,
move the predicate into the shared module and import it where used; in
backend/appwrite/src/infrastructure/appwrite-mounted-robot-access.ts#L97-L102,
remove the local copy and import the same helper, preserving the existing
AppwriteException and generic object checks.

In `@backend/appwrite/src/infrastructure/transactional-pairing-store.ts`:
- Around line 163-174: Guard the resolveClaimConflict flow in the surrounding
claim-conflict handler so it is only called when conflictRobotId is non-null and
represents the found claim robot; do not pass the fallback empty string.
Preserve the existing accepted, consumed, device_already_mounted, and
thrown-error handling for valid robot IDs, while allowing earlier conflicts
without a resolved robot ID to surface through the existing error path.

In `@backend/appwrite/src/runtime/mounted-robot-runtime.ts`:
- Around line 21-39: Extract the duplicated Appwrite account construction from
the identity verifier callbacks into a local JWT account factory, mirroring
createUserAccount in pairing-runtime.ts. Reuse the factory in both
getCurrentAccountId and getCurrentAnonymousAccount while preserving the existing
JWT validation and account/session behavior.
- Line 10: Update the mounted robot runtime’s reportError handling: either
remove the unused reportError parameter and update callers such as
get-mounted-robot.ts, or invoke it for identity/lookup failures instead of
retaining the dead-code marker. Ensure the runtime no longer silently accepts an
error reporter that is never used.

In `@backend/appwrite/test/transactional-pairing-store.test.ts`:
- Around line 218-231: Rename the test case title in the claimAtomically
rejection test to describe generic candidate membership validation via the
canClaim callback, removing the stale “Team-member” wording. Keep the test
setup, assertions, and behavior unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1f1a1a12-f71e-4000-979a-34b9924e0918

📥 Commits

Reviewing files that changed from the base of the PR and between 5949816 and df37c86.

📒 Files selected for processing (34)
  • .github/workflows/appwrite-backend-ci.yml
  • README.md
  • backend/appwrite/README.md
  • backend/appwrite/src/application/mounted-robot-services.ts
  • backend/appwrite/src/application/pairing-services.ts
  • backend/appwrite/src/domain/household-invitation.ts
  • backend/appwrite/src/domain/mounted-robot-access.ts
  • backend/appwrite/src/domain/pairing-claim.ts
  • backend/appwrite/src/entrypoints/claim-robot.ts
  • backend/appwrite/src/entrypoints/create-pairing-code.ts
  • backend/appwrite/src/entrypoints/get-mounted-robot.ts
  • backend/appwrite/src/functions/claim-robot.ts
  • backend/appwrite/src/functions/function-identity.ts
  • backend/appwrite/src/functions/get-mounted-robot.ts
  • backend/appwrite/src/infrastructure/appwrite-mounted-robot-access.ts
  • backend/appwrite/src/infrastructure/appwrite-pairing-persistence.ts
  • backend/appwrite/src/infrastructure/appwrite-robot-access-directory.ts
  • backend/appwrite/src/infrastructure/transactional-pairing-store.ts
  • backend/appwrite/src/runtime/mounted-robot-runtime.ts
  • backend/appwrite/src/runtime/pairing-runtime.ts
  • backend/appwrite/test/appwrite-mounted-robot-access.test.ts
  • backend/appwrite/test/appwrite-pairing-persistence.test.ts
  • backend/appwrite/test/appwrite-robot-access-directory.test.ts
  • backend/appwrite/test/claim-robot-handler.test.ts
  • backend/appwrite/test/function-identity.test.ts
  • backend/appwrite/test/get-mounted-robot.test.ts
  • backend/appwrite/test/household-entrypoints.test.ts
  • backend/appwrite/test/household-services.test.ts
  • backend/appwrite/test/mounted-robot-runtime.test.ts
  • backend/appwrite/test/pairing-runtime.test.ts
  • backend/appwrite/test/pairing-services.test.ts
  • backend/appwrite/test/transactional-pairing-store.test.ts
  • mobile_app/README.md
  • mobile_app/dosey_app/README.md
💤 Files with no reviewable changes (1)
  • backend/appwrite/src/application/pairing-services.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: Flutter native iOS build
  • GitHub Check: Flutter format, analyze, test, Android flavors
  • GitHub Check: Native tests, XIAO builds, static checks
  • GitHub Check: Validate auth-disabled web build
🧰 Additional context used
🪛 ast-grep (0.45.0)
backend/appwrite/test/mounted-robot-runtime.test.ts

[warning] 26-26: Do not use variable for regular expressions
Context: new RegExp(variable)
Note: [CWE-1333] Inefficient Regular Expression Complexity. Security best practice.

(regexp-non-literal-typescript)


[warning] 26-26: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(variable)
Note: [CWE-1333] Inefficient Regular Expression Complexity

(regexp-from-variable)

🪛 LanguageTool
mobile_app/dosey_app/README.md

[style] ~18-~18: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e-time checks, and schedule profiles. - Local household/profile metadata plus Appwrit...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~35-~35: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...us only, not provisioning. - appwrite for human identity, robot ownership, and cu...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🔇 Additional comments (40)
backend/appwrite/src/infrastructure/appwrite-robot-access-directory.ts (2)

37-46: LGTM!


68-74: 🎯 Functional Correctness

Query.equal('userId', ...) is supported for listMemberships.

No change needed for this filter.

backend/appwrite/src/infrastructure/transactional-pairing-store.ts (1)

107-153: LGTM!

backend/appwrite/src/infrastructure/appwrite-pairing-persistence.ts (1)

44-60: LGTM!

Also applies to: 170-224, 253-292, 421-463

backend/appwrite/src/application/mounted-robot-services.ts (1)

17-22: LGTM!

backend/appwrite/src/infrastructure/appwrite-mounted-robot-access.ts (1)

21-42: LGTM!

Also applies to: 45-95

backend/appwrite/src/entrypoints/get-mounted-robot.ts (1)

4-13: LGTM!

backend/appwrite/src/functions/get-mounted-robot.ts (1)

13-19: 🎯 Functional Correctness

verifyAnonymous narrowing matches the declared shape.

AnonymousIdentityVerification is string | { readonly reason: 'provider' } | null, and the verifyAnonymous implementation returns { reason: 'provider' } only for non-anonymous provider accounts, so these narrowings are consistent.

backend/appwrite/src/domain/mounted-robot-access.ts (1)

1-13: LGTM!

backend/appwrite/src/domain/pairing-claim.ts (1)

16-17: LGTM!

backend/appwrite/src/functions/function-identity.ts (1)

7-17: LGTM!

Also applies to: 31-35, 45-48, 67-86

backend/appwrite/src/runtime/pairing-runtime.ts (1)

18-36: LGTM!

Also applies to: 57-72, 85-92

backend/appwrite/src/entrypoints/create-pairing-code.ts (1)

11-12: LGTM!

backend/appwrite/src/functions/claim-robot.ts (2)

6-6: LGTM!

Also applies to: 77-77


34-46: 🗄️ Data Integrity & Integration

Keep claim-robot deployed on separate secure and legacy paths.

This repo source alone doesn’t define which Appwrite Function ID gets this anonymous-only handler or mounted-access runtime settings, so the Team-backed restoration path used by installed clients must remain on a separate legacy Function and this handler/source should not replace it.

.github/workflows/appwrite-backend-ci.yml (1)

1-52: LGTM!

README.md (3)

51-51: 📐 Maintainability & Code Quality | ⚡ Quick win

Wording implies Functions, not Teams, own household authority.

This row states "App data | Drift/SQLite remains local-first; Appwrite provides human identity, while Functions provide household ownership and mounted-phone pairing foundations", but backend/appwrite/README.md explicitly states that "Appwrite Teams remain the authority for robot ownership and human household membership" and TablesDB is the authority for pairing/mounted-device access. Consider rewording this row to keep the authority split intact (e.g. "Functions mediate access to Appwrite-Team-owned households and TablesDB-backed pairing") so the at-a-glance summary doesn't contradict the more precise backend contract described elsewhere in this PR.


84-88: LGTM!


165-165: LGTM!

backend/appwrite/README.md (4)

3-25: LGTM!


35-116: LGTM!


135-138: 📐 Maintainability & Code Quality | ⚡ Quick win

"above" should be "below."

Create a server-only database with no client row permissions. This contract has six TablesDB tables, including mounted_robot_access above. The mounted_robot_access columns are documented after this sentence (further down this section), not above it — the reference direction is backwards and will confuse readers scanning for it earlier in the file.

📝 Proposed fix
-Create a server-only database with no client row permissions. This contract has
-six TablesDB tables, including `mounted_robot_access` above.
+Create a server-only database with no client row permissions. This contract has
+six TablesDB tables, including `mounted_robot_access` below.

164-179: LGTM!

backend/appwrite/test/appwrite-mounted-robot-access.test.ts (1)

1-93: LGTM!

backend/appwrite/test/appwrite-pairing-persistence.test.ts (3)

13-81: LGTM!


84-221: LGTM!


83-83: 🎯 Functional Correctness

describe is already imported from node:test.

backend/appwrite/test/appwrite-robot-access-directory.test.ts (1)

6-134: LGTM!

backend/appwrite/test/mounted-robot-runtime.test.ts (1)

1-31: LGTM!

mobile_app/dosey_app/README.md (1)

18-18: LGTM!

Also applies to: 27-35, 44-55, 64-79, 100-100, 123-123

backend/appwrite/test/claim-robot-handler.test.ts (2)

42-43: LGTM!

Also applies to: 89-89, 100-130, 179-179


189-189: 🎯 Functional Correctness

device_already_mounted already maps to HTTP 409.

backend/appwrite/test/function-identity.test.ts (1)

7-94: LGTM!

backend/appwrite/test/get-mounted-robot.test.ts (1)

1-179: LGTM!

backend/appwrite/test/household-entrypoints.test.ts (1)

8-16: LGTM!

backend/appwrite/test/household-services.test.ts (1)

13-16: LGTM!

Also applies to: 96-103

backend/appwrite/test/pairing-runtime.test.ts (1)

17-71: LGTM!

backend/appwrite/test/pairing-services.test.ts (1)

21-25: LGTM!

Also applies to: 52-61, 76-151

backend/appwrite/test/transactional-pairing-store.test.ts (1)

12-83: LGTM!

Also applies to: 102-102, 114-139, 233-306

mobile_app/README.md (1)

14-14: LGTM!

Also applies to: 29-32, 63-71

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread .github/workflows/appwrite-backend-ci.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread backend/appwrite/src/application/mounted-robot-services.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread backend/appwrite/src/domain/household-invitation.ts
Comment on lines +37 to +40
return createHash('sha256')
.update(`dosey:household-invitation:v1\0${robotId.length}:${robotId}\0${normalizedEmail.length}:${normalizedEmail}`, 'utf8')
.digest('hex')
.slice(0, 36);

@coderabbitai coderabbitai Bot Jul 29, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate file =="
git ls-files | rg '(^|/)household-invitation\.ts$|household-invitation' || true

echo "== file outline =="
ast-grep outline backend/appwrite/src/domain/household.invitation.ts --view expanded 2>/dev/null || true
ast-grep outline backend/appwrite/src/domain/household-invitation.ts --view expanded 2>/dev/null || true

echo "== relevant household-invitation.ts =="
cat -n backend/appwrite/src/domain/household-invitation.ts

echo "== search previous/current id/hash usage =="
rg -n "household-invitation|documentId|createHash|robotId|normalizedEmail|household-invitation" backend/appwrite/src -S || true

echo "== appwrite invites files outline/list =="
rg -n "household.invitation|household-invitation|householdInvitation|household invitation" backend/appwrite/src tests . --glob '!*node_modules*' --glob '!*dist*' --glob '!*build*' || true

Repository: SloppyBobbert/Dosey

Length of output: 35028


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== git diff for household-invitation.ts =="
git diff -- backend/appwrite/src/domain/household-invitation.ts || true

echo "== create household invitation code =="
cat -n backend/appwrite/src/functions/create-household-invitation.ts

echo "== create household invitation implementation =="
cat -n backend/appwrite/src/application/household-services.ts | sed -n '115,175p'

echo "== household persistence retrieval =="
cat -n backend/appwrite/src/infrastructure/appwrite-household-persistence.ts | sed -n '120,235p'

echo "== appwrite transactional registry duplicate rejection =="
cat -n backend/appwrite/src/infrastructure/transactional-household-registry.ts | sed -n '170,210p'

echo "== behavioral probe: old vs new householdInvitationId outputs =="
node - <<'JS'
const crypto = require('node:crypto');
function old(robotId, normalizedEmail) {
  return crypto.createHash('sha256')
    .update(`${robotId}\n${normalizedEmail}`, 'utf8')
    .digest('hex')
    .slice(0, 36);
}
function current(robotId, normalizedEmail) {
  return crypto.createHash('sha256')
    .update(`dosey:household-invitation:v1\0${robotId.length}:${robotId}\0${normalizedEmail.length}:${normalizedEmail}`, 'utf8')
    .digest('hex')
    .slice(0, 36);
}
const samples = [
  ['robot-1', '[email protected]'],
  ['robot-1', '[email protected]'],
  ['robot-1', 'a b [email protected]'],
];
for (const [robotId, email] of samples) {
  console.log({ robotId, email, old: old(robotId, email), current: current(robotId, email), oldEqualsCurrent: old(robotId, email) === current(robotId, email) });
}
JS

Repository: SloppyBobbert/Dosey

Length of output: 333


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== changed files stat =="
git status --short

echo "== household-invitation diff =="
git diff -- backend/appwrite/src/domain/household-invitation.ts backend/appwrite/src/domain/ | sed -n '1,220p' || true

echo "== household invitation files =="
for f in backend/appwrite/src/functions/create-household-invitation.ts backend/appwrite/src/entrypoints/create-household-invitation.ts; do
  if [ -f "$f" ]; then
    echo "--- $f ---"
    cat -n "$f"
  fi
done

echo "== household services relevant lines =="
for f in backend/appwrite/src/application/household-services.ts backend/appwrite/src/infrastructure/appwrite-household-persistence.ts backend/appwrite/src/infrastructure/transactional-household-registry.ts; do
  if [ -f "$f" ]; then
    echo "--- $f ---"
    cat -n "$f" | sed -n '1,280p'
  fi
done

echo "== behavioral probe: old vs new householdInvitationId outputs =="
node - <<'JS'
const crypto = require('node:crypto');
function old(robotId, normalizedEmail) {
  return crypto.createHash('sha256')
    .update(`${robotId}\n${normalizedEmail}`, 'utf8')
    .digest('_hex')
    .slice(0, 36);
}
function current(robotId, normalizedEmail) {
  return crypto.createHash('sha256')
    .update(`dosey:household-invitation:v1\0${robotId.length}:${robotId}\0${normalizedEmail.length}:${normalizedEmail}`, 'utf8')
    .digest('hex')
    .slice(0, 36);
}
const samples = [['robot-1', '[email protected]'], ['robot-1', '[email protected]'], ['robot-1', 'a b [email protected]']];
for (const [robotId, email] of samples) {
  const oldId = crypto
    .createHash('sha256')
    .update(`${robotId}\n${email}`, 'utf8')
    .digest('hex')
    .slice(0, 36);
  console.log({ robotId, email, old: oldId, current: current(robotId, email), oldEqualsCurrent: oldId === current(robotId, email) });
}
console.log({
  currentId: current('robot-1', '[email protected]'),
  currentEmptyEmail: current('robot-1', ''),
  currentSameRobotDifferentEmail: current('robot-1', '[email protected]'),
});
JS

Repository: SloppyBobbert/Dosey

Length of output: 34770


Verify previous invitation IDs before switching the hash contract.

The changed householdInvitationId format makes every existing (robotId, normalizedEmail) pair generate a different Appwrite row ID, so legacy invitation rows will not be found via replacesInvitation(previousId) or subsequent replacements unless migrated. Also confirm whether the historical contract used unnormalized ${robotId}\n${invitedEmail} or normalized email.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/appwrite/src/domain/household-invitation.ts` around lines 37 - 40,
Before adopting the new hash input in householdInvitationId, verify the
historical ID contract, including whether it used unnormalized robotId plus
invitedEmail separated by a newline. Preserve compatibility by continuing to
resolve existing invitation rows generated under the legacy contract during
replacesInvitation(previousId) and subsequent replacements, or provide the
required migration before switching formats.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread backend/appwrite/src/functions/get-mounted-robot.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread backend/appwrite/src/infrastructure/appwrite-pairing-persistence.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread backend/appwrite/src/infrastructure/transactional-pairing-store.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread backend/appwrite/src/runtime/mounted-robot-runtime.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread backend/appwrite/src/runtime/mounted-robot-runtime.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread backend/appwrite/test/transactional-pairing-store.test.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@SloppyBobbert
fix(appwrite): address review findings
66c2d5f
@SloppyBobbert
SloppyBobbert merged commit 9271343 into main Jul 29, 2026
7 checks passed

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Jul 30, 2026
feat(sync): add secure medication backend #87
Merged
feat(sync): authorize paired robot devices #88
Merged
feat(sync): enforce medication sync authority #121
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Aug 10, 2026
fix(config): make Appwrite environments portable #128
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments
Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@SloppyBobbert
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.