Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
298 commits
Select commit Hold shift + click to select a range
748d56c
refactor: remove transport-specific code from _impl functions
KonstantinMirin Feb 24, 2026
ac82c2a
fix: migrate 44 integration tests from ToolContext/MagicMock to Resol…
KonstantinMirin Feb 24, 2026
c211f4b
fix: remove patches for deleted get_principal functions in 3 test files
KonstantinMirin Feb 24, 2026
03e1e62
fix: replace Mock context with ResolvedIdentity in format_id_filter t…
KonstantinMirin Feb 24, 2026
c64df12
fix: add AdCPAuthenticationError to expected exceptions in auth tests
KonstantinMirin Feb 24, 2026
bbe2cf6
fix: resolve remaining #1050 migration test failures
KonstantinMirin Feb 24, 2026
56c1cdb
refactor: centralize tenant context resolution via ensure_tenant_cont…
KonstantinMirin Feb 24, 2026
64b284d
refactor: replace tenant dict with TenantContext Pydantic model at tr…
KonstantinMirin Feb 24, 2026
218aa97
refactor: add LazyTenantContext for deferred DB loading
KonstantinMirin Feb 24, 2026
e7daf8c
refactor: remove ContextVar reads from all _impl business logic funct…
KonstantinMirin Feb 24, 2026
0899a6f
fix: resolve integration test regressions from #1050 identity migration
KonstantinMirin Feb 24, 2026
8962835
fix: resolve UI and e2e test infrastructure bugs (6 tests)
KonstantinMirin Feb 24, 2026
c60dbbb
refactor: consolidate test runners into single JSON-reporting script
KonstantinMirin Feb 24, 2026
ee9f6e3
fix: resolve 6 test failures across e2e and UI suites
KonstantinMirin Feb 24, 2026
39e4fc3
fix: resolve 8 test failures — MCP Accept header, property tags, form…
KonstantinMirin Feb 24, 2026
bee4a86
fix: resolve 7 test failures — MCP client protocol, pricing format, a…
KonstantinMirin Feb 24, 2026
44ebc97
fix: resolve 6 test suite health bugs (unawaited coroutines, stale mo…
KonstantinMirin Feb 24, 2026
aef2001
fix: resolve update_media_buy workflow step bugs and stale xfail (#1041)
KonstantinMirin Feb 25, 2026
4859915
chore: add pytest filterwarnings to suppress third-party deprecation …
KonstantinMirin Feb 25, 2026
05392ed
chore: upgrade httplib2 0.31.0 → 0.31.2 to resolve pyparsing deprecat…
KonstantinMirin Feb 25, 2026
58fe4b4
refactor: migrate jsonschema.RefResolver to referencing.Registry
KonstantinMirin Feb 25, 2026
9765c1c
refactor: remove EOL google-generativeai dependency
KonstantinMirin Feb 25, 2026
bd78482
fix: prevent FastMCP from overriding pytest filterwarnings
KonstantinMirin Feb 25, 2026
aefd500
fix: close unclosed async resources in test fixtures
KonstantinMirin Feb 25, 2026
0bdd6a1
refactor: replace deprecated starlette WSGIMiddleware with a2wsgi
KonstantinMirin Feb 25, 2026
cd491af
test: add list_creative_formats and list_authorized_properties e2e tests
KonstantinMirin Feb 25, 2026
1eaa380
test: add multi-tenant isolation e2e tests
KonstantinMirin Feb 25, 2026
bcf326a
test: add coverage for update_performance_index and get_adcp_capabili…
KonstantinMirin Feb 25, 2026
969173c
perf: mock time.sleep in slow unit tests (44s -> 7s)
KonstantinMirin Feb 25, 2026
0e98da7
fix: suppress asyncio ResourceWarnings in pytest filterwarnings
KonstantinMirin Feb 25, 2026
3027e34
fix: close HTTPServer sockets in e2e webhook test fixtures
KonstantinMirin Feb 25, 2026
cef3c8d
fix: propagate context parameter in list_authorized_properties MCP wr…
KonstantinMirin Feb 25, 2026
8826e48
perf: parallelize run_all_tests.sh suites for ~2x speedup
KonstantinMirin Feb 25, 2026
80438e3
refactor: replace bash test parallelism with tox + coverage
KonstantinMirin Feb 25, 2026
3cad964
fix: use direct script call instead of process substitution in run_al…
KonstantinMirin Feb 25, 2026
5e9787f
chore: prune test-results to keep only the last 10 runs
KonstantinMirin Feb 25, 2026
5c3479a
docs: update testing docs for tox-based test runner
KonstantinMirin Feb 25, 2026
cd00579
Merge remote-tracking branch 'origin/main' into KonstantinMirin/refac…
KonstantinMirin Feb 25, 2026
93d05f0
fix: resolve mypy errors and security audit warning
KonstantinMirin Feb 25, 2026
7307ebc
fix: increase step_id entropy to prevent flaky uniqueness test
KonstantinMirin Feb 25, 2026
b01a502
fix: proxy nginx /health to upstream instead of returning 200 directly
KonstantinMirin Feb 25, 2026
146bc3f
refactor: simplify nginx configs with catch-all pattern for single up…
KonstantinMirin Feb 25, 2026
a05273e
chore: upgrade adcp dependency from 3.2.0 to 3.6.0
KonstantinMirin Feb 25, 2026
9623940
refactor: drop brand_manifest backward compat, enforce brand (BrandRe…
KonstantinMirin Feb 25, 2026
e16fdbe
fix: replace request.brand_manifest with request.brand across source …
KonstantinMirin Feb 26, 2026
81e6421
fix: migrate test suite from brand_manifest to brand (BrandReference)
KonstantinMirin Feb 26, 2026
d9474f6
fix: relax A2A get_products validation to allow filter-only queries
KonstantinMirin Feb 26, 2026
46b1145
fix: update tests for adcp 3.6.0 cursor-based pagination and Reportin…
KonstantinMirin Feb 26, 2026
41b6f7d
fix: sync local schema cache with adcp 3.6.0 field names
KonstantinMirin Feb 26, 2026
1b04cdf
test: add regression tests for brand_manifest to brand migration
KonstantinMirin Feb 26, 2026
91a91de
fix: add 6 adcp 3.6.0 Product fields to database model and migration
KonstantinMirin Feb 26, 2026
14b6c40
feat: add entity-scoped formulas, skills, and migration documentation
KonstantinMirin Feb 26, 2026
706f1a9
refactor: add 3 structural guard tests for architecture enforcement
KonstantinMirin Feb 26, 2026
fedd9f0
docs: add structural guards reference and update critical patterns fo…
KonstantinMirin Feb 26, 2026
22a6db5
fix: suppress OTEL noise in tests and fix async event loop test
KonstantinMirin Feb 26, 2026
ec9e720
test: add canonical delivery entity test suite (26 real, 33 stubs)
KonstantinMirin Feb 26, 2026
414078a
test: add creative and media-buy entity test suites (surface map)
KonstantinMirin Feb 26, 2026
f938c43
test: expand creative entity test suite with additional stubs
KonstantinMirin Feb 26, 2026
f45abd1
feat: add /verify-spec skill for spec traceability before remediation
KonstantinMirin Feb 26, 2026
779cf0f
test: add spec traceability links to delivery test suite
KonstantinMirin Feb 26, 2026
2d2aa3f
test: add spec traceability links to creative test suite
KonstantinMirin Feb 26, 2026
1b38283
test: add spec traceability links to media-buy test suite
KonstantinMirin Feb 26, 2026
7ee4036
test: reclassify buyer_campaign_ref roundtrip as CONFIRMED
KonstantinMirin Feb 26, 2026
a1bc028
test: reclassify remaining SPEC_AMBIGUOUS as CONFIRMED in media-buy
KonstantinMirin Feb 26, 2026
5300ceb
test: reclassify partial ID resolution as CONTRADICTS in delivery
KonstantinMirin Feb 26, 2026
92c8eb9
fix: remediate delivery test suite (16 stubs -> real tests)
KonstantinMirin Feb 26, 2026
7861c9b
fix: remediate media-buy test suite (10 stubs -> real tests)
KonstantinMirin Feb 26, 2026
0c20671
fix: align creative test suites with listing Creative base class
KonstantinMirin Feb 26, 2026
1504f64
fix: align existing tests with UpdateMediaBuyRequest XOR validator
KonstantinMirin Feb 26, 2026
296f8bb
fix: remediate delivery test suite batch 2 (20 stubs -> real tests)
KonstantinMirin Feb 26, 2026
1f33d12
fix: remediate creative test suite batch 2 (18 stubs -> real tests)
KonstantinMirin Feb 26, 2026
0ed47ff
fix: remediate media-buy test suite batch 2 (13 stubs -> real tests)
KonstantinMirin Feb 26, 2026
4919ab3
fix: enforce iron rule in remediate formula — stubs are absolute truth
KonstantinMirin Feb 26, 2026
bbb9523
fix: remediate creative test suite batch 3 (15 stubs -> real tests)
KonstantinMirin Feb 26, 2026
d1917ca
fix: remediate media-buy test suite batch 3 (15 stubs -> real tests)
KonstantinMirin Feb 26, 2026
b67e3c7
fix: remediate creative test suite batch 4 (15 stubs -> real tests)
KonstantinMirin Feb 26, 2026
9c00530
fix: remediate media-buy test suite batch 4 (16 stubs -> real tests)
KonstantinMirin Feb 26, 2026
886e8fc
fix: remediate creative test suite batch 5 — final (17 stubs -> real …
KonstantinMirin Feb 26, 2026
9a63b3d
fix: remediate media-buy test suite batch 5 — final (22 stubs -> real…
KonstantinMirin Feb 26, 2026
7c22784
fix: add regression tests for #1039 timezone mismatch in update_media…
KonstantinMirin Feb 26, 2026
60a07f8
fix: replace invalid brand_manifest_policy="flexible" with "public" i…
KonstantinMirin Feb 26, 2026
6afb64e
fix: resolve 500 error on New Product page (#1067)
KonstantinMirin Feb 26, 2026
d9512a6
fix: forward buyer_campaign_ref and ext through transport boundary wr…
KonstantinMirin Feb 26, 2026
d190d9f
fix: address code review findings — forward reporting_webhook, streng…
KonstantinMirin Feb 26, 2026
1262bf5
chore: add integration-from-stub formula for Phase B1
KonstantinMirin Feb 26, 2026
0f97730
chore: add /integrate skill for integration-from-stub formula
KonstantinMirin Feb 26, 2026
932667d
test: add 10 integration tests for creative entity (v3.6 migration)
KonstantinMirin Feb 26, 2026
86864a8
test: add delivery integration tests (11 tests, 0 xfails resolved)
KonstantinMirin Feb 26, 2026
1386354
test: add 15 integration tests for media-buy entity (10 xfails resolved)
KonstantinMirin Feb 26, 2026
fb703b7
fix: update media buy status to active after successful adapter execu…
KonstantinMirin Feb 26, 2026
bfbf084
fix: composite PK for creatives table enabling cross-principal isolation
KonstantinMirin Feb 26, 2026
7178257
fix: migrate _get_media_buys_impl to ResolvedIdentity pattern (Patter…
KonstantinMirin Feb 26, 2026
ae4d992
fix: update agent-produced tests for v3.6 compatibility
KonstantinMirin Feb 26, 2026
7b7fbb3
fix: handle RootModel-wrapped StatusFilter in delivery status resolution
KonstantinMirin Feb 26, 2026
d6608a5
fix: creative_assignments replace-all semantics in update_media_buy
KonstantinMirin Feb 26, 2026
d81576a
fix: add placement data to sample_products fixture for placement vali…
KonstantinMirin Feb 26, 2026
e5fd42a
test: reconcile integration test xfails after Phase C2 fixes
KonstantinMirin Feb 27, 2026
081000d
fix: Docker-verified integration test fixes for Phase C2
KonstantinMirin Feb 27, 2026
ee411bc
feat: add repository pattern structural guard
KonstantinMirin Feb 27, 2026
5a8bf62
fix: register _get_media_buys_impl in structural guards and fix docs …
KonstantinMirin Feb 27, 2026
91c439c
fix: add tenant_id filter to Creative/CreativeReview queries (cross-t…
KonstantinMirin Feb 27, 2026
a1f315d
fix: add tenant_id filters to 13 cross-tenant query leaks
KonstantinMirin Feb 27, 2026
48f119e
feat: add structural guard — no model_dump() in _impl functions
KonstantinMirin Feb 27, 2026
8b9a30b
feat: add MediaBuyRepository + UoW with tenant-scoped queries
KonstantinMirin Feb 27, 2026
4d52188
fix: add tenant_id filter to creative review queries (cross-tenant is…
KonstantinMirin Feb 27, 2026
c8e7cc0
fix: supply principal_id in creative_assignment construction sites
KonstantinMirin Feb 27, 2026
09a930a
fix: update tests for adcp v3.6 schema changes (signals, assets, deli…
KonstantinMirin Feb 27, 2026
80432e8
fix: resolve collateral test failures from adcp v3.6 migration
KonstantinMirin Feb 27, 2026
ae1bddd
fix: add regression test for scheduler status_filter including comple…
KonstantinMirin Feb 27, 2026
518a189
fix: add regression tests for tenant_id filter in creative review que…
KonstantinMirin Feb 27, 2026
89f86a0
fix: add regression tests for principal_id in creative assignment cre…
KonstantinMirin Feb 27, 2026
72bd1e1
Merge branch 'worktree-agent-a6a2d3cf' into KonstantinMirin/adcp-v3.6…
KonstantinMirin Feb 27, 2026
1ef821f
Merge branch 'worktree-agent-a763f754' into KonstantinMirin/adcp-v3.6…
KonstantinMirin Feb 27, 2026
d9bd60a
Merge branch 'worktree-agent-aa2e955a' into KonstantinMirin/adcp-v3.6…
KonstantinMirin Feb 27, 2026
e7cf44c
Merge branch 'worktree-agent-ac8726fe' into KonstantinMirin/adcp-v3.6…
KonstantinMirin Feb 27, 2026
ca69cfa
fix: add known schema-library mismatch allowlist and fix migration
KonstantinMirin Feb 27, 2026
586c725
chore: improve formulas, test runner, and add migration guard
KonstantinMirin Feb 27, 2026
7e7dbfa
fix: align 6 remaining test failures with adcp 3.6.0 behavior
KonstantinMirin Feb 27, 2026
f019f61
chore: add executor agent, agent-db skill, and update team command
KonstantinMirin Feb 27, 2026
94b84b5
fix: enforce integration tests in executor agent, fix asset_type Lite…
KonstantinMirin Feb 27, 2026
1b4fef5
chore: executor agent requires uv sync and baseline tests before changes
KonstantinMirin Feb 27, 2026
a4fb74e
refactor: Phase 2 repository migration — media_buy_list, delivery, ad…
KonstantinMirin Feb 27, 2026
79b6f1c
chore: add clean slate principle to executor agent
KonstantinMirin Feb 27, 2026
93a7ccc
Merge remote-tracking branch 'origin/main' into KonstantinMirin/refac…
KonstantinMirin Feb 27, 2026
29493ae
chore: add baseline and verify-no-regression atoms to molecular formulas
KonstantinMirin Feb 27, 2026
7a7ff42
refactor: add repository write methods + migrate admin blueprint queries
KonstantinMirin Feb 27, 2026
22363dd
refactor: migrate approve_media_buy raw select(MediaBuy) to repository
KonstantinMirin Feb 27, 2026
f58ad4b
fix: delegate A2A tenant detection to resolve_identity() instead of i…
KonstantinMirin Feb 27, 2026
daf7b5a
fix: remove redundant DB queries in REST _resolve_auth()
KonstantinMirin Feb 27, 2026
0f99cae
chore: add test level selection and mutation verification to bug-tria…
KonstantinMirin Feb 27, 2026
17bcf8a
chore: apply ruff formatting to files updated in main merge
KonstantinMirin Feb 27, 2026
e7df3c9
fix: repair integration_v2 A2A tests with fixture-derived mock identity
KonstantinMirin Feb 27, 2026
caca611
refactor: Wave 2 — migrate create/update _impl to UoW + adapter Media…
KonstantinMirin Feb 27, 2026
952776c
refactor: add structural guard — no raw select(MediaPackage) outside …
KonstantinMirin Feb 27, 2026
fff75a2
feat: add property_targeting_allowed to Product model and conversion
KonstantinMirin Feb 27, 2026
70ad857
fix: address code review findings for property_targeting_allowed
KonstantinMirin Feb 27, 2026
687d68e
chore: add CONDUCTOR_PORT isolation for executor agents and manual wo…
KonstantinMirin Feb 27, 2026
8d6a9f1
fix: resolve A2A identity once at transport boundary, not per-handler
KonstantinMirin Feb 27, 2026
c9538ed
refactor: align Product.channels to MediaChannel enum per AdCP spec
KonstantinMirin Feb 27, 2026
6ea8679
feat: add property list resolver with caching for buyer property lists
KonstantinMirin Feb 27, 2026
c9fb156
fix: remove dead fields from AuthContext and pass pre-extracted auth_…
KonstantinMirin Feb 27, 2026
71eeae6
fix: extract testing context from A2A request headers
KonstantinMirin Feb 27, 2026
fb98760
test: add 30 v3.6 Product field contract tests
KonstantinMirin Feb 27, 2026
c9da6e4
feat: add property_list filtering to get_products
KonstantinMirin Feb 27, 2026
8191c36
feat: add obligation coverage reconciliation guard
KonstantinMirin Feb 27, 2026
29d257d
fix: restore get_media_buys A2A skill and fix e2e test failures
KonstantinMirin Feb 27, 2026
b50f951
refactor: add /reclassify skill with deterministic obligation layer c…
KonstantinMirin Feb 28, 2026
deb9896
refactor: migrate MCP auth to unified resolve_identity() path
KonstantinMirin Feb 28, 2026
eae35c0
refactor: reclassify 69 more obligations via LLM review of borderline…
KonstantinMirin Feb 28, 2026
3632c24
fix: pass tenant ORM model directly instead of partial dict in media_…
KonstantinMirin Feb 28, 2026
5204602
refactor: use AdCPValidationError for A2A get_products search criteri…
KonstantinMirin Feb 28, 2026
8ec62e3
feat: implement delete_missing=True archive logic in _sync_creatives_…
KonstantinMirin Feb 28, 2026
b2c9f5b
feat: add empty update validation for update_media_buy (BR-RULE-022)
KonstantinMirin Feb 28, 2026
901b6e2
docs: add Transport Parity Invariant to architecture docs and formulas
KonstantinMirin Feb 28, 2026
eba5d24
fix: skip DB writes in creative sync when dry_run=True
KonstantinMirin Feb 28, 2026
281e7d7
fix: skip adapter call in _create_media_buy_impl when dry_run=True
KonstantinMirin Feb 28, 2026
8ad8e26
feat: add buyer_ref uniqueness validation in create_media_buy (BR-RUL…
KonstantinMirin Feb 28, 2026
60163ee
feat: add creative format vs product format_ids validation in create_…
KonstantinMirin Feb 28, 2026
6d34171
refactor: eliminate double header parsing in A2A middleware
KonstantinMirin Feb 28, 2026
3e4fa92
refactor: remove ContextVar mutation from LazyTenantContext._resolve()
KonstantinMirin Feb 28, 2026
57268df
refactor: remove dead get_principal_from_context from auth_utils.py
KonstantinMirin Feb 28, 2026
b04db98
refactor: extract _get_header_case_insensitive to shared http_utils m…
KonstantinMirin Feb 28, 2026
6282c64
fix: reorder middleware so auth_context runs before a2a_auth
KonstantinMirin Feb 28, 2026
6b29969
refactor: replace 3 auth middlewares with single pure ASGI UnifiedAut…
KonstantinMirin Feb 28, 2026
8dbc0af
refactor: wire A2A CallContextBuilder and thread SDK context to handl…
KonstantinMirin Feb 28, 2026
5915820
fix: add missing GetMediaBuyDeliveryRequest fields from updated AdCP …
KonstantinMirin Feb 28, 2026
7b0c027
refactor: centralize MCP identity resolution via FastMCP Middleware
KonstantinMirin Feb 28, 2026
8d44dac
refactor: convert REST auth to FastAPI Depends
KonstantinMirin Feb 28, 2026
d581913
fix: make task management tests async after sync-to-async conversion
KonstantinMirin Feb 28, 2026
32540ae
refactor: eliminate ContextVar dual-write from A2A auth path
KonstantinMirin Feb 28, 2026
5e8f254
fix: reconcile token extraction priority and case sensitivity in midd…
KonstantinMirin Feb 28, 2026
0e49043
refactor: modernize auth deps to Annotated types and fix type annotat…
KonstantinMirin Feb 28, 2026
460fba2
fix: use uuid task_id, remove debug logs, raise ServerError for stubs
KonstantinMirin Feb 28, 2026
f5b66fe
docs: update stale comments and documentation post-auth-refactoring
KonstantinMirin Feb 28, 2026
1018a8c
refactor: harden auth infrastructure with immutable headers, shared c…
KonstantinMirin Feb 28, 2026
159863f
refactor: eliminate tenant ContextVar side-effect from resolve_identi…
KonstantinMirin Feb 28, 2026
fa29f95
fix: resolve CI test failures from schema drift, stale dates, and ref…
KonstantinMirin Mar 1, 2026
7154d27
merge: integrate PR #1066 auth infrastructure hardening
KonstantinMirin Mar 1, 2026
7f7562e
refactor: move 4 model_dump calls from _impl to repository/transport …
KonstantinMirin Mar 1, 2026
f4678bf
fix: resolve CI failures from auth refactor and schema drift
KonstantinMirin Mar 1, 2026
654d17f
feat: expand obligation guard to scan unit tests, add 282 Covers tags
KonstantinMirin Mar 1, 2026
84a73ba
fix: strip known library mismatches from minimal request test
KonstantinMirin Mar 1, 2026
c7c2727
feat: add DeliveryRepository for webhook delivery tables
KonstantinMirin Mar 1, 2026
479f3ca
refactor: extract delivery schemas to src/core/schemas/delivery.py
KonstantinMirin Mar 1, 2026
95d05cf
refactor: tighten delivery schemas against adcp spec (salesagent-jz3y)
KonstantinMirin Mar 1, 2026
eab2947
feat: implement get_creative_delivery AdCP v3 tool (GH #1030)
KonstantinMirin Mar 1, 2026
0deff46
feat: fill UC-004 delivery obligation stubs (17 tests)
KonstantinMirin Mar 2, 2026
e940409
refactor: replace dict-based add_v2_compat with model-level v2 serial…
KonstantinMirin Mar 2, 2026
09798d8
feat: fill UC-003 update media buy obligation stubs (54 tests)
KonstantinMirin Mar 2, 2026
a992281
feat: fill UC-002 create media buy obligation stubs (56 tests)
KonstantinMirin Mar 2, 2026
1521347
chore: consolidate obligation coverage allowlist (-110 entries)
KonstantinMirin Mar 2, 2026
ef93737
fix: remove dead-code raise e in delivery per-buy exception handler
KonstantinMirin Mar 2, 2026
c433253
chore: remove batch-generated UC-004 delivery tests (+57 allowlist)
KonstantinMirin Mar 2, 2026
aa75790
feat: add UC-004 delivery obligation tests batch 1 (7 obligations)
KonstantinMirin Mar 2, 2026
3a3aa65
feat: add /obligation-test skill for per-obligation test derivation
KonstantinMirin Mar 2, 2026
0ade020
feat: add UC-004 webhook obligation tests batch 2 (10 obligations)
KonstantinMirin Mar 2, 2026
f2b815a
feat: add UC-004 obligation tests (5 obligations)
KonstantinMirin Mar 2, 2026
70f7bce
feat: add UC-004 obligation tests batch 3 (5 obligations)
KonstantinMirin Mar 2, 2026
3fdb0a4
feat: add UC-004 webhook obligation tests batch 4 (5 obligations)
KonstantinMirin Mar 3, 2026
1e5b89f
feat: add UC-004 webhook obligation tests batch 5 (5 obligations)
KonstantinMirin Mar 3, 2026
240d164
feat: add UC-004 delivery obligation tests batch 6 (10 obligations)
KonstantinMirin Mar 3, 2026
bd01f17
feat: add UC-004 obligation tests batch 7 (5 obligations, 12 tests)
KonstantinMirin Mar 3, 2026
7b17a20
feat: add UC-004 obligation tests batch 8 (5 obligations, 10 tests)
KonstantinMirin Mar 3, 2026
e397d9d
fix: convert pricing-option-identified tests to xfail per decision gate
KonstantinMirin Mar 3, 2026
461000e
feat: add test harness architecture + derive-tests skill
KonstantinMirin Mar 3, 2026
97f3dbb
feat: add factory_boy + integration-first test harness
KonstantinMirin Mar 3, 2026
9bf7b29
feat: add obligation-test formula + fix gitignore
KonstantinMirin Mar 3, 2026
0570327
feat: migrate obligation tests to integration harness (batches 5-8)
KonstantinMirin Mar 4, 2026
fe3a472
refactor: merge IntegrationEnv + ImplTestEnv into single BaseTestEnv
KonstantinMirin Mar 4, 2026
39b942c
refactor: extract domain mixins + drop ImplTestEnv alias
KonstantinMirin Mar 4, 2026
d3ce7b5
refactor: add type annotations to test harness base and mixins
KonstantinMirin Mar 4, 2026
2d85ace
refactor: harden harness __exit__ cleanup and add nested env guard
KonstantinMirin Mar 4, 2026
72e4c02
fix: adapter mock raises KeyError for unregistered media_buy_ids
KonstantinMirin Mar 4, 2026
eb21bf5
refactor: add strict=True to all xfail markers
KonstantinMirin Mar 4, 2026
cb6d8a5
refactor: move DB error test to unit, delete dead webhook unit file
KonstantinMirin Mar 4, 2026
87f526c
feat: extend set_adapter_response for multi-package scenarios
KonstantinMirin Mar 4, 2026
6fc29a1
feat: add harness error path meta-tests
KonstantinMirin Mar 4, 2026
ab72d87
refactor: harness minor cleanups — mock consistency, falsy fix, docst…
KonstantinMirin Mar 4, 2026
05723c3
refactor: migrate delivery unit tests from inline @patch to harness
KonstantinMirin Mar 4, 2026
d3ef5c2
fix: add time_budget to schema alignment known mismatches
KonstantinMirin Mar 5, 2026
99ffc10
fix: query PricingOption by synthetic string ID instead of integer PK
KonstantinMirin Mar 5, 2026
d68a136
feat: add conversions and viewability fields to DeliveryTotals
KonstantinMirin Mar 5, 2026
be9efa1
feat: add webhook_payload method for webhook-specific serialization
KonstantinMirin Mar 5, 2026
3b567b1
feat: add notification_type, sequence_number, and next_expected_at to…
KonstantinMirin Mar 5, 2026
5b61dc4
feat: add paused status support and circuit breaker delivery status
KonstantinMirin Mar 5, 2026
0e19700
feat: add auth failure blocking and adapter failure audit trail
KonstantinMirin Mar 5, 2026
84fcb95
feat: add scoped coverage quality gate for deterministic test verific…
KonstantinMirin Mar 5, 2026
3efeb6d
refactor: remove dead product_ids→packages fallback in delivery
KonstantinMirin Mar 5, 2026
30e642b
test: add circuit breaker and partial failure integration tests
KonstantinMirin Mar 5, 2026
00dab8e
test: add integration tests for _send_webhook_enhanced and _deliver_w…
KonstantinMirin Mar 5, 2026
0588aaa
refactor: remove dead reset_circuit_breaker method from WebhookDelive…
KonstantinMirin Mar 5, 2026
f0b3b4e
test: add display message + serialization tests for delivery responses
KonstantinMirin Mar 5, 2026
18e556c
test: add SSRF validation and retry backoff integration tests
KonstantinMirin Mar 5, 2026
248c953
fix: restore requires_server skip when MCP server unavailable
KonstantinMirin Mar 5, 2026
280f8d7
test: add defensive exception handler tests for webhook delivery
KonstantinMirin Mar 5, 2026
24567ee
test: add webhook delivery service coverage tests + remove dead code
KonstantinMirin Mar 5, 2026
13791a3
refactor: remove dead code + add coverage tests for delivery poll
KonstantinMirin Mar 5, 2026
27c4a6a
chore: add webhook unit test files to delivery coverage scope
KonstantinMirin Mar 5, 2026
1ac07a4
test: add 4 integration tests covering webhook_delivery_service.py ed…
KonstantinMirin Mar 5, 2026
22dfdcf
refactor: remove dead get_principal_id_from_context function
KonstantinMirin Mar 5, 2026
35166f4
fix: CPC clicks enum comparison bug + remove dead top-level pricing_o…
KonstantinMirin Mar 5, 2026
db43fdb
chore: update mol-execute formulas and coverage script
KonstantinMirin Mar 5, 2026
81ec0db
chore: merge main (with #1071 squash) into delivery branch
KonstantinMirin Mar 6, 2026
d7d8c36
fix: restore 110 obligation tests lost in auto-merge from #1071
KonstantinMirin Mar 6, 2026
cee9eb3
Merge remote-tracking branch 'origin/main' into KonstantinMirin/v3.6-…
KonstantinMirin Mar 6, 2026
e0aa992
fix: add missing migration and remove stale tool registration
KonstantinMirin Mar 6, 2026
85244d8
fix: address PR #1081 review comments
KonstantinMirin Mar 8, 2026
43739bd
fix: revert SSRF validation from protocol webhook service
KonstantinMirin Mar 8, 2026
67ccfca
Merge remote-tracking branch 'origin/main' into KonstantinMirin/v3.6-…
KonstantinMirin Mar 9, 2026
6cf0f6b
Merge remote-tracking branch 'origin/main' into KonstantinMirin/v3.6-…
KonstantinMirin Mar 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions .claude/code-review/040326_0951/review-architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Architecture Review

**Scope**: Test harness infrastructure for integration testing
- `tests/harness/` -- all files (IntegrationEnv base, DeliveryPollEnv, WebhookEnv, CircuitBreakerEnv, unit variants, meta-tests)
- `tests/factories/` -- factory_boy SQLAlchemy model factories
- `tests/integration/test_delivery_poll_behavioral.py` -- integration tests using DeliveryPollEnv
- `tests/integration/test_delivery_webhook_behavioral.py` -- integration tests using WebhookEnv
- `tests/integration/test_delivery_service_behavioral.py` -- integration tests using CircuitBreakerEnv

**Date**: 2026-03-04

---

## Findings

### CR-01: Unit CircuitBreakerEnv mocks get_db_session at wrong patch target
- **Severity**: Medium
- **Pattern**: CP-3 (Repository Pattern)
- **File**: `tests/harness/delivery_circuit_breaker_unit.py:61`
- **Description**: The unit variant patches `src.core.database.database_session.get_db_session` (the definition site), while the integration variant patches `src.services.webhook_delivery_service.httpx.Client` etc. at the module's import site. For `get_db_session`, the correct patch target depends on how `webhook_delivery_service.py` imports it. If `webhook_delivery_service.py` uses `from src.core.database.database_session import get_db_session`, then patching the definition site (`src.core.database.database_session.get_db_session`) might not intercept calls from the service module -- you should patch at the import site (`src.services.webhook_delivery_service.get_db_session`). This is inconsistent with how all other patches in the same file target `{self.MODULE}.*` but the db patch uses the definition site.
- **Reproduction**: `grep -n "get_db_session" tests/harness/delivery_circuit_breaker_unit.py`
- **Recommended fix**: Change the patch target to `f"{self.MODULE}.get_db_session"` or verify that the service module imports via the module path being patched. If the service imports `get_db_session` directly, the current patch may not actually intercept calls.

### CR-02: Integration WebhookEnv does not mock get_db_session -- potential table dependency
- **Severity**: Low
- **Pattern**: CP-3 (Repository Pattern)
- **File**: `tests/harness/delivery_webhook.py:52-56`
- **Description**: The integration `WebhookEnv` correctly does not mock `get_db_session` (relying on real DB). However, the docstring at line 5 says "Real: get_db_session for delivery record tracking (fails silently if no table)." The phrase "fails silently if no table" suggests the delivery record tracking table may not exist in the test schema. If `integration_db` creates all tables via `Base.metadata.create_all()`, this should work. But if the delivery record tracking model is not registered in `Base.metadata`, the integration tests would silently skip delivery record persistence without the test knowing. This is not a violation per se, but a fragility risk.
- **Reproduction**: Check if `deliver_webhook_with_retry` attempts to write delivery records and whether the relevant model is in `Base.metadata`
- **Recommended fix**: Confirm delivery record model is included in `Base.metadata.create_all()`. If delivery record tracking is a planned feature, add a note or TODO. If it exists, remove the "fails silently" caveat from the docstring.

### CR-03: IntegrationEnv directly mutates factory_boy Meta internals
- **Severity**: Medium
- **Pattern**: N/A (Test infrastructure robustness)
- **File**: `tests/harness/_base.py:118,133`
- **Description**: `IntegrationEnv.__enter__` sets `f._meta.sqlalchemy_session` directly on every factory in `ALL_FACTORIES`, and `__exit__` sets it to `None`. This is a global mutation -- if two IntegrationEnv contexts were accidentally nested or used in parallel (e.g., via threading or parametrize), the second `__exit__` would unbind the session for the still-active first context. This is safe in current sequential usage but fragile. The `_meta.sqlalchemy_session` is shared class-level state; factory_boy's own documentation recommends `cls._meta.sqlalchemy_session` for this purpose, but the global mutation pattern means test isolation depends on execution order.
- **Reproduction**: `grep -n "_meta.sqlalchemy_session" tests/harness/_base.py`
- **Recommended fix**: No immediate fix needed given current sequential test execution. Document the constraint: "IntegrationEnv contexts must not be nested or run concurrently." Consider using a `contextvars.ContextVar` for session binding if parallelism is ever needed.

### CR-04: Factory `sqlalchemy_session_persistence = "commit"` auto-commits each factory call
- **Severity**: Low
- **Pattern**: CP-3 (Repository Pattern)
- **File**: `tests/factories/core.py:20`, `tests/factories/principal.py:16`, etc.
- **Description**: Every factory uses `sqlalchemy_session_persistence = "commit"`. This means every `TenantFactory()`, `PrincipalFactory()`, etc. individually commits. Combined with `RelatedFactory` cascading (e.g., `TenantFactory` auto-creates `CurrencyLimitFactory`), a single `TenantFactory()` call may issue 2+ commits. This is architecturally sound for integration tests (production code needs committed data visible via separate sessions), but means tests cannot batch multiple factory creations in a single transaction for rollback. The `IntegrationEnv._commit_factory_data()` method at `_base.py:97-100` is therefore mostly a safety net (data is already committed by factory_boy). This is acceptable but should be documented clearly.
- **Reproduction**: `grep -n "sqlalchemy_session_persistence" tests/factories/*.py`
- **Recommended fix**: Add a brief comment in `_base.py:_commit_factory_data()` noting that this is a safety net since factories auto-commit. No functional change needed.

### CR-05: DeliveryPollEnv (integration) bypasses repository pattern for adapter mock wiring
- **Severity**: Low
- **Pattern**: CP-5 (Transport Boundary)
- **File**: `tests/harness/delivery_poll.py:57-58`
- **Description**: The integration `DeliveryPollEnv` only patches `get_adapter` (the adapter factory function). This is correct -- the adapter is the external boundary. The `_impl` function's internal use of `MediaBuyUoW` and `get_principal_object` runs against real DB, which is exactly the design intent. No violation here. The integration harness correctly separates external mocks (adapter) from internal DB access.
- **Reproduction**: `grep -n "EXTERNAL_PATCHES" tests/harness/delivery_poll.py`
- **Recommended fix**: None. This is the correct architecture.

### CR-06: Unit WebhookEnv patches get_db_session -- integration WebhookEnv does not
- **Severity**: Low
- **Pattern**: CP-3 (Repository Pattern), architectural consistency
- **File**: `tests/harness/delivery_webhook_unit.py:51` vs `tests/harness/delivery_webhook.py:52-56`
- **Description**: The unit variant mocks `get_db_session` while the integration variant lets it hit real DB. This is the intended design difference between unit and integration harnesses. The separation is clean: unit env mocks everything (external + DB), integration env mocks only external (HTTP, URL validation, timing). No violation.
- **Reproduction**: `diff tests/harness/delivery_webhook_unit.py tests/harness/delivery_webhook.py`
- **Recommended fix**: None. Correct by design.

### CR-07: Integration tests use `from tests.harness import ...` inside test methods
- **Severity**: Low
- **Pattern**: N/A (Style convention)
- **File**: `tests/integration/test_delivery_poll_behavioral.py:46-47`, multiple test classes
- **Description**: Imports of factories and harness envs are done inside test methods rather than at module level. For example: `from tests.factories import MediaBuyFactory, PrincipalFactory, TenantFactory` and `from tests.harness import DeliveryPollEnv` appear inside each test method. This is a conscious choice to avoid import-time failures if DB dependencies are not available, and to make each test self-contained. However, it adds redundancy and ~2 lines of import boilerplate per test.
- **Reproduction**: `grep -n "from tests.factories import" tests/integration/test_delivery_poll_behavioral.py | head -10`
- **Recommended fix**: Consider moving these imports to module level with a `pytest.importorskip` guard or behind `TYPE_CHECKING`. The `@pytest.mark.requires_db` marker already gates test execution, so import-time safety may be unnecessary. This is a style preference, not a pattern violation.

### CR-08: CircuitBreakerEnv (integration) test creates service outside env context
- **Severity**: Medium
- **Pattern**: CP-3 (Repository Pattern)
- **File**: `tests/integration/test_delivery_service_behavioral.py:148-163`
- **Description**: In `test_send_webhook_enhanced_catches_db_errors`, a `WebhookDeliveryService()` is instantiated outside the `CircuitBreakerEnv` context manager, and `get_db_session` is patched directly via `with patch(...)` inline. This bypasses the harness pattern -- the whole point of CircuitBreakerEnv is to centralize mock management. The inline `patch` is the old pattern the harness was designed to replace.
- **Reproduction**: `grep -n "with patch" tests/integration/test_delivery_service_behavioral.py`
- **Recommended fix**: Either wrap this in a `CircuitBreakerEnv` and use `env.mock["client"]` etc., or document why this specific test needs to bypass the harness (perhaps it's testing a scenario the harness doesn't support).

### CR-09: Production _impl imports Context and ToolContext at module level
- **Severity**: N/A (Pre-existing, known)
- **Pattern**: CP-5 (Transport Boundary)
- **File**: `src/core/tools/media_buy_delivery.py:17-22`
- **Description**: `_get_media_buy_delivery_impl` module imports `from fastmcp.server.context import Context` and `from src.core.tool_context import ToolContext` at the top level. However, these imports are used by the transport wrappers in the same module, not by the `_impl` function itself. The structural guard `test_transport_agnostic_impl.py` likely allows this since the _impl function body doesn't reference them. Not a harness issue -- noted for completeness.
- **Reproduction**: `head -25 src/core/tools/media_buy_delivery.py`
- **Recommended fix**: Out of scope for this review. Flagged for awareness only.

---

## Summary of Answers to Key Questions

### 1. Does IntegrationEnv correctly separate external mocks from real DB?
**Yes.** `IntegrationEnv` (`_base.py`) creates a non-scoped SQLAlchemy session for factory_boy, separate from production code's `scoped_session` via `get_db_session()`. Both point to the same PostgreSQL test database (set up by `integration_db` fixture). The `EXTERNAL_PATCHES` dict is the only thing mocked. This is architecturally sound.

### 2. Do the domain envs follow CLAUDE.md patterns?
**Yes.** Integration variants (`delivery_poll.py`, `delivery_webhook.py`, `delivery_circuit_breaker.py`) only mock external services. No transport boundary violations found. No `ToolError`, `Context`, or transport imports in the harness code. Tests use factory_boy instead of inline `session.add()`. All three integration envs inherit from `IntegrationEnv` and follow the same pattern.

### 3. Is the factory session management architecturally sound?
**Mostly yes, with caveats.** The `sqlalchemy_session_persistence = "commit"` ensures factory-created data is visible to production code's separate session. The `_commit_factory_data()` method in `IntegrationEnv` is a safety net. The global mutation of `_meta.sqlalchemy_session` (CR-03) is fragile under parallelism but safe in current sequential test execution.

### 4. Are there transport boundary violations in the harness or tests?
**No.** Zero imports from `fastmcp`, `a2a`, `starlette`, or `fastapi` in any harness or integration test file. Tests call `_impl` functions directly via the harness, correctly bypassing the transport layer. `ResolvedIdentity` is used (not `Context`) -- exactly per CP-5.

### 5. Does the harness follow the repository pattern or bypass it?
**Correctly follows it.** Integration envs let `_impl` functions use their normal repository/UoW patterns against real DB. The only mock is the adapter (external I/O boundary). One exception: `test_send_webhook_enhanced_catches_db_errors` (CR-08) uses inline `patch` outside the harness, which is the old pattern the harness was designed to replace.

---

## Counts

- Critical: 0
- High: 0
- Medium: 3 (CR-01, CR-03, CR-08)
- Low: 5 (CR-02, CR-04, CR-05, CR-06, CR-07)
Loading