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

Extend support command to dump log #446 #450

Merged
merged 43 commits into from
Jan 16, 2024

Conversation

shech2
Copy link
Contributor

@shech2 shech2 commented Dec 21, 2023

Please review and tell me if there is anything i need to change

Summary by CodeRabbit

  • New Features

    • Implemented cache control for improved page load performance.
  • Bug Fixes

    • Removed the login command to streamline user experience.
    • Enhanced the supportCMD function for better user interaction and choice handling.
  • Refactor

    • Optimized command loading and execution processes.

Copy link

netlify bot commented Dec 21, 2023

Deploy Preview for dazzling-kringle-090742 ready!

Name Link
🔨 Latest commit a85358e
🔍 Latest deploy log https://app.netlify.com/sites/dazzling-kringle-090742/deploys/65a6195a215c020008096a51
😎 Deploy Preview https://deploy-preview-450--dazzling-kringle-090742.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

coderabbitai bot commented Dec 21, 2023

Walkthrough

The updated code introduces cache control enhancements to the website, optimizing content delivery with dynamic cache expiration settings. In the command script, it streamlines the command set by removing the login command, enriches the interaction with the supportCMD function, and integrates file system utilities for improved data handling.

Changes

File Path Change Summary
index.html Added cache control meta tags and scripts for dynamic cache expiration and main.ts.
src/commands.ts, aatp/peerbook_webrtc/admin.spec.ts Removed login command, added file system imports, and updated supportCMD function for enhanced user interaction and file management.
aatp/infra/redis/Dockerfile Updated Redis Dockerfile to modify configuration settings application and add a new save configuration setting.

Poem

🐇 "In the web's woven warren, we weave, 🌐
Cache control spells cast before we leave. 🎩✨
Commands pruned, files aligned just right,
CodeRabbit hops on with code so light!" 🚀🐰

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

netlify bot commented Dec 21, 2023

Deploy Preview for terminal7 ready!

Name Link
🔨 Latest commit a85358e
🔍 Latest deploy log https://app.netlify.com/sites/terminal7/deploys/65a6195a29e634000883d412
😎 Deploy Preview https://deploy-preview-450--terminal7.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 5

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 3c7becb and 28ca86b.
Files selected for processing (1)
  • src/commands.ts (3 hunks)

src/commands.ts Outdated Show resolved Hide resolved
src/commands.ts Outdated Show resolved Hide resolved
src/commands.ts Outdated Show resolved Hide resolved
src/commands.ts Outdated Show resolved Hide resolved
src/commands.ts Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 28ca86b and b005f51.
Files selected for processing (1)
  • src/commands.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/commands.ts

@shech2 shech2 closed this Dec 23, 2023
@shech2 shech2 reopened this Dec 23, 2023
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 4

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b005f51 and b18eb77.
Files selected for processing (2)
  • aatp/peerbook_webrtc/admin.spec.ts (4 hunks)
  • src/commands.ts (2 hunks)
Additional comments: 3
src/commands.ts (3)
  • 715-715: The loginCMD function is called with an await keyword, which is correct since the function is asynchronous. However, ensure that the loginCMD function is properly handling exceptions to avoid unhandled promise rejections.

  • 984-1014: The supportCMD function has been enhanced with new functionality for error reporting. Ensure that the server endpoint ${schema}://${terminal7.conf.net.peerbook}/support is correctly configured to handle incoming POST requests with the expected JSON payload. Additionally, consider adding more detailed error messages based on the server's response to aid in troubleshooting.

  • 1016-1017: The loginCMD function is mentioned in the context of the subscribeCMD function. Ensure that the loginCMD function is updated to handle the new subscription logic and that it properly manages the user's login state.

aatp/peerbook_webrtc/admin.spec.ts Outdated Show resolved Hide resolved
aatp/peerbook_webrtc/admin.spec.ts Outdated Show resolved Hide resolved
aatp/peerbook_webrtc/admin.spec.ts Outdated Show resolved Hide resolved
aatp/peerbook_webrtc/admin.spec.ts Outdated Show resolved Hide resolved
@shech2 shech2 changed the title Extend support command to dump log Extend support command to dump log #446 Dec 23, 2023
@shech2 shech2 self-assigned this Dec 23, 2023
@shech2 shech2 requested a review from daonb December 23, 2023 12:36
Copy link
Contributor

@daonb daonb left a comment

Choose a reason for hiding this comment

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

