feat(cli): seed correlation id from ATK_CLI_CORRELATION_ID env var#16222
Draft
JimmyCalhoun wants to merge 1 commit into
Draft
feat(cli): seed correlation id from ATK_CLI_CORRELATION_ID env var#16222JimmyCalhoun wants to merge 1 commit into
JimmyCalhoun wants to merge 1 commit into
Conversation
Allow a parent process that spawns the ATK CLI (e.g. the wiqd CLI) to thread its own correlation id into this run, so both products' telemetry share one join key per invocation. - Correlator.setId(id?) now adopts a valid externally-supplied UUID and falls back to a freshly minted UUID when the value is absent or malformed, so the correlation id is always well-formed. - The CLI entrypoint seeds it from process.env.ATK_CLI_CORRELATION_ID. Behavior is unchanged when the env var is absent (the no-arg path), so this is safe to ship independently of the producer side. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
@JimmyCalhoun please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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
Lets a parent process that spawns the ATK CLI as a subprocess (e.g. the wiqd CLI) thread its own correlation id into this run, so both products' telemetry share one join key per invocation.
Correlator.setId(id?)now adopts a valid externally-supplied UUID and falls back to a freshly minted UUID when the value is absent or malformed (uuid.validate), so the correlation id is always well-formed.process.env.ATK_CLI_CORRELATION_ID. This makes ATK's nativecorrelation-id(already stamped on every telemetry event) equal the parent's id — no new dimension, no schema change.Why
As wiqd adoption grows as a wrapper around ATK, there's no way today to join an ATK telemetry event back to the wiqd action that triggered it. Seeding
correlation-idfrom an env var the parent controls closes that gap with zero new telemetry attributes on the ATK side. The env-var prefix follows the existing caller→ATK convention (ATK_CLI_SKILL), not the deprecatedTEAMSFX_brand.Safety / backward-compat
setId(undefined)→ falls through touuid.v4()→ byte-for-byte identical to prior behavior. The only production caller ofsetIdis this entrypoint.uuid.validate→ fresh UUID. No injection surface (value is only ever used as a correlation id).Correlator.run/runWithIdpaths are unchanged.Safe to ship independently and in any order relative to the wiqd side.
Companion changes (cross-product correlation)
The join key is
ATK.correlation-id == wiqd.session.id. Correlation becomes visible once all three are live in the same invocation; until then every partial-deployment state degrades to "ATK mints its own id."Testing
packages/fx-core—vitest run tests/common/correlator.test.ts: 6/6 pass (valid id adopted; malformed → fresh; absent → fresh).packages/cli—vitest run tests/unit/engine.tests.ts: 46/46 pass (env var present →setId(id); absent →setId(undefined)).🤖 Drafted with GitHub Copilot CLI.