cfgit 0.4.3__tar.gz → 0.4.4__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.
- {cfgit-0.4.3 → cfgit-0.4.4}/PKG-INFO +1 -1
- {cfgit-0.4.3 → cfgit-0.4.4}/plugins/cfg_impact/pyproject.toml +2 -2
- {cfgit-0.4.3 → cfgit-0.4.4}/pyproject.toml +1 -1
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/core/engine.py +51 -14
- {cfgit-0.4.3 → cfgit-0.4.4}/.github/workflows/ci.yml +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/.github/workflows/publish.yml +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/.gitignore +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/CONTRIBUTING.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/CREDITS.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/LICENSE +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/NOTICE +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/README.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/SECURITY.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/ADAPTERS.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/AGENTS.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/BRANCHING_PLAN.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/CONFIGURATION.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/IDENTITY_AND_ATTRIBUTION.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/PUBLISHING.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/README.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/SPEC.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/SPEC_CORE.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/USAGE.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/screenshots/01-diff.png +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/screenshots/02-impact.png +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/screenshots/03-scoped-impact.png +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/screenshots/04-branches.png +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/docs/screenshots/05-pull-request.png +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/examples/.cfg.toml +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/examples/cfgit-support-demo.toml +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/examples/seed_support_demo.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/plugins/cfg_impact/README.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/plugins/cfg_impact/cfg_impact/__init__.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/plugins/cfg_impact/cfg_impact/overview.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/plugins/cfg_impact/cfg_impact/providers/__init__.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/plugins/cfg_impact/cfg_impact/providers/base.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/plugins/cfg_impact/cfg_impact/providers/claude.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/plugins/cfg_impact/cfg_impact/providers/factory.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/plugins/cfg_impact/cfg_impact/providers/gemini.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/plugins/cfg_impact/cfg_impact/providers/openai_provider.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/skills/cfgit/SKILL.md +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/__init__.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/adapters/__init__.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/adapters/base.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/adapters/mongo.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/adapters/postgres.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/approval/__init__.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/approval/base.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/cli/__init__.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/cli/main.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/core/__init__.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/core/authz.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/core/config.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/core/diff.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/core/hashing.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/core/identity.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/core/remedy.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/interfaces/__init__.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/interfaces/actions.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/mcp/__init__.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/mcp/server.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/ui/__init__.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/ui/server.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/src/cfg/update.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_adapter_contract_live.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_authz.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_awareness.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_commit_dry_run.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_config.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_config_discovery.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_console_script.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_core_purity.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_engine_safety.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_export_import.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_hashing.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_identity.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_impact_boundary.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_mcp_identity.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_mongo_history.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_output_mode.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_postgres_history.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_remedy.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_set_fields.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_ui_server.py +0 -0
- {cfgit-0.4.3 → cfgit-0.4.4}/tests/test_update_check.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cfgit
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.4
|
|
4
4
|
Summary: Git-style history, diff, drift detection, and rollback for live database records without migrating or owning your datastore
|
|
5
5
|
Project-URL: Homepage, https://github.com/AusafMo/cfgit
|
|
6
6
|
Project-URL: Repository, https://github.com/AusafMo/cfgit
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "cfgit-impact"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.4"
|
|
4
4
|
description = "Optional cfgit plugin for deterministic system-impact summaries and opt-in LLM narration of database record diffs"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
7
7
|
license = "Apache-2.0"
|
|
8
8
|
authors = [{ name = "Mohammad Ausaf" }]
|
|
9
9
|
dependencies = [
|
|
10
|
-
"cfgit>=0.4.
|
|
10
|
+
"cfgit>=0.4.4,<0.5.0",
|
|
11
11
|
"httpx>=0.27",
|
|
12
12
|
]
|
|
13
13
|
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
"""DB-neutral cfgit engine."""
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
5
6
|
from copy import deepcopy
|
|
6
7
|
from dataclasses import dataclass
|
|
7
8
|
from datetime import datetime, time, timezone
|
|
8
9
|
import fnmatch
|
|
9
10
|
import re
|
|
10
11
|
import uuid
|
|
11
|
-
from typing import Any
|
|
12
|
+
from typing import Any, Callable, TypeVar
|
|
12
13
|
|
|
13
14
|
from cfg.adapters.base import ApplyItem, AtomicityUnavailable, NoSuchConfig, StorageAdapter
|
|
14
15
|
from cfg.core.authz import authorize_mutation
|
|
@@ -42,6 +43,25 @@ class BranchingDisabled(ValueError):
|
|
|
42
43
|
"""Branch/PR commands require [branches] enabled = true."""
|
|
43
44
|
|
|
44
45
|
|
|
46
|
+
_T = TypeVar("_T")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _gather(tasks: list[Callable[[], _T]]) -> list[_T]:
|
|
50
|
+
"""Run independent, blocking adapter reads concurrently and return results in order.
|
|
51
|
+
|
|
52
|
+
The status/ref-list path issues several store round-trips with no data dependency on
|
|
53
|
+
each other (per-collection id distincts, batch heads/records, the history ref list).
|
|
54
|
+
Run serially they sum one RTT each — the whole residual latency on a remote store
|
|
55
|
+
(issue #31). pymongo/psycopg release the GIL during network I/O, so a thread pool turns
|
|
56
|
+
that sum into ~max(single op). Falls back to serial for 0/1 task (no pool overhead).
|
|
57
|
+
Exceptions propagate (first one wins), preserving the serial behavior on failure.
|
|
58
|
+
"""
|
|
59
|
+
if len(tasks) <= 1:
|
|
60
|
+
return [t() for t in tasks]
|
|
61
|
+
with ThreadPoolExecutor(max_workers=min(len(tasks), 8)) as pool:
|
|
62
|
+
return list(pool.map(lambda t: t(), tasks))
|
|
63
|
+
|
|
64
|
+
|
|
45
65
|
class Engine:
|
|
46
66
|
def __init__(
|
|
47
67
|
self,
|
|
@@ -494,10 +514,19 @@ class Engine:
|
|
|
494
514
|
batch_records = getattr(self.adapter, "get_records", None)
|
|
495
515
|
batch_heads = getattr(self.adapter, "get_heads", None)
|
|
496
516
|
if callable(batch_records) and callable(batch_heads):
|
|
497
|
-
|
|
498
|
-
|
|
517
|
+
# One get_records + one get_heads per collection, all independent — run them
|
|
518
|
+
# concurrently so their round-trips overlap instead of summing (issue #31).
|
|
519
|
+
colls = list(by_collection)
|
|
520
|
+
tasks: list[Callable[[], dict]] = []
|
|
521
|
+
for collection in colls:
|
|
522
|
+
ids = by_collection[collection]
|
|
523
|
+
tasks.append(lambda c=collection, i=ids: batch_records(c, i))
|
|
524
|
+
tasks.append(lambda c=collection, i=ids: batch_heads(c, i))
|
|
525
|
+
results = _gather(tasks)
|
|
526
|
+
for idx, collection in enumerate(colls):
|
|
527
|
+
for rid, live in results[2 * idx].items():
|
|
499
528
|
live_by_ref[(collection, rid)] = live
|
|
500
|
-
for rid, head in
|
|
529
|
+
for rid, head in results[2 * idx + 1].items():
|
|
501
530
|
head_by_ref[(collection, rid)] = head
|
|
502
531
|
return live_by_ref, head_by_ref
|
|
503
532
|
|
|
@@ -1315,19 +1344,27 @@ class Engine:
|
|
|
1315
1344
|
|
|
1316
1345
|
def _all_refs(self, *, include_history: bool) -> list[RecordRef]:
|
|
1317
1346
|
refs: set[tuple[str, str]] = set()
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1347
|
+
# The per-collection live-id lookups and the history ref list are independent
|
|
1348
|
+
# round-trips; run them concurrently so they overlap instead of summing (issue #31).
|
|
1349
|
+
colls = [coll.name for coll in self.config.collections]
|
|
1350
|
+
tasks: list[Callable[[], list]] = [
|
|
1351
|
+
lambda c=name: [(c, rid) for rid in self.adapter.list_record_ids(c)] for name in colls
|
|
1352
|
+
]
|
|
1353
|
+
# Prefer the cheap two-field history ref list; fall back to query_history for adapters
|
|
1354
|
+
# that don't implement it (it materializes every non-doc field of every history row).
|
|
1355
|
+
list_history_refs = getattr(self.adapter, "list_history_refs", None)
|
|
1321
1356
|
if include_history:
|
|
1322
|
-
# Prefer the cheap two-field ref list; fall back to query_history for adapters
|
|
1323
|
-
# that don't implement it. query_history materializes every non-doc field of
|
|
1324
|
-
# every history row, which is a multi-second hotspot on a remote store.
|
|
1325
|
-
list_history_refs = getattr(self.adapter, "list_history_refs", None)
|
|
1326
1357
|
if callable(list_history_refs):
|
|
1327
|
-
|
|
1358
|
+
tasks.append(lambda: list(list_history_refs()))
|
|
1328
1359
|
else:
|
|
1329
|
-
|
|
1330
|
-
|
|
1360
|
+
tasks.append(
|
|
1361
|
+
lambda: [
|
|
1362
|
+
(row["collection"], row["record_id"])
|
|
1363
|
+
for row in self.adapter.query_history(limit=None, order="asc", with_doc=False)
|
|
1364
|
+
]
|
|
1365
|
+
)
|
|
1366
|
+
for pairs in _gather(tasks):
|
|
1367
|
+
refs.update(pairs)
|
|
1331
1368
|
return [RecordRef(collection, record_id) for collection, record_id in refs]
|
|
1332
1369
|
|
|
1333
1370
|
def _main_doc(self, ref: RecordRef) -> dict[str, Any] | None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|