Skip to content

Audit 2026-10-17: SDK instrumentor TypeError, SQLite foreign keys, health 503, docs behind key, metadata redaction - #62

Merged
josedaniel-dev merged 5 commits into
mainfrom
audit-2026-10-17
Oct 19, 2026
Merged

josedaniel-dev merged 5 commits into
mainfrom
audit-2026-10-17

Conversation

@josedaniel-dev

Copy link
Copy Markdown
Collaborator

Findings of the read-only audit of the three repos on 2026-10-17 (full report in manitos/docs/auditoria_sistema_2026_10_17.md). Only the safe fixes, each with a regression test:

  • SDK Python (Alta): instrument(openai=True) / anthropic=True assigned a bound method as a class attribute, so every instrumented create() raised TypeError: missing 1 required positional argument: 'self'. Plain wrappers bind the instance; instrument() twice stays reversible.
  • Backend: SQLite connections now enable foreign_keys, busy_timeout and WAL; DELETE /v1/traces/{id} and batch-delete remove the evaluations (orphans counted in /summary); /health answers 503 degraded when SELECT 1 fails; /docs, /redoc, /openapi.json close when OBSERVATORY_API_KEY is set; metadata capture mode redacts the free-form metadata dict (it was stored whole); timeline buckets over 60 min no longer collapse to hourly (epoch-based); lifespan waits for the background loops before engine.dispose().
  • CLI: serve binds to 127.0.0.1 by default (docs/security.md said loopback).
  • Ops/docs: .dockerignore (images carried backend/.venv and observatory.db), nginx proxy_read_timeout for /ws/, CI targets main only (the other branch no longer exists), .env.example lists the variables the code reads (RATE_LIMIT_BATCH aligned to 120/minute), roadmap gains the "Later" section it referred to.

Not changed (decisions for the owner, listed in the report): OBSERVATORY_API_KEY is unset in the live unit (auth off end to end); /ws/live key in the query string; /v1/traces/batch appends spans to an existing trace of any project; import accepts any project_id/actor_id_hash; the LLM judge activates on a bare OPENAI_API_KEY; the SDK tracer snapshots spans at start (no duration/tokens reach the backend); the TS auto-instrumentation is a no-op; systemd unit never runs alembic upgrade.

Verified: ruff check clean, backend 236 passed, SDK Python 48 passed, CLI 63 passed, dashboard tsc clean.

- SDK Python: the instrumentors assigned a bound method as a class attribute, so every instrumented
  create() failed with TypeError (missing self); plain wrappers now, idempotent across instrument() calls.
- Backend: SQLite connections enable foreign_keys, busy_timeout and WAL; DELETE /v1/traces removes the
  evaluations (they were orphaned); /health answers 503 when the database fails; /docs, /redoc and
  /openapi.json close when OBSERVATORY_API_KEY is set; metadata capture mode redacts the free-form
  metadata dict instead of storing it whole; timeline buckets over 60 minutes no longer collapse to
  hourly; shutdown waits for the background loops before disposing the engine.
- CLI: serve binds to 127.0.0.1 by default. nginx: proxy_read_timeout for /ws/. .dockerignore files so
  images never carry .venv or observatory.db. CI targets main only. .env.example lists the variables
  the code reads; roadmap gains the Later section it referred to.
Full report: manitos/docs/auditoria_sistema_2026_10_17.md
…ORY_DB; status shows why it fails (timeout, HTTP status, db) and exits non-zero
main already contains this branch's changes (squashed into #64). Resolved with main's version:
the conflicts in .env.example and backend/app/api/traces.py, and the instrumentors, where the
automatic merge re-added the local _unwrap/_as_method that main moved to _patching.py.
@josedaniel-dev
josedaniel-dev merged commit b3a5669 into main Oct 19, 2026
6 checks passed
@josedaniel-dev
josedaniel-dev deleted the audit-2026-10-17 branch October 19, 2026 21:41
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