Skip to content

Conversation

@Houwie7000
Copy link
Collaborator

@Houwie7000 Houwie7000 commented Oct 27, 2025

I have JIRA issue created

  • branch and/or PR name(s) includes JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected
  • FLP integration tests were ran successful

Add one controller endpoint for handling a post request containing the json skelaton of the layout. This data can then be used to download the right objects/tabs in a later pull request containing the other endpoint (GET for the download).
This is needed because we need the data the user is seeing on their screen at the moment they click the download button. The domain models contain all data I need from the layout excluding the data in the query parameters of the GET request. This can be seen in DownloadConfigDomain.js

This pr does not contain the code needed to do the actual downloading of the objects/tabs.

@Houwie7000 Houwie7000 marked this pull request as ready for review October 27, 2025 16:23
@Houwie7000 Houwie7000 requested a review from graduta as a code owner October 27, 2025 16:23
@Houwie7000
Copy link
Collaborator Author

Houwie7000 commented Oct 28, 2025

Writing more tests and licenses....
(done)

@Houwie7000
Copy link
Collaborator Author

The GitHub actions is back to the point where I need to run it three times for it to succeed... It has trouble with the runsmode tests.

@Houwie7000
Copy link
Collaborator Author

look at: QualityControl/common/library/typedef/TabObject.js existing typedefs

export async function download(downloadLayout, downloadConfiguration, runNumber, res) {
switch (downloadConfiguration.downloadMode) {
case DownloadMode.object:
let file = new File([], '');

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

The initial value of file is unused, since it is always overwritten.

Copilot Autofix

AI 1 day ago

To fix this problem, we should eliminate the unused initial assignment while keeping the later logic and behavior intact. In general, when a local variable is immediately overwritten in all code paths before its value is read, you either remove the initial assignment or, if that value was intended to be used, adjust the code so it is actually read/checked. Here, there is no indication that the initial File([], '') should ever be used; instead, file always represents either a tar archive or a requested object.

The best minimal, behavior-preserving change is to convert let file = new File([], ''); into a plain declaration let file;. This keeps the variable in the same scope, keeps all subsequent assignments and uses exactly the same, and simply avoids constructing a throwaway File instance. No imports or additional methods are required, and no other lines need to change. This edit should be applied in QualityControl/lib/utils/download/downloadEngine.js at line 50 within the DownloadMode.OBJECT case.

Suggested changeset 1
QualityControl/lib/utils/download/downloadEngine.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/QualityControl/lib/utils/download/downloadEngine.js b/QualityControl/lib/utils/download/downloadEngine.js
--- a/QualityControl/lib/utils/download/downloadEngine.js
+++ b/QualityControl/lib/utils/download/downloadEngine.js
@@ -47,7 +47,7 @@
 export async function download(downloadLayout, downloadConfiguration, runNumber, res) {
   switch (downloadConfiguration.downloadMode) {
     case DownloadMode.OBJECT:
-      let file = new File([], '');
+      let file;
       const objects = downloadLayout.tabs.flatMap((tab) => tab.objects.filter((object) => downloadConfiguration.objectIds.includes(object.id)));
       if (objects.length > 1) {
         // Multiple objects requested
EOF
@@ -47,7 +47,7 @@
export async function download(downloadLayout, downloadConfiguration, runNumber, res) {
switch (downloadConfiguration.downloadMode) {
case DownloadMode.OBJECT:
let file = new File([], '');
let file;
const objects = downloadLayout.tabs.flatMap((tab) => tab.objects.filter((object) => downloadConfiguration.objectIds.includes(object.id)));
if (objects.length > 1) {
// Multiple objects requested
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants