-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(/dev): logic to allow customer to modify root source folder #4985
fix(/dev): logic to allow customer to modify root source folder #4985
Conversation
packages/core/package.json
Outdated
@@ -3984,7 +3984,7 @@ | |||
}, | |||
"devDependencies": { | |||
"@aws-sdk/types": "^3.13.1", | |||
"@aws-toolkits/telemetry": "^1.0.205", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to reviewers:
I've updated telemetry and added a new event emission to the /dev logic as the cost was very low and it was just one line in the logic. Let me know if you'd rather split this.
9ca3187
to
c49c978
Compare
@@ -231,7 +232,7 @@ export class FeatureDevController { | |||
break | |||
} | |||
} catch (err: any) { | |||
if (err instanceof ContentLengthError) { | |||
if (err instanceof ToolkitError && err.code === 'ContentLengthError') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we modify this check, how will the ContentLengthError
be handled that is being thrown explicitly here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I need to handle both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of handling both, can we not revert this change back to throwing ContentLengthError
in case of repo size being greater than 200MB ?
c49c978
to
75c3fbf
Compare
packages/amazonq/.changes/next-release/Bug Fix-7034adfe-fc09-44d2-8328-d908ab99f1ac.json
Outdated
Show resolved
Hide resolved
6fd0ef7
to
96bd651
Compare
@@ -55,8 +56,8 @@ export async function prepareRepoData( | |||
} | |||
} catch (error) { | |||
getLogger().debug(`featureDev: Failed to prepare repo: ${error}`) | |||
if (error instanceof ContentLengthError) { | |||
throw error | |||
if (error instanceof ToolkitError && error.code === 'ContentLengthError') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its better to keep existing check for ContentLengthError
as well here.
eceb010
to
8650a10
Compare
} catch (err) { | ||
assert.strictEqual(err instanceof ContentLengthError, true) | ||
} | ||
}).timeout(120 * 1000) // Allow test to run longer than 30 seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the test need to run longer than 30 seconds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Becuase I'm trying to create files that will break the 200MB limit for repo size, this file creation and all takes more time than 30s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm adding the test specifically to avoid any future regressions as a refactor made by another team broke our feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a convoluted way of creating a large set of files. Can't you just try something like?
fs.writeFile('file', new Buffer(<some size>));
That way you can just make one big file, and it might be faster. Would like to avoid extending timeouts since tests already take a long time to run.
If so, make sure to use the fs implementation if srcShared/fs.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, maybe we can stub vscode.workspace.fs.stat(file.fileUri))
or something. I think that would be better than actually allocating a bunch of space on the testing machine (which would be our machines much of the time). I think this would be the preferred solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That way you can just make one big file, and it might be faster. Would like to avoid extending timeouts since tests already take a long time to run.
Yes, absolutely. In fact, this should be in testInteg/
, that is where slow tests live.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestions, I will take another look to this test then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've resorted to stubbing the fsCommon.stat
function. As there is no need in that case to make the test longer, by just stubbing the function I can return a value that will make the logic throw the error.
#4977 also changed the collectFiles() call in |
8650a10
to
eae98d1
Compare
Does this collectFiles call need to be updated? aws-toolkit-vscode/packages/core/src/amazonqFeatureDev/session/sessionState.ts Lines 380 to 384 in df73086
|
Problem
A recent refactor (#4924) moved
collectFiles
to a shared file but also updated the logic to throw another error that the/dev
controller was not expecting. This effectively broke the feature that allows customer to modify root source folder when the folder exceeds 200MBSolution
/dev
controller expects the error to be specific to avoid breaking the logic.License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.