-
Notifications
You must be signed in to change notification settings - Fork 479
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
Seed and serialize spritelab programming expressions #44071
Conversation
serializing from block directory
Hi Bethany, I have some initial questions about the overall approach. it sounds like a good choice, but I am trying to see if I understand what this means for adding more blocks in the future. are these points correct?
for (1), a follow-up question is how bad will that situation be -- are there things that we should make sure don't break in this scenario? applab toolbox blocks have links to their docs, but I don't see any such links on https://studio.code.org/projects/spritelab , so I'm not sure that concern applies here. |
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.
Thanks for the detailed write-up, Bethany! This approach and the actual code change both look good to me.
@@ -10,5 +10,6 @@ | |||
"name": "text" | |||
} | |||
], | |||
"syntax": "button(id, text)" | |||
"syntax": "button(id, text)", | |||
"video_key": "alg_6_variables" |
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.
is this change to an applab block expected?
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.
oh oops 😅
Yep, that's correct.
No, the way this code works now is that the tables are completely separate. There are spritelab blocks not in the blocks table already, so there is not a new way to get into a bad state, but adding a programming expression does not create a new block.
The problem will all of this is that there is no one source of truth for blocks. In applab, blocks are defined in https://github.com/code-dot-org/code-dot-org/blob/staging/apps/src/applab/dropletConfig.js and I guess people have been remembering to add corresponding documentation into curriculumbuilder when blocks are added? I'm not sure if there are blocks without corresponding documentation |
how are new blocks added that are not in the
Yes, agreed, the system is not set up in a way that makes it easy to have a single source of truth for these. I think it is reasonable for us to not tackle that now, though. If our goal is parity with Curriculum Builder, then you've taken away one place each block needs to be added and replaced it with another place, so I think we are good in that sense. |
I think this makes sense. We have already ended up with different places that define the blocks and document the blocks for the other labs like applab. It seems like at least the fact that spritelab will be consistent with the other areas is a win. I still wish we had a way to better validate and check that blocks added in one place get added in the other as well but with spritelab since there is no connection from the programming environment to the documentation on the blocks is probably not as big of a deal anyway |
I had to look this up last week so definitely no apologies needed. The short answer is that most of them are defined in the code-dot-org/blockly repo. The long answer with probably too much detail:
on the rails console to get the spritelab expressions not represented in the It gave me (programming expression key, function name, category):
Of these, most were defined in the files in https://github.com/code-dot-org/blockly/tree/main/blocks. |
Thank you Bethany, great explanation! |
Seed and serialize spritelab!
My proposal, which is implemented in this PR, is to go with the same seed/serialize logic as the rest of the labs, for a few reasons:
blocks
table, which need a config in config/programming_expressions/spritelab. For me, this is the most compelling reasonThe biggest downside is that this information already lives in a bunch of different places (in the
blocks
table, inapps/
, in the blockly repo) and we're adding another place. For me, consistency and simplicity of this feature outweighed the desire to avoid duplication of this information, but I've open to debate here.I considered writing this data to the files in config/blocks/GamelabJr but didn't because:
That said, I am planning on adding a field
block_name
to ProgrammingExpression that would at least create a pointer between the two models (not as an association because, again, not all blocks have an entry inblocks
).Thoughts? I can write this up as a doc if folks would prefer that, but wasn't sure it quite warranted one.
For review, I would recommend viewing the commit with code changes with whitespace hidden then skim the commit that serializes the programming expressions.
Testing story
serialized all programming expressions, committed those files, deleted all programming expressions, reseeded, reserialized, and ensured no diffs. #44019 added a test for this logic
PR Checklist: