Skip to content

Comments

REVAI-4573: Update SDKs to support new model#67

Open
Greyvend wants to merge 5 commits intodevelopfrom
feature/REVAI-4573-migrate-submitjoburl-source-config
Open

REVAI-4573: Update SDKs to support new model#67
Greyvend wants to merge 5 commits intodevelopfrom
feature/REVAI-4573-migrate-submitjoburl-source-config

Conversation

@Greyvend
Copy link

@Greyvend Greyvend commented Feb 19, 2026

Description of Work

The deprecated submitJobUrl(String mediaUrl, RevAiJobOptions options) method was sending media_url in the JSON payload, which is not supported by the v3 transcriber (machine_v3). This PR migrates it to send source_config instead, enabling compatibility with v3.

What Changed

  • ApiClient.java: Deprecated submitJobUrl(String, RevAiJobOptions) now calls setSourceConfig(mediaUrl) instead of setMediaUrl(mediaUrl). Rejects source_config in options to prevent conflicts.
  • RevAiJobTest.java: Added 3 unit tests — source_config conflict detection, auth_headers conflict detection, and serialization verification (sends source_config not media_url). Removed 3 pre-existing false-positive validation tests.
  • SubmitJobTest.java: Added integration test for machine_v3 transcriber via submitJobUrl.
  • AsyncTranscribeMediaUrl.java: Updated example transcriber from machine_v2 to machine_v3.
  • pom.xml: Version bump to 2.6.0.

Screenshots

Test script (examples/TestSubmitJobUrlV3.java)

package ai.rev;

import ai.rev.speechtotext.ApiClient;
import ai.rev.speechtotext.models.asynchronous.RevAiJob;
import ai.rev.speechtotext.models.asynchronous.RevAiJobOptions;

import java.io.IOException;

public class TestSubmitJobUrlV3 {

  public static void main(String[] args) {
    String accessToken = System.getenv("REVAI_ACCESS_TOKEN");
    if (accessToken == null || accessToken.isEmpty()) {
      System.err.println("REVAI_ACCESS_TOKEN environment variable must be set");
      System.exit(1);
    }

    String baseUrl = System.getenv("REVAI_BASE_URL");
    if (baseUrl == null) {
      baseUrl = "http://localhost:5000";
    }

    System.out.println("Using base URL: " + baseUrl);
    ApiClient apiClient = new ApiClient(accessToken, baseUrl);

    String mediaUrl = "https://www.rev.ai/FTC_Sample_1.mp3";

    // Test 1: Deprecated submitJobUrl(String, RevAiJobOptions) with machine_v3
    System.out.println("\n--- Test 1: Deprecated submitJobUrl with machine_v3 ---");
    try {
      RevAiJobOptions options = new RevAiJobOptions();
      options.setMetadata("TestSubmitJobUrlV3 - deprecated method");
      options.setTranscriber("machine_v3");

      RevAiJob job = apiClient.submitJobUrl(mediaUrl, options);
      System.out.println("Job ID: " + job.getJobId());
      System.out.println("Status: " + job.getJobStatus());
      System.out.println("Created: " + job.getCreatedOn());
      System.out.println("SUCCESS: Deprecated method works with machine_v3");
    } catch (IOException e) {
      System.err.println("FAILED: " + e.getMessage());
    }

    // Test 2: Non-deprecated submitJobUrl(RevAiJobOptions) with machine_v3
    System.out.println("\n--- Test 2: Non-deprecated submitJobUrl with machine_v3 ---");
    try {
      RevAiJobOptions options = new RevAiJobOptions();
      options.setSourceConfig(mediaUrl);
      options.setMetadata("TestSubmitJobUrlV3 - options-only method");
      options.setTranscriber("machine_v3");

      RevAiJob job = apiClient.submitJobUrl(options);
      System.out.println("Job ID: " + job.getJobId());
      System.out.println("Status: " + job.getJobStatus());
      System.out.println("Created: " + job.getCreatedOn());
      System.out.println("SUCCESS: Options-only method works with machine_v3");
    } catch (IOException e) {
      System.err.println("FAILED: " + e.getMessage());
    }

    // Test 3: Validation - source_config conflict should throw
    System.out.println("\n--- Test 3: Validation - source_config conflict ---");
    try {
      RevAiJobOptions options = new RevAiJobOptions();
      options.setSourceConfig("https://other-url.com");
      options.setTranscriber("machine_v3");

      apiClient.submitJobUrl(mediaUrl, options);
      System.err.println("FAILED: Should have thrown IllegalArgumentException");
    } catch (IllegalArgumentException e) {
      System.out.println("Caught expected error: " + e.getMessage());
      System.out.println("SUCCESS: Conflict validation works correctly");
    } catch (IOException e) {
      System.err.println("FAILED: Wrong exception type: " + e.getMessage());
    }
  }
}

