Skip to content

fix(hacker): stats 500 and resume auth; fix(test): Windows Mocha env - #981

Open
Jo-9m-n1 wants to merge 1 commit into
devfrom
fix-hacker-tests
Open

Jo-9m-n1 wants to merge 1 commit into
devfrom
fix-hacker-tests

Conversation

@Jo-9m-n1

Copy link
Copy Markdown

Summary:

Fixes failing Mocha integration tests and related API bugs in hacker stats and resume upload authorization.

List of changes:

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Test:

  • Use cross-env such that DEBUG and NODE_ENV work on Windows.
  • Run tests with test, instead of development so it uses the test database.
  • Add cross-env as a devDependency.

Hacker stats:

  • Fix GET /api/hacker/status returning 500 due to an undefined age variable when incrementing age counts.
  • add reviewer stat buckets expected by tests.
  • Fix fieldOfStudy aggregation and guard missing dietaryRestrictions.

Resume upload auth:

  • Compare account IDs with String(), instead of String.toString(), so only the account linked to the hacker can upload a resume for that ID.

Test:

  • Resume upload test: log in with noTeamHackerAccount0 instead of the hacker fixture without email/passowrd.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • npm run test-windows: 171 (all) passing (took around 20 mins) on local Mongo test DB

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Listed change(s) in the Changelog
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules

- fix getStats age bug, reviewer buckets, cache and field aggregations
- fix ensureAccountLinkedToHacker account ID comparison for resume routes
- run tests with cross-env and NODE_ENV=test on npm test / test-windows
- use account credentials in resume upload integration test

@janekhuong janekhuong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks for fixing the tests. a few notes:

  • update the package-lock.json file with cross-env
  • can we drop all the "-windows" scripts and use cross env for all of them?
  • add a "--timeout 10000" flag to test script; there are a couple tests timing out bc they take longer than 2 seconds

so the script section would now look like:
"scripts": {
"start": "cross-env DEBUG=hackboard:* NODE_ENV=development nodemon --ignore gcp_creds.json ./bin/www.js",
"deploy": "NODE_ENV=deployment node ./bin/www.js",
"debug": "cross-env DEBUG=hackboard:* NODE_ENV=development nodemon --ignore gcp_creds.json ./bin/www.js",
"test": "cross-env DEBUG=hackboard:* NODE_ENV=test mocha -r dotenv/config --reporter spec "tests/.js" --exit --timeout 10000",
"seed": "cross-env NODE_ENV=development node ./seed/index.js",
"docs": "apidoc -i ./routes -o ./docs/api/",
"format": "prettier --write "
/.js"",
"lint": "eslint --fix "**/
.js""
}

const stats = {
total: 0,
status: {},
reviewerStatus: {},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Humor an old alum who saw this in GitHub notifications... I know this isn't what's in the model but seeing this in the diff is triggering me. Shouldn't this be modeled as an object?

reviews: [
    {
        reviewerId: "...", // Reference to the reviewer's account
        status: "Accept",
        comments: "Good experience and a thoughtful application."
    }
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@krubenok Thank you for the feedback, alums are always welcome! We'll take a look and fix this.

Apologies for the Github reach-out, but we're currently running into a serious issue with our mchacks.ca domain. As a previous director, we would really appreciate if you could get in touch with us and help us out, as we think this domain was registered during your time at McHacks. Please send me an email at janek170805@gmail.com. Thank you!!

@krubenok krubenok Nov 10, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This commit has all the details I have: hackmcgill/mchacks6@676e119

the account was probably one of the @mchacks.ca ones I no longer have access to for either/both cloudflare and namecheap. Slack archive I still have says maybe devops@mchacks.ca or kyle@mchakcs.ca Somewhere in the zoho email archives probably, maybe the directors aliases too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for taking the time to look into this @krubenok. It looks like we don't have any access to deleted/inactive zoho accounts like devops@mchacks.ca or kyle@mchacks.ca.

This is an update on our current situation:

Our mchacks.ca domain's DNS configurations were mysteriously changed on Nov. 6, 2026 and is now parked. We believe at some point over the years the domain registrar was changed from Namecheap to Gandi, and its management has been delegated to AWS, a Gandi reseller. Investigating this requires signing in to our AWS account, but we're currently locked out, since our root email is on the parked mchacks.ca domain and we can't receive the verification code. We've been trying to contact past McHacks members for help, but still haven't found out what account the mchacks.ca domain is registered under. We're hoping AWS support can recover our account and we will continue investigating from there.

If there's anyone you can point us to that may have more information about this please let us know!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

8 years later I don't have much else to share. I have no idea where the data has gone. All the creds I had for AWS, namecheap and everything else have long since gone stale. I did register the domain back in the day but it' been several renewals since then so I can't speak to where they've ended up since then.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey @krubenok, just wanted to update you and let you know that we got the mchacks.ca domain back up! I messaged one of the numbers under the WHOIS lookup for hackmcgill.ca and turns out Chris Dobson (a friend of yours, I believe) had both domains registered in his personal AWS account. He just shut down his account a couple months ago, so that's why our domains were parked. We've since been able to transfer ownership of those domains to our Cloudflare account. Thanks so much for helping us out! I know it’s been a while since your McHacks days haha, so I really appreciate it

This branch had an error being deployed

1 failed deployment
testing — 176e7de2 Deployed Oct 15, 2026 by Jo-9m-n1 via build (20.x) #503
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.

3 participants