Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(toolkit-lib): CODE_REGISTRY.md tracks valid codes and their documentation #44

Merged
merged 18 commits into from
Feb 25, 2025

Conversation

kaizencc
Copy link
Contributor

@kaizencc kaizencc commented Feb 17, 2025

closes aws/aws-cdk#33434

generates CODE_REGISTRY.md using information gathered in codes.ts. this pr:

  • updates codes.ts to have additional information stored
  • introduces a script that generates a markdown table from the CODES object
  • updates projen to build CODE_REGISTRY.md as a post-build step

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

@@ -0,0 +1,29 @@
| Code | Description | Level | Data Interface |
|------|-------------| ----- | -------------- |
| CDK_TOOLKIT_I1000 | Provides synthesis times. | info | undefined |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the real interesting stuff is in the Data Interface section, which I haven't approached yet

@@ -0,0 +1,29 @@
| Code | Description | Level | Data Interface |
|------|-------------| ----- | -------------- |
| CDK_TOOLKIT_I1000 | Provides synthesis times. | info | undefined |
Copy link
Contributor

Choose a reason for hiding this comment

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

probably n/a if no data is send

Copy link
Contributor

@mrgrain mrgrain left a comment

Choose a reason for hiding this comment

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

This is the right direction I think.

One think I'm going to be interested in is how we can soft-enforce to correct level and data structure when using codes. Would love to see your ideas for that.

| Code | Description | Level | Data Interface |
|------|-------------|-------|----------------|
| CDK_TOOLKIT_I1000 | Provides synthesis times. | info | n/a |
| CDK_TOOLKIT_I1901 | Provides stack data | result | [StackData](docs/interfaces/StackData.html) |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

doc pages aren't committed so i don't know exactly what to do here

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can link to the public page once it's available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if you're ok with me naming and exposing these values here, then I will add docstrings. I'm also not sure what to do with successfuldeploystackresult because we are using that interface from aws-cdk so it otherwise doesn't show up in the generated docs

@@ -107,10 +108,10 @@ export const warn = <T>(message: string, code?: VALID_CODE, payload?: T) => {
/**
* Creates an info level message.
*/
export const info = <T>(message: string, code?: VALID_CODE, payload?: T) => {
export const info = <T>(message: string, code?: CodeInfo, payload?: T) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i forgot how we said we wanted to soft enforce that we call info on a code with level info. can you jog my memory @mrgrain ?

Comment on lines 8 to 10
Object.values(codes).forEach((code) => {
table += `| ${code.code} | ${code.description} | ${code.level} | ${code.interface ? linkInterface(code.interface) : 'n/a'} |\n`;
});
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can check here that the key and code are the same and otherwise throw

Co-authored-by: Momo Kornher <kornherm@amazon.co.uk>
@codecov-commenter
Copy link

codecov-commenter commented Feb 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.51%. Comparing base (757ae69) to head (c75884f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #44      +/-   ##
==========================================
- Coverage   84.57%   84.51%   -0.06%     
==========================================
  Files         196      196              
  Lines       35187    35187              
  Branches     4522     4524       +2     
==========================================
- Hits        29760    29740      -20     
- Misses       5281     5301      +20     
  Partials      146      146              
Flag Coverage Δ
suite.unit 84.51% <ø> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kaizencc kaizencc changed the title docs(toolkit): CODE_REGISTRY.md tracks valid codes and their documentation docs(toolkit-lib): CODE_REGISTRY.md tracks valid codes and their documentation Feb 24, 2025
@mrgrain mrgrain disabled auto-merge February 24, 2025 18:51
@rix0rrr rix0rrr added the pr/exempt-integ-test Skips the integ test steps if set. label Feb 25, 2025
@rix0rrr rix0rrr marked this pull request as draft February 25, 2025 08:48
@rix0rrr rix0rrr marked this pull request as ready for review February 25, 2025 08:48
@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Feb 25, 2025
Merged via the queue into main with commit fdf54d0 Feb 25, 2025
11 checks passed
@aws-cdk-automation aws-cdk-automation deleted the conroy/markdown branch February 25, 2025 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/exempt-integ-test Skips the integ test steps if set.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate messages & requests codes list
5 participants