Skip to content

test(coverage): api → ≥95% (models, db, handlers slices) + OSV dep bump#163

Merged
mastermanas805 merged 42 commits into
masterfrom
coverage/api-integration
May 23, 2026
Merged

test(coverage): api → ≥95% (models, db, handlers slices) + OSV dep bump#163
mastermanas805 merged 42 commits into
masterfrom
coverage/api-integration

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

Integration of the api coverage drive, validated together before master:

Full CI runs here. 🤖 Generated with Claude Code

mastermanas805 and others added 30 commits May 23, 2026 08:47
Covers db/cache/nosql/queue/queue_provider/storage/storage_presign/
provision_helper/family_bulk_twin handler files via bufconn fake
provisioner, sqlmock, miniredis, and package-var seams. New exports
live in export_provarms_test.go (not the shared export_test.go).

Co-authored-by: Claude <noreply@anthropic.com>
Clears OSV-Scanner/govulncheck (GO-2026-5005..5033 crypto, 5025..5030 net).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Raise the handler files the prior slice left below 95% (resource, webhook,
onboarding, admin_customers, admin_impersonate, admin_promos_audit,
admin_customer_notes, billing) plus internal/middleware to ≥95%.

Seams added (production behavior unchanged — vars default to the real fn):
- admin_impersonate.go: signImpersonationToken var (drives sign_failed 503).
- webhook.go: cryptoEncrypt var (drives storeEncryptedURL encrypt-fail).

Techniques: brokenDB closed-pool for db_failed arms; DATA-DOG/go-sqlmock for
mid-sequence failures (mark-converted / team-create / user-create, soft-delete,
List scan/rows-err, Detail per-query failures); bufconn fakeProvisioner for the
Delete gRPC-deprovision arm; a dead MinIO endpoint for the storage-deprovision
warn arm; dead-Redis clients for fail-open arms; real onboarding JWTs minted
in-process for claim/preview/start branches; the cov2 webhook harness for the
payment-failed + charged-receipt arms.

All new test files carry a _residual suffix; new re-exports live in
export_residual_test.go (no edits to the shared export_test.go /
export_rbw_test.go / export_billing_test.go).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…/internal_*/custom_domain/storage)

Recovers handler coverage that was 0% under CI's postgres-only matrix because
the routes were k8s/storage-gated and never wired into a test app:
- api_keys, internal_resend_magic_link, internal_backup_refund, magic_link_circuit
  ctors: pure DB + fake-mailer, now driven end-to-end.
- logs.go: typed clientset field against kubernetes.Interface + SetClientset
  seam so a k8s fake clientset exercises the tier/status/pod-list/stream arms.
- custom_domain.go: stubbed CustomDomainProvider + real DB drives
  Create/List/Verify(ingress+cert+fail)/Delete.
- storage.go + storage_presign.go: real do-spaces-backed provider (zero network
  at provision/presign time) drives broker-mode + authenticated + presign arms.

internal/handlers under CI conditions: 80.9% -> 84.6%.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- coverage.yml: add a NATS service (8222 monitor) so /queue/new's NATS health
  check passes — without it every queue provision 503s and the handler's
  provision + per-tenant-credential arms never run under CI. Switch the
  postgres service to pgvector/pgvector:pg16 (drop-in superset) so /vector/new's
  CREATE EXTENSION vector succeeds instead of skipping (~44% -> covered).
