release-train: develop -> staging - #506
Merged
Merged
Conversation
…ckend#1897) (#503) RFC-BACKEND-1872 D2 for the CLI, and D12's host-process path. The Go half of what backend#1896 does for the Python services. Unblocks #1907. The CLI emits nothing today — it is not a pod, so the edge Collector's filelog receiver cannot reach it, and a field failure is only ever a support thread. e := telemetry.New(cfg.CurrentEnv, version, hostname) err := e.Emit("cli.command.failed", telemetry.Attrs{"error.type": "network"}) ENFORCED, NOT DOCUMENTED. The contract's mechanically-checkable rules run at the call site and return an error: the <domain>.<object>.<outcome> grammar with its closed vocabularies, the attribute-key namespace, retired names, value types, and the error set a failure must carry — stacktrace included. It returns rather than panics, because a CLI must never die of telemetry; but a malformed event must not pass silently either, and the caller's tests are where it fails. THE ENVIRONMENT IS DERIVED, NOT RESTATED. `New` classifies via `api.IsKnownEnv`, the same function that rejects a `--env staging` typo at the CLI's front door, and a test asserts the two agree across dev/stg/prod/staging/ prd/PROD/"". One saying yes while the other says no is precisely how records acquire a guessed environment. The domain vocabulary is narrower than the full registry — `cli` and `auth` only. The CLI is not the installer and not the backend, so admitting domains it cannot legitimately produce would make a typo look plausible. That is the failure already visible in the browser leg, where 461 of 484 events are named `not_specified`. 25 tests, 100% statement coverage, `make check` green. Twelve rules mutation-proved. ONE SURVIVED THE FIRST PASS, and it was a weak test rather than weak code — the same one the Python side hit. Every key I had tried was caught by the retired or namespace rule, so nothing exercised the key-SHAPE check; it needed a key that passes every other rule and is still badly shaped (`tracebloc.clientID`). Added, and the mutation now bites. NOTHING IMPORTS THIS YET, deliberately: #1907 is the consumer ticket. One consequence worth recording rather than discovering — `make deadcode` scans reachability from ./cmd/tracebloc, so a package outside that import graph is invisible to it. The gate is SILENT on this package, not passing it, and will start covering it the moment #1907 wires the first call site. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Contributor
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 209e4b5. Configure here.
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.
Automated promotion by the release train (RFC-0008 D14). Head is the train-managed
release-train/to-stagingbranch (a mirror ofdevelop), so it never collides with a human PR. Merged only when the fr-gate is green.Note
Low Risk
New library-only package with no production wiring in the diff; validation errors return to callers without changing CLI behavior until integrated.
Overview
Introduces
internal/telemetry, the Go side of the backend telemetry contract (RFC-BACKEND-1872), so the CLI can emit validated outcome events instead of relying on pod log collection.An
Emitteris built with fixed resource identity (service.name/tracebloc.component=cli), version normalization (dev/empty →0.0.0-unknown), andExports()aligned withapi.IsKnownEnv—unknown envs never getdeployment.environmentand do not export.Emitenforces event naming (cli/authdomains, closed outcomes), attribute keys (OTel allowlist,tracebloc.*, retired names), primitive values, omission of nil/empty strings, and failure records (error.type, full exception set when any exception field is present). Delivery is via an injectableSetSink; nil sink still runs validation.telemetry_test.golocks identity, env/version behavior, grammar, attributes, failure rules, and sink/resource layering.Reviewed by Cursor Bugbot for commit 209e4b5. Bugbot is set up for automated code reviews on this repo. Configure here.