Make the first RAG slice executable without risking production data
Some checks failed
verify / verify (push) Has been cancelled

The Stage 1 foundation now proves provider contracts with mocks and validates PostgreSQL/pgvector ingestion, approval binding, retrieval, reranking, and idempotency using only synthetic data. Live Bailian validation remains gated on rotating the exposed key.

Constraint: The key shown in chat is compromised and cannot be used or committed

Rejected: Mark Stage 1 complete from mock and offline results | real three-model smoke is still required

Confidence: high

Scope-risk: moderate

Reversibility: clean

Directive: Do not enable real-data ingestion until Stage 3 cloud approval and outbound manifest controls are enforced end to end

Tested: make verify; 41 pytest tests; strict mypy; Ruff; Compose config; pinned image build; empty-volume migration; role denial; two idempotent 20-vector seeds; database restart persistence

Not-tested: Live Bailian calls require a newly rotated key; React product UI is not implemented
This commit is contained in:
2026-07-12 15:41:58 +08:00
parent ec1acb36b5
commit f4ba5d5342
61 changed files with 6886 additions and 20 deletions

58
backend/pyproject.toml Normal file
View File

@@ -0,0 +1,58 @@
[project]
name = "geological-rag-backend"
version = "0.1.0"
description = "Backend and reproducible PoC tools for the geological prospecting RAG system"
readme = "README.md"
requires-python = ">=3.12,<3.13"
dependencies = [
"alembic>=1.14,<2",
"fastapi>=0.115,<1",
"httpx>=0.28,<1",
"pgvector>=0.3,<1",
"psycopg[binary]>=3.2,<4",
"pydantic>=2.10,<3",
"pydantic-settings>=2.7,<3",
"sqlalchemy>=2.0,<3",
"uvicorn[standard]>=0.34,<1",
]
[dependency-groups]
dev = [
"mypy>=1.14,<2",
"pytest>=8.3,<10",
"pytest-asyncio>=0.25,<2",
"ruff>=0.9,<1",
]
[build-system]
requires = ["hatchling>=1.27,<2"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["app"]
[tool.pytest.ini_options]
addopts = "-ra --strict-config --strict-markers"
asyncio_mode = "auto"
testpaths = ["tests"]
[tool.ruff]
line-length = 100
target-version = "py312"
[tool.ruff.lint]
select = ["E", "F", "I", "B", "UP", "ASYNC", "S"]
ignore = ["S101"]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["S105", "S106", "S603", "S607"]
[tool.mypy]
python_version = "3.12"
strict = true
warn_unreachable = true
plugins = ["pydantic.mypy"]
[[tool.mypy.overrides]]
module = ["pgvector.*"]
ignore_missing_imports = true