Skip to content

chore: improve appwrite maintenance path#12535

Open
quyentonndbs wants to merge 1 commit into
appwrite:1.9.xfrom
quyentonndbs:maint/20260608072126
Open

chore: improve appwrite maintenance path#12535
quyentonndbs wants to merge 1 commit into
appwrite:1.9.xfrom
quyentonndbs:maint/20260608072126

Conversation

@quyentonndbs

Copy link
Copy Markdown

Summary:

  • Add or tighten focused edge-case tests or type assertions in tests/benchmarks/ws.js, tests/benchmarks/http.js related to TypeScript, frontend tooling, test stability, build fixes; avoid docs-only changes and broad refactors.
  • Keep the change narrow so it is straightforward to review.

Notes:

  • I kept this scoped to the relevant implementation and tests.

@greptile-apps

greptile-apps Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR hardens two k6 benchmark helpers: cookieHeader in http.js gains array handling for multi-valued Set-Cookie response headers, and the WebSocket 'channels are right' check in ws.js moves from a fragile exact-string JSON comparison to a structured parse-and-assert approach.

  • http.js: The array branch joins raw Set-Cookie values (which include attributes like Path=/; HttpOnly) with '; ', producing a malformed Cookie request header; only the name=value portion of each entry should be extracted before joining.
  • ws.js: The new check correctly handles type safety, JSON parse errors, and structural assertions independently — a clear improvement over the previous JSON.stringify equality check that would break on key ordering or extra fields.

Confidence Score: 3/5

The WebSocket change is safe, but the cookie-joining logic in http.js will produce malformed Cookie request headers that may cause authenticated benchmark flows to fail silently.

The cookieHeader function joins full Set-Cookie response header values including attributes like Path=/ and HttpOnly directly into the Cookie request header, which can break session-based authentication flows in the benchmark. The ws.js change is well-constructed and has no issues.

tests/benchmarks/http.js — the cookieHeader array-join logic needs attention

Important Files Changed

Filename Overview
tests/benchmarks/http.js Adds array handling in cookieHeader for multi-valued Set-Cookie headers, but joins full header values including attributes, producing malformed Cookie request headers.
tests/benchmarks/ws.js Replaces brittle exact-string JSON comparison with a robust parsed check that handles key ordering differences, extra properties, and parse errors gracefully.

Reviews (1): Last reviewed commit: "chore: improve appwrite maintenance path" | Re-trigger Greptile

Comment thread tests/benchmarks/http.js
Comment on lines +462 to +464
if (Array.isArray(cookie)) {
return cookie.join('; ');
}

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.

P1 When multiple Set-Cookie response headers are joined with '; ', each value typically includes cookie attributes (e.g. session=abc; Path=/; HttpOnly). Joining them produces a malformed Cookie request header where attribute names like Path and HttpOnly get parsed as cookie names by the server. The correct approach is to extract only the name=value portion (everything before the first ;) from each Set-Cookie entry before joining.

Suggested change
if (Array.isArray(cookie)) {
return cookie.join('; ');
}
if (Array.isArray(cookie)) {
return cookie.map(c => c.split(';')[0].trim()).join('; ');
}

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.

1 participant