Skip to content

Upgrade Go to 1.27 + Agentic development improvements - #223

Merged
fank merged 3 commits into
OCAP2:mainfrom
YetheSamartaka:main
Dec 1, 2026
Merged

fank merged 3 commits into
OCAP2:mainfrom
YetheSamartaka:main

Conversation

@YetheSamartaka

@YetheSamartaka YetheSamartaka commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor
  • Upgrade Go from 1.26.0 to 1.27.4. The Dockerfile is now a builder image: the Go 1.27.4 toolchain on Debian slim with gcc and mingw-w64, plus a DEBIAN_RELEASE=bullseye build argument for glibc 2.31. CI, release and the README build steps use it.
  • CI coverage now covers all packages, including the ABI entry-point tests (-tags=ocap_abi_test -coverpkg=./...).
  • CI: the coverage report job no longer fails on pull requests from forks. It skips the PR comment there and writes the report to the run summary. Pull requests from this repository still get the comment.
  • The memory backend reports gzip and file close errors when exporting, which were silently dropped before.
  • Upload client: form-write errors are reported, and an upload the server rejects early no longer leaves the writer goroutine blocked.
  • Startup: access to the API client is synchronized (it is set asynchronously during init). OTel no longer receives a typed-nil log file when no log file exists. OTel batch processors start only after every exporter has been created.
  • Startup, database, Postgres and OTel code expose small replaceable factory variables for tests; production behavior is unchanged. Log level dispatch is simplified to slog.Log.
  • Tests: new coverage for startup and storage initialization, mission save and upload, database, SQLite, Postgres, OTel and the ArmA entry points. The entry-point tests use a test-only shim behind the ocap_abi_test build tag, which is excluded from release builds.
  • WebSocket backend: the spool, recovery, reconnect and handshake error paths are now tested. The package gains six variables that tests can replace (three filesystem calls, the file lock, the dialer and the JSON encoder), and a SetWriteDeadline error check that gorilla can never trigger is removed. Behavior and wire format are unchanged.
  • Agent docs: AGENTS.md (including the rule that native v2 recordings are stored by the web as protobuf and v1 JSON is generated for download), CONTRIBUTING.md, docs/ (agent workflows, comment hygiene, maintainer context, testkit), .agents roles and skills. CLAUDE.md imports AGENTS.md.

Go 1.27 improvements (benchmarks: synthetic data, Go 1.26.11 vs 1.27.4, benchstat, n=12):

  • Encoding WebSocket envelopes is 38% faster on Go 1.27 (2.44 µs to 1.52 µs for a soldier-state envelope), with the same allocations. encoding/json now runs on the new v2 engine, and every streamed message goes through it.

  • Go 1.27 enables size-specialized allocation and the rewritten compress/flate encoder by default. The memory backend's .json.gz exports use the new encoder. Neither was measured separately here.

  • encoding/json/v2 is available without GOEXPERIMENT. The v1 export writes each value directly to the output with MarshalWrite in v1-compatible mode: same output (sorted map keys, HTML escaping) and 15% fewer bytes allocated than the same export on Go 1.27 without this change.

  • Trade-off: the memory backend's v1 export is slower under the new JSON engine. With 40 units over 1,000 frames it takes 2.1 times as long as on Go 1.26 (15.3 ms to 32.9 ms), with 48% more memory and 3.3 times as many allocations. Building with GOEXPERIMENT=nojsonv2 restores the Go 1.26 figures, which confirms the cause. This PR's writer reduces the extra memory to 26% but not the time; reusing one encoder across values is a likely follow-up.

  • Verified locally: build, vet and tests pass on Linux and Windows, and the race detector is clean. Coverage with the CI command is 100% (4,116 of 4,116 statements, the same in three runs), against 91.1% for current main.

Rebased onto main. Where main had since changed the same code, its
version is kept:

- WebSocket delivery uses main's resumable connection unchanged. The
  earlier single-pass envelope encoder would drop the seq field, and the
  reconnect fixes are already part of the rewrite.
- flushOTel, the save tag, mission discard/keep and storage reuse follow
  main. Startup tests now expect a mission start without a parser to fail
  and a later :STORAGE:INIT: to reuse the backend, and wait for
  :MISSION:OK: before resetting the backend the queued start still reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pull request from a fork runs with a read-only token, so the coverage
report job failed when it tried to comment ("Resource not accessible by
integration"). For those pull requests the comment is skipped and the
same report is written to the run summary. Pull requests from this
repository keep the comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fank

fank commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Ratatoskr reviewed this pull request.

Approved on 7f1257f7. See the review.

Finished 2026-11-30 22:13 UTC.

@fank fank left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE — 0 blocking findings.

Review details

Reviewed head 7f1257f78ea606fc013aa40bedf46326074f3c44 against base bad7dca41694fddafde716dbce762970b783b711, including surrounding startup, mission save, upload, export, storage, native interface, and build code. No actionable correctness, safety, or compatibility defects found.

Verification:

  • With Go 1.27.4 (PATH=/tmp/go/bin:$PATH), go test -count=1 ./internal/... ./pkg/core ./pkg/streaming passed.
  • go vet ./internal/... ./pkg/core ./pkg/streaming passed with the same toolchain.
  • go test ./... could not build the native interface and recorder packages locally: no C compiler is installed and CGO defaults to disabled. Docker verification was also unavailable because access to its daemon socket is denied. Local race tests and native builds were not run.
  • Inspected successful CI run 46522207694: full vet, native-tagged coverage tests, Windows DLL build, and coverage report passed. Inspected affected-file coverage; the export writer, API client, database helpers, and OTel provider report 100% statement coverage. This is not a claim of live ArmA, external PostgreSQL, or Linux release-build verification.

Earlier discussions: GraphQL returned no review threads (hasNextPage: false); no discussions required replies or resolution. Authenticated reviewer identity: fank.

The reviewed checkout was not modified; no commits, pushes, or merge actions were performed.

Coverage with the CI command reaches 100%. Tests replace six package
variables to reach failures no portable setup produces: three
filesystem calls, the file lock, the dialer and the JSON encoder. The
SetWriteDeadline error check is removed, as gorilla only stores the
deadline. Behavior and wire format are unchanged.

AGENTS.md now says the web keeps a v1 JSON copy by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@YetheSamartaka
YetheSamartaka requested a review from fank December 1, 2026 08:50
@fank

fank commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Ratatoskr reviewed this pull request.

Approved on 2a92f992. See the review.

Finished 2026-12-01 09:04 UTC.

@fank fank left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE — 0 blocking findings; 1 optional coverage observation.

Review details

Reviewed 2a92f992846cef88146c467479ed30ccd812cc5e against bad7dca41694fddafde716dbce762970b783b711, including upload cancellation/cleanup, export compatibility and close-error propagation, startup synchronization, OTel initialization, native entry points, and build/CI changes. No actionable blocking defect found.

Optional: The downloaded coverage artifact from run 46604522085 covers 4,112/4,116 statements (99.90%), rather than the description's stable 100%. Uncovered blocks are cmd/ocap_recorder/main.go:275–282 and internal/storage/sqlite/sqlite.go:101–102. Consider synchronizing tests with those background paths before claiming deterministic full coverage; this does not block approval.

Verification: Inspected the successful CI logs for go vet ./..., the tagged whole-suite coverage command, and the Windows c-shared Docker build. Independently downloaded and counted the coverage profile. These are CI results, not locally executed tests. Local go version failed because Go is not installed/on PATH; docker info failed with socket permission denied. Local tests, race checks, Linux/Windows builds, ArmA acceptance, and external PostgreSQL acceptance were therefore not run.

Earlier discussions: GraphQL enumeration returned no review threads (hasNextPage: false); none required replies or resolution. Checkout left unchanged.

@fank
fank merged commit c2d8c0c into OCAP2:main Dec 1, 2026
3 checks passed
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