Skip to content

Conversation

@esclipse
Copy link
Owner

@esclipse esclipse commented Jan 9, 2026

Motivation

  • Ensure the client-selected strategy is respected and mapped to the cloud function key instead of always requesting all strategies.
  • Normalize multi-strategy cloud results into a consistent matches shape with strategy tags and deduplication so the frontend can present merged results.
  • Replace the old polling proxy with a synchronous request flow that includes retries, abort timeouts, and robust response parsing.
  • Fix TypeScript typing issues (duplicate strategy identifier) and preserve optional AI scoring while exposing a maxDuration constant.

Description

  • Add a StrategyKey union type and make normalizeStrategy explicitly return StrategyKey, and use it in convertCloudFunctionResult.
  • Replace polling/proxy logic with a synchronous POST flow that calls the cloud function, uses parseCloudFunctionResponse, retry/backoff, request timeouts/abort, and returns normalized { matches, stats, summary }.
  • Normalize and deduplicate results from results.strategy1|2|3, add optional fields like strategy, j_value, and j_last on match objects, and compute stats/summary.
  • Update UI in app/stock/page.tsx to remove polling, add symbolsInput and summary state, make some match fields optional in types, and render improved loading/empty/error and AI analysis output.

Testing

  • The TypeScript compiler was run and initially failed due to a duplicate strategy identifier, which was corrected by introducing the StrategyKey type (compile failure observed before the fix).
  • No other automated unit or integration tests were executed for these changes.
  • Manual safeguards (timeouts/retries) were exercised during development but are not part of automated tests.

Codex Task

@vercel
Copy link

vercel bot commented Jan 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
mcp-test Ready Ready Preview, Comment Jan 9, 2026 9:53am

Copy link

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

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: 4d563acf1f

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +193 to +196
const controller = new AbortController();
const hasSymbols = symbolsValue && symbolsValue.trim().length > 0;
const timeout = hasSymbols ? 3 * 60 * 1000 : 15 * 60 * 1000;
const timeoutId = setTimeout(() => controller.abort(), timeout);

Choose a reason for hiding this comment

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

P1 Badge Align full-analysis timeout with 5‑minute route limit

When no symbols are provided, the handler sets a 15‑minute timeout (timeout = ... 15 * 60 * 1000), but the route declares maxDuration = 300 (5 minutes). In that scenario (full analysis without symbols), the serverless runtime will terminate the request before your 15‑minute abort/retry loop can finish, so the client will never receive a successful response even if the cloud function eventually completes. This regression is specific to long‑running full scans after removing polling; consider lowering the timeout to ≤300s, re‑introducing polling, or increasing maxDuration if the platform supports it.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants