Skip to content

feat: add analytics deco site agent - #92

Closed
igorbrasileiro wants to merge 2 commits into
mainfrom
feat/admin-integration
Closed

igorbrasileiro wants to merge 2 commits into
mainfrom
feat/admin-integration

Conversation

@igorbrasileiro

Copy link
Copy Markdown
Contributor

What is this contribution about?

Describe your changes and why they're needed.

Screenshots/Demonstration

Add screenshots or a Loom video if your changes affect the UI.

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes

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]>
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