-
Notifications
You must be signed in to change notification settings - Fork 12
PagePool: materialize the reserved module/command tab; plumb priority through definition lookups #4863
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
Merged
PagePool: materialize the reserved module/command tab; plumb priority through definition lookups #4863
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
1cf2626
PagePool: materialize the reserved module/command tab; plumb priority…
habdelra 0aa6fa9
Address Codex review: await ensureStandbyPool unconditionally
habdelra 9c3ddbb
Drop the same current<desired guard from the brand-new-affinity branch
habdelra 8129768
Plumb job priority through lookupDefinition (x-boxel-job-priority hea…
habdelra 95e988e
Indexer: pre-warm every realm .gts/.gjs module, not just per-row deps
habdelra 2a0aa93
Merge origin/main: adopt clearRealmCache → clearRealmDefinitions rename
habdelra 978b020
Merge branch 'prerender-deadlock-pagepool-priority' into prerender-de…
habdelra 6a45c7a
Host: stamp user priority on outbound _federated-search by default
habdelra 9a40c88
Broaden pre-warm sweep to all executables: .ts/.js can host CardDef too
habdelra 2b74fc2
Address review: tighten === true check, fix doc comment, add unit tests
habdelra 8bff668
Restore `.gts`/`.gjs`-only pre-warm sweep with corrected rationale
habdelra db7c299
Add X-Boxel-Job-Priority to CORS allow-headers
habdelra a89c949
Merge branch 'prerender-deadlock-pagepool-priority' into prerender-de…
habdelra 18f5504
Merge remote-tracking branch 'origin/prerender-deadlock-pagepool-prio…
habdelra afe40c1
Merge remote-tracking branch 'origin/main' into prerender-deadlock-pa…
habdelra 90bea13
Merge remote-tracking branch 'origin/prerender-deadlock-pagepool-prio…
habdelra 572f941
Merge pull request #4866 from cardstack/prerender-deadlock-user-api-p…
habdelra de0548f
Merge pull request #4864 from cardstack/prerender-deadlock-pre-warm-r…
habdelra 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
There are no files selected for viewing
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,150 @@ | ||
| import { module, test } from 'qunit'; | ||
|
|
||
| import { userInitiatedPriority } from '@cardstack/runtime-common'; | ||
|
|
||
| import { resolveOutboundJobPriority } from '@cardstack/host/services/store'; | ||
|
|
||
| // Pure-resolver tests for the policy that decides what | ||
| // `X-Boxel-Job-Priority` value the host SPA stamps on outbound | ||
| // `_federated-search` calls. The function is module-internal logic | ||
| // extracted so its policy can be pinned without acceptance-test | ||
| // scaffolding. | ||
| // | ||
| // Two states gated by `__boxelDuringPrerender`: | ||
| // - inside prerender → forward (preserve 0) | ||
| // - outside prerender → user-initiated (10) by default | ||
| module('Unit | job-priority-header | resolveOutboundJobPriority', function () { | ||
| module('outside a prerender tab (user / API caller)', function () { | ||
| test('returns userInitiatedPriority when no global is set', function (assert) { | ||
| assert.strictEqual( | ||
| resolveOutboundJobPriority({ | ||
| duringPrerender: undefined, | ||
| jobPriority: undefined, | ||
| }), | ||
| userInitiatedPriority, | ||
| ); | ||
| }); | ||
|
|
||
| test('returns userInitiatedPriority when __boxelDuringPrerender is false', function (assert) { | ||
| assert.strictEqual( | ||
| resolveOutboundJobPriority({ | ||
| duringPrerender: false, | ||
| jobPriority: undefined, | ||
| }), | ||
| userInitiatedPriority, | ||
| ); | ||
| }); | ||
|
|
||
| test('honors an explicit override on __boxelJobPriority', function (assert) { | ||
| // Batch / scripting tooling running in the host SPA can set the | ||
| // global before issuing a fetch; outside a prerender tab we still | ||
| // forward what they set rather than overriding to user priority. | ||
| assert.strictEqual( | ||
| resolveOutboundJobPriority({ | ||
| duringPrerender: undefined, | ||
| jobPriority: 3, | ||
| }), | ||
| 3, | ||
| ); | ||
| assert.strictEqual( | ||
| resolveOutboundJobPriority({ | ||
| duringPrerender: false, | ||
| jobPriority: 0, | ||
| }), | ||
| 0, | ||
| 'override with 0 is preserved (not coerced to user priority)', | ||
| ); | ||
| }); | ||
|
|
||
| test('rejects a truthy but non-boolean __boxelDuringPrerender — uses strict === true', function (assert) { | ||
| // If `__boxelDuringPrerender` somehow ended up as a stringy | ||
| // truthy value (e.g. set by a future code path that didn't | ||
| // coerce), the policy must NOT silently flip to "forward 0"; | ||
| // a real user-facing fetch would then queue behind background | ||
| // indexing. The check is `=== true` for exactly this reason. | ||
| assert.strictEqual( | ||
| resolveOutboundJobPriority({ | ||
| duringPrerender: 'yes', | ||
| jobPriority: undefined, | ||
| }), | ||
| userInitiatedPriority, | ||
| ); | ||
| assert.strictEqual( | ||
| resolveOutboundJobPriority({ | ||
| duringPrerender: 1, | ||
| jobPriority: undefined, | ||
| }), | ||
| userInitiatedPriority, | ||
| ); | ||
| }); | ||
| }); | ||
|
|
||
| module('inside a prerender tab', function () { | ||
| test('forwards an explicit __boxelJobPriority of 10', function (assert) { | ||
| assert.strictEqual( | ||
| resolveOutboundJobPriority({ | ||
| duringPrerender: true, | ||
| jobPriority: 10, | ||
| }), | ||
| 10, | ||
| ); | ||
| }); | ||
|
|
||
| test('forwards an explicit __boxelJobPriority of 0 — must NOT upgrade', function (assert) { | ||
| // System-initiated indexing has priority 0. A | ||
| // `_federated-search` fired by the card render must preserve | ||
| // that or its sub-prerenders would outrank the parent job. | ||
| assert.strictEqual( | ||
| resolveOutboundJobPriority({ | ||
| duringPrerender: true, | ||
| jobPriority: 0, | ||
| }), | ||
| 0, | ||
| ); | ||
| }); | ||
|
|
||
| test('defaults to 0 when __boxelJobPriority is missing (older render-runner / test fixture)', function (assert) { | ||
| assert.strictEqual( | ||
| resolveOutboundJobPriority({ | ||
| duringPrerender: true, | ||
| jobPriority: undefined, | ||
| }), | ||
| 0, | ||
| ); | ||
| }); | ||
|
|
||
| test('rejects malformed __boxelJobPriority values', function (assert) { | ||
| // Non-number / negative / non-integer values fall through to | ||
| // the default for the active branch. | ||
| assert.strictEqual( | ||
| resolveOutboundJobPriority({ | ||
| duringPrerender: true, | ||
| jobPriority: -1, | ||
| }), | ||
| 0, | ||
| ); | ||
| assert.strictEqual( | ||
| resolveOutboundJobPriority({ | ||
| duringPrerender: true, | ||
| jobPriority: 1.5, | ||
| }), | ||
| 0, | ||
| ); | ||
| assert.strictEqual( | ||
| resolveOutboundJobPriority({ | ||
| duringPrerender: true, | ||
| jobPriority: '10', | ||
| }), | ||
| 0, | ||
| ); | ||
| assert.strictEqual( | ||
| resolveOutboundJobPriority({ | ||
| duringPrerender: false, | ||
| jobPriority: -1, | ||
| }), | ||
| userInitiatedPriority, | ||
| 'malformed value outside prerender → user-initiated default', | ||
| ); | ||
| }); | ||
| }); | ||
| }); |
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
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.
Uh oh!
There was an error while loading. Please reload this page.