Skip to content

feat: make Guard client portal-canonical with fallback tests#169

Merged
kantorcodes merged 5 commits into
mainfrom
feat/guard-roadmap-sdk
Apr 19, 2026
Merged

feat: make Guard client portal-canonical with fallback tests#169
kantorcodes merged 5 commits into
mainfrom
feat/guard-roadmap-sdk

Conversation

@kantorcodes

@kantorcodes kantorcodes commented Apr 19, 2026

Copy link
Copy Markdown
Member

Summary

  • align Guard client fallback to use portal canonical /api/guard/* semantics from legacy /api/v1/guard/* calls
  • add absolute-request support required for canonical fallback from API-v1-normalized base URLs
  • add regression tests for 404/501 fallback and non-fallback hard errors
  • expose guard contract version constants for migration telemetry

Verification

  • pnpm run lint
  • pnpm run typecheck
  • pnpm run build
  • pnpm exec jest --config jest.config.json --coverage=false __tests__/services/registry-broker-guard-client.test.ts

Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a fallback mechanism for Guard service routes to handle legacy path transitions. It refactors the RegistryBrokerClient to support absolute URL requests and implements requestPortalFirstJson to automatically retry failed requests (404/501) using canonical portal paths. Comprehensive tests were added to verify the fallback behavior and error handling. Feedback was provided to simplify the path transformation logic in toPortalCanonicalGuardPath to reduce repetition and improve maintainability.

Comment thread src/services/registry-broker/client/guard.ts
Comment thread src/services/registry-broker/client/guard.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Apr 19, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
src/services/registry-broker/client/guard.ts 69 Unsafe type cast - uses (error as { status?: unknown }) to check error status. Use instanceof RegistryBrokerError instead.
Files Reviewed (2 files changed since last review)
  • src/services/registry-broker/client/guard.ts - 1 issue (unsafe cast)
  • __tests__/services/registry-broker-guard-client.test.ts - removed 3 tests for URL handling scenarios

Incremental changes since last review (fed0d2b → HEAD):

  • Further simplified toPortalCanonicalGuardPath with explicit if-statements (from segment-based logic)
  • Simplified buildPortalCanonicalGuardUrl - now only uses base.origin (removed all path prefix handling)
  • Removed 3 test cases for relative URL, proxy path, and non-v1 base path handling

The critical issue at line 69 remains unfixed. Inline comments already exist on this issue.

Fix these issues in Kilo Cloud


Reviewed by minimax-m2.5-20260211 · 346,804 tokens

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 84b30816e0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/services/registry-broker/client/guard.ts Outdated
Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e38488012

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/services/registry-broker/client/guard.ts
Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4f2f8c3d12

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/services/registry-broker/client/guard.ts Outdated
Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fed0d2b1d1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/services/registry-broker/client/guard.ts Outdated
Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>
@kantorcodes kantorcodes merged commit 7a649ae into main Apr 19, 2026
11 checks passed
@kantorcodes kantorcodes deleted the feat/guard-roadmap-sdk branch April 19, 2026 17:48
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