Skip to content

feat: filter vehicles by synthetic device connection - #187

Merged
elffjs merged 1 commit into
mainfrom
feat/filter-vehicles-by-connection
Jul 15, 2026
Merged

elffjs merged 1 commit into
mainfrom
feat/filter-vehicles-by-connection

Conversation

@elffjs

@elffjs elffjs commented Jul 15, 2026

Copy link
Copy Markdown
Member

What

Adds a connection field to VehiclesFilter so callers can list all vehicles paired with a synthetic device that belongs to a given connection, keyed by the connection's address:

{
  vehicles(first: 100, filterBy: { connection: "0x1111...1111" }) {
    totalCount
    nodes { tokenId owner syntheticDevice { tokenId } }
  }
}

Because it's a filter on the existing vehicles query, it composes with the other filters for free — e.g. filterBy: { connection: "0x...", make: "Toyota", owner: "0x..." }.

How

A vehicle links to a connection only through its synthetic device, and synthetic_devices.connection_id is a FK to connections.id (the 32-byte padded name), not the address. So when the filter is set, queryModsFromFilters joins vehicles → synthetic_devices → connections and filters on connections.address. No migration required.

Tests

Added connection + synthetic-device fixtures to the vehicle filter suite and three cases: connection alone, connection + owner, and a no-results combo. Full internal/repositories/vehicle package suite passes.

Notes / open questions

  • Naming: went with the plain connection on the filter. syntheticDeviceConnection would be more self-documenting but verbose — happy to rename.
  • MCP: did not add an @mcpExample demonstrating the connection filter on the vehicles query. Can add one if we want the MCP tool to advertise it.

🤖 Generated with Claude Code

Add a `connection` field to `VehiclesFilter` (keyed by connection address)
so callers can list all vehicles paired with a synthetic device under a
given connection. A vehicle links to a connection through its synthetic
device, so this joins vehicles -> synthetic_devices -> connections and
filters on the connection address.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@elffjs
elffjs merged commit 31ecdd0 into main Jul 15, 2026
2 checks passed
@elffjs
elffjs deleted the feat/filter-vehicles-by-connection branch July 15, 2026 15:01
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