-
Notifications
You must be signed in to change notification settings - Fork 2
infra: updated mocha to not bail on first test failure: #230
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
base: main
Are you sure you want to change the base?
Conversation
# P1B: Starter Task: Refactoring PR **Use this pull request template to briefly answer the questions below in one to two sentences each.** Feel free to delete this text at the top after filling out the template. > You are **not permitted** to use generative AI services (e.g., ChatGPT) to compose the answers. > Any such use will be treated as a violation of academic integrity. ## 1. Issue **Please provide a link to the associated GitHub issue:** **Link to the associated GitHub issue:** **Full path to the refactored file:** **What do you think this file does?** *(Your answer does not have to be 100% correct; give a reasonable, evidence‑based guess.)* **What is the scope of your refactoring within that file?** *(Name specific functions/blocks/regions touched.)* **Which Qlty‑reported issue did you address?** *(Name the rule/metric and include the BEFORE value; e.g., “Cognitive Complexity 18 in render()”.)* ## 2. Refactoring **How did the specific issue you chose impact the codebase’s adaptability?** **What changes did you make to resolve the issue?** **How do your changes improve adaptability? Did you consider alternatives?** ## 3. Validation **How did you trigger the refactored code path from the UI?** **Attach a screenshot of the logs and UI demonstrating the trigger.** *(Run `./nodebb log`; include the relevant UI view. Temporary logs should be removed before final commit.)* **Attach a screenshot of `qlty smells --no-snippets <full/path/to/file.js>` showing fewer reported issues after the changes.**
kaylae605
left a comment
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.
It seems like attributes were added to the test file that were missing before, which was causing the tests to fail.
I still believe there needs to be more additions as the test suite is still failing. Maybe something got removed in the restructuring process?
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.
Pull Request Overview
This PR adds bulk operations for queued posts management, allowing users to accept or reject multiple queued posts at once rather than handling them individually. The implementation includes a fallback mechanism to maintain compatibility with older servers.
- Introduces new bulk API endpoints for accepting and rejecting multiple queued posts
- Updates the client-side post queue to use bulk operations with fallback to individual requests
- Adds comprehensive API documentation for the new bulk endpoints
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/routes/write/posts.js | Adds routing for bulk queue operations |
| src/controllers/write/posts.js | Implements controller handlers for bulk operations |
| src/api/posts.js | Core bulk processing logic with Promise.allSettled for error handling |
| public/src/client/post-queue.js | Client-side integration with fallback mechanism |
| public/openapi/write/posts/queue/bulk/accept.yaml | API documentation for bulk accept endpoint |
| public/openapi/write/posts/queue/bulk.yaml | API documentation for bulk reject endpoint |
| public/openapi/write.yaml | Registers new bulk endpoints in OpenAPI specification |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if (r.status === 'fulfilled') { | ||
| success.push(r.value); | ||
| } else { | ||
| errors.push({ id: data.ids[idx], error: r.reason && r.reason.message ? r.reason.message : String(r.reason) }); |
Copilot
AI
Oct 2, 2025
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 error handling logic is duplicated between acceptQueuedPostsBulk and removeQueuedPostsBulk. Consider extracting this into a helper function to reduce code duplication.
| if (r.status === 'fulfilled') { | ||
| success.push(r.value); | ||
| } else { | ||
| errors.push({ id: data.ids[idx], error: r.reason && r.reason.message ? r.reason.message : String(r.reason) }); |
Copilot
AI
Oct 2, 2025
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 error handling logic is duplicated between acceptQueuedPostsBulk and removeQueuedPostsBulk. Consider extracting this into a helper function to reduce code duplication.
| alerts.success(`[[post-queue:bulk-${action}-success, ${ids.length}]]`); | ||
| ajaxify.refresh(); | ||
| } catch (err) { | ||
| // fallback to sequential if bulk fails (e.g., older server without bulk endpoints) |
Copilot
AI
Oct 2, 2025
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.
The word 'sequential' should be 'individual' to be more accurate, as the fallback uses Promise.allSettled which runs requests in parallel, not sequentially.
| // fallback to sequential if bulk fails (e.g., older server without bulk endpoints) | |
| // fallback to individual requests if bulk fails (e.g., older server without bulk endpoints) |
P1B: Starter Task: Refactoring PR
Use this pull request template to briefly answer the questions below in one to two sentences each.
Feel free to delete this text at the top after filling out the template.
1. Issue
Please provide a link to the associated GitHub issue:
Link to the associated GitHub issue:
Full path to the refactored file:
What do you think this file does?
(Your answer does not have to be 100% correct; give a reasonable, evidence‑based guess.)
What is the scope of your refactoring within that file?
(Name specific functions/blocks/regions touched.)
Which Qlty‑reported issue did you address?
(Name the rule/metric and include the BEFORE value; e.g., “Cognitive Complexity 18 in render()”.)
2. Refactoring
How did the specific issue you chose impact the codebase’s adaptability?
What changes did you make to resolve the issue?
How do your changes improve adaptability? Did you consider alternatives?
3. Validation
How did you trigger the refactored code path from the UI?
Attach a screenshot of the logs and UI demonstrating the trigger.
(Run
./nodebb log; include the relevant UI view. Temporary logs should be removed before final commit.)Attach a screenshot of
qlty smells --no-snippets <full/path/to/file.js>showing fewer reported issues after the changes.