cfgit 0.1.2__tar.gz → 0.1.3__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.1.2 → cfgit-0.1.3}/PKG-INFO +1 -1
- {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/pyproject.toml +2 -2
- {cfgit-0.1.2 → cfgit-0.1.3}/pyproject.toml +1 -1
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/config.py +1 -7
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/engine.py +7 -1
- {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_config.py +26 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_engine_safety.py +24 -2
- {cfgit-0.1.2 → cfgit-0.1.3}/.github/workflows/ci.yml +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/.github/workflows/publish.yml +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/.gitignore +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/CONTRIBUTING.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/CREDITS.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/LICENSE +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/NOTICE +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/README.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/SECURITY.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/docs/ADAPTERS.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/docs/AGENTS.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/docs/BRANCHING_PLAN.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/docs/CONFIGURATION.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/docs/IDENTITY_AND_ATTRIBUTION.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/docs/PUBLISHING.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/docs/README.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/docs/SPEC.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/docs/SPEC_CORE.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/docs/USAGE.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/docs/screenshots/01-diff.png +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/docs/screenshots/02-impact.png +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/docs/screenshots/03-scoped-impact.png +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/examples/.cfg.toml +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/examples/cfgit-support-demo.toml +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/examples/seed_support_demo.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/README.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/__init__.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/overview.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/providers/__init__.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/providers/base.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/providers/claude.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/providers/factory.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/providers/gemini.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/providers/openai_provider.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/skills/cfgit/SKILL.md +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/__init__.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/adapters/__init__.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/adapters/base.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/adapters/mongo.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/adapters/postgres.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/approval/__init__.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/approval/base.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/cli/__init__.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/cli/main.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/__init__.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/authz.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/diff.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/hashing.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/identity.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/interfaces/__init__.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/interfaces/actions.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/mcp/__init__.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/mcp/server.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/ui/__init__.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/ui/server.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_adapter_contract_live.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_authz.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_console_script.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_core_purity.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_hashing.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_identity.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_impact_boundary.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_mcp_identity.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_mongo_history.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_postgres_history.py +0 -0
- {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_ui_server.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cfgit
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
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.1.
|
|
3
|
+
version = "0.1.3"
|
|
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.1.
|
|
10
|
+
"cfgit>=0.1.3,<0.2.0",
|
|
11
11
|
"httpx>=0.27",
|
|
12
12
|
]
|
|
13
13
|
|
|
@@ -308,13 +308,7 @@ def _resolve_uri(raw: str, *, env_name: str) -> str:
|
|
|
308
308
|
if raw.startswith("env:"):
|
|
309
309
|
key = raw[4:]
|
|
310
310
|
value = os.environ.get(key)
|
|
311
|
-
|
|
312
|
-
return value
|
|
313
|
-
if env_name == "dev":
|
|
314
|
-
fallback = os.environ.get("MONGODB_URI")
|
|
315
|
-
if fallback:
|
|
316
|
-
return fallback
|
|
317
|
-
return ""
|
|
311
|
+
return value or ""
|
|
318
312
|
return raw
|
|
319
313
|
|
|
320
314
|
|
|
@@ -1082,7 +1082,7 @@ class Engine:
|
|
|
1082
1082
|
else:
|
|
1083
1083
|
rows = self.adapter.query_history(collection=ref.collection, record_id=ref.record_id, ref=value, with_doc=True)
|
|
1084
1084
|
if not rows:
|
|
1085
|
-
raise NoSuchConfig(
|
|
1085
|
+
raise NoSuchConfig(_ref_not_found_message(value))
|
|
1086
1086
|
if len(rows) > 1:
|
|
1087
1087
|
raise ValueError(f"ambiguous ref: {value}")
|
|
1088
1088
|
return rows[0]
|
|
@@ -1358,6 +1358,12 @@ def _branch_plan_result(plan: dict[str, Any], *, state: str | None = None) -> di
|
|
|
1358
1358
|
return result
|
|
1359
1359
|
|
|
1360
1360
|
|
|
1361
|
+
def _ref_not_found_message(value: str) -> str:
|
|
1362
|
+
if value.isdecimal():
|
|
1363
|
+
return f"ref not found: {value} (sequence refs use @{value}; bare values are oid prefixes)"
|
|
1364
|
+
return f"ref not found: {value}"
|
|
1365
|
+
|
|
1366
|
+
|
|
1361
1367
|
def _parse_branch_range(value: str, default_branch: str) -> tuple[str, str]:
|
|
1362
1368
|
raw = str(value or "").strip()
|
|
1363
1369
|
if ".." not in raw:
|
|
@@ -32,3 +32,29 @@ db = "cfgit-test"
|
|
|
32
32
|
assert project.branches.enabled is True
|
|
33
33
|
assert project.branches.refs_collection == "cfgit_refs_custom"
|
|
34
34
|
assert project.branches.default_branch == "main"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_env_uri_does_not_fallback_to_generic_mongodb_uri(tmp_path, monkeypatch) -> None:
|
|
38
|
+
monkeypatch.delenv("DEV_MONGODB_URI", raising=False)
|
|
39
|
+
monkeypatch.setenv("MONGODB_URI", "mongodb://wrong.example")
|
|
40
|
+
path = tmp_path / ".cfg.toml"
|
|
41
|
+
path.write_text(
|
|
42
|
+
"""
|
|
43
|
+
[project]
|
|
44
|
+
name = "test"
|
|
45
|
+
|
|
46
|
+
[[collection]]
|
|
47
|
+
name = "demo"
|
|
48
|
+
id_field = "id"
|
|
49
|
+
|
|
50
|
+
[env.dev]
|
|
51
|
+
database = "mongo"
|
|
52
|
+
uri = "env:DEV_MONGODB_URI"
|
|
53
|
+
db = "cfgit-test"
|
|
54
|
+
""",
|
|
55
|
+
encoding="utf-8",
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
project = load_config(path)
|
|
59
|
+
|
|
60
|
+
assert project.envs["dev"].uri == ""
|
|
@@ -152,6 +152,22 @@ def test_single_record_valid_time_ref_resolves_date_syntax() -> None:
|
|
|
152
152
|
assert resolved["doc"]["value"] == "old"
|
|
153
153
|
|
|
154
154
|
|
|
155
|
+
def test_bare_numeric_ref_not_found_points_to_sequence_syntax() -> None:
|
|
156
|
+
coll = CollectionConfig(name="demo", id_field="id")
|
|
157
|
+
row = _history_row(
|
|
158
|
+
coll,
|
|
159
|
+
{"id": "alpha", "value": "old"},
|
|
160
|
+
seq=12,
|
|
161
|
+
valid_from=datetime(2026, 6, 1, tzinfo=timezone.utc),
|
|
162
|
+
)
|
|
163
|
+
engine, _adapter = _engine(collection=coll, history=[row], heads={("demo", "alpha"): row})
|
|
164
|
+
|
|
165
|
+
with pytest.raises(NoSuchConfig, match=r"sequence refs use @12"):
|
|
166
|
+
engine.resolve_ref(RecordRef("demo", "alpha"), "12")
|
|
167
|
+
|
|
168
|
+
assert engine.resolve_ref(RecordRef("demo", "alpha"), "@12")["seq"] == 12
|
|
169
|
+
|
|
170
|
+
|
|
155
171
|
def test_empty_message_is_rejected_in_engine() -> None:
|
|
156
172
|
engine, _adapter = _engine(records={("demo", "alpha"): {"id": "alpha", "value": 1}})
|
|
157
173
|
|
|
@@ -589,8 +605,14 @@ class FakeAdapter:
|
|
|
589
605
|
continue
|
|
590
606
|
if record_id is not None and row["record_id"] != record_id:
|
|
591
607
|
continue
|
|
592
|
-
if ref is not None
|
|
593
|
-
|
|
608
|
+
if ref is not None:
|
|
609
|
+
if ref.startswith("@"):
|
|
610
|
+
if row["seq"] != int(ref[1:]):
|
|
611
|
+
continue
|
|
612
|
+
else:
|
|
613
|
+
oid = ref.removeprefix("sha256:").removeprefix("#")
|
|
614
|
+
if not str(row["oid"]).startswith(oid):
|
|
615
|
+
continue
|
|
594
616
|
if as_of_recorded is not None and row["recorded_at"] > as_of_recorded:
|
|
595
617
|
continue
|
|
596
618
|
if as_of_valid is not 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
|