Skip to content

feat(sdk,cli): fill gaps for run items and metadata management#147

Merged
santi698 merged 4 commits into
mainfrom
tssdk-63-fill-run-item-metadata-gaps
Jul 23, 2026
Merged

feat(sdk,cli): fill gaps for run items and metadata management#147
santi698 merged 4 commits into
mainfrom
tssdk-63-fill-run-item-metadata-gaps

Conversation

@santi698

Copy link
Copy Markdown
Collaborator

Summary

Fills SDK/CLI gaps for run items and metadata management, per TSSDK-63.

Adds SDK methods and corresponding CLI commands:

SDK method CLI command API endpoint
getRunItem(runId, externalId) runs items get <runId> <externalId> GET /v1/runs/{run_id}/items/{external_id}
updateRunMetadata(runId, customMetadata) runs metadata set <runId> <json> PUT /v1/runs/{run_id}/custom-metadata
updateRunItemMetadata(runId, externalId, customMetadata) runs items metadata set <runId> <externalId> <json> PUT /v1/runs/{run_id}/items/{external_id}/custom-metadata
deleteRunResults(runId) runs results delete <runId> DELETE /v1/runs/{run_id}/artifacts

--items-style JSON parsing for the metadata commands supports "null" to explicitly clear existing custom metadata.

Side fix

Found and fixed a stale nested packages/cli/node_modules/@aignostics/sdk@3.6.1 (a real directory, not a symlink) that shadowed the workspace symlink to packages/sdk. It silently broke CLI tests exercising new SDK methods (sdk.updateRunMetadata is not a function) even though the SDK source/dist had them. A full clean reinstall (rm -rf node_modules packages/*/node_modules package-lock.json && npm install) regenerated a correct lockfile — this also reduced npm audit findings on this branch from 7 to 1 (low severity).

Testing

  • npm run test (both packages) — 251 tests passing (55 SDK + 196 CLI)
  • npm run typecheck — clean
  • npm run lint — clean
  • npm run build — clean

Refs: TSSDK-63

santi698 added 2 commits July 22, 2026 16:32
Adds SDK methods and corresponding CLI commands:

- PlatformSDKHttp.getRunItem() -> `runs items get <runId> <externalId>`
- PlatformSDKHttp.updateRunMetadata() -> `runs metadata set <runId> <json>`
- PlatformSDKHttp.updateRunItemMetadata() -> `runs items metadata set <runId> <externalId> <json>`
- PlatformSDKHttp.deleteRunResults() -> `runs results delete <runId>`

Maps to GET /v1/runs/{run_id}/items/{external_id}, PUT /v1/runs/{run_id}/custom-metadata,
PUT /v1/runs/{run_id}/items/{external_id}/custom-metadata, DELETE /v1/runs/{run_id}/artifacts.

Also fixes a stale nested packages/cli/node_modules/@aignostics/sdk (pinned to
an old published version) that shadowed the workspace symlink and silently
broke CLI tests against new SDK methods. Full clean reinstall regenerates a
correct package-lock.json.

Refs TSSDK-63
tsconfig.base.json mapped @aignostics/sdk/test to
packages/sdk/src/test-utils/index.ts, which never existed (the real
file is http-mocks.ts). This has been broken since 77db132 but was
masked by a stale nested packages/cli/node_modules/@aignostics/sdk
copy with its own built dist. Now that the lockfile is clean, the
alias fails to resolve, making cli.test.ts and vitest.setup.ts
imports untyped and tripping @typescript-eslint/no-unsafe-* in CI.
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #147      +/-   ##
==========================================
+ Coverage   97.26%   97.71%   +0.44%     
==========================================
  Files          14       14              
  Lines        1500     1794     +294     
  Branches      225      251      +26     
==========================================
+ Hits         1459     1753     +294     
  Misses         41       41              
Flag Coverage Δ
unittests 97.71% <100.00%> (+0.44%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/cli/src/cli-functions.ts 100.00% <100.00%> (ø)
packages/cli/src/cli.ts 98.77% <100.00%> (+0.48%) ⬆️
packages/sdk/src/platform-sdk.ts 99.08% <100.00%> (+0.21%) ⬆️

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0

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.

Where do we need that for?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Sonarcloud scan action, I'll add a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done!

santi698 added 2 commits July 23, 2026 14:53
The coverage-report job's checkout has always used the default shallow
clone (fetch-depth: 1), so SonarQube cannot resolve the 'main' ref to
diff against for PR analysis. This makes it unable to attribute
uploaded lcov coverage to 'new code', reporting 0% new-code coverage
and failing the Quality Gate, even though the same lcov.info reports
correct coverage to Codecov in the step above. Set fetch-depth: 0 so
Sonar has full history and branch refs available.
… lcov paths

actions/upload-artifact strips the least common ancestor ('packages')
when uploading packages/sdk/coverage/lcov.info and
packages/cli/coverage/lcov.info together, so the artifact actually
contains sdk/coverage/lcov.info and cli/coverage/lcov.info. Downloading
with path: . therefore restored the files at ./sdk/... and ./cli/...
instead of ./packages/sdk/... and ./packages/cli/.... Codecov's
uploader does its own broad file discovery so it found them anyway,
but SonarQube's sonar.javascript.lcov.reportPaths does an exact
lookup and reported 'No LCOV files were found'. Download into
packages/ instead so both tools see the paths they expect.
@santi698
santi698 force-pushed the tssdk-63-fill-run-item-metadata-gaps branch from a7df116 to bb45b79 Compare July 23, 2026 12:53
@sonarqubecloud

Copy link
Copy Markdown

@santi698
santi698 merged commit dc54c3b into main Jul 23, 2026
16 checks passed
@santi698
santi698 deleted the tssdk-63-fill-run-item-metadata-gaps branch July 23, 2026 12:57
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