test(cdk): スナップショットシリアライザのデッドパターン削除と軽微な堅牢化
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- aws, node.js, typescript
- Domain
- infrastructure, testing
Research direction
Start with apps/cdk/test/snapshot-plugin.ts and compare its serializer patterns with the generated cdk.out/*.template.json output. Run the apps/cdk test:unit command (vitest run) after removing the identified dead patterns; if hardening is included, regenerate snapshots with -u and inspect the diff. Done means the tests pass without unintended snapshot changes.
Written by the indexing model from the issue text.
Description
背景
apps/cdk/test/snapshot-plugin.ts は、cdk synth が出力する非決定的トークン(アセットハッシュ、Lambda Version 論理 ID 末尾のハッシュ等)を redact して CloudFormation スナップショットを安定させるシリアライザです。現在の合成テンプレートに照らすと、実際には何もマッチしていない置換パターン(デッド)が複数あり、加えて軽微な堅牢化の余地があります。
現状パターンと合成出力の突き合わせ
.replace(/([A-Fa-f0-9]{64}.zip)/, 'REDACTED')
.replace(/([A-Fa-f0-9]{64}.mjs)/, 'REDACTED')
.replace(/.*cdk-hnb659fds-container-assets-.*/, 'REDACTED')
.replace(/webapp-starter-[0-9a-z]*/, 'REDACTED')
.replace(/(.*CurrentVersion).*/, '$1REDACTED')
合成テンプレート(cdk.out/*.template.json)を確認した結果:
削除候補(デッド)
webapp-starter-[0-9a-z]*: 合成出力にwebapp-starter-<suffix>形の文字列は出現しない。[0-9a-z]*は 0 文字にマッチするため実質何も redact していない。削除してよい。.*cdk-hnb659fds-container-assets-.*: 合成テンプレートにcdk-hnb659fds-container-assets-を含む文字列が存在しない(この構成のコンテナイメージはデプロイ時ビルドで作成される ECR リポジトリを参照し、bootstrap の container-assets リポジトリを参照しないため)。デッド。削除を検討。
維持(誤って削除しないこと)
.zip/.mjs: Lambda バンドルアセットの S3 キーのハッシュを redact。LIVE。(.*CurrentVersion).*: Lambda Version 論理 ID 末尾のハッシュを redact。アプリ/依存の変更で変わる値のため維持が必要。LIVE。
軽微な堅牢化(任意)
.zip/.mjsパターンの.が未エスケープで任意 1 文字にマッチする →\.へ。- 同パターンに
/gが無く、1 つの文字列値に 64hex が 2 つ以上現れると 2 個目以降が漏れる(現状は該当文字列 0 件のため実害はなく、保険)。 (.*CurrentVersion).*は貪欲マッチ。意図を明確化するならCurrentVersion[A-Za-z0-9]*$等へアンカー。
受け入れ条件
- デッドパターン削除後、
apps/cdkのtest:unit(vitest run)でスナップショット差分が発生しない(=当該パターンが何も変えていなかったことの確認)。 - 堅牢化を入れる場合はスナップショットを
-uで再生成し、diff が意図どおりであることを確認。
- Dominant language
- TypeScript
- Stars
- 229
- Forks
- 45
- Avg merge
- 1m
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws-samples/serverless-full-stack-webapp-starter-kit
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
aws-samples/serverless-full-stack-webapp-starter-kit#108 · 1 reaction ·
-
enhancement needs-triage
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 68/100
aws-samples/serverless-full-stack-webapp-starter-kit#291 · 1 reaction ·
-
enhancement needs-triage stale
Difficulty 3/5 1-2 days Newbie friendliness 72/100
aws-samples/serverless-full-stack-webapp-starter-kit#224 · 4 comments ·
-
bug needs-triage
Difficulty 3/5 1-2 days Newbie friendliness 78/100
aws-samples/serverless-full-stack-webapp-starter-kit#219 · 2 comments ·
All issues in aws-samples/serverless-full-stack-webapp-starter-kit
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100