mcp-dispatch-pg 0.1.0a1__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.
- mcp_dispatch_pg-0.1.0a1/.gitignore +14 -0
- mcp_dispatch_pg-0.1.0a1/AGENTS.md +55 -0
- mcp_dispatch_pg-0.1.0a1/CHANGELOG.md +32 -0
- mcp_dispatch_pg-0.1.0a1/LICENSE +21 -0
- mcp_dispatch_pg-0.1.0a1/PKG-INFO +706 -0
- mcp_dispatch_pg-0.1.0a1/README.md +695 -0
- mcp_dispatch_pg-0.1.0a1/pyproject.toml +62 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/__init__.py +9 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/__main__.py +3 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/alias.py +37 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/anchor.py +85 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/attention.py +17 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/blob.py +48 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/cli.py +90 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/derived.py +65 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/file.py +57 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/link.py +61 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrate.py +304 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrations/core/0001_tables.sql +289 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrations/core/0002_embedding_partition.sql +35 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrations/core/0003_work.sql +129 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrations/core/0004_record.sql +551 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrations/core/0005_blob.sql +56 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrations/core/0006_link_alias.sql +255 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrations/core/0007_tag.sql +177 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrations/core/0008_purge.sql +72 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrations/core/0009_derived.sql +129 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrations/core/0010_state_attention.sql +47 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrations/core/0011_position.sql +133 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrations/core/0012_anchor.sql +93 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/migrations/core/0013_file.sql +91 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/pool.py +159 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/position.py +27 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/py.typed +0 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/record.py +366 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/state.py +27 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/tag.py +69 -0
- mcp_dispatch_pg-0.1.0a1/src/mcp_dispatch_pg/work.py +116 -0
- mcp_dispatch_pg-0.1.0a1/tests/__init__.py +0 -0
- mcp_dispatch_pg-0.1.0a1/tests/conftest.py +69 -0
- mcp_dispatch_pg-0.1.0a1/tests/content.py +27 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_anchor.py +234 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_blob.py +145 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_content_contract.py +252 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_derived.py +516 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_file.py +639 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_holder.py +96 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_link_alias.py +456 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_migrate.py +162 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_pool.py +107 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_position.py +271 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_purge.py +310 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_record.py +1524 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_remaining_contracts.py +98 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_schema.py +306 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_state_attention.py +157 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_tag.py +340 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_validation.py +126 -0
- mcp_dispatch_pg-0.1.0a1/tests/test_work.py +356 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# AGENTS.md: mcp-dispatch-pg
|
|
2
|
+
|
|
3
|
+
Postgres connections, independent module migrations, and shared content tables.
|
|
4
|
+
This file is for work on the package; README.md describes using it.
|
|
5
|
+
|
|
6
|
+
## Set up and check
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
uv sync
|
|
10
|
+
uv run ruff check .
|
|
11
|
+
uv run ruff format --check .
|
|
12
|
+
uv run mypy
|
|
13
|
+
uv run pytest -rs
|
|
14
|
+
uv build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Set `MCP_DISPATCH_PG_TEST_URL` for real database tests. Each test owns a database;
|
|
18
|
+
the role must have CREATEDB and extension creation privileges, with pgvector available.
|
|
19
|
+
|
|
20
|
+
## Layout
|
|
21
|
+
|
|
22
|
+
- `src/mcp_dispatch_pg/pool.py`: call transactions, independent transactions, process holder and heartbeat.
|
|
23
|
+
- `src/mcp_dispatch_pg/work.py`: typed queue wrappers using the caller's transaction.
|
|
24
|
+
- `src/mcp_dispatch_pg/record.py`: typed record and purge writers, conflict mapping and content hash.
|
|
25
|
+
- `src/mcp_dispatch_pg/blob.py`: immutable blob storage and collection wrappers.
|
|
26
|
+
- `src/mcp_dispatch_pg/file.py`: named blob states, optimistic writes and version/prefix readers.
|
|
27
|
+
- `src/mcp_dispatch_pg/link.py`: link normalization, note and removal wrappers.
|
|
28
|
+
- `src/mcp_dispatch_pg/alias.py`: alias writers and waiting-link resolution wrappers.
|
|
29
|
+
- `src/mcp_dispatch_pg/tag.py`: tag identities, namespace policy, tagging and expiry wrappers.
|
|
30
|
+
- `src/mcp_dispatch_pg/derived.py`: hash-guarded summaries, keywords, vectors and dependent work.
|
|
31
|
+
- `src/mcp_dispatch_pg/state.py`: per-record and global JSON state.
|
|
32
|
+
- `src/mcp_dispatch_pg/attention.py`: ordered batch attention stamps.
|
|
33
|
+
- `src/mcp_dispatch_pg/position.py`: transaction-scoped sibling position allocation.
|
|
34
|
+
- `src/mcp_dispatch_pg/anchor.py`: immutable observations and current resolutions.
|
|
35
|
+
- `src/mcp_dispatch_pg/migrate.py`: registration, ordering, checksums, ledger, locking.
|
|
36
|
+
- `src/mcp_dispatch_pg/cli.py`: migrate/status, with addresses read from the environment.
|
|
37
|
+
- `src/mcp_dispatch_pg/migrations/core/`: SQL shipped in the wheel.
|
|
38
|
+
- `tests/`: sentence names, server tests isolated by a database fixture, local checks.
|
|
39
|
+
|
|
40
|
+
## Rules
|
|
41
|
+
|
|
42
|
+
- Plain SQL and fully qualified objects. Never change a connection's search path.
|
|
43
|
+
- One migration file is one transaction. Never edit or remove an applied file.
|
|
44
|
+
- Register prerequisites explicitly. Refuse checksum drift and unknown ledger rows.
|
|
45
|
+
- Never print a database address, driver error containing it, or a secret.
|
|
46
|
+
- One way to do a thing. An error says what the caller should change.
|
|
47
|
+
- Keep dependencies to psycopg and psycopg-pool. Python 3.12+, ruff and mypy clean.
|
|
48
|
+
- Queue changes go through core.work_put/claim/renew/done/fail; wrappers own no transaction or retry loop.
|
|
49
|
+
- Record changes go through core.put/edit/patch/move/retire/restore/replace/commit/blank/purge/purge_retired.
|
|
50
|
+
- Named files go through core.file_set (which uses the record and alias writers); file types must keep history. Removals clear the blob and keep the record and alias.
|
|
51
|
+
- Blob, link, alias and tagging changes go only through their core.blob_*, core.link_*, core.alias_* and core.tag* / core.untag functions; no other caller writes those tables.
|
|
52
|
+
- Derived, state, attention and anchor changes go through core.summary_put/keyword_put/embedding_put, core.state_put/state_remove, core.attend and core.anchor_* only.
|
|
53
|
+
- Allocate sibling positions through core.pos_after/pos_last and place the row in the same READ COMMITTED transaction.
|
|
54
|
+
- No search or module-specific tables yet.
|
|
55
|
+
- Do not commit, push, tag, or stash unless explicitly asked.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0a1
|
|
4
|
+
|
|
5
|
+
A pre-release for packages that build on the schema. Until 0.1.0 the migration
|
|
6
|
+
files may still change: apply a pre-release only to a database you can drop.
|
|
7
|
+
|
|
8
|
+
- Add named file writes with blob-key conflicts, removal states and version/prefix readers.
|
|
9
|
+
- Compare alias values by bytes for literal prefix index ranges.
|
|
10
|
+
- Allow moving retired non-version records with the ordinary placement checks.
|
|
11
|
+
- Add typed file wrappers, conflict name/present attributes and isolated behavior/concurrency tests.
|
|
12
|
+
|
|
13
|
+
- Add hash-guarded summary, keyword and embedding writers with prerequisite work routing.
|
|
14
|
+
- Add state upsert/removal and ordered batch attention stamps.
|
|
15
|
+
- Add sibling position allocation with group serialization and quiet renumbering.
|
|
16
|
+
- Add anchor observations, initial/current resolutions and removal without triggers.
|
|
17
|
+
- Add a stable one-hop successor reader and typed wrappers for the new functions.
|
|
18
|
+
- Add isolated behavior and concurrency tests; migration expectations follow shipped files.
|
|
19
|
+
|
|
20
|
+
- Add immutable byte/path blobs and reference-aware collection; working commits use the blob writer.
|
|
21
|
+
- Add type-gated physical purge with core cleanup and surviving link-removal events.
|
|
22
|
+
- Add normalized links, inverse names, single targets, cycle serialization and mandatory removal receipts.
|
|
23
|
+
- Add alias registration, explicit moves and safe waiting-link resolution.
|
|
24
|
+
- Add tag identities, open/closed namespaces, quiet batch tagging and expiry collection.
|
|
25
|
+
- Add typed wrappers and isolated database behavior and concurrency tests for these writers.
|
|
26
|
+
|
|
27
|
+
- Add derived-work enqueue, claim, renew, done and fail functions with typed wrappers.
|
|
28
|
+
- Add process holders, shared lease liveness and independent pool heartbeats.
|
|
29
|
+
- Add call transactions and independent short transactions using psycopg pools.
|
|
30
|
+
- Add module migrations, checksum validation, dependency ordering, and advisory locking.
|
|
31
|
+
- Ship shared content tables, pgvector partitions, and type partition promotion.
|
|
32
|
+
- Add environment-based migrate/status commands and isolated PostgreSQL tests.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Reto Stamm
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|