test-upgrade
Skill329 starsChanged 7 days agoMIT-0View on GitHub
Use when validating an in-place CloudFormation stack upgrade between two published releases, including recovery from a rollback deadlock.
In this repository42 other files it gives its agents.
- .claude/rules/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-modelSkill
- agent-capability-reviewSkill
- api-rbac-testSkill
- backend-lambdaSkill
- code-reviewSkill
- create-hf-dataset-prSkill
- curate-security-resultsSkill
- cut-release-changelogSkill
- dependabot-prsSkill
- documentationSkill
- extraction-pipelineSkill
- fix-single-issueSkill
- frontend-uiSkill
- full-test-batterySkill
- infrastructureSkill
- live-auth-checksSkill
- live-eval-and-costSkill
- prepare-changelogSkill
- prep-develop-for-releaseSkill
- product-demoSkill
- pr-review-ciSkill
- pr-reviewSkill
- releaseSkill
- release-validationSkill
- remove-classification-flat-keysSkill
- repo-quality-reviewSkill
- run-benchmarksSkill
- run-stack-testsSkill
- srt-security-scanSkill
- sync-pii-anonymizerSkill
- testing-qaSkill
- transform-deploy-testSkill
- ui-i18nSkill
- update-solution-profileSkill
- ux-test-ciSkill
- ux-testSkill
- ux-test-stories-ciSkill
- ux-test-storiesSkill
- work-the-backlog-hazardsSkill
- work-the-backlogSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this to validate an in-place CloudFormation stack upgrade between two published GenAI-IDP releases — e.g.
- Very specific: line 55
Every release in CHANGELOG.md lists its template URLs.
- Very specific: line 149
Keep /tmp/upgrade-baseline — §8 compares the post-upgrade run against it.
- Very specific: line 153
Use the console-equivalent update-stack, reusing all existing parameter values so the diff is purely the template:
- Distinctive: line 215
If the update or rollback fails, the parent's failed-resource list is mostly
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Test Stack Upgrade (version X → Y)
Use this to validate an in-place CloudFormation stack upgrade between two
published GenAI-IDP releases — e.g. "does upgrading a 0.5.16 stack to 0.6.1
succeed, or does it fail and roll back?" This reproduces exactly what a
customer does with the AWS console Update stack utility against the public
idp-main_<version>.yaml template. It is the go-to when a user reports an
upgrade/rollback failure (like the PATTERNSTACK / UpdateDefaultConfig
deadlock).
Complementary to live-eval-and-cost.md (accuracy/cost A-B) and
full-test-battery.md (test suites). This skill is purely about "does the
CFN stack update apply cleanly, without rollback".
All AWS calls use
AWS_PROFILE=default. Confirm the account first —AWS_PROFILE=default aws sts get-caller-identity— the token expires often; if it returnsExpiredToken, ask the user to refresh (! aws sso login --profile default) before proceeding. Deploy target for this repo's test work: region us-west-2, in whichever accountAWS_PROFILE=defaultresolves to (the expected account id is in theidpagentic-deploy-targetmemory, not in this file).Stale AWS credential env vars shadow the profile.
AWS_PROFILE=defaulton the command line does NOT overrideAWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKENif those are exported in the shell — env-var creds always win, so an expired set producesExpiredTokeneven after the profile token is refreshed. Ifsts get-caller-identityfails, check for and unset them BEFORE asking the user to re-auth:env | grep -E '^AWS_(ACCESS_KEY_ID|SECRET_ACCESS_KEY|SESSION_TOKEN|SECURITY_TOKEN|CREDENTIAL_EXPIRATION)=' unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_SECURITY_TOKEN AWS_CREDENTIAL_EXPIRATIONNote:
unsetdoes not persist across separate Bash tool calls (each call is a fresh shell sourced from the profile). If the profile itself exports these, prefix the failing command with the unset, or fix the shell profile. A harmless leftoverAWS_PROFILE/AWS_REGIONin the env is fine — only the raw key/token vars shadow the profile.
0. Inputs you need
- FROM version (base to deploy fresh), e.g.
0.5.16 - TO version (upgrade target), e.g.
0.6.1 - A throwaway stack name, e.g.
UpgradeTest0517to061 - Region (default
us-west-2)
1. Get the template URLs (from CHANGELOG.md)
Every release in CHANGELOG.md lists its template URLs. Grep them — don't
hand-type:
grep -nE "idp-main_<VERSION>\.yaml" CHANGELOG.mdCanonical us-west-2 pattern:
https://s3.us-west-2.amazonaws.com/aws-ml-blog-us-west-2/artifacts/genai-idp/idp-main_<VERSION>.yamlAlso available in us-east-1 and eu-central-1 (swap the region in both the
host and the aws-ml-blog-<region> bucket), and in ca-central-1 for releases
after 0.6.11 — where ⚠️ the bucket is aws-bigdata-blog-replica-ca-central-1,
not aws-ml-blog-ca-central-1, which does not exist, so the swap-the-region
rule does not produce Canada's URL. An upgrade test that spans that boundary
cannot run in Canada at all, because the FROM release has no artifacts there. The
grep above is the reliable answer for a given pair: a release whose ## Templates
block carries three URLs is one of those.
These are the published artifacts. To instead test an upgrade to local code, build with
python3 publish.py <bucket-base> <prefix> <region>and use the resultingidp-main.yamlS3 URL as the TO template.
2. Inspect required parameters before deploying
The template is a public object — download and list which parameters have no default (those you must supply):
cd /tmp && curl -s -o idp-from.yaml "<FROM_URL>"
# Required params = those with a Type but no Default. For recent releases the
# ONLY required one is AdminEmail; everything else defaults.Confirm this per release (parameters drift between versions). A quick check:
python3 - <<'EOF'
import re
txt=open('/tmp/idp-from.yaml').read().splitlines()
inp=False;cur=None;p={}
for ln in txt:
if ln.rstrip()=='Parameters:': inp=True; continue
if inp and re.match(r'^[A-Za-z]',ln): break
if inp:
m=re.match(r'^ ([A-Za-z0-9]+):\s*$',ln)
if m: cur=m.group(1);p[cur]={};continue
if cur:
mm=re.match(r'^ (Default|Type):\s*(.*)$',ln)
if mm: p[cur][mm.group(1)]=mm.group(2).strip()
print("REQUIRED:", [k for k,v in p.items() if 'Default' not in v])
EOF3. Deploy the FROM base stack
STACK=UpgradeTest0517to061 ; REGION=us-west-2
AWS_PROFILE=default aws cloudformation create-stack \
--stack-name "$STACK" --region "$REGION" \
--template-url "<FROM_URL>" \
--parameters ParameterKey=AdminEmail,ParameterValue=<your.email@example.com> \
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \
--disable-rollback # keep failed resources inspectable if CREATE fails
AWS_PROFILE=default aws cloudformation wait stack-create-complete \
--stack-name "$STACK" --region "$REGION"CAPABILITY_AUTO_EXPAND is required (nested stacks + SAM transform).
Poll status while waiting:
AWS_PROFILE=default aws cloudformation describe-stacks --stack-name "$STACK" \
--region "$REGION" --query 'Stacks[0].StackStatus' --output textBase create takes ~20-40 min (CodeBuild builds the UI, containers push to ECR).
4. Smoke-test the FROM stack (baseline) — REQUIRED
Always process samples/lending_package.pdf on the FROM stack before
upgrading, and capture the output as a baseline. This proves the stack is
functional pre-upgrade and gives you a diff target to confirm the upgrade
preserved basic functionality (an upgrade that reaches UPDATE_COMPLETE but
silently breaks extraction is still a regression).
STACK=UpgradeTest0517to061 ; REGION=us-west-2
idp-cli run-inference --stack-name "$STACK" --region "$REGION" \
--profile default --dir samples/ --file-pattern 'lending_package.pdf' \
--batch-prefix pre-upgrade --monitor
# note the batch-id it prints, then pull the results:
idp-cli download-results --stack-name "$STACK" --region "$REGION" \
--profile default --batch-id <batch-id> --output-dir /tmp/upgrade-baseline
idp-climay import a STALEidp_commonfrom another checkout — this only corruptsconfig-download/config-upload(silently strips v0.6 fields), NOTrun-inference/download-results. So doc processing is safe, but do not round-trip configs through the CLI here. (Seeidpagentic-deploy-target.)
Keep /tmp/upgrade-baseline — §8 compares the post-upgrade run against it.
5. Upgrade to the TO version (the actual test)
Use the console-equivalent update-stack, reusing all existing parameter
values so the diff is purely the template:
AWS_PROFILE=default aws cloudformation update-stack \
--stack-name "$STACK" --region "$REGION" \
--template-url "<TO_URL>" \
--parameters ParameterKey=AdminEmail,UsePreviousValue=true \
$(: reuse EVERY other param) \
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPANDTo reuse all previous parameter values without listing them, first read them and emit
UsePreviousValue=truefor each:AWS_PROFILE=default aws cloudformation describe-stacks --stack-name "$STACK" \ --region "$REGION" --query 'Stacks[0].Parameters[].ParameterKey' --output text \ | tr '\t' '\n' | sed 's/.*/ParameterKey=&,UsePreviousValue=true/'Paste those into
--parameters. (A parameter that no longer exists in the TO template must be dropped; a new required param in TO must be given a value.)
Then wait and watch:
AWS_PROFILE=default aws cloudformation wait stack-update-complete \
--stack-name "$STACK" --region "$REGION" # returns non-zero on rollback6. Monitor the config custom resource during the update
The highest-risk step in an X→Y upgrade is the UpdateDefaultConfig custom
resource in the nested PATTERNSTACK (patterns/unified/template.yaml). It
re-validates config_library/pricing.yaml, model_config_limits.yaml, and
runs the v0.5→v0.6 config migration on both update AND rollback — a
validation failure there deadlocks the nested stack in
UPDATE_ROLLBACK_FAILED. Tail its Lambda while the update runs:
FN=$(AWS_PROFILE=default aws lambda list-functions --region "$REGION" \
--query "Functions[?starts_with(FunctionName,'${STACK}') && contains(FunctionName,'UpdateConfiguration')].FunctionName" \
--output text)
AWS_PROFILE=default aws logs tail "/aws/lambda/$FN" --since 15m --follow --region "$REGION" \
| grep -iE "error|units|valid|migrat|traceback|pydantic"Upgrades crossing config format 0.9 (v0.6.12 → v0.6.13 and later). The same
custom resource also runs the 0.8→0.9 conversion that nests the classification
settings by model call. A stored configuration that combines a page limit
(maxPagesForClassification other than ALL) with boundary detection is converted
to sectionSplitting: disabled, and the conversion logs a warning starting
classification.maxPagesForClassification is ... Converted to sectionSplitting
'disabled' — expect it for any such profile in the log of whichever function
reads the profile first (this config Lambda, or the classification function on the
first document; the runtime then saves the converted profile back, while a pinned
pre-upgrade revision logs it every time it is loaded), and do not report it as a failure (no shipped
preset uses the combination, so a stack on the stock default profile prints
none). If the test includes a rollback, a profile saved in v0.6.13 runs on
v0.6.12 with v0.6.12's built-in classification defaults, because v0.6.12 recognises
none of the nested keys; the fix is to restore that profile's last pre-upgrade
revision in the v0.6.12 configuration editor, after the rollback. The stack-managed
default profile is rebuilt by the rollback and keeps working. See
docs/migration-v0612-to-v0613.md.
7. Diagnose a failure
If the update or rollback fails, the parent's failed-resource list is mostly collateral — find the true root cause in the nested stack's own events:
# Parent failures (includes collateral siblings)
AWS_PROFILE=default aws cloudformation describe-stack-events --stack-name "$STACK" \
--region "$REGION" \
--query "StackEvents[?contains(ResourceStatus,'FAILED')].[Timestamp,LogicalResourceId,ResourceStatusReason]" \
--output table | head -40
# Drill into the nested PATTERNSTACK (usual culprit)
PS=$(AWS_PROFILE=default aws cloudformation describe-stack-resources --stack-name "$STACK" \
--region "$REGION" \
--query "StackResources[?LogicalResourceId=='PATTERNSTACK'].PhysicalResourceId" --output text)
AWS_PROFILE=default aws cloudformation describe-stack-events --stack-name "$PS" \
--region "$REGION" \
--query "StackEvents[?contains(ResourceStatus,'FAILED')].[LogicalResourceId,ResourceStatusReason]" \
--output table | head -40Recovery from UPDATE_ROLLBACK_FAILED (pricing/config deadlock)
The custom resource reads pricing.yaml from the ConfigurationBucket S3
path, not the template. Fix the S3 object, then continue the rollback:
# validate a candidate pricing.yaml locally first
PYTHONPATH=lib/idp_common_pkg python3 -c "import yaml; from idp_common.config.models import PricingConfig; PricingConfig(**yaml.safe_load(open('config_library/pricing.yaml')))"
# upload corrected file to the config bucket key config_library/pricing.yaml, then:
AWS_PROFILE=default aws cloudformation continue-update-rollback --stack-name "$STACK" --region "$REGION"
# NOTE: no --resources-to-skip; child stacks reject direct skip. Fixing S3 lets
# the parent rollback complete once re-validation passes.(See the pricing-units-rollback-deadlock memory for the verified recovery.)
8. Confirm success
AWS_PROFILE=default aws cloudformation describe-stacks --stack-name "$STACK" \
--region "$REGION" --query 'Stacks[0].[StackStatus]' --output text
# want: UPDATE_COMPLETE (NOT UPDATE_ROLLBACK_COMPLETE / _FAILED)Optionally confirm the version bumped:
AWS_PROFILE=default aws cloudformation describe-stacks --stack-name "$STACK" \
--region "$REGION" --query "Stacks[0].Outputs[?contains(OutputKey,'ersion')]" --output table9. Smoke-test the upgraded stack & compare to baseline — REQUIRED
Re-run the same document on the upgraded stack and diff the output against
the §4 baseline. UPDATE_COMPLETE alone is not a pass — functionality must be
preserved.
idp-cli run-inference --stack-name "$STACK" --region "$REGION" \
--profile default --dir samples/ --file-pattern 'lending_package.pdf' \
--batch-prefix post-upgrade --monitor
idp-cli download-results --stack-name "$STACK" --region "$REGION" \
--profile default --batch-id <batch-id> --output-dir /tmp/upgrade-afterCompare the extraction/classification results:
diff -r /tmp/upgrade-baseline /tmp/upgrade-afterExpect the document to process to completion with comparable extracted values.
Some drift is normal and NOT a regression: LLM non-determinism, and any
config-shape changes the v0.5→v0.6 migration intentionally introduces (e.g.
confidence/assessment structure, new metering fields). Across config format 0.9 the
split-then-classify section-classification metering context is SectionClassification;
development builds before the release called it Labeling, so mapping the two
only matters when the FROM side is a develop build that ran strategy: split_then_classify
— a released v0.6.12 has neither key, and combined runs meter under
Classification on both sides. What you're ruling out
is a functional break — empty extractions, a workflow that errors/times
out, classes no longer detected, or confidence collapsing to null across the
board. Call out clearly whether the doc still processes and whether extracted
values are materially equivalent.
10. Tear down
Throwaway stacks should be deleted once the result is recorded (unless a failure needs inspection — keep it and tell the user):
AWS_PROFILE=default aws cloudformation delete-stack --stack-name "$STACK" --region "$REGION"
AWS_PROFILE=default aws cloudformation wait stack-delete-complete --stack-name "$STACK" --region "$REGION"Buckets with DeletionPolicy: Retain (Input/Output/Config) may remain — empty
and delete them manually if doing a full cleanup.
Checklist
- Creds valid (
sts get-caller-identityreturns the expected account); no staleAWS_ACCESS_KEY_ID/SESSION_TOKENenv vars shadowing the profile - Template URLs for FROM + TO grepped from CHANGELOG
- Required params confirmed from the FROM template
- Base FROM stack CREATE_COMPLETE
- Baseline:
lending_package.pdfprocessed on FROM stack, output saved update-stackto TO template, all params reused (drop params removed in TO)UpdateConfigurationLambda logs watched during update- Final status
UPDATE_COMPLETE(no rollback) - Compare:
lending_package.pdfre-processed post-upgrade; output vs baseline confirms functionality preserved (no functional break) - Result reported; throwaway stack deleted (or kept if failed)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

