Skip to content

fix(jira): address PR #302 review — signature binding, REST-pivot docs, ADR-015#11

Closed
flamingquaks wants to merge 1 commit into
mayakost:feat/288-jira-integrationfrom
flamingquaks:fix/288-jira-review-fixes
Closed

fix(jira): address PR #302 review — signature binding, REST-pivot docs, ADR-015#11
flamingquaks wants to merge 1 commit into
mayakost:feat/288-jira-integrationfrom
flamingquaks:fix/288-jira-review-fixes

Conversation

@flamingquaks

Copy link
Copy Markdown

Summary

Addresses all six blocking issues (and the test-coverage gaps) from krokoko's changes-requested review on aws-samples#302. Merging this into feat/288-jira-integration updates that PR in place.

Blocking issues resolved

  1. CI red (test_config.py syntax error) — already fixed at PR HEAD by 1e4a4a0; this branch keeps the agent suite green (1005 passed).
  2. Stale Starlight mirrors — regenerated at this HEAD; node docs/scripts/sync-starlight.mjs is clean.
  3. Multi-tenant signature binding (security)
    • bgagent jira setup no longer mirrors the stack-wide secret into per-tenant bundles. Each tenant keeps its own secret; only the first tenant seeds the stack-wide fallback (needed for Settings-UI webhooks, which omit cloudId).
    • The receiver forwards verified_via: 'per-tenant' | 'stack-wide' to the processor. On stack-wide verification the processor refuses a body-supplied cloudId and binds the delivery to the sole active tenant (drops when zero/multiple); a missing verified_via is treated as untrusted.
    • Missing-timestamp deliveries log the skipped replay-window check so the bypass is observable.
  4. ADR / docs MCP→REST reconciliation — ADR renumbered to ADR-015 (feat(tasks): workflow-driven tasks — declarative steps + repo-less workflows (#248) aws-samples/sample-autonomous-cloud-coding-agents#296 took ADR-014), status accepted, rewritten for the implemented REST outbound and the actual dedup key ({issueKey}#{webhookEvent}#{timestamp}). JIRA_SETUP_GUIDE, USER_GUIDE ("six ways"), ROADMAP, jira-integration.ts, jira-webhook-processor.ts, config.py, and test_config.py docstrings all brought in line. channel_mcp.py drops the non-functional jira entry from CHANNEL_MCP_BUILDERS (the Atlassian Remote MCP can't authenticate headlessly), with tests pinning the no-op.
  5. Non-existent CLI command in user-facing strings — unmapped-project feedback and setup "Next steps" now print bgagent jira map <cloud-id> <project-key> --repo … (setup interpolates the actual cloudId).
  6. Dead orchestrator IAMnotifyJiraOnConcurrencyCap implemented in orchestrate-task.ts (parity with Linear), so the registry-read + secret grants in agent.ts now have their consumer.

Test coverage added

  • cdk/test/handlers/jira-webhook-multi-tenant.test.ts — 10 cases mirroring the Linear multi-workspace suite (per-tenant verify, cross-tenant mismatch fatal, revoked no-fallback even when stack-wide matches, verified_via tagging, infra-error 500, missing-timestamp dispatch).
  • Processor cloudId trust-binding tests (4 cases incl. stack-wide + foreign-cloudId drop).
  • cdk/test/handlers/shared/jira-feedback.test.ts — ADF body shape (pinned exactly — REST v3 400s otherwise), timeout/non-2xx/resolver-throw paths.
  • cdk/test/constructs/jira-integration.test.ts — key schemas, GSI, dedup TTL, env wiring, and read-only receiver IAM on the OAuth prefix.
  • cli/test/jira-oauth.test.ts — 22 cases: JSON (not form-encoded) token exchange, refresh-token rotation persistence, invalid_grant, accessible-resources, PKCE, authorize-URL params incl. audience.
  • stored-oauth-token-parity.test.ts parameterized to also cover the Jira StoredOauthTokenStoredJiraOauthToken pair.

Verification

  • cdk: 109 suites / 1977 passed
  • cli: 26 suites / 325 passed (+ compile + eslint clean)
  • agent: 1005 passed, ruff + ty clean
  • check-types-sync / check-constants-sync OK; Starlight mirrors regenerated

🤖 Generated with Claude Code

…T-pivot docs, ADR-015

Resolves all blocking issues from the changes-requested review:

Security (multi-tenant signature binding):
- `bgagent jira setup` no longer mirrors the stack-wide signing secret
  into per-tenant OAuth bundles; each tenant keeps its own secret and
  only the FIRST tenant seeds the stack-wide fallback.
- The receiver forwards `verified_via` ('per-tenant' | 'stack-wide') to
  the processor; on stack-wide verification the processor refuses a
  body-supplied cloudId and binds the delivery to the sole active
  tenant, dropping when ambiguous (missing verified_via = untrusted).
- Missing-timestamp deliveries now log the skipped replay check so the
  bypass is observable.

ADR / docs reconciliation (MCP → REST pivot):
- ADR renumbered to ADR-015 (post-aws-samples#296 ADR-014 collision), status
  accepted, rewritten for the implemented REST outbound path and the
  actual dedup key; JIRA_SETUP_GUIDE / USER_GUIDE ("six ways") /
  ROADMAP / construct + handler docstrings brought in line.
- channel_mcp.py drops the non-functional Jira MCP entry (Atlassian
  Remote MCP cannot authenticate headlessly); jira gate is now an
  explicit no-op with tests pinning it.

Parity / correctness:
- notifyJiraOnConcurrencyCap added to orchestrate-task (the IAM grants
  in agent.ts now have a consumer), mirroring the Linear path.
- Unmapped-project feedback + setup "Next steps" print the real
  command: `bgagent jira map <cloud-id> <project-key> --repo …`.
- `webhookEvent` union no longer collapsed by `| string`; stale
  cloudId doc comment fixed.

Test coverage:
- jira-webhook-multi-tenant.test.ts (10 cases: per-tenant verify,
  cross-tenant mismatch, revoked no-fallback, stack-wide tagging,
  missing-timestamp dispatch, infra-error 500).
- Processor cloudId trust-binding tests (4 cases incl. the
  stack-wide + foreign-cloudId drop).
- jira-feedback.test.ts (ADF body shape, timeout, non-2xx, resolver
  throw), jira-integration construct test (key schemas, TTL, env
  wiring, read-only receiver IAM), CLI jira-oauth.test.ts (22 cases:
  JSON token exchange, refresh rotation, accessible-resources),
  Jira pair added to stored-oauth-token parity contract test.

Suites: cdk 1977 passed, cli 325 passed, agent 1005 passed; Starlight
mirrors regenerated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant