Skip to content
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

refactor(amazonq): refactor doc and featureDev SessionState #6388

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

siakmun-aws
Copy link
Contributor

Problem

This is aimed to resolve jscpd

Solution

Refactor SessionState in doc and featureDev


  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@siakmun-aws siakmun-aws force-pushed the siakmun/refactor-session-state-dev-doc branch from 33f1073 to bcd4d1a Compare January 17, 2025 23:12
@siakmun-aws siakmun-aws force-pushed the siakmun/refactor-session-state-dev-doc branch from 03f7ed3 to 4fb81be Compare January 21, 2025 19:00
@avi-alpert
Copy link
Contributor

/runIntegrationTests

@avi-alpert
Copy link
Contributor

/runIntegrationTests

@avi-alpert
Copy link
Contributor

/runIntegrationTests

@avi-alpert
Copy link
Contributor

/runIntegrationTests

@siakmun-aws siakmun-aws marked this pull request as ready for review January 23, 2025 18:16
@siakmun-aws siakmun-aws requested review from a team as code owners January 23, 2025 18:16
@avi-alpert
Copy link
Contributor

/runIntegrationTests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file is mostly copied over from FeatureDev's types.ts. Original file is deleted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an abstract class of the original FeatureDevClient from amazonFeatureDev/client/featureDev.ts, allowing /doc to inherit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The several abstract classes CodeGenBase, BasePrepareCodeGenState and BaseCodeGenState are refactor versions of /doc and /dev's CodeGenBase, PrepareCodeGenState and CodeGenState. Most implementations are copied over, with different logic addressed with polymorphism (through methods such as handleProgress handleGenerationComplete). Logic-wise, this is the same as the original implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved from FeatureDev to common folder, with getDeletedFileInfos and registerNewFiles added to allow calling from /doc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved logic to common sessionState.ts and handled different logic with polymorphism

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as /doc sessionState.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied from original featureDev test file to allow calling from /doc tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved common functions to amazonq folder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

createCodeGenState was called from two places. Moved to be a common function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

createCodeGenState was called from two places. Moved to be a common function

@siakmun-aws siakmun-aws force-pushed the siakmun/refactor-session-state-dev-doc branch from 9863db6 to 34b539e Compare January 28, 2025 22:11
@siakmun-aws
Copy link
Contributor Author

siakmun-aws commented Jan 28, 2025

Duplicate code for packages/core/src/___/session: not in the scope of this PR since this was to refactor SessionState. Session is not included

@siakmun-aws siakmun-aws force-pushed the siakmun/refactor-session-state-dev-doc branch from 2536198 to 2f6ce38 Compare January 29, 2025 18:38
@siakmun-aws siakmun-aws force-pushed the siakmun/refactor-session-state-dev-doc branch from 2f6ce38 to 68672b2 Compare February 3, 2025 18:42
@jpinkney-aws
Copy link
Contributor

/runIntegrationTests

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.

4 participants