Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Description

This PR updates the TestRail connector to use updated_on instead of created_on as the cursor field for incremental synchronization of test runs. This allows the connector to detect when existing test runs are modified (e.g., when test results are added) and re-sync them to Faros, not just newly created runs.

The implementation follows the same pattern already used by the Cases stream, which successfully uses updated_on/updated_after for incremental sync.

Key changes:

  • Added updated_on field to TestRailsRun interface
  • Updated RunState from created_after to updated_after
  • Changed cursor field from created_on to updated_on in Runs stream
  • Updated API client to use updated_after/updated_before query parameters
  • Added updated_on to run.json schema

Type of change

  • Bug fix (fixes incremental sync missing updates to existing runs)
  • New feature
  • Breaking change (state schema changes from created_after to updated_after)

Related issues

Fixes FAI-18460

Migration notes

⚠️ Breaking Change: This PR changes the state schema for the Runs stream. Existing connectors will have state with created_after, but the code now expects updated_after.

On the first sync after upgrading:

  • The code will fall back to 0 for updated_after (due to ?? 0 in the code)
  • This will effectively trigger a full refresh of runs for that first sync
  • Subsequent syncs will work incrementally as expected

Extra info

Review checklist:

  • Verify TestRail API documentation confirms support for updated_after/updated_before parameters on /get_runs endpoint
  • Confirm state migration strategy is acceptable (one-time full refresh on upgrade)
  • Consider whether the unrelated .envrc change in .gitignore should be removed or committed separately
  • The Cases stream already uses this exact pattern - verify it works correctly in production

Link to Devin run: https://app.devin.ai/sessions/1804a07814f849e3b24272db387ccc24

Requested by: [email protected] (@thierryfaros)

faros-ai-devin and others added 2 commits June 9, 2025 20:57
…remental sync

This change updates the TestRail connector to use the updated_on field
instead of created_on as the cursor for incremental synchronization of
test runs. This allows the connector to detect when existing test runs
are modified (e.g., when test results are added) and re-sync them to Faros.

Changes:
- Added updated_on field to TestRailsRun interface
- Updated RunState to use updated_after instead of created_after
- Changed cursor field from created_on to updated_on in Runs stream
- Updated API client to use updated_after/updated_before query parameters
- Added updated_on to run.json schema

This follows the same pattern already implemented in the Cases stream.

Co-Authored-By: [email protected] <[email protected]>
@devin-ai-integration
Copy link
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

@sonarqubecloud
Copy link

@thierryfaros thierryfaros requested a review from Copilot October 21, 2025 21:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the TestRail connector to use updated_on instead of created_on for incremental synchronization of test runs, enabling the connector to detect and re-sync modified runs (e.g., when test results are added), not just newly created ones.

Key changes:

  • Changed cursor field from created_on to updated_on for the Runs stream
  • Updated API client to use updated_after/updated_before query parameters instead of created_after/created_before
  • Modified state schema from created_after to updated_after

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
sources/testrails-source/src/testrails/testrails-models.ts Added updated_on field to TestRailsRun interface
sources/testrails-source/src/testrails/testrails-client.ts Updated API query parameters to use updated_after/updated_before
sources/testrails-source/src/streams/run.ts Changed state schema and cursor field to use updated_on
sources/testrails-source/resources/schemas/run.json Added updated_on field to JSON schema

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@devin-ai-integration
Copy link
Contributor Author

Closing due to inactivity for more than 7 days. Configure here.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 30, 2025
@dbruno21 dbruno21 deleted the devin/1761080220-testrail-updated-on-cursor branch October 31, 2025 17:04
@dbruno21
Copy link
Contributor

#2320

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants