feat: go export microservice drop in with gRPC comms and thin API shim#2153
Draft
PeterBaker0 wants to merge 4 commits into
Draft
feat: go export microservice drop in with gRPC comms and thin API shim#2153PeterBaker0 wants to merge 4 commits into
PeterBaker0 wants to merge 4 commits into
Conversation
PeterBaker0
marked this pull request as draft
June 23, 2026 06:00
PeterBaker0
force-pushed
the
feat/go-export-service-3d4e
branch
from
June 24, 2026 04:05
a979119 to
1bc1a2a
Compare
Co-authored-by: Peter Baker <PeterBaker0@users.noreply.github.com> Signed-off-by: Cursor Agent <cursoragent@cursor.com>
Signed-off-by: Peter Baker <peter.baker122@csiro.au>
… tests, and CI Bring the Go gRPC export sidecar closer to production parity with the Node exporters by fixing deleted-related-record stripping, broadening attachment ZIP field detection, hardening CouchDB HTTP calls, and adding rollout controls. Go service: - Port stripDeletedRelatedRefs for CSV, spatial, full, and JSON records exports - Include TakePhoto and FileUploader fields in attachment ZIP exports - Add Health RPC, optional shared-secret auth, structured gRPC error codes - Add EXPORT_FORMAT_JSON_RECORDS and configurable chunk size - Add unit tests for CSV escaping, filenames, related refs, attachments, spatial empty output, auth, and error mapping API: - Replace ad-hoc exportGrpcClient usage with exportHttpStreamer bridge - Support EXPORT_SERVICE_MODE (auto|grpc|legacy) and GRPC_URL alias - Wire all download routes and GET /:id/records/ through the unified bridge - Add exportServiceStreamer tests with injectable client and rollout config CI: - Run go test and build for export-service on every PR Co-authored-by: Peter Baker <PeterBaker0@users.noreply.github.com> Signed-off-by: Cursor Agent <cursoragent@cursor.com>
Signed-off-by: Peter Baker <peter.baker122@csiro.au>
PeterBaker0
force-pushed
the
feat/go-export-service-3d4e
branch
from
June 24, 2026 04:21
1bc1a2a to
5a56cef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Introduces a Go gRPC export sidecar that performs the heavy lifting of notebook exports while Conductor keeps auth, download-token validation, and HTTP response headers unchanged. The API gains a thin bridge (
exportHttpStreamer) that streams gRPCFileChunks straight to the browser and falls back to the existing Node exporters when the sidecar is unavailable.This is a drop-in rollout: with no export-service configured, behaviour stays on the legacy Node path.
Go export service (
export-service/)proto/export.protowith committed Go bindings underinternal/pbx-export-service-secretmetadataEXPORT_PROFILE=true) for memory, goroutines, and active export statsgo test ./...andgo buildon every PRAPI shim (
api/src/services/)exportServiceClient— lazy gRPC client from shared proto; maps export payloads to protobuf requestsexportHttpStreamer— unified routing for all download routes andGET /:id/records/exportTypes— shared TypeScript types for formats, rollout mode, and gRPC payloadsEXPORT_SERVICE_GRPC_ADDRESS/EXPORT_SERVICE_GRPC_URL— sidecar addressEXPORT_SERVICE_MODE—auto(default),grpc, orlegacyEXPORT_SERVICE_SHARED_SECRET— optional mutual authEXPORT_SERVICE_GRPC_DEADLINE_MS— optional call deadlineautomode: pre-stream gRPC failures fall back to legacy Node exporters; mid-stream failures destroy the HTTP response (partial downloads cannot be safely restarted)grpcmode: no fallback — sidecar must be availablelegacymode so existing API tests are unaffectedConfiguration
Conductor (API)
EXPORT_SERVICE_GRPC_ADDRESSEXPORT_SERVICE_MODEautoauto,grpc, orlegacyEXPORT_SERVICE_SHARED_SECRETEXPORT_SERVICE_GRPC_DEADLINE_MSGo export service
EXPORT_GRPC_ADDR:9090COUCHDB_INTERNAL_URLhttp://localhost:5984COUCHDB_USER/COUCHDB_PASSWORDadmin/passwordEXPORT_PROFILEfalseSee
export-service/README.mdfor local development commands.Test plan
cd export-service && go test ./...— unit tests for CSV escaping, filenames, deleted related refs, attachments, spatial output, auth, error mappingcd api && pnpm test— includesexportServiceStreamer.test.ts(grpc piping, legacy mode, mid-stream failure, auto fallback)EXPORT_SERVICE_GRPC_ADDRESSunset; verify CSV, photo ZIP, GeoJSON, KML, full export, and JSON records download as beforeEXPORT_SERVICE_GRPC_ADDRESS=localhost:9090,EXPORT_SERVICE_MODE=auto; start sidecar; confirm exports stream via gRPC; stop sidecar and confirm pre-stream fallback to NodeEXPORT_SERVICE_MODE=grpc; confirm exports fail clearly when sidecar is down (no silent fallback)EXPORT_SERVICE_SHARED_SECRETon API and sidecar; confirm unauthenticated gRPC calls are rejected