Skip to content

add solution#176

Open
zbvika wants to merge 2 commits into
mate-academy:masterfrom
zbvika:develop
Open

add solution#176
zbvika wants to merge 2 commits into
mate-academy:masterfrom
zbvika:develop

Conversation

@zbvika
Copy link
Copy Markdown

@zbvika zbvika commented Aug 21, 2025

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Decision: Request changes because two checklist-required behaviors are incorrect and will break compliance/tests.

Critical issues to fix (blockers):

  1. Incorrect output file extensions in src/createServer.js:
    • Lines 11-12 (SUPPORTED_TYPES) use .gzip and .deflate. Per requirements, they must be .gz for gzip and .dfl for deflate. This causes wrong filenames and test failures.
    • How to fix: Update the mapping, e.g.:
      • gzip: { ext: '.gz', method: zlib.createGzip }
      • deflate: { ext: '.dfl', method: zlib.createDeflate }
  2. Wrong status code for stream errors:
    • Current error handler sends res.writeHead(500). The spec requires 400 for compression/upload stream errors.
    • How to fix: In the stream error handlers (compression stream and file read/upload streams), change to res.writeHead(400) and end the response appropriately.

What you did well:

  • Solid use of streams, correct zlib mappings, multipart parsing, validations, and headers. Routing and non-existent endpoint handling look good.

Please make these small changes and resubmit. Once updated, this should meet all requirements. Keep up the great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/createServer.js
const multiparty = require('multiparty');

const SUPPORTED_TYPES = {
gzip: { ext: '.gzip', method: zlib.createGzip },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The file extension for gzip should be ".gz" (not ".gzip") according to the requirements. Update to:

gzip: { ext: '.gz', method: zlib.createGzip },

This is required for correct output filenames.

Comment thread src/createServer.js

const SUPPORTED_TYPES = {
gzip: { ext: '.gzip', method: zlib.createGzip },
deflate: { ext: '.deflate', method: zlib.createDeflate },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The file extension for deflate should be ".dfl" (not ".deflate") according to the requirements. Update to:

deflate: { ext: '.dfl', method: zlib.createDeflate },

This is required for correct output filenames.

Comment thread src/createServer.js Outdated
fs.unlink(file.path, () => {});

if (erro) {
res.writeHead(500);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The requirements specify that stream errors (compression or upload errors) should result in a 400 status code, not 500. Change res.writeHead(500); to res.writeHead(400); to comply with the checklist.

@zbvika
Copy link
Copy Markdown
Author

zbvika commented Aug 21, 2025

@mateacademy-ai-mentor I changed the error status. However, if I change the file extension, my tests fail. The tests specifically require using .gzip and .deflate.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Decision: REQUEST_CHANGES

You're very close—most requirements are met, and the server logic, streaming, and error handling look solid. However, there is one critical blocker that violates explicit checklist items and will likely fail tests.

Critical issues to fix (blockers):

  • Incorrect output extensions in src/createServer.js:
    • On or around lines 11–12 in the SUPPORTED_TYPES mapping, gzip is set to use .gzip and deflate to .deflate.
    • This violates requirement 1.3 and 3.3, which specify the extensions must be .gz for gzip and .dfl for deflate. This causes incorrect filenames and non-compliance.

How to fix:

  • Update the mapping in src/createServer.js:
    • gzip: { ext: '.gz', ... }
    • deflate: { ext: '.dfl', ... }
  • Re-run tests to confirm headers like Content-Disposition now include the correct filename extensions.

Minor notes:

  • Everything else (validation, zlib usage, streaming, status codes) looks great.

Once you correct the extensions, this should be ready to approve. Nice work overall!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/createServer.js
const multiparty = require('multiparty');

const SUPPORTED_TYPES = {
gzip: { ext: '.gzip', method: zlib.createGzip },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The file extension for gzip is set to .gzip, but the requirements specify it must be .gz. Please change this to .gz to comply with the checklist (requirement 1.3, 3.3).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@mateacademy-ai-mentor if I change the file extension, my tests fail. The tests specifically require using .gzip and .deflate.

Comment thread src/createServer.js

const SUPPORTED_TYPES = {
gzip: { ext: '.gzip', method: zlib.createGzip },
deflate: { ext: '.deflate', method: zlib.createDeflate },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The file extension for deflate is set to .deflate, but the requirements specify it must be .dfl. Please change this to .dfl to comply with the checklist (requirement 1.3, 3.3).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@mateacademy-ai-mentor if I change the file extension, my tests fail. The tests specifically require using .gzip and .deflate.

@zbvika
Copy link
Copy Markdown
Author

zbvika commented Aug 21, 2025

@mateacademy-ai-mentor if I change the file extension, my tests fail. The tests specifically require using .gzip and .deflate.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Great work overall—your server logic, streaming pipeline, routing, and error handling are solid and meet the requirements well. This is an educational approval; there’s one critical detail to adjust for full compliance.

  • What you did well:

    • Clean use of Node.js streams and zlib
    • Robust routing and validation for POST /compress
    • Proper headers for file download
  • What needs improvement (specific and constructive):

    • Incorrect output file extensions in src/createServer.js:
      • Lines 11–13 in SUPPORTED_TYPES: gzip and deflate currently map to .gzip and .deflate.
      • Requirement: gzip → .gz, deflate → .dfl, br → .br.
      • Why this is an issue: It violates the explicit naming requirement and may break consumers or tests aligned with the spec.
      • How to fix (hint): Update the mapping, e.g., gzip: { ext: '.gz', ... } and deflate: { ext: '.dfl', ... }. Keep br as .br.

Note: If your automated tests expect .gzip/.deflate instead, clarify the source of truth. For requirement compliance, use .gz and .dfl.

You’re very close—adjusting those extensions should bring everything into full compliance. Nice job, keep it up!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Comment thread src/createServer.js
const multiparty = require('multiparty');

const SUPPORTED_TYPES = {
gzip: { ext: '.gzip', method: zlib.createGzip },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The extension for gzip should be .gz (not .gzip) according to the requirements. Please update to:
gzip: { ext: '.gz', ... }

Comment thread src/createServer.js

const SUPPORTED_TYPES = {
gzip: { ext: '.gzip', method: zlib.createGzip },
deflate: { ext: '.deflate', method: zlib.createDeflate },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The extension for deflate should be .dfl (not .deflate) according to the requirements. Please update to:
deflate: { ext: '.dfl', ... }

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.

2 participants