Skip to content

fix(cli): separate usage from deployment telemetry - #247

Open
lipikaramaswamy wants to merge 1 commit into
mainfrom
lipikaramaswamy/fix-anonymizer-usage-type
Open

fix(cli): separate usage from deployment telemetry#247
lipikaramaswamy wants to merge 1 commit into
mainfrom
lipikaramaswamy/fix-anonymizer-usage-type

Conversation

@lipikaramaswamy

Copy link
Copy Markdown
Collaborator

Summary

  • separate Anonymizer's CLI/SDK usage classification from the shared NEMO_DEPLOYMENT_TYPE environment variable
  • preserve explicit shared NeMo deployment overrides such as nvidia-internal
  • add a fresh-process regression test that launches the real anonymizer --help console entry point

Root cause and user impact

Anonymizer set NEMO_DEPLOYMENT_TYPE=cli before importing Data Designer. Data Designer 0.8 validates that shared variable at import time and only accepts deployment-level values such as library, api, nvidia-internal, and undefined. As a result, a fresh installation could fail before any CLI command—including anonymizer --help—started.

This change introduces ANONYMIZER_USAGE_TYPE for the Anonymizer-specific cli/sdk distinction and leaves NEMO_DEPLOYMENT_TYPE available for shared deployment classification.

Validation

  • make check
  • full unit suite: 1,193 passed
  • targeted CLI and telemetry suite: 88 passed
  • regression test invokes the installed-style console script in a clean subprocess with Data Designer import-time validation active

Contributor checklist

  • No plan required: focused compatibility fix confined to telemetry initialization and regression coverage
  • No linked GitHub issue required: maintainer-owned hotfix for QA bug NVIDIA 6557542
  • Public API impact: none; no exported symbols, signatures, defaults, or bundled skill templates changed
  • Documentation: telemetry environment-variable documentation was updated in the owning module
  • PII fixtures: none added
  • Secrets or credentials: none added

Signed-off-by: lipikaramaswamy <lramaswamy@nvidia.com>
@lipikaramaswamy
lipikaramaswamy marked this pull request as ready for review August 12, 2026 21:42
@lipikaramaswamy
lipikaramaswamy requested a review from a team as a code owner August 12, 2026 21:42
@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR separates Anonymizer’s CLI/SDK usage classification from the shared NeMo deployment classification, preventing Data Designer import-time validation failures while preserving explicit deployment overrides.

  • Introduces ANONYMIZER_USAGE_TYPE for cli and sdk telemetry classification.
  • Keeps NEMO_DEPLOYMENT_TYPE as the higher-priority shared deployment override.
  • Adds isolated telemetry tests and a real console-entry-point regression test for fresh-process CLI startup.

Confidence Score: 5/5

The PR appears safe to merge, with the changed environment-variable separation and precedence behavior covered by focused regression tests.

The CLI and SDK no longer place usage-only values into the shared deployment variable, explicit shared overrides remain effective, invalid telemetry values retain the existing safe fallback, and no concrete blocking or non-blocking defect remains.

Important Files Changed

Filename Overview
src/anonymizer/interface/anonymizer.py SDK initialization now defaults the Anonymizer-specific usage variable without writing an invalid value into the shared deployment variable.
src/anonymizer/interface/cli/main.py CLI bootstrap now marks CLI usage through the dedicated environment variable before importing runtime dependencies.
src/anonymizer/telemetry.py Telemetry resolves explicit shared deployment overrides first, then Anonymizer usage, while retaining safe invalid-value fallback behavior.
tests/interface/cli/test_cli_help.py Adds a clean-subprocess regression test exercising the installed-style console entry point with deployment variables removed.
tests/test_telemetry.py Covers the new usage variable, default SDK behavior, and shared deployment override precedence.

Reviews (1): Last reviewed commit: "fix(cli): separate usage from deployment..." | Re-trigger Greptile

# Track whether Anonymizer is used through the CLI or SDK separately from the
# shared NeMo deployment type. Data Designer validates NEMO_DEPLOYMENT_TYPE
# against deployment-level values such as "library" and "api" at import time.
os.environ.setdefault("ANONYMIZER_USAGE_TYPE", "cli")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: If we need to unblock, then sure. But this is more bifurcation and different patterns across the SDG libraries. For things like env vars about telemetry that really have no reason to be different in my opinion.

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.

3 participants