M0 skeleton: packaging & toolchain, layered configuration, and structured logging

August 19, 2026
ai-agentai-mcpai-engineerView source PR β†—

Ship the foundations so higher-level intelligence has a stable home.

Lead: Merged a stacked change set that establishes the M0 skeleton for ansina β€” packaging, layered configuration, and structured logging with an error taxonomy. This is infrastructure-first: small, test-covered primitives that make future agent work reliable and observable.

πŸš€ Packaging & Toolchain

  • 🧰 Added reproducible packaging via pyproject.toml and uv.lock to pin deps for predictable builds.
  • πŸ› οΈ Makefile provides simple developer ergonomics (build, lint, test) so contributors can focus on features.
  • πŸ“¦ Project layout: src/ansina, py.typed, and sensible .gitignore / .pre-commit-config.yaml to catch regressions early.
  • πŸ” CI-ready baseline: commits and scaffolding aim to make downstream PRs (like config & logging) trivial to merge.

🧭 Layered Configuration System

  • πŸ—‚οΈ Introduced a layered settings model (src/ansina/config/settings.py) that merges defaults, env, and ansina.example.toml.
  • πŸ” Enables runtime overrides and environment-specific profiles while keeping a clear canonical source-of-truth.
  • πŸ§ͺ Tests added (tests/unit/config/test_settings.py) to validate precedence, parsing, and edge-cases β€” configuration is code, and now it’s tested.
  • πŸ“„ Documented intent in docs/architecture/blueprint.md (sections 3–5) so config decisions are traceable.

πŸ” Structured Logging & Error Taxonomy

  • 🧾 Structured logging modules (src/ansina/logging/*) introduce context, formatter, redaction, and setup helpers for consistent logs.
  • 🧩 Error taxonomy (src/ansina/errors.py) classifies failures so observability and retries can be systematic instead of ad-hoc.
  • πŸ”’ Redaction utilities keep sensitive fields out of telemetry; formatters standardize JSON-friendly output for downstream ingestion.
  • βœ… Coverage: unit tests (tests/unit/logging/* and tests/unit/test_errors.py) ensure shape, context propagation, and redaction behave as expected.

πŸ› οΈ Why this order mattered

  • 🧱 Packaging first: a stable toolchain made subsequent config and logging work reproducible across machines and CI.
  • πŸ”— Layered config next: it lets apps behave correctly in dev, CI, and production without code changes.
  • πŸ“‘ Logging & errors last: with predictable packaging and config, logs map to real runtime semantics and tests can assert behavior.

What’s parked or next

  • ▢️ #3 (structured logging) was merged together for cohesion; CI green gates remain a priority before broader feature work.
  • πŸ”­ Next: wire observability into agent runtime paths and start collecting real traces during e2e experiments.

Small wins like these are quiet but multiply: fewer surprises, faster iteration, and safer experiments.