Skip to content

Conversation

@mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Nov 20, 2025

Reason for this change

It always bothered me that we don't have an easy way of converting a template analytics string back for debugging.
This PR adds a debugging utility to decode analytics strings back into readable ConstructInfo objects.

Description of changes

  • Added parseAnalytics() function that reverses the formatAnalytics() encoding
  • Added parsePrefixEncodedList() helper to decode the trie structure
  • Added trieToConstructInfos() to convert trie back to ConstructInfo array
  • Added comprehensive tests verifying parseAnalytics is the inverse of formatAnalytics

The implementation handles the v2:deflate64 format by base64 decoding, gunzipping, and parsing the prefix-encoded trie structure.

Describe any new or updated permissions being added

None

Description of how you validated changes

Added unit tests covering:

  • Single construct parsing
  • Multiple constructs with same version
  • Nested module constructs
  • Different versions

All tests verify that parseAnalytics(formatAnalytics(x)) === x

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@mrgrain mrgrain requested a review from a team as a code owner November 20, 2025 11:03
@github-actions github-actions bot added the p2 label Nov 20, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team November 20, 2025 11:03
@mrgrain mrgrain changed the title feat(core): add parseAnalytics function for debugging chore(core): add parseAnalytics function for debugging Nov 20, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Nov 20, 2025
Adds parseAnalytics function to decode analytics strings back into ConstructInfo objects. This is useful for debugging and understanding what constructs are being tracked in the analytics metadata.
@mrgrain mrgrain force-pushed the mrgrain/feat/core/parse-analytics branch from 19f5ecc to 6635fde Compare November 20, 2025 11:06
@mergify
Copy link
Contributor

mergify bot commented Nov 20, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 8df9b06 into main Nov 20, 2025
19 of 20 checks passed
@mergify mergify bot deleted the mrgrain/feat/core/parse-analytics branch November 20, 2025 11:47
@github-actions
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

contribution/core This is a PR that came from AWS. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants