feat(api): refactor Google Sheets client layer#100
Merged
archiewood merged 34 commits intoevidence-dev:mainfrom Feb 12, 2026
Merged
feat(api): refactor Google Sheets client layer#100archiewood merged 34 commits intoevidence-dev:mainfrom
archiewood merged 34 commits intoevidence-dev:mainfrom
Conversation
Guard GCC/Clang warning flags from MSVC and skip unit tests on Emscripten. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Unit tests run as reusable workflow, gating all downstream jobs - SQL tests run after unit tests using service account key file auth - Distribution builds only start after both test stages pass - Remove unit test subdirectory from extension build (standalone only) - Guard compiler warning flags for MSVC compatibility - Add test_sql.sh script for local and CI SQL test execution - Replace legacy generate_google_token.py with minimal token generator - Organize .gitignore Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fork PRs don't have access to repository secrets, so SQL tests now skip with a warning instead of failing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add concurrency cancel-in-progress to SQL tests and deploy docs - SQL tests support workflow_call, pull_request_target, and workflow_dispatch - pull_request_target requires integration-tests environment approval - workflow_dispatch allows maintainers to manually test fork PR refs - Gracefully skip when credentials unavailable Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Windows headers define DELETE as a macro, causing MSVC build failures. Also update development docs with repo layout, testing guide, and CI pipeline overview. Add CLAUDE.md for quick reference. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
archiewood
reviewed
Feb 3, 2026
ee95c6e to
4d25a5d
Compare
Member
|
Thank you @mharrisb1 ! |
Closed
This was referenced Feb 12, 2026
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.
Problem
The current implementation has authentication, HTTP transport, and API logic tightly coupled:
Solution
Introduce clean separation of concerns with three distinct layers:
IHttpClient)IAuthProvider)GoogleSheetsClient)This enables:
MockHttpClientWhat Changed
IHttpClient,HttpLibClient,MockHttpClientBearerTokenAuth,OAuthAuth,ServiceAccountAuthGoogleSheetsClient,SpreadsheetResource,ValuesResourceCreateAuthFromSecret()shared between read and copyGetGSheetSecret()reusable helpergsheets_read.cppgsheets_copy.cppCI Pipeline
Restructured the CI pipeline to gate builds behind tests:
graph LR A[push / pull_request] --> B[Unit Tests] B --> C[SQL Tests] C --> D[Build next] C --> E[Build stable]UnitTests.yml), called by the main pipelineSQLTests.yml), using a service account key file to authenticate against the Google Sheets API (bothTOKENandKEY_FILE_PATHtests)add_subdirectory(test/unit)from rootCMakeLists.txtso unit tests only build in their own workflow (fixes WASM build failure)scripts/test_sql.shfor running SQL tests locally and in CIgenerate_google_token.pywith minimal token generatorgoogle-auth+requestsClient API
Architecture
flowchart TB subgraph "Extension Layer" EXT[gsheets_extension.cpp] READ[gsheets_read.cpp] COPY[gsheets_copy.cpp] end subgraph "Service Layer" CLIENT[GoogleSheetsClient] SPREAD[SpreadsheetResource] VAL[ValuesResource] end subgraph "Auth Layer" AUTH[IAuthProvider] BEARER[BearerTokenAuth] OAUTH[OAuthAuth] SA[ServiceAccountAuth] AUTH --> BEARER AUTH --> OAUTH AUTH --> SA end subgraph "Transport Layer" HTTP[IHttpClient] HTTPLIB[HttpLibClient] MOCK[MockHttpClient] DUCKDB["DuckDBHttpClient"] HTTP --> HTTPLIB HTTP --> MOCK HTTP --> DUCKDB end EXT --> READ EXT --> COPY READ --> CLIENT COPY --> CLIENT CLIENT --> SPREAD SPREAD --> VAL CLIENT --> AUTH VAL --> HTTP SA --> HTTP HTTPLIB --> |HTTPS| GOOGLE[Google APIs]Next Steps
gsheets_get_token.cpp- Replace legacy JWT/token code withServiceAccountAuthingsheets_auth.cpp(CREATE SECRET path)DuckDBHttpClientusing DuckDB'sHTTPUtilto enable WASM support and leverage DuckDB's built-in HTTP handlingHttpQueryParamssupport to the transport layer for cleaner URL building (currently hardcoded in path strings)Related Issues & PRs
Directly Addresses
perform_https_requestfor WASMIHttpClientinterface enables swappable HTTP implementationsEnables / Unblocks
DuckDBHttpClientstub ready for HTTPUtil implementationHttpLibClientor via decorator patternOAuthAuthclass simplifies OAuth flow changesIAuthProviderinterface enables new auth methodsNoAuthProviderreturning empty headerFoundation for Future Work
SpreadsheetResourcewill exposeCreate()methodValuesResourceprovides bothAppend()andUpdate()