Skip to content

Address chart lab review debt#13

Merged
robertoecf merged 1 commit into
mainfrom
codex/chart-review-debt
May 5, 2026
Merged

Address chart lab review debt#13
robertoecf merged 1 commit into
mainfrom
codex/chart-review-debt

Conversation

@robertoecf
Copy link
Copy Markdown
Owner

Summary

  • Addresses chart-lab review debt left from PR Add official chart explorer standard #10 and PR Harden chart lab as experiment #12.
  • Canonicalizes custom endpoint paths before applying the Labs allowlist, blocking dot-segment bypasses like /bcb/series/../../openapi.json.
  • Removes unsupported /tesouro/bonds/history from the Labs allowlist until the chart parser supports Tesouro date fields.
  • Improves time normalization for numeric Unix timestamps and intraday ISO timestamps.
  • Respects an explicitly requested scalar field on OHLC payloads instead of forcing candlesticks.

Review feedback addressed

Validation

  • node --check src/findata/web/static/chart-explorer.js
  • .venv/bin/python -m pytest tests/test_api.py -q
  • .venv/bin/ruff format --check src/ tests/ scripts/
  • .venv/bin/ruff check src/ tests/ scripts/
  • .venv/bin/python -m mypy src/findata
  • .venv/bin/python -m pytest tests/ -q
  • git diff --check
  • Browser check on http://127.0.0.1:8765/charts: default Selic chart loads, no console errors, /bcb/series/../../openapi.json is rejected after URL canonicalization, and Tesouro history is rejected while unsupported.

Merge note

Do not merge this PR until review status, bot/human comments, and pending improvements are summarized and Roberto explicitly approves merge in the current conversation.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Warning

Rate limit exceeded

@robertoecf has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 37 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 039de2a7-235b-4a3c-b91a-3e3f40e23513

📥 Commits

Reviewing files that changed from the base of the PR and between 79177ec and 4a8444b.

📒 Files selected for processing (2)
  • src/findata/web/static/chart-explorer.js
  • tests/test_api.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/chart-review-debt

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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 enhances the chart explorer by adding support for intraday data through improved time parsing and Unix timestamp handling. Key changes include refactoring endpoint normalization using the URL API, removing the Tesouro bonds history endpoint, and updating the chart's time scale visibility based on the presence of intraday data. Additionally, the logic for selecting candlestick charts was refined, and data sorting was updated to handle numeric timestamps correctly. I have no feedback to provide as there were no review comments.

@robertoecf robertoecf merged commit 29053b0 into main May 5, 2026
7 checks passed
Copy link
Copy Markdown

@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: 4a8444bb10

ℹ️ 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 +202 to +204
if (typeof value === "number") {
const date = new Date(value > 1e11 ? value : value * 1000);
return timestampFromDate(date);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Parse numeric period codes before Unix timestamp fallback

The new numeric fast-path treats all numbers as Unix timestamps (value * 1000 or ms), which silently misparses common period codes like 202401/202312 into 1970 dates. Before this commit, numeric values were stringified and could match the YYYYMM parser branch, so monthly series with numeric periodo values would now render with incorrect time axes and corrupted ordering.

Useful? React with 👍 / 👎.

if (typeof a.time === "number" && typeof b.time === "number") {
return a.time - b.time;
}
return String(a.time).localeCompare(String(b.time));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Order mixed time representations chronologically

When one point has numeric time and another has date-string time, the comparator falls back to String(...).localeCompare(...), which is lexicographic rather than chronological across types. That can invert points (e.g., Unix 1714521600 vs 2024-05-01), causing non-monotonic series input and incorrect chart rendering for datasets mixing day-only and timestamped records.

Useful? React with 👍 / 👎.

@robertoecf robertoecf deleted the codex/chart-review-debt branch May 7, 2026 00:59
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