- queue.go: add SetCredProvider seam; new test injects a fake
  QueueCredentialProvider to cover the AuthMode=isolated success + creds-error
  fallback arms (legacy_open provider can't reach them).
- audit.go: filter/tier/CSV/masked-email arms via query-param matrix + all tiers.
- backup.go: parseListCursor/parseIntStrict arms via bad/huge ?limit + ?before.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
White-box coverage for confirmationLinkBase / buildConfirmationLink / teamIsPaid
/ deletionAuditKind* / deletionAuditResourceType / EmailConfirmDeletionRedirect-
Handler — pure string/URL composition + a no-side-effect 302 that the
deploy/stack delete-confirm flow only reaches when provisioning is available.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…elete arms

- github_deploy.go: Get (connected/not-connected/not-found/cross-team) and
  Disconnect (happy/idempotent/not-found/cross-team) — existing tests only
  covered Connect + Receive.
- vault.go: GetSecret version-fetch + validation arms, ListKeys, DeleteSecret
  arms via the existing vaultTestApp + makeTeamUser helpers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… + family-binding helpers

- twin.go: beginTwinApproval (202 pending-approval, hermetic — short-circuits
  before provisioning) + consumeApprovedTwin invalid/not-found arms (were 0%).
- promote_approval.go: checkApproveRateLimit (real redis, under + over budget) +
  the 5 approval HTML helpers (white-box).
- family_bindings.go: BindingError.Error, mapBindingError every kind + default +
  empty-key label, nameOrType, nameOrEmpty (white-box pure helpers).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…brevo webhook arms

- webhook.go: newWebhookAuthenticated (team-owned provision + receive verbs +
  list-requests) — anonymous-path tests didn't reach it.
- vector.go: newVectorAuthenticated (pro-team pgvector provision) — now reachable
  with the pgvector CI image; skips cleanly if backend unavailable.
- email_webhooks.go: Brevo invalid-payload / missing-email-skip / insert-fail
  fail-open arms via sqlmock.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…Hostname + SNS pure helpers

- stack.go: Delete email-confirm 202 + Cancel + immediate-skip-header + not-found
  + cross-team; UpdateEnv not-found/invalid-body/missing-env/invalid-key/merge+
  delete/deleting-409 (custom app wires the noop email client + confirm routes).
- custom_domain.go: validateHostname every rejection arm (white-box).
- sns_verify.go: parseSNSCertPEM / buildSNSSigningString / snsFieldValue
  white-box (the network defaultFetchCert path stays out by design).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…p path

- stack.go New: missing-manifest / invalid-manifest / missing-tarball / per-tier
  deployment-cap 402 (noop provider).
- vector.go: anonymous dedup path (vectorAnonymousLimits + decryptConnectionURL
  on the limit-exceeded branch) after exceeding the per-fingerprint cap.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…+ audit pure helpers

- internal_terminate.go: empty-token / bad-purpose / missing-iat / future-iat-skew
  verify arms (existing test covered wrong-secret/expired/mismatch/missing-bearer).
- vault.go CopySecrets: missing/invalid from-to env, same-env, invalid-key-in-
  allowlist, invalid-body validation arms.
- audit.go: maskEmail all 4 arms + tierLookbackDays blocked/unlimited/bounded
  (white-box).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Covers Receive's non-push-event ignore, branch-mismatch ignore, zero-SHA
branch-delete ignore, and invalid-push-payload 400 — the idempotency/ping/
signature tests didn't reach these branch-filter arms.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
custom_domains.hostname is GLOBALLY unique and SetupTestDB reuses one shared
instant_dev_test DB, so hardcoded hostnames collided across consecutive runs
(and the rate-limit IP key survived its 2s TTL). Switch custom-domain hostnames
+ the promote-approval rate-limit IPs to per-run uuid-derived values. Verified
3x consecutive runs green without a DB reset.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…domain/deletion_confirm/webhook/storage

Build fake-client scaffolding (no waivers) to drive previously-unreachable
error and network arms under CI conditions:

- billing.go: add BillingPortal interface + billingPortalFactory seam
  (SetBillingPortalForTestPortal) so ListInvoicesAPI / UpdatePaymentMethodAPI /
  ChangePlanAPI post-subscription arms (success / circuit-open / razorpay-error)
  run against a FAKE Razorpay portal — never a real network call, never rzp_live.
  93.4% -> 94.9%.
- vault.go: bad-AES-key app + closed-DB app drive encrypt/decrypt/persist/fetch/
  list/delete/copy error arms; invalid-team JWT + validate-arms + quota-blocked
  copy. 79.9% -> 93.7%.
- deletion_confirm.go: BV* export seams drive requestEmailConfirmedDeletion /
  resolveEmailConfirmedDeletion / cancelEmailConfirmedDeletion through a real
  fiber.Ctx + fake Mailer + crafted pending_deletions rows. 74.8% -> 89.3%.
- twin.go: consumeApprovedTwin approval-gate arms (not-approved/mismatch/expired/
  wrong-team/success) + family-validate twin_exists + redis dispatch. 65.1% -> 80.2%.
- custom_domain.go: stubbed CustomDomainProvider cert-poll/still-issuing/cap/
  ingress-teardown arms + validateHostname rejections + closed-DB arms. 76.8% -> 82.6%.
- webhook.go: auth invalid-team + garbage-ring-item decode-skip. 90.6% -> 91.0%.
- storage.go: authenticated quota-exceeded / team-lookup-fail / invalid-team arms.

All new tests carry the _bvwave suffix; re-exports live in export_bvwave_test.go
(no collisions with existing export_*_test.go). go build ./... + go vet clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…b_deploy/resource

Adds black-box + targeted-arm tests pushing internal/handlers coverage on the
four target files via fake-provider scaffolding (no production code touched):

- vector.go (67.9%→84.2%): bufconn fakeProvisioner gRPC arm of provisionVectorDB
  + createPgvectorExtension stub (now 100%); decryptConnectionURL three arms via
  exported VectorDecryptConnectionURLForTest; anon/auth validation + 402 + gRPC-
  error + persist-failure arms.
- backup.go (78.9%→85.3%): CreateRestore target_resource_id arms (invalid/
  not-found/cross-team/type-mismatch/happy/missing-sha256); list/map all-optional-
  fields; requireOwnedResource fetch_failed (brokenDB); parseIntStrict too-large;
  parseUserIDFromCtx malformed.
- github_deploy.go (73.3%→81.8%): Connect invalid_body/invalid_branch/
  already_connected(409)/installation_id; Receive deploy-triggered(202)+rate-
  limit(429); not-found arms (bad uuid / unknown connection / cross-team).
- resource.go (92.8%→93.4%): pause/resume provider HAPPY paths against real
  pg/redis/mongo (revoke/grant CONNECT, ACL on/off, role grant/revoke) via
  exported Call{Pause,Resume}ProviderForTest; RotateCredentials postgres+redis
  happy paths.

New test-only export file export_vecwave_test.go (no duplicate re-exports).

Residual <95% arms are error-injection (DB-mid-call failure, races, recycle/
dedup birthday-collision) and the unreachable crypto/rand.Read arm
(RotateCredentials, Go 1.26) — documented in the brief report.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a CreateCheckoutAPI test that wires Redis (exercising the SETNX dedup
guard success path) and posts malformed JSON to hit the invalid_body 400 arm.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds the deploy/stack async-build-pipeline coverage slice (suffix
_deployasync). Builds a fault-injecting database/sql driver
(faultdb_deployasync_test.go) that proxies lib/pq and forces query/exec
failures after the Nth call, so the mid-handler 'first query succeeds →
a later query errors → 503' arms — unreachable with a plain closed-DB
handle — are exercised across Get/Logs/List/UpdateEnv/Delete/Redeploy/
Promote/Family/ConfirmDelete/CancelDelete.

Per-file coverage (CI conditions, pgvector pg16 + redis7 + mongo6 + nats):
  deploy.go            86.3% → 95.2%
  promote_approval.go  72.5% → 93.5%
  stack.go             80.9% → 92.5%

Covers runStackDeploy/runStackRedeploy/captureAutopsy/runDeploy +
per-service onUpdate/onImageBuilt callbacks via the existing noop
StackProvider/compute.Provider doubles + SetStackProvider/
SetComputeProvider seams, plus ghost-team requireTeam error arms,
TTL/env/tarball validation arms, promote create/in-place/vault paths,
and email-confirmed deletion deprovision flows.

Residual <95% arms are test-resistant: k8s-provider constructors
(need a live cluster), corrupted-multipart tarball open/read arms,
crypto/rand + marshal-of-controlled-data branches (cannot fail), and
CAS-lost-race !ok branches (concurrency-only). Documented in the
agent report.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…r/backup/storage/stack/resource/webhook/api_keys + DNS+minio+twin seams

Drives the api internal/handlers package coverage up via:
- twin.go: faultdb DB-error arms (source/team/approval lookups, execute,
  validate-family) + bad-team-id + named-source carry-forward + derefUUID unit.
- github_deploy.go: Connect/Get/Disconnect/Receive fetch/create/delete/enqueue/
  decrypt DB-error arms via faultdb + httptest-signed push; requireTeam arms.
- custom_domain.go: NEW lookupTXT package-var seam → TXT-match success +
  cert->ready transition; faultdb DB-error arms across requireTeam/Stack/Domain,
  Create/List/Delete; serialize optional fields.
- vector.go / storage.go: bufconn fakeProvisioner + NEW hermetic prefix-scoped
  storage impl (storage.NewWithImpl seam) → credential mode + per-tenant IAM
  audit arm; soft-delete + persist-fail arms.
- backup.go: count-fail-while-list-succeeds + insert/team/list DB-error arms.
- stack.go: k8s-provider-fallback constructor branch, checkStackDeployLimit
  redis-error, stackOwnerCheck anon-mismatch, consumeApprovedPromote DB-error.
- resource.go: Pause/Resume/Rotate faultdb DB-error + rollback arms.
- webhook.go / api_keys.go / family_bulk_twin.go: auth + DB-error arms.
- agent_action / maskSourceIP / buildContextConfig pure-function default branches.

New seams: custom_domain.lookupTXT package var; storage.NewWithImpl (hermetic
prefix-scoped impl); reuse of existing faultdb driver + bufconn fakeProvisioner.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…l_terminate + pure-func default branches

- status.go: compute per-component fail-open + listComponents-error 500.
- api_keys.go: Create/List/Revoke db_failed via faultdb + bad-id + not-found.
- internal_terminate.go: invalid-team-id + team-lookup/idempotency/pause DB-error arms.
- agent_action/maskSourceIP/buildContextConfig pure-function default branches.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…or arms

ConfirmDelete → resolveEmailConfirmedDeletion missing-token / lookup-failed /
mark-failed arms via faultdb + seeded pending_deletions row.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ugh arm

Drives vector.go's over-cap dedup branch where the existing resource's stored
connection_url fails to decrypt (corrupted post-provision), exercising the
fail-closed fallthrough to fresh provision (vector.go:294-298). DB-exposed
bufconn fixture lets the test corrupt the row + hammer the cap.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…p CreateRestore/ListRestores DB-error arms

- vector.go: over-cap dedup decrypt-fail fallthrough (corrupt all active rows
  then over-cap) + cross-service-fallback 429 (retype rows so type-lookup
  misses but any-lookup hits); auth gRPC-error soft-delete via DB-exposed
  failing bufconn fixture.
- backup.go (now 95.8%): CreateRestore team/backup/inflight/insert DB-error
  arms, no-user 401, missing-ack 400; ListRestores count-fail; bad-team/bad-id
  across all four routes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…rms; storage/vector anon over-cap dedup

- storage.go: decideStorageMode BucketPerTenant+paid branch; auth quota-check
  fail-open + storage-limit-reached 402; anonymous over-cap dedup happy +
  decrypt-fail fallthrough.
- vector.go: anonymous over-cap dedup happy path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… email-disabled; webhook anon over-cap dedup

- stack.go New: deployment_limit_reached 402 (over-cap team), quota_check_failed
  503 (faultdb count error); ConfirmDelete deletion_email_disabled (no email
  client wired).
- webhook.go NewWebhook: anonymous over-cap dedup branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
RotateCredentials persist-error arm (UpdateConnectionURL fails after a
decryptable URL rotate) via faultdb + rfEncryptURL seed helper.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ource_family Family/ListFamilies DB-error arms

- audit.go: List + ListCSV db_failed via faultdb.
- vault.go: PutSecret encryptPlaintext aes-key-invalid 500.
- resource.go (Family/ListFamilies): fetch_failed + invalid_id + list DB-error.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…DB-error arms

- whoami.Get: nil-db early return + tier/email enrichment success.
- usage_wall.GetWall: db_failed via faultdb.
- deploys_audit.List: db_failed via faultdb.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ward 95%

Add 12 _final2 test files covering the biggest reachable uncovered chunks in
the api internal/handlers package, lifting the package from 93.12% → 93.9%
under CI conditions (pgvector/redis/mongo/nats, migrations applied,
go test ./internal/handlers/... -short -count=1 -p 1).

Covered arms (all reachable; no waivers):
- auth.go: GitHub/Google find-or-create LinkID errors, email-lookup DB errors
  (fault DB), Google empty-name team-name fallback. (OAuth flows driven via the
  existing SetOAuthURLsForTest + startFakeOAuth seams.)
- sns_verify.go: full snsVerifier.verify matrix (guards, cert-fetch error,
  sig decode, SignatureVersion 1/unknown/2, happy RSA verify) + getCert
  cache hit/miss/error via a generated throwaway RSA cert + fetchCert seam.
- internal_terminate.go: dunning/downgrade DB-error arms (staged openFaultDB),
  razorpay canceler-not-configured / cancel-error / happy paths.
- internal_resend_magic_link.go: lookup/update-hash DB errors + mark-failed /
  attempts-lookup / mark-abandoned best-effort error arms (fault DB + fake mailer).
- deploy_ttl.go: MakePermanent/SetTTL update_failed + refresh_failed +
  lookupDeployment fetch_failed (seeded deploy + staged fault DB).
- deploy_teardown_reconciler.go: begin_tx_failed, list_failed, empty-tx commit,
  mark_failed (fault DB + existing fakeTeardownProvider).
- env_policy.go: Get fetch_failed, Put role_lookup_failed / owner_required /
  invalid_body / invalid_env_policy / persist_failed / happy.
- billing.go (CreateCheckoutAPI): CreateSubscription circuit-open / razorpay-error
  / incomplete-response / persistence-failure (fake CreateSubscription seam,
  HMAC-signed payloads only, never a real key).
- stack.go: UpdateEnv fetch/persist DB errors + Family fetch_failed (seeded
  stack + staged fault DB).
- audit.go: bad-team-id unauthorized + List/CSV happy paths with metadata +
  actor-email lookup.
- provision_helper.go denyProvisionOverCap (was 0%) + per-handler over-cap
  (no-existing → 429; with-existing → dedup-return) + backend-failure
  soft-delete + finalizeProvision-failure persist arms across
  db/cache/nosql/vector/queue/storage/webhook (anon + authenticated).

No new exported test symbols were required (all arms reachable via existing
export_*_test.go seams or white-box package handlers tests), so no
export_final2_test.go was added.

Provably-unreachable arms left uncovered (documented): defaultFetchCert
(real network), generateOAuthState/issueSessionJWT failures (crypto/rand +
HS256 []byte key cannot fail), the k8s ComputeProvider constructor branch
(needs a live cluster; noop fallback is covered).

Known pre-existing shared-dev-DB flakes unrelated to this change: TestAdminList_*
(limit=100 paging on accumulated data) and TestQueue_* (NATS :8222 monitor not
reachable locally) — verify on a fresh DB per CLAUDE.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…copy list-failed

- family_bulk_twin happy path: seed active postgres+redis+mongodb parents in
  one env and POST /families/bulk-twin to another with working local backends,
  exercising twinOneParent + ProvisionForTwinCore success for all three
  backends (db/cache/nosql 81.8%→89.3%, twinOneParent →82.6%).
- vault.go CopySecrets list_failed arm: rename vault_secrets away after the
  team/tier checks pass (isolated DB) so ListVaultSecretKeys errors → 5xx.

Package 93.9% → 93.93% under CI conditions; only the documented pre-existing
shared-dev-DB flakes remain (TestAdminList_* paging, TestQueue_* NATS :8222).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mastermanas805 and others added 12 commits May 23, 2026 18:29
…ior-preserving seams

Production seams (package-var indirection, prod path unchanged, each new line covered):
- helpers.go: `randRead = rand.Read` — routes generateAppID/generateOAuthState/
  generateSessionID through it so the rand.Read error arm is testable.
- stack.go: `openMultipartFile` (tarball open) + `newK8sStackProvider` factory.
- deploy.go: routes both fh.Open() sites through openMultipartFile; adds
  `newK8sComputeProvider` factory; routes generateAppID through randRead.

Both k8s factory seams cover their default closure body AND the noop-fallback
error arm + the success arm via injected fakes; all seam lines are 100% covered.

New _final3 tests close confirmed-reachable arms: stack/deploy multipart New
error arms, stack Redeploy invalid-form + tarball-open, internal-JWT verifier
wrong-method/bad-uuid arms (terminate/backup-refund/resend), OAuth-start +
CLI-session rand.Read errors, /claim missing-email/invalid-token/already-claimed,
resolveResourceBindings rejection matrix, resource Family not-found/cross-team,
familyMember map name/parent branches, agent-action deployment-limit tiers,
requireName/sanitizeName invalid-UTF8, respondProvisionFailed circuit-open,
twin ProvisionForTwinCore create/validate fault arms, webhook anon over-cap dedup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…eam_members + promote audit

- Cover the newK8sStackProvider / newK8sComputeProvider default closure bodies
  (InvokeDefault*ForTest) AND the noop-fallback error arms (seam forced to
  error) so every new seam production line is 100% covered (patch-coverage).
- team_members cacheInviteResponse (nil-rdb/dead-rdb store-error) + emitInviteAudit
  insert-error arms via exporters + fault DB.
- emitPromoteAuditEvent InsertAuditEvent-error arm via exporter + fault DB.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
missing-fields / unknown-experiment / invalid-variant / action-truncation arms
of POST /api/v1/experiments/converted.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drives (*VaultHandler).audit best-effort warn arm via exporter + fault DB.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ror arms

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… arms

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…id arms

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ror arms

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…seams

Add two behavior-preserving package-var seams to lift internal/handlers coverage:
- var checkStorageQuota = quota.CheckStorageQuota (seams.go); route db/cache/nosql
  call sites through it so StorageExceeded warning arms are reachable in tests.
- var buildLogsClientset over buildLogsK8sClientset; NewLogsHandler + the
  in-cluster/kubeconfig fallback now coverable via a client-go fake clientset.

NewLogsHandler + buildLogsK8sClientset now 100%. Local handlers coverage
93.93% -> 94.8% (capped: TestQueue_* requires NATS, unavailable locally;
authoritative number needs CI with NATS + customer-DB).

Recovered from a stalled background agent (stalled on the full ./... measure).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The TestQueue_IsolatedCreds_EmbeddedInResponse / _CredIssueError_FallsBackToLegacyOpen
coverage tests provision via queueprovider.Provision, which health-checks
http://localhost:8222/healthz (NATSHost defaults to localhost). CI had no NATS
service, so they 503'd on every run — the required build-and-test check has been
red on this branch since they landed. Add a nats-server -m 8222 step (service
containers can't pass -m). Repoint the two NATS-DOWN tests (finalize/softdelete
final2) off 127.0.0.1 to the reserved non-resolvable host nats.test (matching the
7 other queue-fault tests) so a live localhost NATS doesn't satisfy their 503
expectation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mastermanas805 mastermanas805 merged commit 3b549ed into master May 23, 2026
13 checks passed
mastermanas805 added a commit that referenced this pull request May 23, 2026
deploy.yml runs its own 'go test ./... -short -p 1' gate with postgres+redis
but no NATS. After #163 merged the TestQueue_* coverage tests to master, this
gate 503s on them and the deploy aborts before build/push — wedging the deploy
pipeline for every merge to master. Mirror the ci.yml NATS step here.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants