Deprecating Firebase#56277
Conversation
…t block Co-authored-by: Cassi Brenci <cnbrenci@users.noreply.github.com>
Co-authored-by: Cassi Brenci <cnbrenci@users.noreply.github.com>
Co-authored-by: Cassi Brenci <cnbrenci@users.noreply.github.com>
…precision/smoothing
Extract DatablockStorageKvp.set_kvps
This commit causes the firebase and datablock storage APIs to diverge a little. Co-authored-by: Cassi Brenci <cnbrenci@users.noreply.github.com>
…rageBackend() which returns the right backend. Co-authored-by: Cassi Brenci <cnbrenci@users.noreply.github.com>
|
This PR is a continuation of #54643, which was mis-closed by the Git LFS migration (#55759). Previous Comments:
In applab.js this is just used to update data preview pages when columns are renamed, seems like that doesn't necessitate a full firebase-level DB.
The only thing that looks like it might need subscription like functionality is
Questions to answer:
I'd personally like to see how widely used the From this we can compute: "percent of active applab projects using the onRecord event block", which can then inform a decision to just deprecate
@cnbrenci and I tracked down where applab student source is being saved, and its in main.json files in S3, e.g.: https://s3.console.aws.amazon.com/s3/object/cdo-v3-sources?region=us-east-1&prefix=sources/50000063/131542020/main.json
@cnbrenci and I tracked down where applab student source is being saved, and its in main.json files in S3, e.g.:
So we can go: Now we need to figure out how to do
Confirmed that this does work (I successfully downloaded the source)
The last step would be we need to run it against the prod dashboard DB with the "sources" s3_path_prefix instead of "sources_development" #!/usr/bin/env ruby
require_relative('../config/environment')
# Gets a sampling of applab source code from s3
# computes the percentage of those sources that use the onRecordEvent block
def percent_projects_actively_using_block(project_type, block_type, last_active_after, sample_size)
projects = Project.where(project_type: project_type, updated_at: last_active_after...).take(sample_size)
s3_path_prefix = "sources_development"
# s3_path_prefix = "sources" # or in dev: "sources_development"
s3_bucket = "cdo-v3-sources"
projects_have_block = projects.map do |project|
s3_path = "#{s3_path_prefix}/#{project.storage_id}/#{project.id}/main.json"
file_contents = AWS::S3.download_from_bucket(s3_bucket, s3_path)
contains_block = JSON.parse(file_contents)["source"].include?("onRecordEvent(")
contains_block
end
percent_using_block = (projects_have_block.count(true).to_f / projects_have_block.size) * 100
puts "Percentage of #{project_type} projects using the #{block_type} block is #{percent_using_block}"
end
def percent_applabs_actively_using_on_record_event
num_samples = 1000
timeframe = 30.days.ago
percent_projects_actively_using_block("applab", "onRecordEvent", timeframe, num_samples)
end
puts "Percent of recent applab projects using 'onRecordEvent':"
puts(percent_applabs_actively_using_on_record_event)
I guess a next step is figuring out how/where we can run this to have production DB creds (preferably read-only) available. One option, which might actually be simplest, is to run this on our
TL;DR: 0.002% of applab projects (that aren't stubs or chat apps) created in the last 2 months use the
Also worth noting that none of the apps appear to be finished to an extent that I think its likely anyone is actively using them in a multiplayer context, including the chat apps.
So we went back to the sampling, and grabbed 105k samples covering all of 2022... We scanned 2022 (samples from each month), and we found 3 "valid" apps in 2022 out of 105k samples (=0.003%, about the same as the "last two months" sample). "Valid" meant apps that weren't either chat apps, or stub code (e.g. "drag some blocks out"). We found 11 chat apps out of the 105k, so chat apps were 0.01%, though some of the 11 are variations on the same "WUT by Adam" chat. So basically, looks like our rate of apps that use the onRecordEvent block is ~~0.002 - 0.003% (pretty in the noise given how few examples there were even with 100k samples each time)
Relevant code is here: https://github.com/code-dot-org/code-dot-org/blob/e6905b0c899383ca2c7e43885f847cedf84478b2/apps/src/p5lab/gamelab/commands.js/#L25-L47 The PR that added them is here: #11951 @davidsbailey any chance you remember why we were adding these APIs without adding them as blocks?
no, sadly I do not think I was involved in this decision.
Previous Reviews: |


Tracking issue for the firebase deprecation project: https://github.com/orgs/code-dot-org/projects/4
This PR will probably not be merged, but we're writing a fair bit of code to build a bulk importer etc that we'll probably throw away (see #55189 ). We could have opened a new repo, but it seemed reasonable just to keep it on this branch.