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.
Files changed (73) hide show
  1. {cfgit-0.1.2 → cfgit-0.1.3}/PKG-INFO +1 -1
  2. {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/pyproject.toml +2 -2
  3. {cfgit-0.1.2 → cfgit-0.1.3}/pyproject.toml +1 -1
  4. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/config.py +1 -7
  5. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/engine.py +7 -1
  6. {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_config.py +26 -0
  7. {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_engine_safety.py +24 -2
  8. {cfgit-0.1.2 → cfgit-0.1.3}/.github/workflows/ci.yml +0 -0
  9. {cfgit-0.1.2 → cfgit-0.1.3}/.github/workflows/publish.yml +0 -0
  10. {cfgit-0.1.2 → cfgit-0.1.3}/.gitignore +0 -0
  11. {cfgit-0.1.2 → cfgit-0.1.3}/CONTRIBUTING.md +0 -0
  12. {cfgit-0.1.2 → cfgit-0.1.3}/CREDITS.md +0 -0
  13. {cfgit-0.1.2 → cfgit-0.1.3}/LICENSE +0 -0
  14. {cfgit-0.1.2 → cfgit-0.1.3}/NOTICE +0 -0
  15. {cfgit-0.1.2 → cfgit-0.1.3}/README.md +0 -0
  16. {cfgit-0.1.2 → cfgit-0.1.3}/SECURITY.md +0 -0
  17. {cfgit-0.1.2 → cfgit-0.1.3}/docs/ADAPTERS.md +0 -0
  18. {cfgit-0.1.2 → cfgit-0.1.3}/docs/AGENTS.md +0 -0
  19. {cfgit-0.1.2 → cfgit-0.1.3}/docs/BRANCHING_PLAN.md +0 -0
  20. {cfgit-0.1.2 → cfgit-0.1.3}/docs/CONFIGURATION.md +0 -0
  21. {cfgit-0.1.2 → cfgit-0.1.3}/docs/IDENTITY_AND_ATTRIBUTION.md +0 -0
  22. {cfgit-0.1.2 → cfgit-0.1.3}/docs/PUBLISHING.md +0 -0
  23. {cfgit-0.1.2 → cfgit-0.1.3}/docs/README.md +0 -0
  24. {cfgit-0.1.2 → cfgit-0.1.3}/docs/SPEC.md +0 -0
  25. {cfgit-0.1.2 → cfgit-0.1.3}/docs/SPEC_CORE.md +0 -0
  26. {cfgit-0.1.2 → cfgit-0.1.3}/docs/USAGE.md +0 -0
  27. {cfgit-0.1.2 → cfgit-0.1.3}/docs/screenshots/01-diff.png +0 -0
  28. {cfgit-0.1.2 → cfgit-0.1.3}/docs/screenshots/02-impact.png +0 -0
  29. {cfgit-0.1.2 → cfgit-0.1.3}/docs/screenshots/03-scoped-impact.png +0 -0
  30. {cfgit-0.1.2 → cfgit-0.1.3}/examples/.cfg.toml +0 -0
  31. {cfgit-0.1.2 → cfgit-0.1.3}/examples/cfgit-support-demo.toml +0 -0
  32. {cfgit-0.1.2 → cfgit-0.1.3}/examples/seed_support_demo.py +0 -0
  33. {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/README.md +0 -0
  34. {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/__init__.py +0 -0
  35. {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/overview.py +0 -0
  36. {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/providers/__init__.py +0 -0
  37. {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/providers/base.py +0 -0
  38. {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/providers/claude.py +0 -0
  39. {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/providers/factory.py +0 -0
  40. {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/providers/gemini.py +0 -0
  41. {cfgit-0.1.2 → cfgit-0.1.3}/plugins/cfg_impact/cfg_impact/providers/openai_provider.py +0 -0
  42. {cfgit-0.1.2 → cfgit-0.1.3}/skills/cfgit/SKILL.md +0 -0
  43. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/__init__.py +0 -0
  44. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/adapters/__init__.py +0 -0
  45. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/adapters/base.py +0 -0
  46. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/adapters/mongo.py +0 -0
  47. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/adapters/postgres.py +0 -0
  48. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/approval/__init__.py +0 -0
  49. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/approval/base.py +0 -0
  50. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/cli/__init__.py +0 -0
  51. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/cli/main.py +0 -0
  52. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/__init__.py +0 -0
  53. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/authz.py +0 -0
  54. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/diff.py +0 -0
  55. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/hashing.py +0 -0
  56. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/core/identity.py +0 -0
  57. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/interfaces/__init__.py +0 -0
  58. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/interfaces/actions.py +0 -0
  59. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/mcp/__init__.py +0 -0
  60. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/mcp/server.py +0 -0
  61. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/ui/__init__.py +0 -0
  62. {cfgit-0.1.2 → cfgit-0.1.3}/src/cfg/ui/server.py +0 -0
  63. {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_adapter_contract_live.py +0 -0
  64. {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_authz.py +0 -0
  65. {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_console_script.py +0 -0
  66. {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_core_purity.py +0 -0
  67. {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_hashing.py +0 -0
  68. {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_identity.py +0 -0
  69. {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_impact_boundary.py +0 -0
  70. {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_mcp_identity.py +0 -0
  71. {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_mongo_history.py +0 -0
  72. {cfgit-0.1.2 → cfgit-0.1.3}/tests/test_postgres_history.py +0 -0
  73. {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.2
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.2"
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.2,<0.2.0",
10
+ "cfgit>=0.1.3,<0.2.0",
11
11
  "httpx>=0.27",
12
12
  ]
13
13
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cfgit"
3
- version = "0.1.2"
3
+ version = "0.1.3"
4
4
  description = "Git-style history, diff, drift detection, and rollback for live database records without migrating or owning your datastore"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -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
- if value:
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(f"ref not found: {value}")
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 and ref.startswith("@") and row["seq"] != int(ref[1:]):
593
- continue
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