Skip to content
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

local storage dev root id #2407

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

local storage dev root id #2407

wants to merge 1 commit into from

Conversation

scytacki
Copy link
Member

@scytacki scytacki commented Sep 17, 2024

Do not merge

This PR uses a random id in local storage for the root id when the appMode is dev. This restores a similar behavior to how appMode dev worked before the switch to use session storage for the firebase credentials.

To enable this:

  • the security rules for the dev root were relax, so any user can write to any dev root. This was done in this PR: refactor firebase root id computation #2403
  • update user icon rollover so devs can find their root
  • update getRootId utility to create or use the existing local storage id.
  • update tests to verify the functionality

However:

This approach breaks the Firebase functions which create and read data in the Realtime database and Firestore. These functions compute the root based on a context and the firebase auth that is passed to them. Previously the dev root was firebase auth uid, so that is what these functions are using. To support the new dev root approach, we'll need to send the random id from local storage to the functions. This complicates things because it is used by almost all the functions. We haven't migrated the old functions to the new functions-v2 folder, so it is harder to work on them.

The functions that would be broken in appMode dev are:

  • getImageData: downloads images from firebase. I don't remember if this is used for all student images, or just ones outside of the current class
  • publishSupport: publishing mulit-class supports
  • validateCommentableDocument: this is the key one for the current work. It creates the metadata document in Firestore if it doesn't exist. So without it working the sort work tab doesn't have any metadata documents to show.
  • postDocumentComment: save a teacher comment
  • getNetworkDocument: retrieve a doc from a different class which is allowed because the user is in the same network
  • getNetworkResources: get a list of documents from other classes the teacher has access too because of their network

All of these functions should not crash with this PR, they just are looking in or updating the wrong root in Firebase. So they save documents in the wrong place, or return no documents because the runtime is writing to a different place than the functions are looking.

This puts a random id in local storage and uses it for the Firestore and Realtime database root ids.
This approach is currently broken though, because the Firebase functions have not been updated to use this same root id. The functions continue to use the Firebase user id instead.

See this PR for more info: #2403
Copy link

cypress bot commented Sep 17, 2024

collaborative-learning    Run #13766

Run Properties:  status check passed Passed #13766  •  git commit 45b5ebe0be: local storage dev root id
Project collaborative-learning
Branch Review local-storage-dev-root
Run status status check passed Passed #13766
Run duration 01m 41s
Commit git commit 45b5ebe0be: local storage dev root id
Committer Scott Cytacki
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 1
View all changes introduced in this branch ↗︎

Copy link

codecov bot commented Sep 17, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 54.70%. Comparing base (62d0166) to head (45b5ebe).
Report is 48 commits behind head on master.

Files with missing lines Patch % Lines
src/clue/components/clue-app-header.tsx 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (62d0166) and HEAD (45b5ebe). Click for more details.

HEAD has 5 uploads less than BASE
Flag BASE (62d0166) HEAD (45b5ebe)
cypress-regression 5 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2407       +/-   ##
===========================================
- Coverage   85.90%   54.70%   -31.20%     
===========================================
  Files         737      728        -9     
  Lines       37824    37685      -139     
  Branches     9624     9604       -20     
===========================================
- Hits        32492    20617    -11875     
- Misses       5027    16045    +11018     
- Partials      305     1023      +718     
Flag Coverage Δ
cypress-regression ?
cypress-smoke 28.07% <9.09%> (+<0.01%) ⬆️
jest 48.79% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@scytacki scytacki added the punted an incomplete PR that we is postponed and we hope to get back to it label Sep 19, 2024
Base automatically changed from 188211348-local-storage-dev-root to master September 19, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
punted an incomplete PR that we is postponed and we hope to get back to it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant