Skip to content

feat: add GOCACHEPROG subprocess and /buildcache HTTP handler#45

Merged
wolfeidau merged 2 commits into
mainfrom
feat/cacheprog
Mar 14, 2026
Merged

feat: add GOCACHEPROG subprocess and /buildcache HTTP handler#45
wolfeidau merged 2 commits into
mainfrom
feat/cacheprog

Conversation

@wolfeidau
Copy link
Copy Markdown
Member

@wolfeidau wolfeidau commented Mar 12, 2026

  • Add cacheprog subcommand that speaks the GOCACHEPROG JSON stdin/stdout
    protocol, with a local disk cache (fast path) and HTTP fallback to the
    content-cache server
  • Add protocol/buildcache package with HTTP handler (GET/PUT /buildcache/)
    and metadb EnvelopeIndex-backed action→blob mapping
  • Register /buildcache/ routes in server/http.go with 24h default TTL

Usage:
GOCACHEPROG="content-cache cacheprog --server http://localhost:8080" go build ./...

See https://pkg.go.dev/cmd/go/internal/cacheprog

- Add `cacheprog` subcommand that speaks the GOCACHEPROG JSON stdin/stdout
  protocol, with a local disk cache (fast path) and HTTP fallback to the
  content-cache server
- Add protocol/buildcache package with HTTP handler (GET/PUT /buildcache/)
  and metadb EnvelopeIndex-backed action→blob mapping
- Register /buildcache/ routes in server/http.go with 24h default TTL

Usage:
  GOCACHEPROG="content-cache cacheprog --server http://localhost:8080" go build ./...
- Add context propagation to cacheprog HTTP requests, cancel on close
- Log writeResponse errors in get/put goroutines instead of discarding
- Add actionID hex validation in buildcache HTTP handler
- Fix missing Time field in put sidecar metadata
- Fix TOCTOU in local cache fast path (read meta first, then verify blob)
- Move buildcache routes before goproxy catch-all in route registration
- Rename buildcacheHandler to buildcache in Server struct for consistency
- Add buildcache case to deriveProtocol fallback
- Add comprehensive tests for handler, index, and cacheprog runner
@wolfeidau wolfeidau merged commit 369a29d into main Mar 14, 2026
1 check passed
@wolfeidau wolfeidau deleted the feat/cacheprog branch March 14, 2026 02:16
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.

1 participant