I found a few minor thing and a major design bug: Now the user has no place to tell us what happened.
You'll also need to add aatp tests to test the front and back and ensure an email is sent. We're already doing something similar - validating an email was sent - in the last function in admin.spec.ts .

src/commands.ts Outdated Show resolved Hide resolved
src/commands.ts Outdated Show resolved Hide resolved
src/commands.ts Outdated Show resolved Hide resolved
src/commands.ts Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b18eb77 and 98a0102.
Files ignored due to filter (1)
  • netlify.toml
Files selected for processing (2)
  • aatp/peerbook_webrtc/admin.spec.ts (4 hunks)
  • src/commands.ts (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • aatp/peerbook_webrtc/admin.spec.ts
  • src/commands.ts

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 98a0102 and cd66ee6.
Files selected for processing (1)
  • src/commands.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/commands.ts

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 28749d3 and 7f11b9b.
Files selected for processing (1)
  • src/commands.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/commands.ts

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7f11b9b and e322124.
Files selected for processing (1)
  • aatp/peerbook_webrtc/admin.spec.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • aatp/peerbook_webrtc/admin.spec.ts

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e322124 and 539142e.
Files selected for processing (1)
  • aatp/peerbook_webrtc/admin.spec.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • aatp/peerbook_webrtc/admin.spec.ts

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 539142e and 723610f.
Files selected for processing (2)
  • aatp/peerbook_webrtc/admin.spec.ts (1 hunks)
  • src/commands.ts (3 hunks)
Files skipped from review as they are similar to previous changes (2)
  • aatp/peerbook_webrtc/admin.spec.ts
  • src/commands.ts

@shech2 shech2 added enhancement New feature or request help wanted Extra attention is needed labels Jan 3, 2024
@shech2 shech2 linked an issue Jan 3, 2024 that may be closed by this pull request
@shech2
Copy link
Contributor Author

shech2 commented Jan 3, 2024

It's doesn't run locally , I have a problem with peerbook maybe I'm missing the args , I don't remember them.

Copy link
Contributor

@daonb daonb left a comment

Choose a reason for hiding this comment

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

almost there...

aatp/peerbook_webrtc/admin.spec.ts Outdated Show resolved Hide resolved
src/commands.ts Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 4

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 723610f and faa462c.
Files selected for processing (1)
  • src/commands.ts (3 hunks)
Additional comments: 1
src/commands.ts (1)
  • 14-14: The imports from @capacitor/filesystem are correctly added to support file operations within the supportCMD function.

src/commands.ts Show resolved Hide resolved
src/commands.ts Show resolved Hide resolved
src/commands.ts Show resolved Hide resolved
src/commands.ts Show resolved Hide resolved
@shech2 shech2 requested a review from daonb January 10, 2024 09:33
@daonb
Copy link
Contributor

daonb commented Jan 13, 2024

The newlines I saw are no longer there. It's strange, maybe something
to do with my browser 🤷 I can't merge it yet as it breaks the tests
because of PeerBook.

I'll first release PeerBook so the tests will pass and then merge this.

Thanks for this, I can't wait for it to delpoyed. I'm seening a bug and
today I just close the gate and reconnect. With this I can email the logs
before reconnecting so we can figure out how to squash the 🐛

@shech2
Copy link
Contributor Author

shech2 commented Jan 13, 2024

The newlines I saw are no longer there. It's strange, maybe something to do with my browser 🤷 I can't merge it yet as it breaks the tests because of PeerBook.

I'll first release PeerBook so the tests will pass and then merge this.

Thanks for this, I can't wait for it to delpoyed. I'm seening a bug and today I just close the gate and reconnect. With this I can email the logs before reconnecting so we can figure out how to squash the 🐛

We can do this together if you want

src/commands.ts Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between faa462c and baa13a2.
Files selected for processing (1)
  • src/commands.ts (3 hunks)
Additional comments: 5
src/commands.ts (5)
  • 14-14: The addition of the Filesystem, Directory, and Encoding imports from @capacitor/filesystem is appropriate for file operations within the supportCMD function.
  • 991-995: The previous comment regarding the email validation regex is still valid. A more robust solution or a library for email validation should be considered.
  • 1006-1007: The previous comment about the conditional operation not assigning the result back to fieldsNative is still valid. The suggested fix should be implemented.
  • 1054-1055: The previous comment about the missing break statement in the "Save log to file" case is still valid. The suggested fix should be implemented.
  • 1057-1057: The previous comment about the loginCMD function awaiting itself is still valid. This should be corrected to prevent a recursive call and potential stack overflow error.

src/commands.ts Show resolved Hide resolved
@shech2 shech2 requested a review from daonb January 15, 2024 16:33
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between baa13a2 and a85358e.
Files selected for processing (2)
  • aatp/infra/redis/Dockerfile (1 hunks)
  • aatp/peerbook_webrtc/admin.spec.ts (1 hunks)
Additional comments: 1
aatp/infra/redis/Dockerfile (1)
  • 2-3: The changes to the Redis configuration settings look correct. Please ensure that disabling AOF persistence (appendonly no) and RDB snapshots (save "") is intentional and verify that these settings are correctly applied when the container starts.

Comment on lines +353 to +384
test('test the support command', async ({request}) => {
await sleep(100)
await page.keyboard.type('support')
await page.keyboard.press('Enter')
await sleep(100)
let twr = await getTWRBuffer(page)
expect(twr).toMatch(/address:$/)
await page.keyboard.type('[email protected]')
await page.keyboard.press('Enter')
await sleep(100)
await page.keyboard.press('ArrowDown')
await page.evaluate(() => { terminal7.log('log line')})
await page.keyboard.press('Enter')
await sleep(100)
twr = await getTWRBuffer(page)
expect(twr).toMatch(/issue:$/)
await page.keyboard.type('test issue')
await page.keyboard.press('Enter')

let count = 0
let msg
while (count < 2) {
await sleep(100)
const res = await request.get('http://smtp:8025/api/v2/messages')
msg = await res.json()
count = msg.count
}
expect(msg.count).toBe(2)
const body = msg.items[0].Content.Body
expect(body).toMatch(/test issue/)
expect(body).toMatch(/log line/)
})
Copy link

Choose a reason for hiding this comment

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

The new test for the "support" command is well-structured and covers the expected behavior. However, consider adding assertions to verify that the email address ([email protected]) and the log line (log line) are included in the email body sent by the support command to ensure the complete log dump is captured.

+ expect(body).toMatch(/[email protected]/)
+ expect(body).toMatch(/log line/)

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
test('test the support command', async ({request}) => {
await sleep(100)
await page.keyboard.type('support')
await page.keyboard.press('Enter')
await sleep(100)
let twr = await getTWRBuffer(page)
expect(twr).toMatch(/address:$/)
await page.keyboard.type('[email protected]')
await page.keyboard.press('Enter')
await sleep(100)
await page.keyboard.press('ArrowDown')
await page.evaluate(() => { terminal7.log('log line')})
await page.keyboard.press('Enter')
await sleep(100)
twr = await getTWRBuffer(page)
expect(twr).toMatch(/issue:$/)
await page.keyboard.type('test issue')
await page.keyboard.press('Enter')
let count = 0
let msg
while (count < 2) {
await sleep(100)
const res = await request.get('http://smtp:8025/api/v2/messages')
msg = await res.json()
count = msg.count
}
expect(msg.count).toBe(2)
const body = msg.items[0].Content.Body
expect(body).toMatch(/test issue/)
expect(body).toMatch(/log line/)
})
test('test the support command', async ({request}) => {
await sleep(100)
await page.keyboard.type('support')
await page.keyboard.press('Enter')
await sleep(100)
let twr = await getTWRBuffer(page)
expect(twr).toMatch(/address:$/)
await page.keyboard.type('[email protected]')
await page.keyboard.press('Enter')
await sleep(100)
await page.keyboard.press('ArrowDown')
await page.evaluate(() => { terminal7.log('log line')})
await page.keyboard.press('Enter')
await sleep(100)
twr = await getTWRBuffer(page)
expect(twr).toMatch(/issue:$/)
await page.keyboard.type('test issue')
await page.keyboard.press('Enter')
let count = 0
let msg
while (count < 2) {
await sleep(100)
const res = await request.get('http://smtp:8025/api/v2/messages')
msg = await res.json()
count = msg.count
}
expect(msg.count).toBe(2)
const body = msg.items[0].Content.Body
expect(body).toMatch(/test issue/)
expect(body).toMatch(/log line/)
expect(body).toMatch(/test@gmail.com/)
expect(body).toMatch(/log line/)
})

@daonb daonb merged commit 4c8cee5 into master Jan 16, 2024
10 checks passed
@shech2 shech2 deleted the Extend_support_command_to_dump_log branch January 16, 2024 17:43
daonb pushed a commit to daonb/terminal7 that referenced this pull request Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend support command to dump log
2 participants