Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/realm-server/handlers/handle-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ export default function handleSearch(opts: {
// assembly pass entirely: the host re-resolves every result from its raw
// card+source file, so the transitive `included[]` expansion is
// throwaway work in this path. Same gating as `cacheOnlyDefinitions`.
//
// This is also what keeps the assembled-resource budget off a render's
// search: the pass the budget bounds does not run at all here, so there is
// nothing to exempt. The budget's exemption is carried by the routes that
// do run the pass during a render — the card+html entry leg.
let omitIncluded = cacheOnlyDefinitions;
let jobPriority = sanitizeJobPriorityHeader(
ctxt.get(PRERENDER_JOB_PRIORITY_HEADER),
Expand Down
11 changes: 7 additions & 4 deletions packages/realm-server/tests/card-endpoints-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,8 @@ module(basename(import.meta.filename), function () {
let etag = response.get('etag') ?? '';
assert.ok(etag, 'response carries an ETag');
assert.true(
/^"\d+(?:-[0-9a-f]+)?:card-rri"$/.test(etag),
`ETag matches "<indexed_at>(-<realmInfoHash>)?:card-rri" pattern (got ${etag})`,
/^"\d+(?:-[0-9a-f]+)?:card-rri-lb\d+"$/.test(etag),
`ETag matches "<indexed_at>(-<realmInfoHash>)?:card-rri-lb<budget>" pattern (got ${etag})`,
);
assert.strictEqual(
response.get('cache-control'),
Expand Down Expand Up @@ -3733,7 +3733,7 @@ module(basename(import.meta.filename), function () {
'old ETag no longer matches → fresh 200',
);
assert.true(
/^"\d+(?:-[0-9a-f]+)?:card-rri"$/.test(
/^"\d+(?:-[0-9a-f]+)?:card-rri-lb\d+"$/.test(
staleResponse.get('etag') ?? '',
),
`GET reports a validator for the read shape (got ${staleResponse.get('etag')})`,
Expand Down Expand Up @@ -3818,7 +3818,10 @@ module(basename(import.meta.filename), function () {
// caller from treating the echo as the card's read representation.
assert.strictEqual(
patchResponse.get('etag'),
(initialEtag ?? '').replace(/:card-rri"$/, ':card-rri-write-echo"'),
(initialEtag ?? '').replace(
/:card-rri-lb\d+"$/,
':card-rri-write-echo"',
),
'no-op PATCH validates the unchanged state under the write-echo shape',
);
assert.notStrictEqual(
Expand Down
16 changes: 9 additions & 7 deletions packages/realm-server/tests/card-html-endpoints-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,14 @@ module(basename(import.meta.filename), function () {
),
'the card item rides in included',
);
// An item carries `meta.realmInfo` (which can change without a reindex),
// so an item-bearing response folds the realm-info hash in as a third
// segment on top of the `<index>:none` composite.
// An item carries `meta.realmInfo` (which can change without a reindex)
// and is assembled under the link budget (whose value decides what the
// item's closure holds), so an item-bearing response folds both in on top
// of the `<index>:none` composite. A pure-html response carries neither.
let etag = response.get('etag') ?? '';
assert.true(
/^"\d+:none:[^:"]+"$/.test(etag),
`an item response has no rendering channel + a realm-info segment, got ${etag}`,
/^"\d+:none:[^:"]+:lb\d+"$/.test(etag),
`an item response has no rendering channel + realm-info and budget segments, got ${etag}`,
);
});

Expand Down Expand Up @@ -320,10 +321,11 @@ module(basename(import.meta.filename), function () {
assert.strictEqual(data.type, 'entry');
// A file renders natively; whichever branch it resolves, the ETag pairs
// the two channels (a rendering → `<gen>:<gen>`, else `<gen>:none`), plus
// a realm-info segment when it falls back to its item.
// realm-info and budget segments when it falls back to its item — both
// ride on an item and neither on a pure rendering.
let etag = response.get('etag') ?? '';
assert.true(
/^"\d+:(\d+|none)(:[^:"]+)?"$/.test(etag),
/^"\d+:(\d+|none)(:[^:"]+:lb\d+)?"$/.test(etag),
`the file entry carries a composite ETag, got ${etag}`,
);
});
Expand Down
Loading
Loading