amfs-adapter-postgres 0.2.24__tar.gz → 0.2.26__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/PKG-INFO +2 -2
  2. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/pyproject.toml +2 -2
  3. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/adapter.py +12 -2
  4. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/schema.sql +1 -0
  5. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/.gitignore +0 -0
  6. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/__init__.py +0 -0
  7. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/_fts.py +0 -0
  8. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/async_adapter.py +0 -0
  9. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/knn.py +0 -0
  10. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/migrations/001_initial.sql +0 -0
  11. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/migrations/002_artifact_refs.sql +0 -0
  12. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/migrations/002_search_indexes.sql +0 -0
  13. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/migrations/003_knowledge_graph.sql +0 -0
  14. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/migrations/004_agent_groups.sql +0 -0
  15. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/migrations/005_configurable_embedding_dim.sql +0 -0
  16. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/migrations/006_is_artifact.sql +0 -0
  17. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/migrations/006_outcome_confidence_semantics.sql +0 -0
  18. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/migrations/007_outcome_propagation_row_copy.sql +0 -0
  19. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/migrations/008_outcome_evidence.sql +0 -0
  20. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/migrations/009_action_priors.sql +0 -0
  21. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/migrations/010_local_evidence.sql +0 -0
  22. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/migrations/011_outcome_task_text.sql +0 -0
  23. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/retention.py +0 -0
  24. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/tenant_context.py +0 -0
  25. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/tenant_gucs.py +0 -0
  26. {amfs_adapter_postgres-0.2.24 → amfs_adapter_postgres-0.2.26}/src/amfs_postgres/trace_partitions.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: amfs-adapter-postgres
3
- Version: 0.2.24
3
+ Version: 0.2.26
4
4
  Summary: AMFS Postgres adapter with back-propagation triggers
5
5
  License-Expression: Apache-2.0
6
6
  Requires-Python: >=3.11
7
- Requires-Dist: amfs-core>=0.3.38
7
+ Requires-Dist: amfs-core>=0.3.39
8
8
  Requires-Dist: psycopg-pool>=3.1
9
9
  Requires-Dist: psycopg[binary]<4,>=3.1
@@ -1,13 +1,13 @@
1
1
  [project]
2
2
  name = "amfs-adapter-postgres"
3
- version = "0.2.24"
3
+ version = "0.2.26"
4
4
  description = "AMFS Postgres adapter with back-propagation triggers"
5
5
  requires-python = ">=3.11"
6
6
  license = "Apache-2.0"
7
7
  dependencies = [
8
8
  # 0.3.14 adds the capture fields this adapter now persists and selects back,
9
9
  # tool_calls among them.
10
- "amfs-core>=0.3.38",
10
+ "amfs-core>=0.3.39",
11
11
  "psycopg[binary]>=3.1,<4",
12
12
  "psycopg-pool>=3.1",
13
13
  ]
@@ -1439,6 +1439,16 @@ class PostgresAdapter(AdapterABC):
1439
1439
  # Multi-tenant unique constraints: include account_id so different
1440
1440
  # tenants can have entries/agents/branches/tags with the same names.
1441
1441
  #
1442
+ # ``uq_entry_version`` also includes ``branch``: versions are numbered
1443
+ # per branch — ``write`` reads the newest row on *its* branch and adds
1444
+ # one, ``merge_branch`` renumbers onto the parent — so the same
1445
+ # (entity, key, version) legitimately exists on main and on every
1446
+ # branch that has written the key. Without ``branch`` in the constraint
1447
+ # the first write of an existing key on a fresh branch raised
1448
+ # ``UniqueViolation`` (seen 2026-09-22: the repair loop could not open a
1449
+ # branch for a procedure key an earlier fix had already written, and
1450
+ # every fix fell back to "writes to main on Ship", which is no canary).
1451
+ #
1442
1452
  # Each DROP+ADD pair runs inside an explicit transaction (BEGIN/COMMIT)
1443
1453
  # so that if ADD fails, the DROP is rolled back and the old constraint
1444
1454
  # stays in place. The pool uses autocommit=True, so without an
@@ -1447,8 +1457,8 @@ class PostgresAdapter(AdapterABC):
1447
1457
  (
1448
1458
  "amfs_memory_entries",
1449
1459
  "uq_entry_version",
1450
- "UNIQUE (namespace, entity_path, key, version, account_id)",
1451
- ["namespace", "entity_path", "key", "version", "account_id"],
1460
+ "UNIQUE (namespace, branch, entity_path, key, version, account_id)",
1461
+ ["namespace", "branch", "entity_path", "key", "version", "account_id"],
1452
1462
  ),
1453
1463
  (
1454
1464
  "amfs_agents",
@@ -35,6 +35,7 @@ CREATE TABLE IF NOT EXISTS amfs_memory_entries (
35
35
  superseded_at TIMESTAMPTZ,
36
36
  account_id UUID,
37
37
  CONSTRAINT uq_entry_version UNIQUE (namespace, entity_path, key, version, account_id)
38
+ -- widened to include ``branch`` by the adapter's constraint migration (versions are per branch)
38
39
  );
39
40
 
40
41
  CREATE INDEX IF NOT EXISTS idx_entries_current