Open GuillermoFloresV opened 1 year ago
@GuillermoFloresV @ngillux
Related to freeCodeCamp/classroom
needing to make corresponding changes via https://github.com/freeCodeCamp/classroom/pull/401
I believe the following changes in freeCodeCamp/freeCodeCamp
impacted freeCodeCamp/classroom
:
From https://github.com/freeCodeCamp/freeCodeCamp/pull/50769#pullrequestreview-1502560914 by @ojeytonwilliams to @naomi-lgbt on June 28th:
It's not really relevant to this PR, but I wonder if we should switch the meta.json format from
"challengeOrder": [ [ "id": "587d7dbc367417b2b2512bb1", "title": "Create a Simple JSX Element" [, to
"challengeOrder": [ { "id": "587d7dbc367417b2b2512bb1", "title": "Create a Simple JSX Element" }, Working with tuples is nasty and, weirdly, I don't think much code needs to change to accommodate this. What do you reckon?
Anyways, back on topic, some nitpicks:
From https://github.com/freeCodeCamp/freeCodeCamp/pull/50955 by @naomi-lgbt on July 12th:
As mentioned in https://github.com/freeCodeCamp/freeCodeCamp/pull/50769#pullrequestreview-1502560914, this migrates the meta.json files to use objects instead of tuples.
@GuillermoFloresV @ngillux
I want to highlight that a JSON object is unordered by design based on the JSON standard in RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format
• When we request the FCC API that responds with a JSON object (instead of a tuple), the order isn't guaranteed.
• Item 0 in a JSON object probably won't be the same as item 0 in a tuple, and the ordering in the JSON response can change from one request to the next.
Therefore, when you implement:
We want to set up a job to ping the endpoints used by classroom mode and compare them to what the project is currently expecting. From there, if there is a change detected we want to display what it is and possibly alert the maintainers of the repo (or at the very least set up triggers for associated files) to alert contributors about the changes.
I believe you would need a JSON diff tool that understands semantics and ignores the ordering in the response.
Reference:
From https://datatracker.ietf.org/doc/html/rfc8259.html
An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array.
An array is an ordered sequence of zero or more values.
Thank you!
Sorry about this, I didn't realise that Classroom was relying on the shape of that data. I should have realised given that it changed the schema.
For the short term I'll try and keep that in mind. In the longer term the api-rewrite should handle this issue since any changes to the api will come with a change in the api version.
Actually the challenge data is taken from the client static files.
Right, but we changed that in https://github.com/freeCodeCamp/freeCodeCamp/pull/50955
Yup. I was pointing out this part
For the short term I'll try and keep that in mind. In the longer term the api-rewrite should handle this issue since any changes to the api will come with a change in the api version.
Classroom doesn't use the main API, it gets the challenge data from client static files
Ah, good point.
Just to reiterate, once we have the new API up and running there should no longer be a need to rely on those static files since Classroom will be able to get whatever it needs from (hopefully) stable api endpoints.
Describe the bug Recently, we came across an issue that seems to have originated from changes on the FCC backend. Our API processing file (
/util/api_processor
) started creating undefined data inside theallChallenges
key inside ourCreateDashboardObject
function.The fault came from attempting to access a zeroth index inside of our response object. We did some digging and found that the issue persists despite rolling back changes made to the processing file and files associated with it, leaving us with the assumption that this was caused by changes in the fcc API that we use to build and display classrooms.
To Reproduce Steps to reproduce the behavior: This issue will be patched by #401 however, we want to at the very least be more aware of changes happening on FCC's end so that we do not waste time figuring out what caused our code to break.
Expected behavior We want to set up a cron job to ping the endpoints used by classroom mode and compare them to what the project is currently expecting. I found this article that walks through how to set one up using GitHub Actions, so it should be a good starting point. From there, if there is a change detected we want to display what it is and possibly alert the maintainers of the repo (or at the very least set up triggers for associated files) to alert contributors about the changes.