Skip to content

opt: do not route to static assets for API path#1237

Merged
looplj merged 1 commit intorelease/v0.9.xfrom
dev-tmp
Apr 1, 2026
Merged

opt: do not route to static assets for API path#1237
looplj merged 1 commit intorelease/v0.9.xfrom
dev-tmp

Conversation

@looplj
Copy link
Copy Markdown
Owner

@looplj looplj commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

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

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 refactors the static file handler to distinguish between API routes, static assets, and SPA routes, ensuring that unknown API paths return a JSON 404 error instead of falling back to the SPA index. It also includes whitespace cleanups, indentation fixes in tests, and new unit tests for the static handler logic. I have no feedback to provide.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 3 new potential issues.

View 6 additional findings in Devin Review.

Open in Devin Review

clientUA: "Client/1.0",
wantUAHeader: "axonhub/1.0", // Pass-through disabled: middleware sets default UA
},
name: "channel_disabled_ignores_global",
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.

🔴 Rule violation: new(false) used instead of lo.ToPtr(false) — also invalid Go syntax

new(false) is used to create a *bool, but Go's builtin new takes a type, not a value — this won't compile. The backend rule in .agent/rules/backend.md:72 mandates using lo.ToPtr to get a pointer to a constant value. The rest of the orchestrator package consistently uses lo.ToPtr(false) for this purpose (e.g. candidates_stream_policy_test.go, transform_options_test.go).

Suggested change
name: "channel_disabled_ignores_global",
channelUASetting: lo.ToPtr(false),
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

wantUAHeader: "axonhub/1.0", // Pass-through disabled: middleware sets default UA
},
{
name: "channel_enabled_ignores_global",
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.

🔴 Rule violation: new(true) used instead of lo.ToPtr(true) — also invalid Go syntax

new(true) is used to create a *bool, but Go's builtin new takes a type, not a value — this won't compile. The backend rule in .agent/rules/backend.md:72 mandates using lo.ToPtr to get a pointer to a constant value. The rest of the orchestrator package consistently uses lo.ToPtr(true) for this purpose.

Suggested change
name: "channel_enabled_ignores_global",
channelUASetting: lo.ToPtr(true),
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@@ -1836,7 +1837,7 @@ func TestApplyUserAgentPassThrough(t *testing.T) {
},
{
name: "enabled_but_no_client_ua",
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.

🔴 Rule violation: new(true) used instead of lo.ToPtr(true) — also invalid Go syntax

Same issue as the other instances: new(true) is invalid Go (builtin new takes a type, not a value) and violates the backend rule in .agent/rules/backend.md:72 that mandates lo.ToPtr for pointer-to-constant values.

Suggested change
name: "enabled_but_no_client_ua",
channelUASetting: lo.ToPtr(true),
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@looplj looplj merged commit a897394 into release/v0.9.x Apr 1, 2026
3 checks passed
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