Skip to content

Conversation

@na66im
Copy link
Contributor

@na66im na66im commented Dec 2, 2025

No description provided.

@na66im na66im self-assigned this Dec 2, 2025
@na66im na66im force-pushed the task/TSSDK-26-add-sort-custom-metadata-filters branch 2 times, most recently from c3f8290 to 2bee18c Compare December 2, 2025 14:46
@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

❌ Patch coverage is 97.22222% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/cli/src/cli-functions.ts 95.65% 1 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #48      +/-   ##
==========================================
+ Coverage   95.59%   95.63%   +0.04%     
==========================================
  Files           9        9              
  Lines        1157     1191      +34     
  Branches      158      167       +9     
==========================================
+ Hits         1106     1139      +33     
- Misses         51       52       +1     
Flag Coverage Δ
unittests 95.63% <97.22%> (+0.04%) ⬆️

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

Files with missing lines Coverage Δ
packages/cli/src/cli.ts 95.58% <100.00%> (+0.25%) ⬆️
packages/sdk/src/platform-sdk.ts 93.40% <100.00%> (+0.07%) ⬆️
packages/cli/src/cli-functions.ts 99.65% <95.65%> (-0.35%) ⬇️

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.

@na66im na66im force-pushed the task/TSSDK-26-add-sort-custom-metadata-filters branch from 2bee18c to 3ff4eb6 Compare December 3, 2025 08:33
@na66im na66im force-pushed the task/TSSDK-26-add-sort-custom-metadata-filters branch from 3ff4eb6 to 00a3dbb Compare December 3, 2025 09:05
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 3, 2025

@santi698
Copy link
Collaborator

santi698 commented Dec 4, 2025

LGTM, however I think we should either add an e2e test now or create a ticket for adding it.

Copilot finished reviewing on behalf of na66im December 4, 2025 13:35
Copy link

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

This PR adds sorting and custom metadata filtering capabilities to the list-application-runs command in both the SDK and CLI packages. The implementation allows users to filter runs by custom metadata key-value pairs and sort results by various fields.

Key changes:

  • Extended SDK listApplicationRuns method with customMetadata and sort parameters
  • Added CLI options for custom metadata filtering (JSON string) and sorting (JSON array of field names)
  • Implemented JSON parsing and validation with error handling for both new parameters

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/sdk/src/platform-sdk.ts Added customMetadata and sort parameters to listApplicationRuns method
packages/cli/src/cli.ts Added command-line options for custom metadata filtering and sorting
packages/cli/src/cli-functions.ts Implemented JSON parsing logic, validation, and error handling for new parameters
packages/cli/src/cli-functions.spec.ts Added comprehensive test coverage for new filtering and sorting features, including error cases
ATTRIBUTIONS.md Updated license formatting for various dependencies (formatting changes only)

}
}

let sortBy: string[] | undefined = undefined;
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

Redundant initialization: let sortBy: string[] | undefined = undefined; can be simplified to let sortBy: string[] | undefined; since variables are already undefined by default.

Suggested change
let sortBy: string[] | undefined = undefined;
let sortBy: string[] | undefined;

Copilot uses AI. Check for mistakes.
})
.option('sort', {
describe:
'Sort by field (run_id\napplication_version_id\norganization_id\nstatus\nsubmitted_at\nsubmitted_by\n)',
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The description format with embedded newlines (\n) is unusual for CLI help text and may not render as intended in the help output. Consider using a clearer format like: 'Sort by field (e.g., ["run_id", "-status"])' or provide examples in the description instead of listing all possible fields with newlines.

Suggested change
'Sort by field (run_id\napplication_version_id\norganization_id\nstatus\nsubmitted_at\nsubmitted_by\n)',
'Sort by field (e.g., "run_id", "-status", "submitted_at"). Fields: run_id, application_version_id, organization_id, status, submitted_at, submitted_by.',

Copilot uses AI. Check for mistakes.
sort?: string;
}
): Promise<void> {
console.log('Options received:', options);
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

Debug logging statement should be removed before merging to production. This appears to be leftover debugging code that will clutter console output for end users.

Suggested change
console.log('Options received:', options);

Copilot uses AI. Check for mistakes.
await listApplicationRuns('production', mockAuthService, {
applicationId: 'app1',
customMetadata: '{"key": "value"}',
sortBy: '["-created_at"]',
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

Incorrect parameter name: sortBy should be sort to match the function signature and other test cases. This test will fail because the listApplicationRuns function expects a parameter named sort, not sortBy.

Suggested change
sortBy: '["-created_at"]',
sort: '["-created_at"]',

Copilot uses AI. Check for mistakes.
console.log('Options received:', options);
if (options?.customMetadata) {
try {
JSON.parse(options?.customMetadata || '{}') as unknown;
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

Redundant fallback in JSON.parse(options?.customMetadata || '{}'). Since this code is inside an if (options?.customMetadata) block, the value is guaranteed to be truthy, making the || '{}' fallback unnecessary.

Suggested change
JSON.parse(options?.customMetadata || '{}') as unknown;
JSON.parse(options.customMetadata) as unknown;

Copilot uses AI. Check for mistakes.
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.

3 participants