Skip to content

Fix CI: env override breaking migrate/evals, ruff lint, untrack .env - #2

Merged
SERGIOCORVALIS merged 4 commits into
mainfrom
cursor/fix-ci-and-stubs-beb7
Oct 20, 2026
Merged

SERGIOCORVALIS merged 4 commits into
mainfrom
cursor/fix-ci-and-stubs-beb7

Conversation

@SERGIOCORVALIS

@SERGIOCORVALIS SERGIOCORVALIS commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Problem

CI was red (evals-nightly migrate to :5434, ci ruff). Launch audit found fake-success stubs and a live Decimal crash. After fixes, e2e-smoke still failed: tsx -e top-level await rejected under CJS.

Fixes

CI / env

  • loadRootEnv + Python load_dotenv do not override CI/shell env
  • Untrack .env; align DATABASE_URL to port 5432
  • Ruff clean; _*.py probes excluded
  • evals-nightly: clear skip when OPENAI_API_KEY secret missing
  • e2e API health smoke → apps/api/src/ciDepsSmoke.ts (no tsx -e top-level await)

Launch hardening

  • Cabinet RFQ: ok:false when disabled / Playwright missing / error
  • Client email replies: throw smtp_not_configured in production
  • TG outbound: throw in production without TG_BOT_TOKEN
  • validate_economics: real VAT mode annotation
  • Production API boot requires OPENAI_API_KEY
  • Remove mock:// demo partner seeds + migration 015

Runtime bug

  • Postgres Decimal crashed apply_ops_hint / save_quote → _dumps(default=str)

Verification

  • typecheck + all Node unit tests; ruff + 102 pytest
  • Live e2e: RFQ, grey-scheme, pricing fallback, deal close, cabinet APIs, apply_ops_hint
  • ciDepsSmoke.ts locally → api-deps-ok

Debut blockers (config, not code)

OPENAI_API_KEY, SMTP/IMAP and/or TG_BOT_TOKEN, non-default cabinet passwords, partner channel (ALLOW_FILE_TARIFFS and/or supplier emails). Mock rates forbidden in production.

Open in Web Open in Cursor 

evals-nightly and e2e migrate were connecting to port 5434 because
loadRootEnv/load_dotenv overwrote CI DATABASE_URL from a committed .env.
Default to non-override env loading, align DATABASE_URL to 5432, untrack
.env, fix ruff unused imports, and skip golden LLM evals clearly when
OPENAI_API_KEY is missing.

Co-authored-by: sergio_Corvallis <sergiocorvallis@gmail.com>
@cursor

cursor Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes env loading defaults and production boot/outbound failure modes across API, workers, and Python services; DB migration deletes mock partners. Core deal/RFQ paths are affected but covered by expanded tests.

Reviewed by Cursor Bugbot for commit 55ee650. Bugbot is set up for automated code reviews on this repo. Configure here.

cursoragent and others added 3 commits October 20, 2026 20:08
validate_economics had a no-op pass for client_ru_sells_with_vat; now
returns client_price_vat_mode and flags missing VAT on domestic corridors.
Orchestrator: rewrite deal_id branch without empty pass (same behavior).

Co-authored-by: sergio_Corvallis <sergiocorvallis@gmail.com>
- Email client replies and cabinet RFQ no longer report success when SMTP/
  Playwright/cabinet are missing (prod throws / ok:false).
- TG bot send fails in production without TG_BOT_TOKEN.
- API production boot requires OPENAI_API_KEY (parity with Python).
- Fix Decimal TypeError crashing apply_ops_hint / save_quote (db _dumps).
- Remove mock:// demo partner seeds; migration 015 cleans existing DBs.

Co-authored-by: sergio_Corvallis <sergiocorvallis@gmail.com>
tsx -e compiles as CJS and rejects top-level await; move deps check
into apps/api/src/ciDepsSmoke.ts (async main + dynamic db import).

Co-authored-by: sergio_Corvallis <sergiocorvallis@gmail.com>

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 55ee650. Configure here.

if (corridor == DOMESTIC or not is_international(corridor)) and sells_with_vat:
if vat_mode != VAT_INCLUDED:
issues.append("client_price_missing_vat")
escalate = True

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

VAT check never escalates

Low Severity

The new client_price_missing_vat branch compares client_price_vat_mode(corridor) to included under the same corridor condition that function uses to return included, so the issue is never raised and domestic VAT is never escalated.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 55ee650. Configure here.

Comment thread services/pyproject.toml
src = ["."]
extend-exclude = [".venv"]
# Local one-off probes (_proxy_probe.py, _fix_*.py) must not break CI lint.
extend-exclude = [".venv", "_*.py"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ruff exclude skips package inits

Low Severity

The new ruff extend-exclude pattern _*.py is gitignore-style and also matches every __init__.py under services, so package init modules are no longer linted.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 55ee650. Configure here.

@SERGIOCORVALIS
SERGIOCORVALIS marked this pull request as ready for review October 20, 2026 20:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T20:25:03.552849Z 55ee650 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SERGIOCORVALIS
SERGIOCORVALIS merged commit 4862aa3 into main Oct 20, 2026
4 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.

2 participants