fix(pay-for-content-browser-use): CLI 0.14 status parse + scaffold .gitignore + content polish#1561
Conversation
…tignore + content polish - pay_for_content_browser.py / .ipynb: harden agentcore status JSON parsing for CLI 0.14.x output (Update-available notice + identifier key rename from agentRuntimeArn). Extract first balanced JSON object from stdout and fall back across identifier / agentRuntimeArn / runtimeArn / arn. - payment_agent.py + pay_for_content_browser.py: establish "Amazon Bedrock AgentCore Runtime" first mention in module docstrings. - Replace one "Ensure" -> "Verify" and one "Always" -> softer phrasing for clearer non-prescriptive language. - Add .gitignore for the features tree (mirrors workshops tree) so the generated payforcontent/ scaffold and CDK build artifacts stay untracked. Validation: ruff format --check + ruff check both pass; .py ran end-to-end on AgentCore Runtime with paid content unlock; notebook cells diffed cell-by-cell against the validated .py.
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
One robustness issue in the new Minimal repro against the current parser shape: stdout = 'notice\n{"resources":[{"name":"PayForContent","identifier":"arn:ok","message":"upgrade notice } after JSON"}]}\nupgrade available'
# current scan stops at the `}` inside message and json.loads() sees truncated JSONBecause this path is specifically meant to tolerate non-JSON CLI notices around the payload, I would use No AWS calls or payments were used for this check; this is only a parser-level readback of the PR diff. |
|
Latest scan for commit: Security Scan ResultsScan Metadata
SummaryScanner ResultsThe table below shows findings by scanner, with status based on severity thresholds and dependencies: Column Explanations: Severity Levels (S/C/H/M/L/I):
Other Columns:
Scanner Results:
Severity Thresholds (Thresh Column):
Threshold Source: Values in parentheses indicate where the threshold is configured:
Statistics calculation:
|
|
Please update your PR |
- Replace manual brace-counting with json.JSONDecoder().raw_decode() so
JSON strings containing { or } characters parse correctly (TateLyman
review).
- Mark Solana Devnet USDC mint address as a non-secret to clear the
detect-secrets HIGH finding from ASH (false positive: it is a public
on-chain SPL token mint).
Applied to both the features-folder Python script and the workshops
notebook so the two trees stay in sync.
Summary
Migration follow-up to #1540. Four small changes across the new
01-features/08-agents-that-transact/02-use-cases/pay-for-content-browser-use/and
06-workshops/13-AgentCore-payments/02-use-cases/pay-for-content-browser-use/trees:agentcore status --jsonnow prepends anUpdate available notice and renamed
agentRuntimeArn→identifier. Bothpay_for_content_browser.pyandpay_for_content_browser.ipynbnow extract thefirst balanced JSON object from stdout and fall back across
identifier/agentRuntimeArn/runtimeArn/arn. Without this fix Step 5 fails on afresh CLI install.
payment_agent.pyandpay_for_content_browser.pymodule docstrings now establish "Amazon Bedrock AgentCore Runtime" before
using the abbreviated form.
Ensure→Verifyand softenedone
Always..gitignorefor the features tree — mirrors the workshops tree; keeps thegenerated
payforcontent/scaffold and CDK build artifacts untracked.Validation
ruff format --checkandruff checkboth pass on the modified.pyfilespay_for_content_browser.pyran end-to-end on AgentCore Runtime — paywall unlocked, payment recorded, observability dashboard populated.py; no functional driftTest plan
ruff format --checkpasses in CIruff checkpasses in CIpython pay_for_content_browser.pyend-to-end with a fresh CLI install (verifies CLI 0.14 fix)