Skip to content

✨ feat(lara): upgrade sdk and add streaming translator wrapper#4550

Open
riccio82 wants to merge 3 commits intodevelopfrom
feat/lara-patch
Open

✨ feat(lara): upgrade sdk and add streaming translator wrapper#4550
riccio82 wants to merge 3 commits intodevelopfrom
feat/lara-patch

Conversation

@riccio82
Copy link
Copy Markdown
Collaborator

@riccio82 riccio82 commented Apr 30, 2026

Summary

Upgrade @translated/lara from 1.8.0-beta.3 to ^1.9.0 and introduce a LaraTranslator subclass that overrides translate() to stream partial responses and return the final chunk.

Type

  • feat — new user-facing feature
  • fix — bug fix
  • refactor — restructure without behavior change
  • chore — build, deps, config, docs
  • perf — performance improvement
  • test — test coverage

Changes

File Change
package.json bump @translated/lara from 1.8.0-beta.3 to ^1.9.0
public/js/api/laraTranslate/laraTranslate.js add LaraTranslator subclass with streaming translate override, wire it in laraTranslate()
public/js/api/laraTranslate/laraTranslate.test.js add 6 unit tests covering payload mapping, headers, context blocks, error handling, and streaming
yarn.lock update resolved dependency graph

Testing

  • vendor/bin/phpunit --exclude-group=ExternalServices --no-coverage passes
  • ./vendor/bin/phpstan passes (0 errors, with baseline)
  • Manual testing performed (describe below)
  • New tests added for changed behavior
  • Regression tests added for bug fixes

6 Jest tests pass covering: streaming result return, context block assembly, option/header forwarding, error on empty stream, and reasoning mode.

AI Disclosure

  • No AI tools were used in this PR
  • AI tools were used — details below

Sisyphus (OpenCode, claude-opus-4-6)

Notes

None.

- bump @translated/lara from 1.8.0-beta.3 to ^1.9.0

- introduce LaraTranslator override to stream partial responses and return final chunk

- update lockfile to match resolved dependency graph
Copilot AI review requested due to automatic review settings April 30, 2026 10:45
Copy link
Copy Markdown
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

Upgrades the @translated/lara SDK and introduces a local LaraTranslator wrapper to consume streamed translation responses while continuing to return the final translation payload to existing callers.

Changes:

  • Bumped @translated/lara from 1.8.0-beta.3 to ^1.9.0 (lockfile resolves to 1.9.1).
  • Added LaraTranslator extends Translator overriding translate() to use postAndGetStream() and return the last streamed chunk.
  • Refreshed yarn.lock to reflect the updated dependency graph.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
package.json Updates Lara SDK dependency range to ^1.9.0.
public/js/api/laraTranslate/laraTranslate.js Adds streaming translator wrapper and switches instantiation to the wrapper.
yarn.lock Updates resolved versions for Lara + related dependency updates.

Comment thread public/js/api/laraTranslate/laraTranslate.js Outdated
@github-actions
Copy link
Copy Markdown

🧪 Test-Guard Report

❌ FAIL — Some changed source files lack adequate test coverage.

Coverage Analysis: ❌ FAIL

No changed source files found in coverage report (threshold: 80%)

File Verdict Reason
public/js/api/laraTranslate/laraTranslate.js ❌ fail not in coverage report

Test File Matching: ❌ FAIL

File matching: 1 fail

File Verdict Reason
public/js/api/laraTranslate/laraTranslate.js ❌ fail No matching test file found

Per-File Evaluation: ❌ FAIL

All files resolved by deterministic shortcuts.

File Verdict Reason
public/js/api/laraTranslate/laraTranslate.js ❌ fail shortcut → no relevant tests in PR and no/low coverage

Result: ❌ FAIL


Why this FAIL?

  • Coverage Analysis: public/js/api/laraTranslate/laraTranslate.js is missing from the coverage report → coverage configuration likely excludes this file, so tests do not exercise it.
  • Test File Matching: No test file matches public/js/api/laraTranslate/laraTranslate.js → no tests currently cover this source file.
  • Per-File Evaluation: public/js/api/laraTranslate/laraTranslate.js has no relevant tests and no coverage → no tests exist or run for this file.

To resolve: add or update tests covering public/js/api/laraTranslate/laraTranslate.js and ensure coverage configuration includes it.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 30, 2026 10:54
Copy link
Copy Markdown
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

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

public/js/api/laraTranslate/laraTranslate.js:83

  • textBlocks is never reassigned, so it should be declared as const rather than let to prevent accidental mutation/reassignment and match typical style in this codebase.
  let textBlocks = [
    ...contextListBefore.map((item) => {
      return {text: item, translatable: false}
    }),
    {text: source, translatable: true},
    ...contextListAfter.map((item) => {
      return {text: item, translatable: false}
    }),
  ]

Comment thread public/js/api/laraTranslate/laraTranslate.js
@github-actions
Copy link
Copy Markdown

🧪 Test-Guard Report

❌ FAIL — Some changed source files lack adequate test coverage.

Coverage Analysis: ❌ FAIL

No changed source files found in coverage report (threshold: 80%)

File Verdict Reason
public/js/api/laraTranslate/laraTranslate.js ❌ fail not in coverage report

Test File Matching: ❌ FAIL

File matching: 1 fail

File Verdict Reason
public/js/api/laraTranslate/laraTranslate.js ❌ fail No matching test file found

Per-File Evaluation: ❌ FAIL

All files resolved by deterministic shortcuts.

File Verdict Reason
public/js/api/laraTranslate/laraTranslate.js ❌ fail shortcut → no relevant tests in PR and no/low coverage

Result: ❌ FAIL


Why this FAIL?

  • Coverage Analysis: The file public/js/api/laraTranslate/laraTranslate.js is not included in the coverage report, indicating a coverage configuration issue → update coverage instrumentation or source filters to include this file.
  • Test File Matching: No test file matches public/js/api/laraTranslate/laraTranslate.js → add or update tests that cover this file.
  • Per-File Evaluation: The file public/js/api/laraTranslate/laraTranslate.js has no relevant tests in the PR and low or no coverage → add tests exercising this file’s changes.

To resolve: add tests covering public/js/api/laraTranslate/laraTranslate.js and ensure coverage configuration includes it.

- mock @translated/lara SDK to verify payload mapping and headers
- test context block assembly, option forwarding, and error handling
- verify streaming returns last partial result
@github-actions
Copy link
Copy Markdown

🧪 Test-Guard Report

✅ PASS — All changed source files have adequate test coverage.

Coverage Analysis: ❌ FAIL

No changed source files found in coverage report (threshold: 80%)

File Verdict Reason
public/js/api/laraTranslate/laraTranslate.js ❌ fail not in coverage report

Test File Matching: ✅ PASS

File matching: 1 pass

File Verdict Reason
public/js/api/laraTranslate/laraTranslate.js ✅ pass Test file modified in PR: public/js/api/laraTranslate/laraTranslate.test.js

Per-File Evaluation: ✅ PASS

Evaluated 1 files: 1 via AI (1 batch), 0 via shortcuts.

File Verdict Reason
public/js/api/laraTranslate/laraTranslate.js ✅ pass Tests cover streaming translation, headers, options, error on no result, and reasoning callback.

Result: ✅ PASS

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