Normalize ATProto CID links in GraphQL responses#40
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🚅 Deployed to the hyperindex-pr-40 environment in hyperindex-v2-setup
|
📝 WalkthroughWalkthroughThis PR fixes GraphQL serialization of ATProto CID links by adding runtime resolvers that normalize CID references. The resolvers support both plain CID strings and Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/graphql/schema/builder_test.go (1)
898-921: ⚡ Quick winPrefer the shared DB test helper for setup consistency.
Line 901–Line 920 manually bootstrap SQLite + migrations; please route this through the shared helper (
internal/testutil/db.go) to keep DB-backed tests consistent and reduce setup drift.As per coding guidelines:
**/*_test.go: Prefer shared test helpers such asinternal/testutil/db.gowhen adding DB-backed tests.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/graphql/schema/builder_test.go` around lines 898 - 921, Replace the manual SQLite/migrations bootstrap in setupSchemaRecordTestDB with the shared test DB helper from internal/testutil/db.go: remove sqlite.NewExecutor, migrations.Run and the explicit exec.Close cleanup, call the shared helper (e.g., SetupTestDB/NewTestDB from internal/testutil/db.go) to obtain the test DB executor/ctx and register its cleanup, then use that executor to construct repositories.NewRecordsRepository, BatchInsert the provided rec, build resolver.Repositories and return resolver.WithRepositories(ctx, repos).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@internal/graphql/schema/builder_test.go`:
- Around line 898-921: Replace the manual SQLite/migrations bootstrap in
setupSchemaRecordTestDB with the shared test DB helper from
internal/testutil/db.go: remove sqlite.NewExecutor, migrations.Run and the
explicit exec.Close cleanup, call the shared helper (e.g., SetupTestDB/NewTestDB
from internal/testutil/db.go) to obtain the test DB executor/ctx and register
its cleanup, then use that executor to construct
repositories.NewRecordsRepository, BatchInsert the provided rec, build
resolver.Repositories and return resolver.WithRepositories(ctx, repos).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 33d77fe3-be0f-4ff8-90f8-c1e493d35de0
📒 Files selected for processing (5)
.changes/unreleased/fix-graphql-cid-link-serialization.yamlinternal/graphql/schema/builder_test.gointernal/graphql/types/mapper.gointernal/graphql/types/object.gointernal/graphql/types/types_test.go
Summary
Blob.refvalues from ATProto{ "$link": "..." }objects into plain CID strings.cid-linkscalar and array fields without changing raw record JSON output.Tests
go test -v ./internal/graphql/typesgo test -v ./internal/graphql/schemago build -v ./...make lintDATABASE_URL=sqlite::memory: go test -v -race ./...make testSummary by CodeRabbit
Bug Fixes