Harden + scaffold: FastAPI/Celery/Postgres/Redis dynamic-pricing skeleton#1
Merged
Conversation
- PricingEngine with guardrails as constructor inputs (min margin, max change pct, new-product protection) - MerchantPolicy gates suggestions before any external write - AuditTrail is append-only and is the rollback substrate - ShopifyClient stubbed; HMAC webhook verification is real - Structured JSON logging, X-Process-Time middleware, optional Sentry - /health and /health/ready probe Postgres and Redis independently
The local alembic/ directory was tripping ruff's first-party autodetection, so 'from alembic import ...' was being grouped with first-party imports.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Greenfield scaffold of an authority-separated Shopify dynamic-pricing service. Pricing engine proposes, merchant policy gates, Shopify client executes, audit trail records. Guardrails are constructor inputs, not exception handlers. Rollback reads back through the append-only
price_eventstable.9 commits, ~1,800 LOC across 47 new files. Do NOT merge before reviewing the README narrative against the engineering — they should match.
Pre-merge checklist
Hygiene
shopify_api_key,sentry_dsn,secret: str) match(api_key|secret|password|token|dsn|bearer); no actual secret valuesclaude|anthropic|cowork|lovable|ai-generated|gpt|gemini|last updated|voice match|audit-defensible|operator note|justin|krishnamurthy.env.exampleplaceholders only (your-shopify-api-key-here,change-me).gitignorecovers.env,*.db,__pycache__,.venv,node_modules,dist,.idea,.vscode,.DS_Store,*.logLicense + attribution
Copyright (c) 2026 Mac McFall / M87 Studiobackend/app/__init__.pyauthor block in placefrontend/package.jsonauthor andrepository.urlset (uses current repo nameE-Commerce; GitHub redirect will handle post-rename)README rewrite
Tests / migrations / CI
backend/tests/test_smoke.py— 3 tests (health, root, X-Process-Time header)backend/tests/test_pricing_engine.py— 8 tests covering cost floor, merchant min/max, max-change-pct caps (up + down), new-product protection, neutral-signal no-op, suggestion-id uniquenessbackend/tests/test_policy.py— 4 tests covering auto-apply window, manual-review hold, large-delta reject, no-change approvalbackend/alembic/versions/0001_initial_schema.py— hand-written baseline formerchants,products,price_events(no live DB available to autogenerate against).github/workflows/ci.yml— ruff + pytest on backend, vite build on frontend, runs on push to main and on PRItems NOT in this PR (your hand-off)
e-commerce→ecom-dynamic-pricing(Settings → Rename — keyword surface matters for recruiter search)FastAPI + Celery + Postgres + Redis SaaS skeleton for Shopify dynamic pricing with guardrails, rollback, and audit trail.fastapi celery postgres redis shopify saas marketplace dynamic-pricing python react typescript dockerTest plan
cd backend && pip install -r requirements-dev.txt && pytest— expect 15 tests passcd backend && ruff check .— expect cleancp .env.example .env && docker compose up --build— api on :8000, worker running, alembic migrations apply on startupcurl http://localhost:8000/health/ready— Postgres + Redis both reportokcd frontend && npm install && npm run build— vite build succeedsbackend/app/shopify/client.py— confirm the stub is documented as a stub and the cutover plan is reachableGenerated by Claude Code