Skip to content

v0.2.0

Choose a tag to compare

@apstndb apstndb released this 05 Jul 16:10
· 4 commits to main since this release
7dd2921

Breaking changes

Context-first API

Client.Context has been removed. All request methods now take context.Context as their first parameter:

  • DoAPIRequest(ctx, method, reqURL, body, contentType)
  • DoGet(ctx, reqURL)
  • DoJSONPost(ctx, reqURL, body)
  • BatchGetDocuments(ctx, names)

Migration for dependents (dkcli, gcp-docs-mirror-tools, spanner-mycli):

  1. Remove Client.Context field assignment.
  2. Pass ctx as the first argument to every Client method call.
  3. If you previously relied on Client.Context for cancellation/timeouts, pass that same context per call instead.

BatchGetDocuments validation

BatchGetDocuments now rejects empty name lists and more than MaxBatchGetDocuments (20) names per call. Use the new BatchGetDocumentsAll helper for larger lists (see below).

New features

  • MaxBatchGetDocuments constant — documents the API limit of 20 names per documents:batchGet call.
  • BatchGetDocumentsAll(ctx, names) — fetches documents in chunks of MaxBatchGetDocuments while preserving input order.
  • Document.ContentLengthBytes — new field mapped from the API's contentLengthBytes.
  • Package documentation — added doc.go with godoc for the dkapi package.
  • Agent instructions — added AGENTS.md (referenced by CLAUDE.md) documenting module purpose, conventions, and verification commands.
  • CI workflow — GitHub Actions runs go test -race, go vet, golangci-lint, and govulncheck on Go 1.24 and 1.25.
  • Dependabot — weekly updates for Go modules and GitHub Actions.
  • golangci-lint config.golangci.yml with errcheck, govet, staticcheck, and unused linters.

Fixes

  • CLOUDSDK_CONFIG ADC resolution — when CLOUDSDK_CONFIG or GOOGLE_APPLICATION_CREDENTIALS is set, or when the default ADC credentials file exists, token and quota-project metadata are read from that file instead of falling through to metadata-server ADC.
  • external_account quota project — ADC now requires a quota project for external_account credentials (in addition to authorized_user), matching authorized_user behavior.
  • Bounded error-body readsCheckResponse limits response body reads to 1 MiB for non-2xx and 429 responses, preventing unbounded memory use on error responses.
  • NormalizeDocName hardening — handles full URLs via url.Parse, strips query strings and fragments, removes trailing slashes, accepts uppercase HTTP:///HTTPS:// prefixes, and normalizes empty input to documents/.

Documentation

  • README — updated example for context-first API, documents BatchGetDocumentsAll, CLOUDSDK_CONFIG support, bounded error reads, and links to pkg.go.dev.

Dependent repos

Open PRs in dkcli, spanner-mycli, and gcp-docs-mirror-tools that pin pseudo-versions of this module should update to:

go get github.com/apstndb/developerknowledge-go@v0.2.0

Not included

PR #20 (expand retry policy beyond 429-only) remains open and is not part of this release.