✨ feat(lara): upgrade sdk and add streaming translator wrapper#4550
✨ feat(lara): upgrade sdk and add streaming translator wrapper#4550
Conversation
- 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
There was a problem hiding this comment.
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/larafrom1.8.0-beta.3to^1.9.0(lockfile resolves to1.9.1). - Added
LaraTranslator extends Translatoroverridingtranslate()to usepostAndGetStream()and return the last streamed chunk. - Refreshed
yarn.lockto 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. |
🧪 Test-Guard Report❌ FAIL — Some changed source files lack adequate test coverage. Coverage Analysis: ❌ FAILNo changed source files found in coverage report (threshold: 80%)
Test File Matching: ❌ FAILFile matching: 1 fail
Per-File Evaluation: ❌ FAILAll files resolved by deterministic shortcuts.
Result: ❌ FAIL Why this FAIL?
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>
There was a problem hiding this comment.
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
textBlocksis never reassigned, so it should be declared asconstrather thanletto 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}
}),
]
🧪 Test-Guard Report❌ FAIL — Some changed source files lack adequate test coverage. Coverage Analysis: ❌ FAILNo changed source files found in coverage report (threshold: 80%)
Test File Matching: ❌ FAILFile matching: 1 fail
Per-File Evaluation: ❌ FAILAll files resolved by deterministic shortcuts.
Result: ❌ FAIL Why this FAIL?
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
🧪 Test-Guard Report✅ PASS — All changed source files have adequate test coverage. Coverage Analysis: ❌ FAILNo changed source files found in coverage report (threshold: 80%)
Test File Matching: ✅ PASSFile matching: 1 pass
Per-File Evaluation: ✅ PASSEvaluated 1 files: 1 via AI (1 batch), 0 via shortcuts.
Result: ✅ PASS |
Summary
Upgrade
@translated/larafrom1.8.0-beta.3to^1.9.0and introduce aLaraTranslatorsubclass that overridestranslate()to stream partial responses and return the final chunk.Type
feat— new user-facing featurefix— bug fixrefactor— restructure without behavior changechore— build, deps, config, docsperf— performance improvementtest— test coverageChanges
package.json@translated/larafrom1.8.0-beta.3to^1.9.0public/js/api/laraTranslate/laraTranslate.jsLaraTranslatorsubclass with streaming translate override, wire it inlaraTranslate()public/js/api/laraTranslate/laraTranslate.test.jsyarn.lockTesting
vendor/bin/phpunit --exclude-group=ExternalServices --no-coveragepasses./vendor/bin/phpstanpasses (0 errors, with baseline)6 Jest tests pass covering: streaming result return, context block assembly, option/header forwarding, error on empty stream, and reasoning mode.
AI Disclosure
Sisyphus (OpenCode, claude-opus-4-6)
Notes
None.