Skip to content

feat(v2): rewrite completo — Fase 0–4 con ORM y multi-dialecto#10

Merged
ShibaRoPinoo merged 1 commit into
mainfrom
feature/v2-release
May 18, 2026
Merged

feat(v2): rewrite completo — Fase 0–4 con ORM y multi-dialecto#10
ShibaRoPinoo merged 1 commit into
mainfrom
feature/v2-release

Conversation

@ShibaRoPinoo
Copy link
Copy Markdown
Owner

Resumen

Consolida en un commit el trabajo de los PRs #5#9. Sus ramas quedaron divergentes tras varios force-pushes para arreglar la nueva versión de ruff; las cerré con "merged to base" para preservar historia.

Esta PR trae el árbol completo verde a `main`.

Por fase

  • Fase 0shiba/ modular, SQL injection cerrada, catálogo SHIBA-XYZW de errors codes, excepciones tipadas, transacciones, context manager, tooling (ruff/mypy/pytest/CI).
  • Fase 1or_where, where_in/null/between/like, where_group(cb), where_json, group_by/having, find/exists/pluck, agregados, paginate/chunk/iterate, upsert(..., on=[...]), truncate, raw.
  • Fase 1.5 — ORM tipado: Model con metaclass + fields.* con 12 subclases + ModelQuery[T] hidratado + set_default_connection.
  • Fase 2 — PostgreSQL: doble comilla, JSONB, BYTEA, TIMESTAMP, GENERATED ALWAYS AS IDENTITY, ON CONFLICT DO UPDATE. shiba.connect(dsn) factory.
  • Fase 4 — 7 tests de integración con Testcontainers (MySQL 8 + Postgres 16), marker integration, job CI separado.

Test plan

  • `pytest -q` → 114 passed, 7 deselected
  • `pytest -m integration` → 7 passed contra contenedores reales (39s end-to-end)
  • `ruff check .` limpio
  • `mypy --strict` limpio sobre 25 archivos
  • CI verde en GitHub Actions

Histórico

Los PRs #5#9 quedan cerrados como referencia del paso a paso:

🤖 Generated with Claude Code

@ShibaRoPinoo ShibaRoPinoo force-pushed the feature/v2-release branch 2 times, most recently from 0435fd1 to 3a0e864 Compare May 18, 2026 05:37
Consolida en un solo commit el trabajo de los PRs #5#9 (cuyas ramas
quedaron divergentes tras varios force-pushes para fix de CI). El detalle
por fase vive en los PRs cerrados.

Fase 0 — Seguridad y estructura
- Paquete `shiba/` modular con core/ agnóstico y dialects/.
- SQL injection cerrada: valores parametrizados, identificadores
  validados y citados por dialecto.
- Catálogo `SHIBA-XYZW` de error codes con mapper desde drivers.
- Excepciones tipadas, transacciones explícitas, context manager.
- `shibamysql/` shim deprecated.
- Tooling: pyproject.toml, ruff, mypy --strict, pytest, CI.

Fase 1 — Query builder rico
- `or_where`, `where_in/not_in/null/not_null/like/between`,
  `where_group(callback)`, `where_json(col, path, value)`.
- `group_by`, `having`, `find`, `exists`, `pluck`, agregados.
- `paginate`, `chunk`, `iterate`.
- `upsert(data, on=[...])`, `truncate`, `raw` escape hatch.

Fase 1.5 — ORM híbrido tipado
- `Model` con metaclass que lee anotaciones por MRO con
  `inspect.get_annotations(eval_str=True)`.
- 12 subclases de `Field` (PrimaryKey, String, Json, DateTime,
  DecimalField, Enum, ForeignKey, ...) e inferencia automática.
- `ModelQuery[T]` hidrata filas a instancias.
- Conexión global (`set_default_connection`) o por clase (`__db__`).

Fase 2 — PostgreSQL
- Dialect con doble comilla, `JSONB`, `BYTEA`, `TIMESTAMP`,
  `GENERATED ALWAYS AS IDENTITY`, `ON CONFLICT DO UPDATE`.
- Driver psycopg3 con import perezoso (dep opcional).
- `shiba.connect("mysql://...")`/`postgres://...` factory.

Fase 4 — Tests de integración
- 7 tests sobre MySQL 8 y Postgres 16 con Testcontainers,
  marker `integration`, job CI separado.

Stats
- 114 unit tests + 7 integration verdes (39s end-to-end).
- ruff y mypy --strict limpios sobre 25 archivos.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ShibaRoPinoo ShibaRoPinoo merged commit 077f757 into main May 18, 2026
5 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.

1 participant