Skip to content

feat: "cdk flags" command reports active and missing feature flags (unstable) #699

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

Merged
merged 8 commits into from
Jul 15, 2025

Conversation

vivian12300
Copy link
Contributor

  • Read feature flag artifacts from the Cloud Assembly
  • Introduces cdk flags, which displays user's current feature flag configuration in the form of a table

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

@github-actions github-actions bot added the p2 label Jul 8, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team July 8, 2025 23:45
@rix0rrr rix0rrr changed the title feat: read feature flag report from CLI feat: "cdk flags" command reports active and missing feature flags (unstable) Jul 14, 2025
Comment on lines 48 to 51
expect(plainTextOutput).toContain('Feature Flags Report:');
expect(plainTextOutput).toContain('Feature Flag Name');
expect(plainTextOutput).toContain('Recommended Value');
expect(plainTextOutput).toContain('User Value');
Copy link
Contributor

Choose a reason for hiding this comment

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

You are asserting a lot of things here. Why are you asserting this, and what are you protecting against?

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 want to make sure the output being displayed to the user matches what I'm expecting (the headers and the information about the flag).

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but why? Or put another way: what are you protecting that someone might accidentally break? Because a lot of this is now double bookkeeping, but not in a way that seems immediately valueable. Also, testing that the text you unconditionally print did actually get unconditionally printed... is that worth it?

If you just want to eyeball the output, expect(...).toMatchSnapshot() or expect(...).toMatchInlineSnapshot() might be appropriate.

If someone wants to change a column header, they now need to change that in two places (change it in the code, and change it here). That may be worth it if that column name encodes a public contract, but it's just annoying busywork if it doesn't.

My point is that tests aren't free: they are additional code to write, compile, run, and maintain. So I'd hope they assert something worthwhile, to pull their weight

(And this is a very trivial case, but that generalizes to more complicated tests)

@vivian12300 vivian12300 deployed to integ-approval July 14, 2025 14:59 — with GitHub Actions Active
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 79.26829% with 17 lines in your changes missing coverage. Please review.

Project coverage is 79.34%. Comparing base (286b063) to head (7c7e5dd).

Files with missing lines Patch % Lines
packages/aws-cdk/lib/cli/cli.ts 18.75% 13 Missing ⚠️
packages/aws-cdk/lib/cli/cdk-toolkit.ts 63.63% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #699      +/-   ##
==========================================
- Coverage   79.38%   79.34%   -0.04%     
==========================================
  Files          49       50       +1     
  Lines        7209     7278      +69     
  Branches      809      821      +12     
==========================================
+ Hits         5723     5775      +52     
- Misses       1467     1484      +17     
  Partials       19       19              
Flag Coverage Δ
suite.unit 79.34% <79.26%> (-0.04%) ⬇️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Jul 15, 2025
Merged via the queue into aws:main with commit d62b991 Jul 15, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants