Repository navigation
Conversation
Adds Vitest with a Node environment and a test script, so that the fixes for the review of #56 come with tests (review point 9). The tests use fixtures and mocks only. The config is a subset of the one on chore/add-tests-and-docs; on a conflict, that branch's config can win. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, point 1: the WES list filtered only on type.artifact, so the user's token could go to any registered service. Krini now reads GET /verifications next to GET /services (without a token) and keeps entries verified with the same identifier, URL and type, with an https URL without user info. A registry without /verifications yields no services. The service-info route uses the same list. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, point 8 (#44, step 3): on a 401, the WES provider now renews the session through the refresh route once and retries the request once. If that fails too, a toast asks the user to log in again. Concurrent renewals share one refresh request, so a rotating refresh token is used only once. The provider moves to src/lib/token-wes-provider.ts to be testable. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Vite's native config loader doesn't support __dirname in .mts files. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, point 8: document the renew and retry of WES requests. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, point 7 (#41): the TES list now uses the same verified registry list as WES (verified entries with https URLs only), and /ga4gh/tes/v1 is added to a service URL only if it's missing, so registry URLs that include it no longer get it twice. Not fixed: @elixir-cloud/tes 1.0.1 can't send the user's token yet (cloud-components#443); the README says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, point 6 (#40, step 5): a1e8a2e removed the /tes-api rewrite and the default selection, but the selector still offered "TEST SERVER" at /tes-api, which now leads nowhere. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, small points: the selector rendered the reason of an unreachable service twice. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, small points: join(", v") added a "v" to every version but the first. The versions are now shown as the service lists them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, small points: cookies() returns the cookies of the incoming request, so the second read of logout_marker could never differ from the first. Adds tests for the logout check and the httpOnly token cookies. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, small points: the README still mentioned VITE_HOST_URI, the old login.elixir-europe.org and a logo this branch deletes. It now points to the LS Login URL, explains which host login works on, uses public/logo.svg, and names the Apache License 2.0 that LICENSE holds (instead of MIT). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, small points: shadcn is the CLI that generates the UI components and provides a stylesheet imported at build time; the app doesn't need it at runtime, and it was the path of the bun audit advisories. bun audit --prod --audit-level=high finds nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
next build type-checks the tests too and rejected the untyped mock. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, point 8, follow-up: the refresh timer posted to the refresh route on its own, so it could use a rotating refresh token at the same time as a renewal after a 401. Both now use renewSession() in src/lib/session.ts, which runs one request at a time. If a WES service rejects the renewed token too, Krini now says that the service doesn't accept the login, instead of asking to log in again. Adds a test that the form body is sent again on the retry. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, points 1 and 7, follow-up: after a refresh of the list, a service whose verification was removed stayed selected, and requests with the user's token kept going to it. The WES and TES stores now clear the selection if the new list doesn't have it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, point 7, follow-up: the TES list route reads the registry without a token and no longer returns 401, so the "Login to fetch TES servers" branch can't be reached. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, point 8, follow-up: an expired session asks to log in; a renewed token that is rejected too gets its own message. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, point 1, follow-up: any failure of GET /verifications gave an empty list, which the WES route then cached for a minute. Now only 404 and 405 (a registry without the endpoint) give no services; other errors, e.g. timeouts and 5xx, fail the request (502), so a short registry outage doesn't hide all services. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, point 1, follow-up: tests that the route fetches the service info of verified services only, and returns 500 like the other routes if CLOUD_REGISTRY_URL is missing (was 502). The accepted artifacts are now shared constants of src/lib/registry.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Review of #56, points 8 and small points, follow-up: the retry test now checks the form fields of both requests and that the call succeeds, and the refresh route says why one logout check is enough. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
next build type-checks the tests and couldn't call the union of the two store types. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's GuideData structuresClear WES and TES selections when a refreshed service list no longer contains the selected URL.
APIUse verified registry entries for TES discovery, WES discovery, and WES service-info lookup, with explicit handling for registry configuration and failures.
Keep refresh-cookie validation tied to the incoming request and remove the redundant second logout-marker check.
Uses of the APIUse the shared session-renewal flow for WES requests and surface distinct messages when renewal fails or the service rejects the renewed token.
Normalize selected TES service URLs before passing them to the TES client and remove the obsolete hard-coded test-server option.
ImplementationCentralize registry URL validation, verification matching, artifact filtering, and bounded public registry requests for service discovery.
Provide a shared same-origin token lookup and single-flight, time-limited session renewal for the refresh timer and WES requests.
Implement the WES provider's bearer-token requests, one renewal and retry after 401, and unauthorized outcome reporting.
Construct a TES API base URL without duplicating its API path.
UIRemove duplicate WES health text and display workflow versions as supplied by the service.
ConfigurationMove the shadcn CLI from runtime dependencies to development dependencies.
DocumentationUpdate the README for the local logo, OIDC host requirements, registry verification behavior, TES token limitation, testing, and Apache-2.0 license.
Document the one-time WES session renewal and retry behavior, including the two possible failure outcomes.
TestsCover verified-service filtering, registry errors, TES and WES route behavior, and verified-service probing.
Test shared session renewal, WES token retry behavior, TES URL normalization, selection cleanup, and refresh-cookie behavior.
Provide shared registry fixtures and request-option helpers for route tests.
Exercise the mock registry's verification endpoint and assert that anonymous visitors see only verified secure services.
Lock files and vendored codeRegenerate the Bun lockfile to match the dependency changes.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 7 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/app/api/workflows/get-wes-servers/route.ts" line_range="145" />
<code_context>
- );
+ // Only verified services: the selected one gets the user's token
+ const wesServices =
+ await fetchVerifiedServices<WESServer>(WES_ARTIFACTS);
const results = await probeWithConcurrencyLimit(
</code_context>
<issue_to_address>
**Revoked WES services receive tokens**
When a WES service is revoked while the route's cache is fresh, the cache-hit branch returns the old list without rechecking verification, so the revoked service remains selectable and `TokenWesProvider` keeps sending the user's access token until the cache expires.
Recheck verifications before returning cached WES servers and remove revoked services from the cached result.
Also at `src/stores/wes.ts:21-28`.
</issue_to_address>
### Comment 2
<location path="src/app/api/workflows/get-wes-servers/route.ts" line_range="145" />
<code_context>
- );
+ // Only verified services: the selected one gets the user's token
+ const wesServices =
+ await fetchVerifiedServices<WESServer>(WES_ARTIFACTS);
const results = await probeWithConcurrencyLimit(
</code_context>
<issue_to_address>
**Revoked services keep receiving requests**
When a selected WES service is unverified while a dashboard remains open, the browser keeps its loaded list until a manual refresh, and the route can serve its 60-second cached list, so `setServers` does not clear the selection; `TokenWesProvider` continues attaching the user's token to a service whose verification was removed.
Revalidate the WES list periodically or before requests, and ensure revocation invalidates both the server cache and the client selection promptly.
Also at `src/stores/wes.ts:21-28`.
</issue_to_address>
### Comment 3
<location path="src/stores/tes.ts" line_range="19-27" />
<code_context>
servers: [],
serversLoaded: false,
- setServers: (servers) => set({ servers, serversLoaded: true }),
+ // A server that left the verified list must not stay selected
+ setServers: (servers) =>
+ set(({ selectedServer }) => ({
+ servers,
+ serversLoaded: true,
+ selectedServer: servers.some((s) => s.url === selectedServer)
+ ? selectedServer
+ : null,
+ })),
}));
</code_context>
<issue_to_address>
**Revoked TES services stay selectable**
When a selected TES service is revoked after the list has loaded and the user keeps the app open, `TESServerList` fetches the registry only while `serversLoaded` is false; after that, it returns without refreshing the list. A service revoked during the open app session therefore remains selected in the Zustand store, and the TES components continue sending requests to it.
Refresh the TES list periodically or on relevant navigation, and clear the selection whenever the current list cannot be revalidated.
</issue_to_address>
### Comment 4
<location path="src/lib/session.ts" line_range="29-40" />
<code_context>
+ * a rotating refresh token is used only once.
+ */
+export function renewSession(): Promise<boolean> {
+ pendingRenewal ??= fetch("/auth/api/refresh", {
+ method: "POST",
+ credentials: "same-origin",
+ cache: "no-store",
+ })
+ .then((response) => response.ok)
+ .catch(() => false)
+ .finally(() => {
+ pendingRenewal = null;
+ });
+
+ return pendingRenewal;
+}
</code_context>
<issue_to_address>
**Concurrent tabs invalidate sessions**
When two tabs renew the same rotating refresh token concurrently, `pendingRenewal` is shared only within one module instance, so both tabs submit the token; the identity provider rejects the replay, and the failed refresh route can clear cookies set by the successful response, leaving the user logged out or with an invalid refresh token.
Coordinate refresh-token renewals across tabs so only one request uses a rotating token at a time.
Also at `src/lib/token-wes-provider.ts:49-51`.
</issue_to_address>
### Comment 5
<location path="src/lib/session.ts" line_range="29-39" />
<code_context>
+ * a rotating refresh token is used only once.
+ */
+export function renewSession(): Promise<boolean> {
+ pendingRenewal ??= fetch("/auth/api/refresh", {
+ method: "POST",
+ credentials: "same-origin",
+ cache: "no-store",
+ })
+ .then((response) => response.ok)
+ .catch(() => false)
+ .finally(() => {
+ pendingRenewal = null;
+ });
+
+ return pendingRenewal;
+}
</code_context>
<issue_to_address>
**A stuck refresh blocks future renewals**
When the browser's request to `/auth/api/refresh` remains pending indefinitely, `renewSession` has no timeout or abort path, so a refresh fetch that never settles leaves `pendingRenewal` set indefinitely. The refresh timer and every WES request that receives a 401 then wait on that same promise instead of attempting another renewal or reporting a completed failure.
Bound the refresh fetch with a timeout or abort signal so the shared promise settles and can be cleared.
</issue_to_address>
### Comment 6
<location path="src/lib/registry.ts" line_range="69" />
<code_context>
+ verifications: unknown,
+ artifacts: readonly string[],
+): T[] {
+ if (!Array.isArray(services) || !Array.isArray(verifications)) return [];
+
+ const verified = new Map<string, ServiceVerification>();
</code_context>
<issue_to_address>
**Registry errors look like empty results**
When `GET /verifications` succeeds with a non-array payload, `filterVerifiedServices` returns an empty list, so the routes report success and the WES route caches that result; users see no services instead of a registry error.
Treat a non-array verification payload as an upstream error rather than returning an empty list.
</issue_to_address>
### Comment 7
<location path="src/app/api/workflows/get-service-info/route.ts" line_range="22" />
<code_context>
- },
- },
- );
+ const servers = await fetchVerifiedServices<WESServer>(WES_ARTIFACTS);
const server = servers.find((item) => item.id === id);
</code_context>
<issue_to_address>
**Non-default ports break service info**
When a verified WES service uses an HTTPS URL with a non-default port, `isAllowedServiceUrl` accepts the URL and the WES list route can probe it, but the service-info route rejects it because `parsedUrl.port` is nonempty, so the info link returns 400.
Allow the service-info route to accept verified HTTPS URLs with non-default ports.
Also at `src/lib/registry.ts:43`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 7 findings to address first, and after a WES service returns 401, Krini now refreshes the session and resends the request with the renewed bearer token to that same service. If the service-selection or retry trust is wrong, the remote service can retain the token and request data; reverting cannot retrieve them.
Blocking findings: src/app/api/workflows/get-wes-servers/route.ts:145, src/app/api/workflows/get-wes-servers/route.ts:145, src/stores/tes.ts:27, src/lib/session.ts:40, src/lib/session.ts:39, and 2 more
Sourcery on #65: a refresh request that never settled would keep the shared renewal pending, so the refresh timer and every WES request after a 401 would wait on it forever. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Sourcery on #65: a GET /verifications response that isn't a list gave an empty, cached service list instead of a registry error. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Signed-off-by: Chitransh <[email protected]>
Brings in the CI workflow (#60) and the env file checks (#68). The README note on the login host keeps the wording of this PR and adds where to set the two variables. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The merge of staging had joined the two lockfiles line by line and dropped the semver 7 that make-dir needs, so the coverage report crashed. This is dev's lockfile with shadcn moved to the dev dependencies, as package.json has it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Vitest on dev runs only src/**/*.test.ts, so the tests of this PR in tests/ no longer ran. They now sit next to the modules they test, the fixtures in src/test/registry.ts share the registry URL and errors of src/test/routes.ts, and new cases cover the branches that the 100% threshold of dev requires. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The route tests from #63 expected the lists before the review fixes (no verifications, errors passed on). They now cover the verified lists and fold in the integration tests of this PR, which are removed. The checks that the registry module already makes are gone from the WES list and kept as a second line of defence in the service-info route. The test of a logout during a refresh is gone with the second check (77ee55a): cookies() returns the cookies of the request, so a logout can't change them. The mock registry of the end-to-end tests serves verifications and an unverified entry. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Share the registry request options in src/test/routes.ts, name the helper parameters alike, document the fixtures and the call counts, and say in the README that all Vitest tests are unit tests. The service-info route drops its https and user-info checks: the registry module makes them, and no request could reach them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@AnonymousXC this is ready for your review: |
|
Closing this PR since the code has evolved significantly since these changes were originally made, and the current implementation has diverged. There are also substantial merge conflicts, and resolving them would require reworking much of the existing code. We can track any remaining review comments as separate issues and revisit them after the release, addressing them against the current codebase. Thanks for work! |
Fixes for the review of #56
Hi Chitransh! As you asked, here are the fixes for the review of #56. Since #56 landed in
staging(nowdev) with #61, this PR goes there. Each commit belongs to one point, so you can pick or drop single ones. You already fixed several points on your branch after4dc60e1, so those are skipped here (see the table).Review point → commit → status
GET /verifications(same id, URL and type) withhttpsURLs without user info. A registry without/verifications(404/405) gives no services; other errors give 502 instead of a cached empty list. A selected service that leaves the list is deselectedhttpOnly+/auth/api/token); 77ee55a adds a test for thehttpOnlycookiesLICENSEdeletedpull_request_template.mdstays deleted (your call)OIDC_REDIRECT_URI/APP_ORIGINon the preview host and a registry with verified services. abb7f8c says in the README which host login works onhttpsTES list;/ga4gh/tes/v1is no longer doubled. Not fixed: no token for TES, because@elixir-cloud/tes1.0.1 can't send one yet (elixir-cloud-aai/cloud-components#443); the README says so401join(", v")VITE_HOST_URI, old login URL, logo)packageManagerand theDockerfileshadcnas production dependencydevDependencies(it's only needed at build time);bun audit --prod --audit-level=highfinds nothingUpdate 2026-11-14: merged
devAfter the branch rename (
staging→dev), I mergeddev(044e328: CI from #60, env file checks from #68; one README conflict, resolved by keeping this PR's login-host note and adding where to set the two variables). Your tests from #63 had also come in with the earlier merge ofstaging, and the two suites didn't fit together yet, so four follow-up commits reconcile them:build: regenerate the lockfile after the merge: the earlier merge had joined the twobun.lockfiles line by line and lost thesemver7 thatmake-dirneeds, sobun run test:coveragecrashed. Nowdev's lockfile withshadcnmoved to the dev dependencies.test: move the unit tests next to the code: your Vitest config runssrc/**/*.test.tsonly, so this PR'stests/no longer ran. They're now next to the code (src/lib/*.test.ts,src/stores/stores.test.ts, fixtures insrc/test/registry.tsusing the helpers ofsrc/test/routes.ts), plus a few cases for the 100% threshold.test: check verified lists in the route tests: your route tests expected the behaviour before these fixes (no verifications, registry errors passed on as is). They now check the verified lists, and this PR's integration tests are folded into them and removed. The URL checks in the WES list thatfetchVerifiedServices()already makes are removed (they were unreachable); the service-info route keeps its checks as a second line of defence, minus an unreachabletry/catch. Your test "drops the new tokens after a logout during the refresh" is removed together with the second logout check (77ee55a):cookies()holds this request's cookies, so another request's logout can't change them. Tell me if you'd rather keep the check and the test. The mock registry of the end-to-end tests now serves/verificationsand an unverified entry, which the journey test expects to be dropped.test: tidy the route tests after the review: shared registry request options insrc/test/routes.ts, consistent helper names, comments; the service-info route drops its ownhttpsand user-info checks, whichfetchVerifiedServices()already makes (it keeps port and path checks).How it was verified
After merging
dev(852d184):bun run test:coverage: 17 files, 170 tests pass, 100% coverage (dev's threshold)bun run test:e2e(Playwright, Chromium and Firefox, includesnext build): 22 tests passbun run lint(Biome),bunx next typegen+bunx tsc --noEmit: cleanbun audit --prod --audit-level=high: no vulnerabilitiesCI passedgreen (lint, type check, build, audit, image build and scan; push and publish skipped on PRs as intended), Sourcery passes, Vercel preview deployed. Note: the CI workflow ondevhas no job forbun run testor the end-to-end tests yet, so the test results above are local onlyBefore the merge: see the history of this description (51 Vitest tests, build, audit; no CI for PRs to
stagingthen).Declined review findings
From the reviews of the merge follow-ups (adversarial and quality reviewer subagents, 2 rounds, no high or medium findings left):
src/test/routes.ts.From the reviews before the first push:
From the reviews before pushing (adversarial and quality reviewer subagents):
/ga4gh/wes/v1). That's the route's existing stricter check from feat: rewrite workflow execution using Cloud Components (#42) #56; unifying the two URL policies is a design choice, so I left it for you.bun run testin CI: CI files belong to ci: check PRs and publish images #60, see above.handleUnauthorized: UI copy only; the provider tests cover which outcome is reported.CLOUD_REGISTRY_URLitself before calling the registry module: harmless duplicate, kept to keep the diff small.filterVerifiedServices: registry entries are untyped JSON; the function checks the fields it relies on.From Sourcery on this PR (fixed: renewal timeout in 86c939e, malformed verification list in 1a13dc0; answered and resolved in the threads):
Open questions
None.
🤖 Generated with Claude Code
https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Summary by Sourcery
Secure registry-backed WES and TES access while making session renewal and service discovery resilient.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests:
Chores: