Repository navigation
feat: add analytics deco site agent - #92
Closed
igorbrasileiro wants to merge 2 commits into
Closed
igorbrasileiro wants to merge 2 commits into
igorbrasileiro wants to merge 2 commits into
Conversation
nicacioliveira
pushed a commit
that referenced
this pull request
Aug 7, 2026
The cross-node golden tier was written in TypeScript (#5351, #5399) and deleted with that daemon in #5575, before it ever ran in a deployed config. Nothing replaced it: the Go daemon logged "GOLDEN_CACHE_REMOTE is set but this daemon implements the node-local golden tier only" and installed from scratch. Since then the bucket, the mountpoint PV/PVC and the env var were all provisioned (decocms/terraform-eks-cluster#88/#92, decocms/deco-apps-cd#203), so prod has the volume mounted at /golden-cache with nothing on either end of it. This ports restore, publish and prune to Go, keyed identically to L1 (same credential-stripped repo hash, same lockfile hash) so the two tiers can never disagree about what a key means. Orchestrator wiring: L1 reflink → L2 extract → install. An L2 hit leaves pendingGolden set, so the healthy-boot transition seeds THIS node's L1 from the extracted tree and the next pod here gets the reflink instead of another extract. That transition also runs the L2 publish, which no-ops on an existing key, so the two are safe together. Two deliberate departures from the TypeScript original: - The pipe is os.Pipe, not `bash -c` with pipefail. Both children get one real kernel fd pair, so a multi-GB tree never traverses this process — which matters because the health probe must keep answering (Studio tears the pod down on a single miss), and because a relayed copy is what truncated this transfer in the TS version. Using os/exec's StdoutPipe would reintroduce that relay. This also drops the bash dependency and the shell quoting it needed. - No shell means no `set -o pipefail`; both children's exit codes are checked explicitly instead, consumer first because its stderr is the line that explains a corrupt archive. Unchanged from the original, because they are load-bearing: an archive rather than a tree (per-operation metadata latency is fatal across ~100k files); extract into staging then rename, so an interrupted tar cannot leave a partial node_modules that later code reads as complete; write straight to the final key rather than temp+rename, because a blob store has no rename and does not need one; read the archive back before reporting success, because publish no-ops on an existing key so a corrupt one would be permanent. zstd is already in the sandbox image (packages/sandbox/image/Dockerfile) — it survived the TS deletion. main.go now warns when it is missing rather than warning that the tier is unimplemented. Testing: real files, real tar/zstd, no mocks. Publish on one root and restore on another (the point of the tier), an ~8 MB payload past any pipe buffer (the case that caught a truncating implementation in TS, where a 1 KB fixture passed), dormant-when-unconfigured as the discriminating counterpart, truncated and corrupt archives failing closed with no partial tree and no staging left behind, idempotent publish, and prune by TTL and per-repo cap. `go build ./...`, `go vet`, `gofmt` clean; full internal/setup suite passes. NOT validated on a real pod, and it cannot be yet: the tenant mount is read-only, so publish always fails there and the store stays empty. Restoring needs something to have published — a trusted seeder with the writable mount is the remaining piece, tracked separately. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
nicacioliveira
pushed a commit
that referenced
this pull request
Aug 10, 2026
The cross-node golden tier was written in TypeScript (#5351, #5399) and deleted with that daemon in #5575, before it ever ran in a deployed config. Nothing replaced it: the Go daemon logged "GOLDEN_CACHE_REMOTE is set but this daemon implements the node-local golden tier only" and installed from scratch. Since then the bucket, the mountpoint PV/PVC and the env var were all provisioned (decocms/terraform-eks-cluster#88/#92, decocms/deco-apps-cd#203), so prod has the volume mounted at /golden-cache with nothing on either end of it. This ports restore, publish and prune to Go, keyed identically to L1 (same credential-stripped repo hash, same lockfile hash) so the two tiers can never disagree about what a key means. Orchestrator wiring: L1 reflink → L2 extract → install. An L2 hit leaves pendingGolden set, so the healthy-boot transition seeds THIS node's L1 from the extracted tree and the next pod here gets the reflink instead of another extract. That transition also runs the L2 publish, which no-ops on an existing key, so the two are safe together. Two deliberate departures from the TypeScript original: - The pipe is os.Pipe, not `bash -c` with pipefail. Both children get one real kernel fd pair, so a multi-GB tree never traverses this process — which matters because the health probe must keep answering (Studio tears the pod down on a single miss), and because a relayed copy is what truncated this transfer in the TS version. Using os/exec's StdoutPipe would reintroduce that relay. This also drops the bash dependency and the shell quoting it needed. - No shell means no `set -o pipefail`; both children's exit codes are checked explicitly instead, consumer first because its stderr is the line that explains a corrupt archive. Unchanged from the original, because they are load-bearing: an archive rather than a tree (per-operation metadata latency is fatal across ~100k files); extract into staging then rename, so an interrupted tar cannot leave a partial node_modules that later code reads as complete; write straight to the final key rather than temp+rename, because a blob store has no rename and does not need one; read the archive back before reporting success, because publish no-ops on an existing key so a corrupt one would be permanent. zstd is already in the sandbox image (packages/sandbox/image/Dockerfile) — it survived the TS deletion. main.go now warns when it is missing rather than warning that the tier is unimplemented. Testing: real files, real tar/zstd, no mocks. Publish on one root and restore on another (the point of the tier), an ~8 MB payload past any pipe buffer (the case that caught a truncating implementation in TS, where a 1 KB fixture passed), dormant-when-unconfigured as the discriminating counterpart, truncated and corrupt archives failing closed with no partial tree and no staging left behind, idempotent publish, and prune by TTL and per-repo cap. `go build ./...`, `go vet`, `gofmt` clean; full internal/setup suite passes. NOT validated on a real pod, and it cannot be yet: the tenant mount is read-only, so publish always fails there and the store stays empty. Restoring needs something to have published — a trusted seeder with the writable mount is the remaining piece, tracked separately. Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this contribution about?
Screenshots/Demonstration
Review Checklist