Skip to content

feat(source-amazon-seller-partner): check for existing reports before creating new ones#76093

Merged
octavia-bot-admin[bot] merged 36 commits into
masterfrom
devin/1775474583-report-reuse-optimization
May 5, 2026
Merged

feat(source-amazon-seller-partner): check for existing reports before creating new ones#76093
octavia-bot-admin[bot] merged 36 commits into
masterfrom
devin/1775474583-report-reuse-optimization

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented Apr 6, 2026

What

Addresses oncall#11837 — reduces 429 rate limit errors on report creation by reusing existing SP-API reports instead of always calling createReport.

How

ReportCreationRequester (components.py)

Custom HttpRequester that queries GET /reports before creating a new one. If a matching report exists (same reportType, date range, marketplaceIds), it's reused — no createReport call is made. Falls back to normal creation on any error.

  • Server-side filtering_fetch_reports passes reportTypes, marketplaceIds, and pageSize=100 as query params to the API. No client-side marketplace matching needed.
  • First match wins — API returns results sorted by createdTime descending, so the first matching report in the response is the most recently created.
  • CANCELLED reports skipped — CANCELLED reports are not reused. A new report is always created, acting as a retry mechanism: if data is now available, the new report succeeds; if still no data, the new report is also CANCELLED and the CDK's SKIPPED status mapping handles it silently. The CANCELLED check runs after date range and freshness filters to avoid noisy logs for unrelated CANCELLED reports.
  • Configurable DONE stalenessmax_done_report_age_hours config param (0–24, default 0). When 0, DONE reports are never reused; when >0, only DONE reports younger than the threshold are reused. Non-DONE reports (IN_QUEUE, IN_PROGRESS, FATAL) always reused regardless.

CANCELLED → SKIPPED (manifest.yaml)

Per SP-API docs, CANCELLED means "no data to return." Mapped to CDK SKIPPED status (airbyte-python-cdk#980) — silently drops the partition with no retries, no record fetching, no state advancement.

Other changes

  • request_body_json passthrough — overrides __post_init__ to ensure manifest-defined request body JSON is available via InterpolatedRequestOptionsProvider
  • Documentation — added max_done_report_age_hours to setup guides, new "Report reuse" section, rate limit mitigation recommendation, and a "Report cancellation and data loss" section explaining auto vs manual cancellation with a caution about data loss
  • CDK version — updated to GA 7.18.0 (includes SKIPPED async job status)
  • Outdated test credentials — commented out SECRET_SOURCE-AMAZON-SELLER-PARTNER_OLD_DATA_CREDS in metadata.yaml (no longer valid)
  • Version5.7.6

Updates since last revision

  • Version bump 5.7.5 → 5.7.6 — rebased onto master which already claimed 5.7.5 for #76269
  • Integration test fixes — added GET /reports mock (_get_reports_request / _get_reports_response) to 7 test methods that use http_mocker.clear_all_matchers(). These tests previously only mocked the POST /reports endpoint and failed with NoMockAddress after the ReportCreationRequester pre-check was introduced.
  • CDK 7.18.0 error message update — updated assertion in test_given_http_error_500_on_create_report_when_read_then_no_records_and_error_logged (both TestFullRefresh and TestVendorSalesReportsFullRefresh) from "Giving up _send(...) after 6 tries" to "Max retry limit reached after" to match CDK 7.18.0's changed backoff error message.
  • CANCELLED reports are now skipped instead of reused — enables retry in case data becomes available
  • CANCELLED check moved after date range and freshness filters — avoids noisy skip logs for CANCELLED reports that don't match the current sync's date range
  • Removed _marketplace_ids_match — marketplace filtering moved server-side via marketplaceIds query param
  • _fetch_reports now sends pageSize=100 (API max) for more complete first page
  • Simplified _find_existing_report to return first match instead of tracking best candidate (API pre-sorts by createdTime desc)

Review guide

  1. components.pyReportCreationRequester: send_request override, _fetch_reports (with pageSize/marketplaceIds params), _find_existing_report (date match → freshness → CANCELLED skip → first-match return), _is_report_fresh, _date_ranges_match, _build_synthetic_response
  2. manifest.yamlCustomRequester swap, skipped: [CANCELLED] / timeout: [], new max_done_report_age_hours spec property
  3. test_report_creation_requester.py — 43 unit tests covering fetch params, matching, staleness, CANCELLED skipping, configurable thresholds
  4. test_report_based_streams.py — integration tests for CANCELLED→SKIPPED, incremental state invariance (CANCELLED + empty DONE), plus GET /reports mocks for error-path tests
  5. amazon-seller-partner.md — setup guides, performance considerations, report cancellation/data-loss docs

Review checklist

  • __post_init__ creates _request_options_provider twice (super creates one, then we replace it) — verify no side effects
  • _build_synthetic_response uses Response._content (private attr) — acceptable?
  • CDK version must be updated from prerelease to GA before merge — updated to 7.18.0
  • On FATAL reuse: CDK retries consume all 3 attempts without progress (no new API calls made, but also no recovery). Acceptable?
  • _date_ranges_match compares full datetime with == — if SP-API returns slightly different time components for the same logical range, match fails (safe fallback to create, but could miss reuse)
  • No runtime validation of max_done_report_age_hours — relies solely on manifest spec minimum: 0 / maximum: 24. Out-of-range values would be silently accepted if spec validation is bypassed.
  • marketplaceIds passed as comma-separated string to GET /reports — verify this matches SP-API expected format (vs. repeated query params)
  • First-match-wins relies on API always returning results sorted by createdTime descending — if API sorting changes, wrong report could be selected (safe fallback: creates new report if no match)
  • Integration tests assert CDK 7.18.0 error message "Max retry limit reached after" — if CDK version changes again, these assertions may break

User Impact

Customers hitting 429 rate limits on report creation should see significantly fewer createReport calls. CANCELLED reports are skipped and retried with a new report — if data is now available it succeeds, if not the CDK silently skips it. New max_done_report_age_hours config (highly recommended for rate-limited connections) enables reuse of recent completed reports. No config changes required for the base optimization — in-progress reports are always reused by default.

Documentation explicitly warns users not to manually cancel reports that are being used by Airbyte syncs, as this can cause data loss for that period.

Can this PR be safely reverted and rolled back?

  • YES 💚

Link to Devin session: https://app.devin.ai/sessions/45ba0c82b9654fbb8ce037502492bd3d

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@octavia-bot octavia-bot Bot marked this pull request as draft April 6, 2026 11:31
@octavia-bot
Copy link
Copy Markdown
Contributor

octavia-bot Bot commented Apr 6, 2026

Note

📝 PR Converted to Draft

More info...

Thank you for creating this PR. As a policy to protect our engineers' time, Airbyte requires all PRs to be created first in draft status. Your PR has been automatically converted to draft status in respect for this policy.

As soon as your PR is ready for formal review, you can proceed to convert the PR to "ready for review" status by clicking the "Ready for review" button at the bottom of the PR page.

To skip draft status in future PRs, please include [ready] in your PR title or add the skip-draft-status label when creating your PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 6, 2026

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

PR Slash Commands

Airbyte Maintainers (that's you!) can execute the following slash commands on your PR:

  • 🛠️ Quick Fixes
    • /format-fix - Fixes most formatting issues.
    • /bump-version - Bumps connector versions, scraping changelog description from the PR title.
      • Bump types: patch (default), minor, major, major_rc, rc, promote.
      • The rc type is a smart default: applies minor_rc if stable, or bumps the RC number if already RC.
      • The promote type strips the RC suffix to finalize a release.
      • Example: /bump-version type=rc or /bump-version type=minor
    • /bump-progressive-rollout-version - Alias for /bump-version type=rc. Bumps with an RC suffix and enables progressive rollout.
  • ❇️ AI Testing and Review (internal link: AI-SDLC Docs):
    • /ai-prove-fix - Runs prerelease readiness checks, including testing against customer connections.
    • /ai-canary-prerelease - Rolls out prerelease to 5-10 connections for canary testing.
    • /ai-review - AI-powered PR review for connector safety and quality gates.
  • 🚀 Connector Releases:
    • /publish-connectors-prerelease - Publishes pre-release connector builds (tagged as {version}-preview.{git-sha}) for all modified connectors in the PR.
  • ☕️ JVM connectors:
    • /update-connector-cdk-version connector=<CONNECTOR_NAME> - Updates the specified connector to the latest CDK version.
      Example: /update-connector-cdk-version connector=destination-bigquery
  • 🐍 Python connectors:
    • /poe connector source-example lock - Run the Poe lock task on the source-example connector, committing the results back to the branch.
    • /poe source example lock - Alias for /poe connector source-example lock.
    • /poe source example use-cdk-branch my/branch - Pin the source-example CDK reference to the branch name specified.
    • /poe source example use-cdk-latest - Update the source-example CDK dependency to the latest available version.
  • ⚙️ Admin commands:
    • /force-merge reason="<REASON>" - Force merges the PR using admin privileges, bypassing CI checks. Requires a reason.
      Example: /force-merge reason="CI is flaky, tests pass locally"
📚 Show Repo Guidance

Helpful Resources

📝 Edit this welcome message.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 6, 2026

Deploy preview for airbyte-docs ready!

Project:airbyte-docs
Status: ✅  Deploy successful!
Preview URL:https://airbyte-docs-3itqtvjdw-airbyte-growth.vercel.app
Latest Commit:3f6a690

Deployed with vercel-action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 6, 2026

source-amazon-seller-partner Connector Test Results

555 tests   552 ✅  19m 52s ⏱️
  2 suites    3 💤
  2 files      0 ❌

Results for commit a401559.

♻️ This comment has been updated with latest results.

@darynaishchenko
Copy link
Copy Markdown
Collaborator

Daryna Ishchenko (darynaishchenko) commented Apr 7, 2026

/publish-connectors-prerelease

Pre-release Connector Publish Started

Publishing pre-release build for connector source-amazon-seller-partner.
PR: #76093

Pre-release versions will be tagged as {version}-preview.7e8b85d
and are available for version pinning via the scoped_configuration API.

View workflow run
Pre-release Publish: SUCCESS

Docker image (pre-release):
airbyte/source-amazon-seller-partner:5.7.1-preview.7e8b85d

Docker Hub: https://hub.docker.com/layers/airbyte/source-amazon-seller-partner/5.7.1-preview.7e8b85d

Registry JSON:

@darynaishchenko
Copy link
Copy Markdown
Collaborator

Daryna Ishchenko (darynaishchenko) commented Apr 7, 2026

/publish-connectors-prerelease

Pre-release Connector Publish Started

Publishing pre-release build for connector source-amazon-seller-partner.
PR: #76093

Pre-release versions will be tagged as {version}-preview.ceaa531
and are available for version pinning via the scoped_configuration API.

View workflow run
Pre-release Publish: SUCCESS

Docker image (pre-release):
airbyte/source-amazon-seller-partner:5.7.1-preview.ceaa531

Docker Hub: https://hub.docker.com/layers/airbyte/source-amazon-seller-partner/5.7.1-preview.ceaa531

Registry JSON:

@devin-ai-integration devin-ai-integration Bot force-pushed the devin/1775474583-report-reuse-optimization branch from ceaa531 to 2e963cc Compare April 8, 2026 10:28
@devin-ai-integration devin-ai-integration Bot force-pushed the devin/1775474583-report-reuse-optimization branch 2 times, most recently from 83986e4 to 6747652 Compare April 24, 2026 09:26
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

↪️ Triggering /ai-review per Hands-Free AI Triage Project triage next step.

Reason: PR is ready for review with no prior /ai-review. Triggering review to advance pipeline.

Devin session

@octavia-bot
Copy link
Copy Markdown
Contributor

octavia-bot Bot commented Apr 24, 2026

AI PR Review starting...

Reviewing PR for connector safety and quality.
View playbook

Devin AI session created successfully!

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

devin-ai-integration Bot commented Apr 24, 2026

AI PR Review Report

Review Action: NO ACTION (INCONCLUSIVE)
Risk Level: 4 — Behavioral change: CANCELLED status remapped from timeout to skipped; new ReportCreationRequester adds GET /reports API pre-check before POST createReport. Anti-Pattern gate triggered.

Gate Status
PR Hygiene PASS
Code Hygiene PASS
Test Coverage PASS
Code Security PASS
Per-Record Performance PASS
Breaking Dependencies WARNING
Backwards Compatibility PASS
Forwards Compatibility PASS
Behavioral Changes FAIL
Out-of-Scope Changes PASS
CI Checks UNKNOWN
Live / E2E Tests PASS

CI Checks is UNKNOWN because the Test source-amazon-seller-partner Connector check is still pending. Once CI completes, re-run /ai-review for a definitive result.


📋 PR Details

Connector & PR Info

Connector(s): source-amazon-seller-partner
PR: #76093
HEAD SHA: 67476522f7ccd398a307b3e65fecf07174a89117
Session: https://app.devin.ai/sessions/49b9ce99637547b59e927b5a5d5ce27f

Risk Level

Level: 4 — High
Rationale: CANCELLED report status remapped from timeout (retried by CDK) to skipped (silently dropped) in manifest.yaml. New ReportCreationRequester class in components.py adds a GET /reports API pre-check before POST createReport, fundamentally changing the report creation flow. The Anti-Pattern gate (Behavioral Changes) was triggered by the timeout keyword in the manifest.yaml diff. Both baseImage and test CDK dependency point to a prerelease CDK (7.16.0.post3.dev24082870177) that must be updated to GA before merge.

Risk Level is reported for downstream consumers (e.g. auto-merge policy, reviewer routing). It does not change the review action — APPROVE here means "no blocking objection," not "safe to merge unattended."

Review Action Details

NO ACTION (INCONCLUSIVE) - The Test source-amazon-seller-partner Connector CI check is still pending. No PR review submitted. Human review required, or re-run /ai-review once CI completes.

Note: The bot submits APPROVE whenever all enforced gates PASS, regardless of what the PR changes. APPROVE is a quality signal, not a merge authorization; any auto-merge behavior is governed by separate policy reading decision and risk_level from the metrics marker.

🔍 Gate Evaluation Details

Gate-by-Gate Analysis

Gate Status Enforced? Details
PR Hygiene PASS Yes Detailed description (>5000 chars), changelog updated, no unresolved human comments
Code Hygiene PASS WARNING Source files modified (components.py, manifest.yaml) with test files modified (test_report_creation_requester.py, test_report_based_streams.py)
Test Coverage PASS Yes Feature PR with 43+ new test functions covering all new behavior
Code Security PASS Yes No security-sensitive file patterns matched; no security keywords in diff hunks
Per-Record Performance PASS WARNING Changes are per-partition (report creation), not per-record
Breaking Dependencies WARNING WARNING CDK dependency changed to prerelease 7.16.0.post3.dev24082870177; must be updated to GA before merge
Backwards Compatibility PASS Warning (elevates Risk Level) No spec changes, no streams removed/renamed, no primary key/cursor changes
Forwards Compatibility PASS Warning (elevates Risk Level) stream_state parameters are standard CDK pass-through; no state format/cursor/pagination logic changes; comprehensive tests validate forwards compatibility
Behavioral Changes FAIL Warning (elevates Risk Level) timeout keyword found in manifest.yaml diff hunks — CANCELLED status moved from timeout to skipped, timeout: [] emptied
Out-of-Scope Changes PASS Skip All 9 changed files are within connector directory or docs/
CI Checks UNKNOWN Yes Test source-amazon-seller-partner Connector is still pending; Lint and Build passed
Live / E2E Tests PASS Yes Pre-Release Checks CI check passed; pre-release versions published (5.7.1-preview.7e8b85d, 5.7.1-preview.ceaa531)

PR Hygiene — PASS

PR Description Check:

  • PR Body Length (raw): >5000 characters
  • PR Body Length (after stripping): >5000 characters
  • PR Body Length (visible content): >5000 characters
  • PR Body Preview: ## What\n\nAddresses [oncall#11837](https://github.com/airbytehq/oncall/issues/11837) — Amazon SP-API enforces...
  • PASS: Detailed description covering What, How, Review guide, User Impact, and Revert safety

Docs Changelog Check:

  • docs/integrations/sources/amazon-seller-partner.md updated with version 5.7.4 changelog entry
  • PASS: Changelog updated

Peer Feedback Check:

  • All review comments are from bots: github-code-quality[bot], devin-ai-integration[bot], octavia-bot[bot], github-actions[bot]
  • All bot comment threads are resolved
  • No human reviewer comments found
  • PASS: No unresolved human reviewer comments

Test Coverage — PASS

  • Behavioral Change Detected: Yes
  • Indicators Found: PR title contains feat
  • Test Files Modified:
    • unit_tests/test_report_creation_requester.py (new, 740 lines)
    • unit_tests/integration/test_report_based_streams.py (modified)
    • unit_tests/integration/request_builder.py (modified)
  • New Test Content Found: Yes
  • Test Content Evidence: def test_given_existing_report_with_matching_dates_and_type_when_send_request_then_reuse_report (and 42+ other test functions)

Code Security — PASS

Path-based patterns: No changed files match auth/credential/token path patterns.

Keyword-based patterns (diff-hunk scoped):

  • manifest.yaml diff hunks: No security keywords (authenticator, OAuthAuthenticator, client_id, client_secret, api_key, etc.)
  • metadata.yaml diff hunks: Changed lines are baseImage and dockerImageTag; connectorBuildOptions is a context line only. No security keywords matched.
  • components.py: No auth/credential keywords in added/removed lines.

Behavioral Changes — FAIL (WARNING enforcement)

Operational risk keywords found in diff hunks:

  • manifest.yaml: timeout keyword detected
    • Removed: timeout: with - CANCELLED under it
    • Added: skipped: with - CANCELLED, timeout: []
    • Impact: CANCELLED reports were previously treated as timeout (CDK retries), now treated as skipped (CDK silently drops the partition). This changes retry behavior for CANCELLED reports.

Note: This is a WARNING-level gate that elevates Risk Level but does not by itself block APPROVE.


Breaking Dependencies — WARNING

  • pyproject.toml CDK dependency: ^7.7.07.16.0.post3.dev24082870177 (prerelease, pinned exact)
  • metadata.yaml baseImage: 7.17.27.16.0.post3.dev24082870177 (prerelease)
  • The PR description explicitly notes: "Must be updated to the GA CDK release before final publish."
  • Advisory: The prerelease CDK (7.16.0.post3.dev24082870177) from airbyte-python-cdk#980 adds the SKIPPED async job status. Update to GA CDK before merge.

CI Checks — UNKNOWN

Check Status
Lint source-amazon-seller-partner Connector ✅ PASS
Test source-amazon-seller-partner Connector ⏳ PENDING
Build and Verify Artifacts (source-amazon-seller-partner) ✅ PASS

The Test source-amazon-seller-partner Connector check is still pending. Cannot determine CI status definitively.


Live / E2E Tests — PASS

Validation-Required Detection:

  • API Request/Response Handling Changes: creation_requester section modified in manifest.yaml; components.py adds new HTTP GET pre-check with _http_client.send_request(), request_body_json, .json() keywords
  • Result: Validation IS required

Evidence (Priority 2 — CI Check-Runs):

  • MCP verification unavailable (Cloud SQL Proxy not running)
  • source-amazon-seller-partner Pre-Release Checks — ✅ PASSED
  • Pre-release versions published: 5.7.1-preview.7e8b85d and 5.7.1-preview.ceaa531
  • PASS: Acceptable evidence check-run is green

Backwards Compatibility — PASS

Spec Comparison: No spec file (spec.json, spec.yaml) was modified.

Other breaking change indicators:

  • No streams removed or renamed
  • No primary key or cursor field changes
  • No schema properties removed
  • status_mapping change (CANCELLED: timeout → skipped) is behavioral but does not break existing connection configs
  • Version bump 5.7.3 → 5.7.4 (patch) is appropriate for non-breaking changes

Forwards Compatibility — PASS

Keywords checked in diff hunks:

  • state: Found in stream_state parameter names (standard CDK pass-through, not state format changes)
  • No cursor, checkpoint, incremental_sync, paginator, pagination, transformations, record_selector keywords in diff hunks

Tests proving forwards compatibility:

  • 43+ unit tests in test_report_creation_requester.py
  • Integration tests validating state is unchanged after CANCELLED/empty reports
  • test_given_cancelled_report_when_incremental_read_then_state_unchanged
  • test_given_done_empty_report_when_incremental_read_then_state_unchanged
📚 Evidence Consulted

Evidence

  • Changed files: 9 files
    • components.py — New ReportCreationRequester class (~240 lines added)
    • manifest.yamlcreation_requester type swap + status_mapping change
    • metadata.yaml — baseImage + version bump (5.7.3 → 5.7.4)
    • unit_tests/test_report_creation_requester.py — New test file (740 lines, 43+ tests)
    • unit_tests/integration/test_report_based_streams.py — Updated integration tests
    • unit_tests/integration/request_builder.py — New get_reports_endpoint() method
    • unit_tests/pyproject.toml — CDK dependency update
    • unit_tests/poetry.lock — Lock file update
    • docs/integrations/sources/amazon-seller-partner.md — Changelog entry
  • CI checks: 33 passed, 1 pending (Test source-amazon-seller-partner Connector), 7 skipped
  • PR labels: connectors/source/amazon-seller-partner
  • PR description: Present (detailed, >5000 chars)
  • Existing bot reviews: COMMENTED only (github-code-quality[bot], devin-ai-integration[bot]) — all resolved. No REQUEST_CHANGES or APPROVE reviews.
  • Pre-release published: 5.7.1-preview.7e8b85d, 5.7.1-preview.ceaa531
❓ How to Respond

Providing Context or Justification

The review is currently INCONCLUSIVE because the Test source-amazon-seller-partner Connector CI check is still pending. Once it completes:

  • If tests pass → re-run /ai-review for a definitive APPROVE result
  • If tests fail → investigate and fix failing tests

You can add explanations that the bot will see on the next review:

Option 1: PR Description (recommended)
Add a section to your PR description:

## AI PR Review Justification

### {Gate Name}
[Your explanation here]

Option 2: PR Comment
Add a comment starting with:

AI PR Review Justification:
[Your explanation here]

After adding your response, re-run /ai-review to have the bot evaluate it.

Note: Justifications provide context for the bot to evaluate. For some gates (like the Live / E2E Tests gate), a sufficient justification can lead to PASS. For other gates, justifications help explain the situation but may still require escalation if the gate cannot be remediated.

requested_marketplace_ids = body_json.get("marketplaceIds", []) if body_json else []

if report_type:
existing_report = self._find_existing_report(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check whether max_done_report_age_hours > 0 here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No — max_done_report_age_hours only controls whether DONE reports are reused. The pre-check (_find_existing_report) is still valuable when max_done_report_age_hours == 0 because it reuses reports in other statuses:

  • IN_QUEUE / IN_PROGRESS — avoids creating a duplicate while one is already running
  • CANCELLED — reused so the CDK maps it to SKIPPED (no retry, no wasted API call)
  • FATAL — reused so CDK retries don't create new reports

Only DONE reports are filtered out by _is_report_fresh when the config is 0. So the GET /reports call should always happen regardless of the config value.

@devin-ai-integration devin-ai-integration Bot force-pushed the devin/1775474583-report-reuse-optimization branch from 118cd8a to 36b6966 Compare April 28, 2026 23:18
@octavia-bot
Copy link
Copy Markdown
Contributor

octavia-bot Bot commented Apr 30, 2026

AI PR Review starting...

Reviewing PR for connector safety and quality.
View playbook

Devin AI session created successfully!

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

↪️ Triggering /ai-review per Hands-Free AI Triage Project triage next step.

Reason: Previous AI review returned UNKNOWN. Re-running review for definitive result.

Devin session

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

devin-ai-integration Bot commented Apr 30, 2026

AI PR Review Report

Review Action: NO ACTION (INCONCLUSIVE)
Risk Level: 4 — Behavioral change: CANCELLED status remapped from timeout→skipped; new ReportCreationRequester adds GET /reports API pre-check before POST createReport. Anti-Pattern gate (Behavioral Changes) triggered.

Gate Status
PR Hygiene PASS
Code Hygiene PASS
Test Coverage PASS
Code Security PASS
Per-Record Performance PASS
Breaking Dependencies WARNING
Backwards Compatibility PASS
Forwards Compatibility PASS
Behavioral Changes FAIL
Out-of-Scope Changes PASS
CI Checks UNKNOWN
Live / E2E Tests PASS

CI Checks is UNKNOWN because Test source-amazon-seller-partner Connector (job_id: 73761385963) is still pending. Once CI completes, re-run /ai-review for a definitive result.


📋 PR Details

Connector & PR Info

Connector(s): source-amazon-seller-partner
PR: #76093
HEAD SHA: 22e54ebedc63f3724431df32b4d56c167bc97378
Session: https://app.devin.ai/sessions/5a15e8380c354d19a9f996018504ce78

Risk Level

Level: 4 — High
Rationale: Behavioral change: CANCELLED status remapped from timeout (retry) to skipped (silently drop partition) in manifest.yaml status_mapping. New ReportCreationRequester adds a GET /reports API pre-check that short-circuits POST createReport when a matching report exists. Anti-Pattern gate (Behavioral Changes) triggered — forces risk_level ≥ 4.

Risk Level is reported for downstream consumers (e.g. auto-merge policy, reviewer routing). It does not change the review action — APPROVE here means "no blocking objection," not "safe to merge unattended."

Review Action Details

NO ACTION (INCONCLUSIVE) — The Test source-amazon-seller-partner Connector CI check is still pending. No PR review submitted. Human review required, or re-run /ai-review after CI completes.

Note: The bot submits APPROVE whenever all enforced gates PASS, regardless of what the PR changes. APPROVE is a quality signal, not a merge authorization; any auto-merge behavior is governed by separate policy reading decision and risk_level from the metrics marker.

🔍 Gate Evaluation Details

Gate-by-Gate Analysis

Gate Status Enforced? Details
PR Hygiene PASS Yes Description present (>50 chars), changelog updated (v5.7.5 entry), peer feedback from tolik0 addressed (reply in comment 16)
Code Hygiene PASS WARNING Source files modified (components.py, manifest.yaml); test files modified (test_report_creation_requester.py, test_report_based_streams.py)
Test Coverage PASS Yes PR title contains "feat" (behavioral indicator); new test file with 790 lines (49 unit tests + integration tests)
Code Security PASS Yes No auth/credential file patterns matched; no security keywords in diff hunks of manifest.yaml or metadata.yaml
Per-Record Performance PASS WARNING Changes are at partition/report-creation level (per date slice), not per-record. GET /reports call is once per partition, not per record
Breaking Dependencies WARNING WARNING CDK base image 7.17.2→7.18.0 (minor bump). Minor CDK bump includes SKIPPED async job status support
Backwards Compatibility PASS Warning Spec required array unchanged (both master and PR: aws_environment, region, account_type, lwa_app_id, lwa_client_secret, refresh_token). New optional property max_done_report_age_hours added with default=0. No properties removed
Forwards Compatibility PASS Warning No state/cursor/pagination/transformation keywords in changed hunks. Status mapping change does not affect state format or cursor behavior
Behavioral Changes FAIL Warning (elevates Risk Level) timeout keyword found in diff hunks: timeout: [] replaces previous timeout: - CANCELLED. CANCELLED reports now mapped to skipped instead of timeout (changes retry→skip behavior)
Out-of-Scope Changes PASS Skip All 10 changed files are within connector directory or docs/
CI Checks UNKNOWN Yes Test source-amazon-seller-partner Connector still pending (job_id: 73761385963). Lint ✅, Build ✅
Live / E2E Tests PASS Yes source-amazon-seller-partner Pre-Release Checks ✅ passed. Pre-release versions published (5.7.1-preview.7e8b85d, 5.7.1-preview.ceaa531). MCP verification unavailable (Cloud SQL Proxy not running) — fell back to Priority 2 check-run evidence

Spec Comparison:

  • Master required: ["aws_environment", "region", "account_type", "lwa_app_id", "lwa_client_secret", "refresh_token"]
  • PR required: ["aws_environment", "region", "account_type", "lwa_app_id", "lwa_client_secret", "refresh_token"]
  • No new required fields detected → PASS (additive only: new optional max_done_report_age_hours with default=0)

Behavioral Changes Detail:

  • manifest.yaml status_mapping.timeout: Was [CANCELLED], now []
  • manifest.yaml status_mapping.skipped: New entry [CANCELLED]
  • Net effect: CANCELLED reports previously triggered timeout/retry behavior; now silently skipped (CDK SKIPPED status)
  • New ReportCreationRequester adds GET /reports pre-check before POST createReport
📚 Evidence Consulted

Evidence

  • Changed files: 10 files (+2961, -1646 lines including poetry.lock churn)
    • components.py (+294 lines — new ReportCreationRequester class)
    • manifest.yaml (+24 lines — spec property, status_mapping, CustomRequester swap)
    • metadata.yaml (+4 lines — version bump 5.7.4→5.7.5, CDK base image update)
    • unit_tests/test_report_creation_requester.py (+790 lines — new test file)
    • unit_tests/integration/test_report_based_streams.py (+161 lines — integration tests)
    • unit_tests/integration/config.py (+4 lines)
    • unit_tests/integration/request_builder.py (+9 lines)
    • unit_tests/pyproject.toml (+2 lines — CDK dependency update)
    • unit_tests/poetry.lock (dependency lock update)
    • docs/integrations/sources/amazon-seller-partner.md (+38 lines — docs/changelog)
  • CI checks: 33 passed, 0 failed, 1 pending (Test source-amazon-seller-partner Connector)
  • PR labels: connectors/source/amazon-seller-partner
  • PR description: Present, detailed (~2500+ chars)
  • Existing bot reviews: Prior UNKNOWN review for HEAD SHA 67476522f7ccd398a307b3e65fecf07174a89117 (different commit — new commits pushed since)
  • Pre-release check: source-amazon-seller-partner Pre-Release Checks
❓ How to Respond

Providing Context or Justification

You can add explanations that the bot will see on the next review:

Option 1: PR Description (recommended)
Add a section to your PR description:

## AI PR Review Justification

### {Gate Name}
[Your explanation here]

Option 2: PR Comment
Add a comment starting with:

AI PR Review Justification:
[Your explanation here]

After adding your response, re-run /ai-review to have the bot evaluate it.

Note: The CI Checks gate is UNKNOWN because tests are still running. Once CI completes, re-run /ai-review for a definitive result. If all checks pass at that time, the review will likely be APPROVE (the Behavioral Changes gate is a WARNING that elevates Risk Level but does not block approval).

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

↪ Triggering /ai-review per Hands-Free AI Triage Project triage next step.

Reason: Re-review needed — substantive commits since last UNKNOWN review at 22e54eb (refactor: filter by marketplaceIds in API; refactor: move CANCELLED check after date/freshness filters; current head c5ffcfb).

Devin session

@octavia-bot
Copy link
Copy Markdown
Contributor

octavia-bot Bot commented May 4, 2026

AI PR Review starting...

Reviewing PR for connector safety and quality.
View playbook

Devin AI session created successfully!

devin-ai-integration Bot and others added 20 commits May 5, 2026 00:44
Add max_done_report_age_hours to connector spec (integer, min=0, max=24, default=0).
When 0 (default), DONE reports are never reused — new reports are always created.
When set to a positive value, DONE reports younger than that threshold are reused.
IN_PROGRESS/IN_QUEUE/CANCELLED/FATAL reports are unaffected by this setting.

Updated 48 unit tests covering all configurable threshold scenarios.

Co-Authored-By: bot_apk <apk@cognition.ai>
Co-Authored-By: bot_apk <apk@cognition.ai>
Co-Authored-By: bot_apk <apk@cognition.ai>
… dict directly

Co-Authored-By: bot_apk <apk@cognition.ai>
…od using self.config

Co-Authored-By: bot_apk <apk@cognition.ai>
…avior

Co-Authored-By: bot_apk <apk@cognition.ai>
…d reports

Co-Authored-By: bot_apk <apk@cognition.ai>
Co-Authored-By: bot_apk <apk@cognition.ai>
Co-Authored-By: bot_apk <apk@cognition.ai>
…w report

CANCELLED reports are no longer reused. Instead, a new report is created,
which acts as a retry mechanism: if data is now available the new report
will succeed; if still no data, the new report will also be CANCELLED and
the CDK's SKIPPED status mapping will handle it silently.

Co-Authored-By: bot_apk <apk@cognition.ai>
…return first result

- _fetch_reports now passes pageSize=100 and marketplaceIds query params
- Removed _marketplace_ids_match (filtering done server-side)
- _find_existing_report returns first match (API sorts by createdTime desc)
- Removed best-candidate tracking loop

Co-Authored-By: bot_apk <apk@cognition.ai>
Co-Authored-By: bot_apk <apk@cognition.ai>
… noisy logs

Co-Authored-By: bot_apk <apk@cognition.ai>
…uester pre-check

Co-Authored-By: bot_apk <apk@cognition.ai>
Co-Authored-By: bot_apk <apk@cognition.ai>
@devin-ai-integration devin-ai-integration Bot force-pushed the devin/1775474583-report-reuse-optimization branch from 0cf61fa to a401559 Compare May 5, 2026 00:44
devin-ai-integration Bot and others added 2 commits May 5, 2026 11:39
Co-Authored-By: bot_apk <apk@cognition.ai>
Co-Authored-By: bot_apk <apk@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🙋 Escalating to human review per Hands-Free AI Triage Project triage next step.

Reason: /ai-review has returned UNKNOWN three consecutive times. PR is APPROVED by human reviewer (@tolik0) and mergeable=clean, but new commits have landed since the approval. A maintainer decision is required to either re-confirm merge intent or address what is blocking the AI review verdict.

Devin session

Co-Authored-By: bot_apk <apk@cognition.ai>
@darynaishchenko
Copy link
Copy Markdown
Collaborator

Daryna Ishchenko (darynaishchenko) commented May 5, 2026

/force-merge reason="long running ci for this source, passed for previous commit"

Force-merge job started... Check job output.

Force merge successful! This PR has been merged.

@octavia-bot-admin octavia-bot-admin Bot merged commit 2dfe25a into master May 5, 2026
39 of 40 checks passed
@octavia-bot-admin octavia-bot-admin Bot deleted the devin/1775474583-report-reuse-optimization branch May 5, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants