Skip to content

QVAC-14302 feat[api]: export RuntimeStats interface in NMT addon index.d.ts#1613

Merged
gianni-cor merged 6 commits into
mainfrom
feat/QVAC-14302-export-runtimestats-nmt
May 4, 2026
Merged

QVAC-14302 feat[api]: export RuntimeStats interface in NMT addon index.d.ts#1613
gianni-cor merged 6 commits into
mainfrom
feat/QVAC-14302-export-runtimestats-nmt

Conversation

@RamazTs

@RamazTs RamazTs commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Export a new RuntimeStats interface in packages/qvac-lib-infer-nmtcpp/index.d.ts
  • Fields: totalTokens, totalTime, decodeTime, TPS (required); encodeTime, TTFT (optional — GGML backend only)
  • Fields match the C++ backend output from addon/src/model-interface/TranslationModel.cpp
  • Bergamot backend emits: totalTokens, totalTime, decodeTime, TPS
  • GGML backend emits all of the above plus encodeTime and TTFT

Files changed

  • packages/qvac-lib-infer-nmtcpp/index.d.ts — added RuntimeStats interface (8 lines)

Test plan

  • Verify SDK can import RuntimeStats from @qvac/translation-nmtcpp
  • Confirm no type conflicts with existing interfaces

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolve changelog conflict: bump version to 2.0.3 (2.0.2 already taken on main).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kinsta

kinsta Bot commented Apr 15, 2026

Copy link
Copy Markdown

Preview deployments for qvac-docs-staging ⚡️

Status Branch preview Commit preview
✅ Ready Visit preview Visit preview

Commit: 40095fecc84d555e4368faa4cf7939511d9d8b6a

Deployment ID: 748addf4-f7bb-4a29-9918-2b9542c7ea3c

Static site name: qvac-docs-staging-fazwv

@github-actions

github-actions Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Tier-based Approval Status

**PR Tier:** TIER1

**Current Status:** ✅ APPROVED

**Requirements:**
- 1 Team Member approval ✅ (2/1)
- 1 Team Lead OR Management approval ✅ (1/1)



---
*This comment is automatically updated when reviews change.*

Alok-Ranjan23
Alok-Ranjan23 previously approved these changes Apr 16, 2026
Resolved conflicts in package.json (version bump on top of upstream's 2.1.0)
and CHANGELOG.md (added 2.1.1 entry above upstream's 2.1.0 entry).
Comment thread packages/qvac-lib-infer-nmtcpp/index.d.ts
Alok-Ranjan23

This comment was marked as duplicate.

@gianni-cor gianni-cor left a comment

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.

Requesting one doc change before merge: please add a JSDoc on RuntimeStats covering the unit asymmetry and which backend emits which fields.

Verified against the C++ producers (TranslationModel.cpp lines 565-617 and nmt_state_backend.cpp lines 273-288):

  • totalTime, decodeTime, encodeTimeseconds (us / 1e6)
  • TTFTmilliseconds (C++: encodeTime * 1000.0)
  • TPS → tokens per second
  • totalTokens → integer count

The field names give no hint of the seconds-vs-ms split, so without docs a consumer will reasonably assume all *Time fields share units. The sibling qvac-lib-infer-whispercpp already documents this on its own RuntimeStats — same pattern would work nicely here. Inline suggestion attached.

Comment thread packages/qvac-lib-infer-nmtcpp/index.d.ts
@gianni-cor

Copy link
Copy Markdown
Contributor

Pre-existing nit, not introduced by this PR — but you're already touching adjacent docs:

packages/qvac-lib-infer-nmtcpp/README.md line 371 prints totalTime with the 'ms' label, but the C++ producer emits it in seconds:

console.log('Translation completed in:', response.stats.totalTime, 'ms')

Verified at nmt_state_backend.cpp lines 283-286 (*encode_time = (double)state->t_encode_us / 1e6;) and TranslationModel.cpp line 572 (double totalTime = decodeTime;).

Two options to make this consistent with the new RuntimeStats JSDoc:

console.log('Translation completed in:', response.stats.totalTime, 's')

or

console.log('Translation completed in:', response.stats.totalTime * 1000, 'ms')

Up to you whether to fix here or in a follow-up — flagging since the new typed interface will make this contradiction more visible to SDK users.

Address review on PR #1613:
- Add JSDoc to `RuntimeStats` clarifying that `totalTime`/`encodeTime`/
  `decodeTime` are seconds while `TTFT` is milliseconds, and listing
  which fields each backend emits (Bergamot omits `encodeTime`/`TTFT`).
  Note that pivot translations use prefixed keys.
- Fix README quickstart that printed `totalTime` with a `'ms'` label
  even though the C++ producer emits seconds.
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

✅ E2E Mobile Test Results - iOS

Overall Status: PASSED
Device Farm Result: PASSED
Platform: iOS
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 871eea2

Test Summary

Metric Count
Total Tests 3
✅ Passed 3
❌ Failed 0
⏭️ Skipped 0

Links

  • 🔗 Device Farm Run: View on AWS Device Farm
  • 🔗 Workflow: View Details
  • 📋 Run ARN: arn:aws:devicefarm:us-west-2:833707431398:run:cef7531e-44ed-4ddf-a349-a4b0f72f680d/d3dca65b-23fb-493c-bebd-d79b5ff2af8e

Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

✅ E2E Mobile Test Results - Android

Overall Status: PASSED
Device Farm Result: PASSED
Platform: Android
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 871eea2

Test Summary

Metric Count
Total Tests 6
✅ Passed 6
❌ Failed 0
⏭️ Skipped 0

Links

  • 🔗 Device Farm Run: View on AWS Device Farm
  • 🔗 Workflow: View Details
  • 📋 Run ARN: arn:aws:devicefarm:us-west-2:833707431398:run:cef7531e-44ed-4ddf-a349-a4b0f72f680d/89b8c35d-629f-4b84-b232-5f9be0014257

Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

🧪 C++ Test Coverage Report

Coverage:

📊 Detailed Coverage
Filename                         Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
NmtLazyInitializeBackend.cpp         104                41    60.58%          12                 2    83.33%         156                52    66.67%          62                30    51.61%
NmtLazyInitializeBackend.hpp           2                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
TranslationModel.cpp                 272               146    46.32%          26                 6    76.92%         463               175    62.20%         138                94    31.88%
TranslationModel.hpp                   1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
nmt.cpp                               72                22    69.44%           9                 1    88.89%         136                28    79.41%          38                12    68.42%
nmt.hpp                               51                 4    92.16%          11                 2    81.82%          53                 4    92.45%          28                 0   100.00%
nmt_beam_search.cpp                  116                25    78.45%          10                 3    70.00%         254                32    87.40%          74                17    77.03%
nmt_graph_decoder.cpp                164                78    52.44%          15                 7    53.33%         541               161    70.24%         112                69    38.39%
nmt_graph_encoder.cpp                 54                13    75.93%           3                 0   100.00%         268                33    87.69%          36                15    58.33%
nmt_loader.cpp                       270                67    75.19%          14                 0   100.00%         776                97    87.50%         138                61    55.80%
nmt_state_backend.cpp                188                36    80.85%          20                 0   100.00%         412                60    85.44%         118                47    60.17%
nmt_tokenization.cpp                  88                21    76.14%           8                 0   100.00%         135                36    73.33%          58                25    56.90%
nmt_utils.cpp                        121                98    19.01%           6                 2    66.67%         182               147    19.23%          74                64    13.51%
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                               1503               551    63.34%         136                23    83.09%        3378               825    75.58%         876               434    50.46%

@gianni-cor

Copy link
Copy Markdown
Contributor

/review

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - iOS

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: iOS
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 436e29c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - Android

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: Android
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 436e29c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - iOS

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: iOS
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 436e29c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - Android

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: Android
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 436e29c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - iOS

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: iOS
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 436e29c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - Android

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: Android
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 436e29c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - iOS

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: iOS
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 25f025c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - iOS

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: iOS
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 25f025c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - Android

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: Android
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 25f025c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - Android

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: Android
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 25f025c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - iOS

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: iOS
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 25f025c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - Android

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: Android
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 25f025c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - iOS

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: iOS
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 871eea2

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - Android

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: Android
Addon: @qvac/translation-nmtcpp
PR: #1613
Commit: 871eea2

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

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.

4 participants