Skip to content

docs: Mais Retorno Free quota limits in resolver cascade - #44

Open
robertoecf wants to merge 2 commits into
mainfrom
cursor/mais-retorno-mcp-free-limits
Open

docs: Mais Retorno Free quota limits in resolver cascade#44
robertoecf wants to merge 2 commits into
mainfrom
cursor/mais-retorno-mcp-free-limits

Conversation

@robertoecf

@robertoecf robertoecf commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Documents the optional Mais Retorno cascade step for resolve_asset with the public Free tier limits (500 credits/month, 1-year history, 15 req/s, HTTP 429 when exhausted).
  • Clarifies REST API-key vs MCP OAuth auth, shared credit pool, and variable per-call credit costs so operators do not treat Free as unlimited or as 500 resolutions/month.
  • Cross-links docs/SOURCES_WITH_AUTH.md and points to dated public docs (maisretorno.com/mcp, developers.maisretorno.com, 2026-08-12).

Test plan

Review evidence

  • Deslop: no removable slop found
  • Adversarial review: Adversarial docs review — ship with caveats; medium findings (variable credits; MCP vs API key) addressed in follow-up commit 4c4de9f. Cross-family attempt via Task adversarial-reviewer (Cursor subagent). Label: EXTERNAL_SAME_FAMILY if same host pool, otherwise treat as external harness pass.
  • MCP Trust:
    • Classificação: AGENT_DATA (docs only; no MCP catalog/runtime change)
    • Base: origin/main
    • Head: 4c4de9f
    • Tools tocadas: n/a
    • Conclusão: PASS
    • Achados: NO_FINDINGS — no secrets, no wiring, cascade remains stub-only; docs state operator-owned credentials and Free quota limits.
    • Over-engineering: NO_FINDINGS — docs-only clarification.

Made with Cursor

Summary by CodeRabbit

  • Documentation
    • Documented Mais Retorno as an optional source for asset resolution.
    • Clarified authentication requirements, including API key and OAuth access.
    • Added details about free-plan quotas, shared credits, historical data limits, rate limits, variable usage costs, and HTTP 429 responses.
    • Documented paid-plan limitations and assets outside the supported scope.
    • Updated the changelog with current REST and MCP references and integration status.

robertoecf and others added 2 commits August 12, 2026 16:33
Make the optional resolver cascade step explicit about operator-owned API keys and the public Free tier (500 credits/month), so deploy wiring does not treat it as unlimited.

Co-authored-by: Cursor <cursoragent@cursor.com>
Correct variable per-call credit costs and separate REST API-key wiring from MCP OAuth so the cascade docs do not imply one credit per resolution or the wrong auth path.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change documents Mais Retorno as an optional resolver source. It records REST API key and MCP OAuth authentication, shared Free-tier limits, rate-limit behavior, source classification, and the current integration status.

Changes

Mais Retorno resolver documentation

Layer / File(s) Summary
Resolver source and account usage documentation
docs/RESOLVER.md, docs/SOURCES_WITH_AUTH.md, src/findata/resolver/engine.py, CHANGELOG.md
The documentation identifies Mais Retorno as an optional external source. It describes operator credentials, REST and MCP authentication, shared Free-tier credits, limits, rate-limit behavior, quota exhaustion, source classification, and pending integration work.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main documentation change: Mais Retorno Free quota limits in the resolver cascade.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/mais-retorno-mcp-free-limits

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/findata/resolver/engine.py (1)

10-13: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Use deployment-side wording for provider ownership.

client-side / networked is ambiguous and conflicts with the server-side REST provider described in docs/RESOLVER.md. It can suggest placing the REST API key in browser code. Use outside the library / networked, and state that REST credentials remain in the operator's deployment. The provider documentation recommends X-Api-Key for server-side REST and OAuth for MCP. (developers.maisretorno.com)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/findata/resolver/engine.py` around lines 10 - 13, Update the “External
providers” documentation wording to say providers are outside the library and
networked, not client-side/networked. Clarify that REST credentials remain in
the operator’s deployment, while preserving the existing injected async callback
and provider ownership guidance.

Source: MCP tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/RESOLVER.md`:
- Around line 131-132: Update the “Cota esgotada” entry in RESOLVER.md to state
that HTTP 429 ends when the billing cycle renews or when the operator upgrades
the plan, preserving the existing renewal behavior and email-warning detail.
- Around line 101-102: The resolver documentation and provider contract are
inconsistent: the resolver replaces AssetClassification with provider results
rather than merging fields or lowering confidence. Update docs/RESOLVER.md lines
101-102 and the corresponding contract description in
src/findata/resolver/engine.py lines 14-15 to state that providers control
overrides and confidence, and that cascade entries are carried forward from
enriched.cascade; do not describe merge or confidence-reduction behavior unless
implementing it in the resolver.

---

Nitpick comments:
In `@src/findata/resolver/engine.py`:
- Around line 10-13: Update the “External providers” documentation wording to
say providers are outside the library and networked, not client-side/networked.
Clarify that REST credentials remain in the operator’s deployment, while
preserving the existing injected async callback and provider ownership guidance.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f2077952-8d8b-487b-8e78-2a2bb6092225

📥 Commits

Reviewing files that changed from the base of the PR and between 269f53b and 4c4de9f.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • docs/RESOLVER.md
  • docs/SOURCES_WITH_AUTH.md
  • src/findata/resolver/engine.py

Comment thread docs/RESOLVER.md
Comment on lines 101 to 102
Cada degrau preenche o que o anterior não trouxe e **baixa a confidence**;
`source` reflete a origem final; `cascade` loga o caminho. Os degraus 2 a 4 são

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- candidate files ---'
git ls-files 'docs/RESOLVER.md' 'src/findata/resolver/engine.py' 'tests/*' | sed -n '1,120p'
printf '%s\n' '--- engine outline ---'
ast-grep outline src/findata/resolver/engine.py --view compact || true
printf '%s\n' '--- relevant documentation ---'
cat -n docs/RESOLVER.md | sed -n '80,125p'
printf '%s\n' '--- relevant engine section ---'
cat -n src/findata/resolver/engine.py | sed -n '1,180p'
printf '%s\n' '--- provider and confidence references ---'
rg -n -C 3 'confidence|cascade|source|provider|classification|classify' src/findata/resolver tests docs/RESOLVER.md

Repository: robertoecf/OpenFinData

Length of output: 50378


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- resolver orchestration ---'
cat -n src/findata/resolver/engine.py | sed -n '640,740p'
printf '%s\n' '--- provider-focused tests ---'
cat -n tests/test_resolver.py | sed -n '285,340p'
printf '%s\n' '--- classification model ---'
cat -n src/findata/resolver/models.py | sed -n '145,180p'
printf '%s\n' '--- provider declarations and assignments ---'
rg -n -C 5 'AssetProvider|enriched|result = enriched|confidence|cascade|source' src/findata/resolver/engine.py tests/test_resolver.py
printf '%s\n' '--- static invariant verifier ---'
python3 - <<'PY'
from pathlib import Path
text = Path("src/findata/resolver/engine.py").read_text()
start = text.index("    for provider in providers or []:")
end = text.index("    return result", start)
loop = text[start:end]
checks = {
    "provider receives current result": "await provider(norm, result)" in loop,
    "provider result replaces current result": "result = enriched" in loop,
    "cascade is explicitly combined": "enriched.cascade = [*result.cascade, *enriched.cascade]" in loop,
    "confidence is explicitly reduced": any(
        token in loop for token in (
            "result.confidence -", "enriched.confidence -",
            "confidence = min(", "confidence -= ", "confidence *= ",
        )
    ),
}
for name, value in checks.items():
    print(f"{name}: {value}")
print("--- loop ---")
print(loop)
PY

Repository: robertoecf/OpenFinData

Length of output: 40636


Align the provider contract with the resolver behavior.

The resolver replaces the current AssetClassification with the provider result. It does not merge missing fields or reduce confidence; it only carries forward the returned enriched.cascade. Update both descriptions to document provider-controlled overrides, confidence, and cascade entries, or implement the documented merge behavior.

📍 Affects 2 files
  • docs/RESOLVER.md#L101-L102 (this comment)
  • src/findata/resolver/engine.py#L14-L15
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/RESOLVER.md` around lines 101 - 102, The resolver documentation and
provider contract are inconsistent: the resolver replaces AssetClassification
with provider results rather than merging fields or lowering confidence. Update
docs/RESOLVER.md lines 101-102 and the corresponding contract description in
src/findata/resolver/engine.py lines 14-15 to state that providers control
overrides and confidence, and that cascade entries are carried forward from
enriched.cascade; do not describe merge or confidence-reduction behavior unless
implementing it in the resolver.

Comment thread docs/RESOLVER.md
Comment on lines +131 to +132
| Rate limit | 15 req/s em todos os planos |
| Cota esgotada | HTTP 429 até renovar o ciclo (aviso por email ~80%) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

sed -n '90,145p' docs/RESOLVER.md
printf '\n--- external documentation ---\n'
curl -L --max-time 15 -sS https://developers.maisretorno.com/ | head -c 5000

Repository: robertoecf/OpenFinData

Length of output: 7888


🌐 Web query:

site:developers.maisretorno.com HTTP 429 quota upgrade renewal Mais Retorno API

💡 Result:

If you receive an HTTP 429 Too Many Requests error when using the Mais Retorno API, it indicates that your current credit balance for the billing cycle has been exhausted [1]. To resolve this issue, you have two options: 1. Automatic Renewal: Your credit balance will automatically reset upon the start of your next monthly billing cycle [1]. 2. Immediate Upgrade: You can regain access immediately by upgrading your current API plan [1]. To manage your consumption and avoid hitting these limits, the official documentation recommends respecting the Cache-Control headers returned by the API [1]. Each endpoint has a defined max-age for caching; by utilizing this, you can significantly reduce the number of unnecessary requests, thereby conserving your credit balance [1]. For instance, endpoints such as /quotes/{identifier} and /asset-info/{identifier} have a cache duration of 90 minutes [1].

Citations:


Include the plan-upgrade path for exhausted quotas.

Document that HTTP 429 ends when the cycle renews or the operator upgrades the plan.

Proposed wording
-| Cota esgotada | HTTP 429 até renovar o ciclo (aviso por email ~80%) |
+| Cota esgotada | HTTP 429 até renovar o ciclo ou fazer upgrade (aviso por email ~80%) |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| Rate limit | 15 req/s em todos os planos |
| Cota esgotada | HTTP 429 até renovar o ciclo (aviso por email ~80%) |
| Rate limit | 15 req/s em todos os planos |
| Cota esgotada | HTTP 429 até renovar o ciclo ou fazer upgrade (aviso por email ~80%) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/RESOLVER.md` around lines 131 - 132, Update the “Cota esgotada” entry in
RESOLVER.md to state that HTTP 429 ends when the billing cycle renews or when
the operator upgrades the plan, preserving the existing renewal behavior and
email-warning detail.

Source: MCP tools

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