Skip to content

Conversation

bsekachev
Copy link
Member

Summary

  • refine decode context image workflow with explicit typing in cvat-data
  • add strong typings for lambda manager and CVAT core API surfaces
  • type webhook owner data and ensure event dumping returns SerializedEvent

Testing

  • npx tsc --noEmit --skipLibCheck (cvat-data)
  • npx tsc --noEmit --skipLibCheck (cvat-core) (fails: numerous TS errors)

https://chatgpt.com/codex/tasks/task_b_689c5ef03ec0832c83f793cf6138dd84

Copy link

@bsekachev bsekachev requested a review from Copilot August 22, 2025 07:36
Copy link

@Copilot 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 TypeScript annotations to improve type safety across the cvat-data and cvat-core modules. The changes focus on refining the decode context image workflow with explicit typing and adding strong typings for lambda manager and CVAT core API surfaces.

  • Added explicit TypeScript interfaces and type annotations to worker message handling and decode functions
  • Enhanced type safety for lambda manager methods with proper parameter and return type definitions
  • Updated CVAT core API surface types to use proper server proxy types instead of generic 'any' types

Reviewed Changes

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

Show a summary per file
File Description
cvat-data/src/ts/unzip_imgs.worker.ts Added UnzipMessage interface and typed onmessage event handler
cvat-data/src/ts/cvat-data.ts Converted decodeContextImages to typed function with interface and fixed worker reference
cvat-core/src/webhook.ts Added proper typing for webhook owner data using SerializedUser
cvat-core/src/lambda-manager.ts Added type annotations for method parameters and return types
cvat-core/src/index.ts Replaced 'any' types with proper server proxy types for API methods
cvat-core/src/event.ts Updated dump method return type to SerializedEvent

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

this.zipWorker.onerror(new ErrorEvent('error', {
decodeZipWorker.onerror(new ErrorEvent('error', {
error: event.data.error,
}));
Copy link
Preview

Copilot AI Aug 22, 2025

Choose a reason for hiding this comment

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

Calling decodeZipWorker.onerror directly is incorrect. The onerror property is an event handler that should be triggered by the browser, not called manually. This should likely be reject(event.data.error) instead to properly handle the error in the promise chain.

Suggested change
}));
release();
reject(event.data.error);

Copilot uses AI. Check for mistakes.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.28%. Comparing base (4735565) to head (a380737).
⚠️ Report is 25 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9749      +/-   ##
===========================================
- Coverage    77.24%   75.28%   -1.97%     
===========================================
  Files          408      410       +2     
  Lines        44758    45187     +429     
  Branches      4049     4082      +33     
===========================================
- Hits         34575    34019     -556     
- Misses       10183    11168     +985     
Components Coverage Δ
cvat-ui 77.01% <69.23%> (-0.31%) ⬇️
cvat-server 73.78% <100.00%> (-3.40%) ⬇️
🚀 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.

};
users: {
get: any;
get: typeof serverProxy.users.get;
Copy link
Member Author

Choose a reason for hiding this comment

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

The type is not correct. It serverProxy.users.get returns SerializedUser[].
The API method actually returns User[]

};
cloudStorages: {
get: any;
get: typeof serverProxy.cloudStorages.get;
Copy link
Member Author

Choose a reason for hiding this comment

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

The type is not correct, check implementation

get: any;
activate: any;
deactivate: any;
get: typeof serverProxy.organizations.get;
Copy link
Member Author

Choose a reason for hiding this comment

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

The type is not correct, check implementation

Comment on lines +144 to +145
activate: (organization: Organization) => void;
deactivate: () => void;
Copy link
Member Author

Choose a reason for hiding this comment

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

Not correct, both return promises

};
webhooks: {
get: any;
get: typeof serverProxy.webhooks.get;
Copy link
Member Author

Choose a reason for hiding this comment

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

Type is not correct, check implementation


export interface TrackerResults {
states: any[];
states: Record<string, unknown>[];
Copy link
Member Author

@bsekachev bsekachev Aug 22, 2025

Choose a reason for hiding this comment

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

That seems to be a array, not array of object

}

async requests(): Promise<any[]> {
async requests(): Promise<Record<string, unknown>[]> {
Copy link
Member Author

Choose a reason for hiding this comment

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

The type might be much more specific, as described in API scheme

description?: string;
is_active?: boolean;
owner?: any;
owner?: SerializedUser | User;
Copy link
Member Author

Choose a reason for hiding this comment

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

owner is always SerializedUser here or null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants