Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
dcecbe7
WIP admit anonymous reads
habdelra Oct 5, 2026
2fca192
Merge the compile branch
habdelra Oct 5, 2026
a0f83ac
WIP anonymous reads: skip compiling for a policy that opens nothing; …
habdelra Oct 6, 2026
f202fec
Merge the compile branch
habdelra Oct 6, 2026
ac7ee13
Merge main
habdelra Oct 6, 2026
7367fd6
Turn an exhausted address away before running, count only served read…
habdelra Oct 6, 2026
57eb2c0
Count an anonymous capability check once per pair before it runs; tes…
habdelra Oct 6, 2026
325e840
Explain answers an anonymous caller's write as its route does
habdelra Oct 6, 2026
dec5b31
Rewrite the anonymous admission comment in plain words
habdelra Oct 6, 2026
567d707
Record a route that runs whatever its request names as operation *
habdelra Oct 6, 2026
1d23078
Move anonymous admission and counting out of realm.ts into AnonymousA…
habdelra Oct 6, 2026
a01602f
Merge remote-tracking branch 'origin/main' into cs-13536-policy-admit…
habdelra Oct 6, 2026
2bfa6b7
Merge remote-tracking branch 'origin/main' into cs-13536-policy-admit…
habdelra Oct 6, 2026
f50a0c7
Merge remote-tracking branch 'origin/main' into cs-13536-policy-admit…
habdelra Oct 6, 2026
5b8cb0a
Keep a rate-limited test's requests inside one window
habdelra Oct 6, 2026
19bda94
Merge remote-tracking branch 'origin/main' into cs-13536-policy-admit…
habdelra Oct 6, 2026
7bb9988
Compare rate-limited answers without the wait each names
habdelra Oct 6, 2026
c107673
Merge remote-tracking branch 'origin/main' into cs-13536-policy-admit…
habdelra Oct 6, 2026
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
1 change: 1 addition & 0 deletions packages/catalog/test-subset.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"realmServer": [
"catalog-test-subset-test",
"realm-policy-activation-test",
"realm-policy-anonymous-read-test",
"realm-policy-archived-seal-test",
"realm-policy-batch-test",
"realm-policy-capabilities-test",
Expand Down
28 changes: 28 additions & 0 deletions packages/realm-server/tests/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1733,6 +1733,7 @@ export async function runTestRealmServerWithRealms({
liveSearchCache,
linkShapePolicy,
mediaCacheAdapter,
clientAddress,
}: {
realmsRootPath: string;
realms: {
Expand Down Expand Up @@ -1762,6 +1763,11 @@ export async function runTestRealmServerWithRealms({
// The store every capture surface persists to: the worker's capture task,
// each realm's `_screenshot/` route, and the server's `_screenshot-card`.
mediaCacheAdapter?: MediaCacheAdapter;
// How the server works out a caller's address. Omit for none in front of
// it, which makes every supertest request the same loopback caller; a test
// that tells callers apart trusts one hop and names each in
// `X-Forwarded-For`.
clientAddress?: ConstructorParameters<typeof RealmServer>[0]['clientAddress'];
}) {
stripTlsEnvVars();
ensureDirSync(realmsRootPath);
Expand Down Expand Up @@ -1867,6 +1873,7 @@ export async function runTestRealmServerWithRealms({
liveSearchCache,
linkShapePolicy,
mediaCacheAdapter,
...(clientAddress ? { clientAddress } : {}),
});
let testRealmHttpServer = await awaitListening(
testRealmServer.listen(parseInt(serverURL.port)),
Expand Down Expand Up @@ -3440,6 +3447,27 @@ export const cardInfo = {
// `name` under cardInfo.name (matching the CardDef slot); other fields land
// on attributes directly. Mirrors the host helper so realm-server tests can
// build the same shape without depending on host.
// Waits, where needed, until the current anonymous rate-limit window has
// enough of itself left for a test's requests to land in it together. The
// limiter counts in fixed windows aligned to multiples of `windowSeconds`, so
// two requests either side of a boundary are counted in different windows,
// and a test that expects the second to be refused would see it admitted.
export async function clearOfRateLimitWindowEdge(
limit: unknown,
marginSeconds = 30,
): Promise<void> {
let windowSeconds = (limit as { windowSeconds?: unknown } | undefined)
?.windowSeconds;
if (typeof windowSeconds !== 'number' || windowSeconds <= 0) {
return;
}
let margin = Math.min(marginSeconds, windowSeconds / 2);
let left = windowSeconds - ((Date.now() / 1000) % windowSeconds);
if (left < margin) {
await new Promise((resolve) => setTimeout(resolve, left * 1000 + 50));
}
}

export function realmConfigCardJSON(
config: {
name?: string;
Expand Down
Loading
Loading