Repository navigation
refactor(runtime): owner transports, the creation default and a focus-read ratchet #27275
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
Merged
+1,366
−55
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5822f36
refactor(runtime): owner transports, the creation default and a focus…
f643022
chore(lint): pin defaultCreationHost's own read in the focus-read bas…
f0a6eb1
fix(lint): the focus-read ratchet counts shared focus helpers and des…
119c67c
fix(lint): discover functions that read the default host instead of h…
704ecc2
fix(lint): readers are found through imports and returned values
3a860d8
fix(lint): a reader called through a namespace or dynamic import stil…
14dffd6
fix(lint): renamed, parenthesized and .then() dynamic imports bind re…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { defaultCreationHost } from './default-creation-host' | ||
|
|
||
| describe('defaultCreationHost', () => { | ||
| it('is this computer unless a server is chosen', () => { | ||
| expect(defaultCreationHost(null)).toEqual({ kind: 'local' }) | ||
| expect(defaultCreationHost({ activeRuntimeEnvironmentId: null })).toEqual({ kind: 'local' }) | ||
| expect(defaultCreationHost({ activeRuntimeEnvironmentId: ' env-a ' })).toEqual({ | ||
| kind: 'environment', | ||
| environmentId: 'env-a' | ||
| }) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import type { GlobalSettings } from '../../../shared/global-settings-types' | ||
| import type { RuntimeClientTarget } from '@/runtime/runtime-client-target' | ||
|
|
||
| /** | ||
| * The "Default host for new projects" setting. Only a creation flow with no source row reads it; | ||
| * everything else routes by the resource's owner. | ||
| */ | ||
| export function defaultCreationHost( | ||
| settings: Pick<GlobalSettings, 'activeRuntimeEnvironmentId'> | null | undefined | ||
| ): RuntimeClientTarget { | ||
| const environmentId = settings?.activeRuntimeEnvironmentId?.trim() | ||
| return environmentId ? { kind: 'environment', environmentId } : { kind: 'local' } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Exclude simple property assignments from the read count.
If code adds
settings.activeRuntimeEnvironmentId = id,SETTING_MEMBER_READcounts the assignment as a read. The value of the existing property is not read. The new count can then failcheckRatchetfor a setting write. Exclude assignment-only targets, but keep read-modify-write operations such as+=in the count. Add a direct-assignment case to the write exclusions test.