Output (against local API on localhost:5000)

Using base URL: http://localhost:5000

--- Test 1: Deprecated submitJobUrl with machine_v3 ---
Job ID: ZgHwGVcR8HCG
Status: {status='in_progress'}
Created: 2026-02-19T13:06:11.305Z
SUCCESS: Deprecated method works with machine_v3

--- Test 2: Non-deprecated submitJobUrl with machine_v3 ---
Job ID: ee4BoqOOZWRu
Status: {status='in_progress'}
Created: 2026-02-19T13:06:11.324Z
SUCCESS: Options-only method works with machine_v3

--- Test 3: Validation - source_config conflict ---
Caught expected error: source_config is not compatible with submitJobUrl. Remove source_config from options or use submitJobUrl(RevAiJobOptions) instead.
SUCCESS: Conflict validation works correctly

Additional Comments

The non-deprecated submitJobUrl(RevAiJobOptions) is unchanged — it already sends source_config correctly. Validation for that method is left to the API server.

Greyvend and others added 2 commits February 19, 2026 12:43
…tion

Add unit tests verifying the deprecated submitJobUrl(String, RevAiJobOptions)
rejects source_config in options and sends source_config instead of media_url.
Add integration test for machine_v3 transcriber via submitJobUrl.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ead of media_url

The deprecated submitJobUrl(String, RevAiJobOptions) now sends source_config
instead of media_url, enabling compatibility with machine_v3 transcriber.
Rejects source_config in options to prevent conflicts. Updates example to
use machine_v3 and bumps version to 2.6.0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Greyvend Greyvend requested a review from a team as a code owner February 19, 2026 12:45
Remove SubmitJobUrl_NullOptions, SubmitJobUrl_NullSourceConfig, and
SubmitJobUrl_NullSourceConfigUrl tests. These tests were passing by
accident — they never called mockInterceptor.setSampleResponse(), so
when MockInterceptor tried to create a ResponseBody with a null string,
OkHttp's Kotlin null-check threw IllegalArgumentException. The tests
expected exactly that exception type, so they appeared to validate input
but were actually just catching a mock infrastructure crash.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Greyvend
Copy link
Author

@dmtrrk same story as with the Python SDK with the CI builds.

Greyvend and others added 2 commits February 19, 2026 18:34
actions/cache v1, actions/upload-artifact v3, actions/checkout v2,
and actions/setup-java v1 have been deprecated by GitHub and now
cause automatic build failures. Update all to v4 and add required
`distribution: temurin` parameter for setup-java.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Temurin does not distribute Java 13 (non-LTS, EOL). Replace with
Java 17 (current LTS). Also make upload-artifact names unique per
matrix job as required by actions/upload-artifact@v4.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Greyvend Greyvend requested a review from dmtrrk February 19, 2026 18:43
@Greyvend Greyvend changed the title REVAI-4573: Migrate deprecated submitJobUrl to use source_config instead of media_url REVAI-4573: Update SDKs to support new model Feb 19, 2026
Copy link
Collaborator

@dmtrrk dmtrrk left a comment

Choose a reason for hiding this comment

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

there should be v2 and v3 integration tests to be sure we are backward compatible, and v3 works properly:

  1. v2 integration to work with media url
  2. v3 integration works with the same interface
  3. v3 unit fails with mediaurl

matrix:
# test against latest update of each major Java version, as well as specific updates of LTS versions:
java: [8, 11.0.x, 13 ]
java: [8, 11, 17 ]
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure this is a good idea. let's keep both

@Greyvend
Copy link
Author

there should be v2 and v3 integration tests to be sure we are backward compatible, and v3 works properly:

  1. v2 integration to work with media url

Already covered. The existing SubmitJobUrl_UrlAndOptionsSpecified_ReturnsRevAiJobInProgress test calls submitJobUrl(SOURCE_URL, revAiJobOptions) with machine_v2 (set via getJobOptions()). After the migration, this internally routes through source_config instead of media_url, confirming backward compatibility.

v3 integration works with the same interface

Added in this PR: SubmitJobUrl_WithMachineV3_ReturnsRevAiJobInProgress uses the same submitJobUrl(SOURCE_URL, revAiJobOptions) interface with machine_v3.

v3 unit fails with mediaurl

Can you clarify what you'd expect this test to verify?

@Greyvend Greyvend requested a review from dmtrrk February 20, 2026 13:26
Copy link
Collaborator

@dmtrrk dmtrrk left a comment

Choose a reason for hiding this comment

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

unit tests do not contain mediaUrl + v3 scenario

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.

2 participants