Skip to content

perf: cut over read paths to local projections#28

Merged
dutifulbob merged 5 commits into
mainfrom
perf/read-path-cutover
Apr 25, 2026
Merged

perf: cut over read paths to local projections#28
dutifulbob merged 5 commits into
mainfrom
perf/read-path-cutover

Conversation

@dutifulbob
Copy link
Copy Markdown
Member

Summary

Read endpoints were still doing write-style repository setup before returning data.
This change makes hot reads use the local repository projection that already exists in the shared database.
It also batches search group hydration and adds named timing steps to request logs, so production logs show which part of a read is slow.

What Changed

Reads now avoid GitHub mirror setup work unless they are actually mutating state.
Write paths still use EnsureRepository, because writes may need to create or refresh the local projection.

  • Added readRepositoryProjection for read-only repository lookup.
  • Switched hot reads and access-grant listing to local projection reads.
  • Batched group hydration for search results by public ID.
  • Added compact named query step timings such as repo_read, search_text_rows, mirror_batch_objects, and annotations_batch.
  • Extended tests for query step metrics and search group hydration.

Testing

The local gates pass with the existing coverage and lint thresholds unchanged.
Production verification will happen after merge and deploy.

  • npx --yes @simpledoc/simpledoc@0.1.6 check
  • go vet ./...
  • go test ./...
  • ./scripts/check-go-coverage.sh
  • /home/bob/go/bin/golangci-lint run --timeout=5m
  • go run github.com/goreleaser/goreleaser/v2@latest check
  • git diff --check

Risks

The intended behavior change is that read endpoints now require the repository projection to already exist locally.
That matches the unified database architecture: reads should not call ghreplica to bootstrap repository state.
Mutation paths still keep the old ensure behavior.

@dutifulbob
Copy link
Copy Markdown
Member Author

Implementation-loop report:

  • Local validation passed: SimpleDoc, go vet, go test ./internal/core ./internal/httpapi ./..., coverage gate, golangci-lint, GoReleaser config check, and git diff --check.
  • Codex review found no actionable correctness issues after the final patch.
  • GitHub CI is green: validate and lint both passed.
  • Key behavior: read paths no longer perform repository upserts; they validate current ghreplica identity and then use local prtags projections for joins/hydration.

@dutifulbob dutifulbob merged commit e26c9c8 into main Apr 25, 2026
2 checks passed
@dutifulbob dutifulbob deleted the perf/read-path-cutover branch April 25, 2026 19:30
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