Skip to content

[1/4] Multi-hop query: skeleton E2E#217

Open
zipdoki wants to merge 6 commits intomainfrom
feat/214-skeleton
Open

[1/4] Multi-hop query: skeleton E2E#217
zipdoki wants to merge 6 commits intomainfrom
feat/214-skeleton

Conversation

@zipdoki
Copy link
Contributor

@zipdoki zipdoki commented Mar 17, 2026

Skeleton E2E for design alignment of the wide-row EdgeCache model (Phase 0 of #214).

This PR introduces the EdgeCache wide-row design and validates it end-to-end with mocks, covering metadata creation → data insertion → multi-hop query.

Step 1: Metadata Creation

Add caches field to edge schema — defines cache name, sort fields, and row limit.

"caches": [
  {
    "cache": "recent_wishlist",
    "fields": [{"field": "createdAt", "order": "DESC"}],
    "limit": 100
  }
]

Step 2: Data Insertion

Introduce EdgeCacheRecord as a wide-row model — row key encodes source/table/direction/cache, qualifier holds sort values + target, value holds version + properties.

[EdgeCache - Wide Row]
Row       : hash(source) | tableCode | EDGE_CACHE(-6) | OUT | cacheCode
Qualifier : cacheValues + target
Value     : version + properties

Step 3: Multi-hop Query

Wire CACHE step type into ActionbaseQuery — resolves source references from previous hops and scans the EdgeCache row.

curl -X POST http://localhost:8080/graph/v3/query \
  -H "Content-Type: application/json" \
  -d '{
    "query": [
      {
        "type": "SCAN",
        "name": "hop1",
        "service": "social",
        "label": "follows",
        "src": {"type": "VALUE", "value": ["user1"]},
        "dir": "OUT",
        "index": "created_at_desc",
        "limit": 100,
        "include": false
      },
      {
        "type": "CACHE",
        "name": "hop2",
        "service": "commerce",
        "label": "wishlist",
        "src": {"type": "REF", "ref": "hop1", "field": "tgt"},
        "dir": "OUT",
        "cacheName": "recent_wishlist",
        "limit": 10,
        "include": true
      }
    ]
  }'

EdgeCache Query Endpoint

Add a REST endpoint for single-key EdgeCache lookup.

curl -X GET "http://localhost:8080/graph/v3/databases/{database}/tables/{table}/edges/cache/{cache}?start={source}&direction=OUT&limit=10"

How to test

./gradlew :server:test --tests "*.ActionbaseQueryCacheE2ETest"
./gradlew :engine:test --tests "*.ActionbaseQueryParserSpec"
./gradlew :core:test --tests "*.EdgeSchemaSerializationTest"
./gradlew :core:test --tests "*.TableSerializationTest"

Introduce EdgeCacheRecord wide-row model and wire CACHE step type into ActionbaseQuery.
@zipdoki zipdoki requested a review from em3s as a code owner March 17, 2026 02:23
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Mar 17, 2026
@zipdoki zipdoki mentioned this pull request Mar 17, 2026
5 tasks
Comment on lines +17 to +18
val createCacheRecords: List<EdgeCacheRecord> = emptyList(),
val deleteCacheRecordKeys: List<EdgeCacheRecord.Key> = emptyList(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks necessary, but feels out of scope here. Let’s track this separately.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. Out of scope

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. Out of scope

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. Out of scope

Copy link
Contributor

@em3s em3s left a comment

Choose a reason for hiding this comment

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

The tests ActionbaseQueryParserSpec.kt and ActionbaseQueryCacheE2ETest.kt are well written. Any changes not required to run these tests are out of scope for this PR.

Suggestions:

  1. Remove out-of-scope changes not required to run the two tests.
  2. Add a dedicated /graph/v3/databases/{database}/tables/{table}/edges/cache endpoint alongside get, scan, count, and agg, with tests.
  3. Migrate ActionbaseQuery to v3 as a separate PR before this one, then update the tests to use it.

zipdoki and others added 3 commits March 18, 2026 13:22
Remove EdgeCacheRecord, EdgeRecordType.EDGE_CACHE, EdgeMutationRecords
cache fields, and V2BackedTableBinding TODO comments that are not
required for the skeleton E2E tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce GET /graph/v3/databases/{db}/tables/{table}/edges/cache/{cache}
endpoint as a stub returning empty results, preparing for Phase 1 implementation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@zipdoki zipdoki changed the title [1/4] Multi-hop query: EdgeCache model and skeleton E2E [1/4] Multi-hop query: skeleton E2E Mar 18, 2026
.scan(database, table, index, start, direction, limit, offset, ranges, filters, features)
.mapToResponseEntity()

@GetMapping("/graph/v3/databases/{database}/tables/{table}/edges/cache/{cache}")
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to rename the cache/{cache} endpoint. Here are the candidates:

  • lookup/{cache} — looking up a pre-built wide row structure
  • seek/{cache} — pairs well with scan, same low-level DB terminology
  • hop/{cache} — reflects its role in multi-hop graph traversal
  • walk/{cache} — walking the graph step by step

Which do you prefer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@em3s
I prefer seek/{cache} — consistent with existing DB terminology, and jumping directly to a row key aligns well with EdgeCache wide-row lookups. What do you think?

Cache stub does not validate table existence, so expect 200 with empty
result instead of 404.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@zipdoki
Copy link
Contributor Author

zipdoki commented Mar 18, 2026

@em3s
Addressed your feedback — thanks for the review!

  1. Removed out-of-scope changes. ✅
  2. Added the /edges/cache/{cache} endpoint with tests. ✅
  3. Opened Migrate ActionbaseQuery to v3 service layer #218 as a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants