Skip to content

Port aws-cdk id-based annotations (addWarningV2 / acknowledgeWarning) into a TerraConstructs Annotations facade #161

Description

@so0k

cdktn's Annotations is a pre-V2 copy of aws-cdk core: addWarning/addInfo/addError only — no id-based warnings and no acknowledgment/suppression mechanism. Upstream aws-cdk's own docs call unacknowledgeable warnings an anti-pattern (they block --strict-style workflows and are unsilenceable noise for consumers who have deliberately handled the concern).

Proposal: add a small TerraConstructs Annotations facade (e.g. src/annotations.ts) implementing upstream's V2 shape on top of cdktn's metadata:

  • addWarningV2(id, message) — emit WARN only if the id is not acknowledged in scope; append an ack hint to the message
  • acknowledgeWarning(id, message?) — register the ack for the scope (inherited by children) and strip already-emitted matching warnings

Reference implementation: aws-cdk-lib/core/lib/annotations.ts (Acknowledgements registry + removeWarningDeep). The shape is jsii-compatible upstream, so it should port cleanly.

Payoff — existing call sites already waiting for this:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions