Preserve alias provenance and measure deprecated command usage

Merged
UN
1mo ago
+619-24

Changes

  • Preserve caller-supplied read-output flag provenance through extension option coercion, parser override, and preflight override. An extension-active canonical full-list request no longer reports the deprecated --full alias; an actual --full request still does.
  • Count resolved deprecated command spellings in consented local telemetry state, with daily retention, canonical targets, last-seen times, and zero-use diagnostics. Match complete declared spellings so permanent aliases such as extension list are not counted as deprecated extension use.
  • Serialize telemetry state writes to retain the counters during background flushes. Document the limits of local zero-use evidence and the pending GA removal criterion.
  • Add a real extension regression, isolated CLI integration, and malformed-state/consent unit coverage. Record the PM evidence and regenerate the changelog with the latest published pm-changelog package.

PM items

Verification

  • node scripts/run-tests.mjs coverage: 9,405 passed; exact 100/100/100/100 coverage.
  • Linked PM tests passed in isolated snapshot workspaces.
  • Fresh temporary CLI workspace with a disposable extension: canonical aliases []; actual --full aliases ["--full"].
  • pnpm quality:static, pnpm typecheck, pnpm version:check, pnpm changelog:pm:check, pnpm contracts:check, pnpm sdk:surface:check, pnpm security:scan, and package artifact gate passed.
  • Tracker history drift check passed; 170 older closed items still have resolution-field warnings outside these two items.

Summary by Sourcery

Preserve deprecated-alias provenance and add consented local usage diagnostics to support evidence-based command deprecation decisions.

New Features:

  • Add consented local telemetry counters for deprecated command spellings, including retention, canonical targets, last-seen timestamps, and zero-use diagnostics.

Bug Fixes:

  • Prevent extension-active canonical full-list requests from being falsely attributed to the deprecated --full alias while preserving attribution for actual --full usage.

Enhancements:

  • Preserve command-option provenance through extension processing and serialize telemetry state updates to avoid lost counters during concurrent flushes.
  • Document the limitations of local zero-use evidence and the criteria for eventual alias removal.

Documentation:

  • Document deprecated alias usage diagnostics, retention behavior, consent requirements, and removal evidence limitations.
  • Regenerate the changelog with the newly tracked PM items.

Tests:

  • Add extension regression, isolated CLI integration, and telemetry coverage for consent, malformed state, retention, contention, and alias classification.

Chores:

  • Record and update the associated PM issue and task evidence.

Summary by cubic

Fixes false attribution of the deprecated --full alias on canonical full-list requests when extensions are active, and adds consented local usage counters for deprecated command spellings so removal decisions are evidence-based.

  • Caller-supplied read-output flag provenance is preserved through extension option coercion, parser override, and preflight override, so actual --full requests are still attributed while extension-active canonical requests are not.
  • Resolved deprecated spellings are counted per UTC day in local telemetry state with retention, canonical targets, last-seen times, and zero-use diagnostics; only complete declared spellings match, so permanent aliases like extension list are not counted.
  • Telemetry writes are serialized, and diagnostics re-read state under the lock before pruning so they cannot recreate cleared telemetry data; expired observations are pruned and counts are clamped to safe integers.
  • Adds real-extension regression, isolated CLI integration, and competing-writer, consent, malformed-state, and lock-contention unit coverage.