code-423n4 / code-423n4/code423n4.com

Add contests↔︎sponsors check to validate script

Open
#7,878 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
179
Forks
173
PR merge metrics
No merged PRs in 30d

Description

There are some various checks in bin/validate.js that happen as part of the CI here:

    await validateHandles();
    await validateTeams();
    await validateOrganizations();
    await validateFindings();

But one other one that could be helpful is to validate the contests vs. sponsor data to flag any mismatch there. For example if a contest has been added in the main branch, a stale side branch can start getting a sort of cryptic error like:

2:26:22 PM: error Building static HTML failed for path "/contests/2023-03-aragon-protocol-contest"
2:26:22 PM: 
2:26:22 PM:   182 |               <div className="contest-page__project">
2:26:22 PM:   183 |                 <div className="contest-page__project-link project-link">
2:26:22 PM: > 184 |                   <a href={sponsor.link}>
2:26:22 PM:       |                                    ^
2:26:22 PM:   185 |                     <img
2:26:22 PM:   186 |                       src={sponsor.image.childImageSharp.resize.src}
2:26:22 PM:   187 |                       alt={sponsor.name}
2:26:22 PM: 
2:26:22 PM:   WebpackError: TypeError: Cannot read properties of null (reading 'link')

which isn't obvious but basically means the API is returning a contest but the dev branch is missing the sponsor info and avatar. The validate could detect this more directly and flag it in a clearer way to make it easier to troubleshoot.

[Noting that the bigger picture fix might be to keep the two data sources from getting out of sync in the first place, but that might be a longer-term effort.]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in bin/validate.js by reading the existing validateHandles, validateTeams, validateOrganizations, and validateFindings checks, then trace how contest and sponsor data are loaded. Reproduce or inspect the mismatch where the API returns a contest but the branch lacks sponsor information or an avatar. Done means the validation reports a clear, direct error instead of allowing the static build to fail cryptically.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
ci-cd, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.