fix: repair unit-test compile + vet failures (partial integration cleanup) #736

Merged
jmiller merged 2 commits from fix/vet-test-suite-blockers into dev 2026-07-05 05:58:55 +00:00
Owner

Fixes pre-existing compile/vet failures found once a local Go toolchain (go1.26.3) let go vet ./... actually run. None relate to #727 — all pre-existing on main.

Complete fixes (verified go vet clean)

  • modules/util/util_test.goCryptoRandomInt/String/Bytes return (value, error); the tests used single-value assignments (5 sites). Now capture + assert the error. go vet ./modules/utilclean.
  • routers/web/repo/issue_comment.go — removed a redundant && statusIDStr != "" duplicate condition (real code, not a test).

Partial (integration suite)

  • tests/integration/auth_oauth2_test.gonewFakeOIDCServer was declared twice with different signatures (build failure); renamed the config variant to newFakeOIDCServerWithConfig + updated its caller.
  • tests/integration/api_license_keys_test.go — outdated NewRequestWithBody([]byte)strings.NewReader(...) (10 sites).

⚠️ tests/integration is broadly pre-existing-broken

Fixing the above revealed the fork's integration-test suite has drifted out of compilation across multiple files (e.g. api_packages_composer_test.go type mismatch, and likely more) — API changes never propagated to the tests. This is why the Project CI / Tests job never passes: the test tree doesn't compile. Fully repairing all 242 integration test files is a separate dedicated effort, out of scope here. This PR takes the isolated/complete wins and two integration files; the rest wants its own pass.

Verified: go build ./... clean; go vet on the whole tree except tests/integration — clean (see PR discussion).

https://claude.ai/code/session_01Wsno14cxE49MstXFs9G5KT

Fixes pre-existing compile/vet failures found once a local Go toolchain (go1.26.3) let `go vet ./...` actually run. **None relate to #727** — all pre-existing on `main`. ## Complete fixes (verified `go vet` clean) - **`modules/util/util_test.go`** — `CryptoRandomInt/String/Bytes` return `(value, error)`; the tests used single-value assignments (5 sites). Now capture + assert the error. `go vet ./modules/util` → **clean**. - **`routers/web/repo/issue_comment.go`** — removed a redundant `&& statusIDStr != ""` duplicate condition (real code, not a test). ## Partial (integration suite) - **`tests/integration/auth_oauth2_test.go`** — `newFakeOIDCServer` was declared twice with different signatures (build failure); renamed the config variant to `newFakeOIDCServerWithConfig` + updated its caller. - **`tests/integration/api_license_keys_test.go`** — outdated `NewRequestWithBody([]byte)` → `strings.NewReader(...)` (10 sites). ## ⚠️ `tests/integration` is broadly pre-existing-broken Fixing the above revealed **the fork's integration-test suite has drifted out of compilation across multiple files** (e.g. `api_packages_composer_test.go` type mismatch, and likely more) — API changes never propagated to the tests. **This is why the `Project CI / Tests` job never passes: the test tree doesn't compile.** Fully repairing all 242 integration test files is a **separate dedicated effort**, out of scope here. This PR takes the isolated/complete wins and two integration files; the rest wants its own pass. Verified: `go build ./...` clean; `go vet` on the whole tree **except** `tests/integration` — clean (see PR discussion). https://claude.ai/code/session_01Wsno14cxE49MstXFs9G5KT
jmiller added 2 commits 2026-07-05 05:28:25 +00:00
fix: repair pre-existing test-suite compile/vet failures
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 1m15s
5d797431f0
`go vet ./...` (finally runnable with a local Go toolchain) surfaced three
pre-existing failures that prevented the whole test tree from compiling — which
is very likely why the "Project CI / Tests" job never went green. None relate to
#727; all pre-existing on main.

- modules/util/util_test.go: CryptoRandomInt/String/Bytes now return (value,
  error); the tests used single-value assignment. Updated to capture + assert
  the error (and dropped a now-redundant `var err error`).
- tests/integration/auth_oauth2_test.go: `newFakeOIDCServer` was declared twice
  with different signatures (redeclaration = build failure). Renamed the
  config-struct variant to `newFakeOIDCServerWithConfig` and updated its caller;
  the (sub, oid) variant keeps the original name for its caller.
- routers/web/repo/issue_comment.go: removed a redundant `&& statusIDStr != ""`
  duplicate condition (vet: redundant and).

Verified: `go vet ./modules/util` clean; full `go vet ./...` re-run.

Claude-Session: https://claude.ai/code/session_01Wsno14cxE49MstXFs9G5KT
fix: partial repair of tests/integration compile errors (license test)
Universal: PR Check / Branch Policy (pull_request) Successful in 1s
PR RC Release / Build RC Release (pull_request) Successful in 2s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 55s
Universal: PR Check / Validate PR (pull_request) Successful in 12s
Generic: Project CI / Lint & Validate (pull_request) Successful in 41s
Universal: PR Check / Secret Scan (pull_request) Successful in 57s
Branch Cleanup / Delete merged branch (pull_request) Successful in 2s
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Generic: Project CI / Tests (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
948e7bcd21
api_license_keys_test.go used the outdated NewRequestWithBody signature
(passing []byte where io.Reader is now required) — wrapped the string bodies in
strings.NewReader. Note: tests/integration remains broadly pre-existing-broken
across multiple other fork-added files (api_packages_composer type mismatch,
etc.); those are a separate dedicated cleanup, not part of #727.

Claude-Session: https://claude.ai/code/session_01Wsno14cxE49MstXFs9G5KT
jmiller merged commit 89ed32e961 into dev 2026-07-05 05:58:55 +00:00
jmiller deleted branch fix/vet-test-suite-blockers 2026-07-05 05:58:56 +00:00
Sign in to join this conversation.