Skip to content

Scope: Delete key when deleting scope#45

Merged
danielbeardsley merged 2 commits into
masterfrom
scope--actually-delete
Jun 30, 2026
Merged

Scope: Delete key when deleting scope#45
danielbeardsley merged 2 commits into
masterfrom
scope--actually-delete

Conversation

@danielbeardsley

@danielbeardsley danielbeardsley commented Jun 30, 2026

Copy link
Copy Markdown
Member

Previously, to "delete" a scope, we immediately generated a new value and set() it overtop of the previous one.

  1. This isn't really needed. Sometimes we deleteScope() and don't immediately access it, so doing it eagerly was un-needed
  2. When using McRouter, delete() is guaranteed to be propagated while set() has a less strong guarantee

Yes, this means that in some cases (hard to tell how common) delete is followed by a set() of the scope key shortly afterward and this change adds a delete where one wasn't present before.

However, I think this is outweighed by point 1 above and point 2 shows that this change is important.

The code as it was meant that in our odd case with a bifurcated cache, we had to issue a delete() with every set() because deleteScope() only did a set(). There is a bunch of nuance here (see
https://github.com/iFixit/ifixit/pull/62768).

cr_req 2 -- I want more people to be happy with this change
qa_req 0 -- CI is enough.

CC @sterlinghirsh @jarstelfox @djmetzle

Previously, to "delete" a scope, we immediately generated a new value
and set() it overtop of the previous one.

1. This isn't really needed. Sometimes we deleteScope() and don't
   immediately access it, so doing it eagerly was un-needed
2. When using McRouter, delete() is guaranteed to be propagated
   while set() has a less strong guarantee

Yes, this means that in some cases (hard to tell how common) delete is
followed by a set() of the scope key shortly afterward and this change
adds a delete where one wasn't present before.

However, I think this is outweighed by point 1 above and point 2
shows that this change is important.

The code as it was meant that in our odd case with a bifurcated cache,
we had to issue a delete() with every set() because deleteScope() only
did a set(). There is a bunch of nuance here (see
iFixit/ifixit#62768).
jarstelfox
jarstelfox previously approved these changes Jun 30, 2026

@jarstelfox jarstelfox left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR 🌵

No caller ever passed reset, so drop the dead parameter and the
branches that only ran when it was true.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@djmetzle

djmetzle commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@danielbeardsley

Copy link
Copy Markdown
Member Author

Is this ref:

I don't think so... given that the scope value is still set with get() ... set().

I think it's still a separate issue.

@sterlinghirsh sterlinghirsh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR ⚡

@jarstelfox jarstelfox left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR 🌵

@danielbeardsley danielbeardsley merged commit c7aaf38 into master Jun 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants