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

feat(dev): Stop code generation action #5675

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

Conversation

tverney
Copy link
Contributor

@tverney tverney commented Sep 26, 2024

Problem

Currently /dev don't support stop code generation. This PR introduces this functionality (watch the video below).

Solution

Mynah UI provides onStopChatResponse API which we can hook in the cancellation token provided on VS Code, sharing across an active session, aborting current progress.

Screen.Recording.2024-10-16.at.10.11.20.AM.mov

Notes:

  • RTS is already supporting the change on prod
  • codeGenerationId and uploadId are now being generated in FE
  • AppSec and pentest passed successfully
  • Telemetry is included in this PR and strings are reviewed/approved by Technical writer
  • This stop action is only introduced in /dev feature. This did not enable in any other product for this extension.

License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

This pull request implements a feature or fix, so it must include a changelog entry. See CONTRIBUTING.md#changelog for instructions.

Copy link

This pull request modifies code in src/ but no tests were added/updated. Confirm whether tests should be added or ensure the PR description explains why tests are not required.

@tverney tverney marked this pull request as ready for review October 16, 2024 14:13
dependabot bot and others added 28 commits October 21, 2024 14:32
## Problem:

When a user does a sleep then wake of their computer, the heartbeat is
not up to date since it cannot be sent when the user's computer is
asleep.

Due to this there is a race condition on wake between the next fresh
heartbeat being sent versus when we check the heartbeats to determine if
they are stale (crash). If the crash checker runs before a new heartbeat
can be sent, it will be seen as a crash.

## Solution:

Use a TimeLag class that helps to determine when there is a time
discrepancy. It works by updating a state every second, and if we
determine that the next update to that state took longer than a second,
we determine that there was a lag. Then we simply skip the next crash
check, allowing a fresh heartbeat to be sent.

---

<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

---------

Signed-off-by: nkomonen-amazon <[email protected]>
Initial code for a rule engine to determine whether or not to show an
in-IDE notification. A notification is a JSON payload with a set amount
of criteria. The rule engine accepts context from the currently running
extension then determines if the notification payload's criteria will
fit the provided context.

The types match the commonly designed schema, but may change in future
commits.

Future work:
- More docs
- Updates to types and/or criteria
- Code that will use this

---

<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
See each commit message for revelant fix


---

<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

---------

Signed-off-by: nkomonen-amazon <[email protected]>
…ws#5802)

Add animation for View Diff and Apply Diff buttons. 

Demo - 

https://github.com/user-attachments/assets/05092447-be86-4dc8-89b5-ecb7c4bfee0f



License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
Since the amazonq one is empty

---

<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

Signed-off-by: nkomonen-amazon <[email protected]>
## Problem
Follow up from
aws#5761 (comment).

## Solution
`npm uninstall --save '@types/fs-extra' 'fs-extra' -w packages/core/`
## Problem
Follow up to:
aws#5761 (comment)

## Solution
- target a version of `@types/node` that is closer to the actual version running in CI.
- add a techdebt.test.ts reminder.
## Problem
Limited ability to diagnose problems with EC2 instances provided in the
toolkit.

## Solution
Add a right click option to provide system log of Ec2 instance in
read-only file view.
### Implementation Details
- Log view does NOT live update. This would require refactoring the CWL
significantly. Better to get the feature out and see if this is
something customers want/need.
- To reduce code duplication two new utility components were added
`decodeBase64` in`core/src/shared/utilities/textUtilities.ts` and
`UriSchema` in `core/src/shared/utilities/uriUtils.ts`.
- `decodeBase64` is a helper function to wrap the use of `Buffer.from(X,
"base64").toString()` throughout the toolkit.
- `UriSchema` provides a general framework for translating between an
object and an URI, and vice versa. It allows us to avoid writing the
`isValid` method in all cases. With more work this could likely be more
general, but is only used twice so unclear if it is worth pursuing.
- These changes involved changing some function calls, especially in the
CWL code, but does not impact functionality.
### Pictures 
<img width="1231" alt="image"
src="https://github.com/user-attachments/assets/0991c51e-6e27-4102-a85f-08246a7faab0">
<img width="1508" alt="image"
src="https://github.com/user-attachments/assets/558d831f-7a7c-475b-9400-719ce8fd99d7">


---

<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

---------

Co-authored-by: Justin M. Keyes <[email protected]>
)

## Problem
We want to enforce that the private key generated by the toolkit is not
accidentally slipped into a telemetry metric.

## Solution
Similar to `assertTelemetry`, we implement a `assertNoTelemetryMatch`
test utility that scans all metrics to see if a specified keyword is
included in its keys or values.

With this utility, it is relatively straightforward to assert that this
private key doesn't appear in the telemetry when we generate it and
perform other operations with it.

---

<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

---------

Co-authored-by: Justin M. Keyes <[email protected]>
Creates our own version of an Interval, similar to how we have our own
Timeout

---

<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

Signed-off-by: nkomonen-amazon <[email protected]>
increment the time that we wait for the interval to finish since it runs
slower in ci

---

<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

Signed-off-by: nkomonen-amazon <[email protected]>
Problem: c8 was not given a reporter, therefore it defaulted to `text`
which is the terminal.
Solution: Set it to `lcov`, which is what we have been using previously.

Note: More work may be needed on the .c8rc.json files. We might not need
the one for core/ anymore. They may not be configured in the optimal
way. Is it behaving how we want it to?

---

<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
@tverney tverney requested a review from a team as a code owner October 21, 2024 19:15
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.