dodil/erp-brick-quote

AGENTS.md

Instructions for agents working on brick-quote

This brick is built on erp-platform. Read its BRICKS.md before changing anything here — it holds the rules (ownership, use cases, data, identity, tests) and why each one exists.

Where a change goes

You are changing…It goes in
a business rule ("a sent quote cannot change", the discount gate)domain/quote.py — and a test in tests/test_rules.py named for the story
who may do something, or which rows they seeapplication/use_cases.py — the permission on the declaration, or _sees() / _load(write=True)
a new action for people and agentsa new @QUOTE.use_case in application/ — it becomes a route AND a tool
a column or tablesrc/brick_quote/schema.sql (append; never drop or rename) and infrastructure/tables.py

Never add an HTTP route or an MCP tool by hand. Never import SQLAlchemy, FastAPI or MCP in domain/.

Before you commit

pytest -q --tb=short        # rules + both doors, no bucket needed

Add a test to tests/test_doors.py for any new use case: the outcome through the API and through MCP, and the 404 for another person's row. A change to what is stored also runs scripts/live_check.py on a scratch bucket: SQLite does not reproduce DataK3's differences.

Don't

  • Don't attach a quote to a deal without asking the pipeline AS THE CALLER (_deal_fits): may they see it, is it this customer's, in this currency, open (C1).

  • Don't gate a discount on the net alone, or let a markup offset another line (H2).

  • Don't save a quote without its loaded revision, and don't retry a change whose caller sent one (C3).

  • Don't write to another brick's tables — call its seam.

  • Don't write an upsert or DELETE by hand — use the repository (DataK3's ON CONFLICT differs from Postgres).

  • Don't commit credentials or .env.