Background
PR #726 added a per-version census of stored connection items to the connectionStorage.stats activation telemetry event so we can answer one concrete question: how many real installs still carry pre-v3 storage records, and is it safe to delete the legacy read-time wrapping code?
The wrapping code in question lives in src/services/connectionStorageService.ts:
fromStorageItem — switch on item.version with cases for '3.0', '2.0', and default (v1, no version field).
wrapV1AsV2 — in-memory upgrade of v1 records to the v2 shape.
wrapV2AsCurrent — in-memory upgrade of v2 records to the current shape.
convertV2ToConnectionItem — used only on the v2 branch.
Today this runs on every read of every connection item. It is correct but it is dead weight once the installed base no longer holds any v1/v2 records.
What telemetry to look at
Event: connectionStorage.stats (fires once per activation, after cleanup).
Aggregate counters (across both Clusters and Emulators zones):
v1Items, v2Items, v3Items, unknownVersionItems
hasLegacyItems — boolean property, 'true' iff v1Items + v2Items > 0.
Per-zone counters:
clusters_v1Items, clusters_v2Items, clusters_v3Items, clusters_unknownVersionItems
emulators_v1Items, emulators_v2Items, emulators_v3Items, emulators_unknownVersionItems
Supporting signal on resolvePostMigrationErrors:
previousCleanupVersion — shows installs crossing the legacy '0.8.1' marker → integer counter boundary (added in the same PR).
Questions to answer
- What fraction of unique installs report
hasLegacyItems = 'true' over the most recent full release window?
- What is the absolute count of v1 vs v2 items? (v2 is younger than v1, so removal of v1 may unblock first.)
- Is the legacy population shrinking release-over-release? Plot the trend.
- Are there outlier installs holding a large number of legacy items? (a few power users may matter more than the percentage suggests).
- Any
unknownVersionItems > 0 reports? Those would indicate either future-format records or corruption and are worth flagging separately.
Decision criteria
- Remove v1 wrapping (
wrapV1AsV2, default branch in fromStorageItem) when:
v1Items = 0 across two consecutive release windows, AND
- no install reports
v1Items > 0 in the most recent 30 days.
- Remove v2 wrapping (
wrapV2AsCurrent, convertV2ToConnectionItem, '2.0' branch) when the same criteria hold for v2Items.
- Defer removal as long as
hasLegacyItems = 'true' for any non-trivial cohort; document the next check-in date.
Tasks
Out of scope
References
Background
PR #726 added a per-version census of stored connection items to the
connectionStorage.statsactivation telemetry event so we can answer one concrete question: how many real installs still carry pre-v3 storage records, and is it safe to delete the legacy read-time wrapping code?The wrapping code in question lives in
src/services/connectionStorageService.ts:fromStorageItem— switch onitem.versionwith cases for'3.0','2.0', anddefault(v1, no version field).wrapV1AsV2— in-memory upgrade of v1 records to the v2 shape.wrapV2AsCurrent— in-memory upgrade of v2 records to the current shape.convertV2ToConnectionItem— used only on the v2 branch.Today this runs on every read of every connection item. It is correct but it is dead weight once the installed base no longer holds any v1/v2 records.
What telemetry to look at
Event:
connectionStorage.stats(fires once per activation, after cleanup).Aggregate counters (across both
ClustersandEmulatorszones):v1Items,v2Items,v3Items,unknownVersionItemshasLegacyItems— boolean property,'true'iffv1Items + v2Items > 0.Per-zone counters:
clusters_v1Items,clusters_v2Items,clusters_v3Items,clusters_unknownVersionItemsemulators_v1Items,emulators_v2Items,emulators_v3Items,emulators_unknownVersionItemsSupporting signal on
resolvePostMigrationErrors:previousCleanupVersion— shows installs crossing the legacy'0.8.1'marker → integer counter boundary (added in the same PR).Questions to answer
hasLegacyItems = 'true'over the most recent full release window?unknownVersionItems > 0reports? Those would indicate either future-format records or corruption and are worth flagging separately.Decision criteria
wrapV1AsV2, default branch infromStorageItem) when:v1Items = 0across two consecutive release windows, ANDv1Items > 0in the most recent 30 days.wrapV2AsCurrent,convertV2ToConnectionItem,'2.0'branch) when the same criteria hold forv2Items.hasLegacyItems = 'true'for any non-trivial cohort; document the next check-in date.Tasks
connectionStorage.statsdata from telemetry for the current and previous release windows.v1Items/v2Itemspopulations (unique installs, absolute counts, distributions).wrapV1AsV2/wrapV2AsCurrentand the corresponding branches infromStorageItem. Also drop matching tests.Out of scope
STORAGE_CLEANUP_VERSIONinteger counter is a separate marker and unrelated to whether wrapping can be removed.References
docs/ai-and-plans/PRs/726-storage-load-optimization/