diffcontext 0.5.5__tar.gz → 0.5.6__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. {diffcontext-0.5.5 → diffcontext-0.5.6}/PKG-INFO +1 -1
  2. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/__init__.py +1 -1
  3. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/cache.py +10 -4
  4. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext.egg-info/PKG-INFO +1 -1
  5. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_cache_fallback.py +29 -0
  6. {diffcontext-0.5.5 → diffcontext-0.5.6}/LICENSE +0 -0
  7. {diffcontext-0.5.5 → diffcontext-0.5.6}/README.md +0 -0
  8. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/_warn_once.py +0 -0
  9. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/cli/__init__.py +0 -0
  10. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/context/__init__.py +0 -0
  11. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/context/compiler.py +0 -0
  12. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/context/selector.py +0 -0
  13. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/diff/__init__.py +0 -0
  14. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/diff/git_diff.py +0 -0
  15. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/diff/state_manager.py +0 -0
  16. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/graph_builder.py +0 -0
  17. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/history.py +0 -0
  18. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/impact/__init__.py +0 -0
  19. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/impact/blast_radius.py +0 -0
  20. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/impact/scoring.py +0 -0
  21. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/impact/traversal.py +0 -0
  22. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/impact/visualizer.py +0 -0
  23. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/languages/__init__.py +0 -0
  24. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/languages/typescript.py +0 -0
  25. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/lexical.py +0 -0
  26. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/mcp_server.py +0 -0
  27. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/models.py +0 -0
  28. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/parser.py +0 -0
  29. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/pipeline.py +0 -0
  30. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/py.typed +0 -0
  31. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/rerank/__init__.py +0 -0
  32. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/rerank/features.py +0 -0
  33. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/rerank/model.py +0 -0
  34. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/resolver.py +0 -0
  35. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/scanner.py +0 -0
  36. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/symbols.py +0 -0
  37. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/verify/__init__.py +0 -0
  38. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/verify/cases.py +0 -0
  39. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/verify/history.py +0 -0
  40. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/verify/sufficiency.py +0 -0
  41. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext.egg-info/SOURCES.txt +0 -0
  42. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext.egg-info/dependency_links.txt +0 -0
  43. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext.egg-info/entry_points.txt +0 -0
  44. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext.egg-info/requires.txt +0 -0
  45. {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext.egg-info/top_level.txt +0 -0
  46. {diffcontext-0.5.5 → diffcontext-0.5.6}/pyproject.toml +0 -0
  47. {diffcontext-0.5.5 → diffcontext-0.5.6}/setup.cfg +0 -0
  48. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_cache.py +0 -0
  49. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_compiler_meta.py +0 -0
  50. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_core.py +0 -0
  51. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_cutoff.py +0 -0
  52. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_determinism.py +0 -0
  53. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_downstream_eval.py +0 -0
  54. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_git_diff.py +0 -0
  55. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_harness_api.py +0 -0
  56. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_history.py +0 -0
  57. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_incremental.py +0 -0
  58. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_index_scoping.py +0 -0
  59. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_lexical.py +0 -0
  60. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_mcp_server.py +0 -0
  61. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_rerank.py +0 -0
  62. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_semantic_ablation.py +0 -0
  63. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_semantic_audit.py +0 -0
  64. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_semantic_gap.py +0 -0
  65. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_semantic_metrics.py +0 -0
  66. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_semantic_mine.py +0 -0
  67. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_service_clone.py +0 -0
  68. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_src_layout.py +0 -0
  69. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_stats.py +0 -0
  70. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_token_budget.py +0 -0
  71. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_typescript_adapter.py +0 -0
  72. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_verify.py +0 -0
  73. {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffcontext
3
- Version: 0.5.5
3
+ Version: 0.5.6
4
4
  Summary: Static-analysis-powered repository context compiler for LLMs
5
5
  Author-email: Trakshan Mishra <trakshanmishra477@gmail.com>
6
6
  License: MIT
@@ -32,7 +32,7 @@ Usage as a library:
32
32
  print(ctx.reduction_pct) # how much code was filtered out
33
33
  """
34
34
 
35
- __version__ = "0.5.5"
35
+ __version__ = "0.5.6"
36
36
 
37
37
  # Public, semver-covered API. Everything not listed here (graph_builder,
38
38
  # resolver, symbols, scanner, parser internals) is importable but carries no
@@ -74,18 +74,24 @@ def _resolve_cache_path(
74
74
  if cache_dir:
75
75
  try:
76
76
  os.makedirs(cache_dir, exist_ok=True)
77
+ return os.path.join(cache_dir, ".diffcontext_cache.db")
77
78
  except OSError:
78
- pass
79
- return os.path.join(cache_dir, ".diffcontext_cache.db")
79
+ logger.warning(
80
+ "cache: --cache-dir %s is not writable; falling through cascade",
81
+ cache_dir,
82
+ )
80
83
 
81
84
  # 2. Env var override
82
85
  env_cache_dir = os.environ.get("DIFFCONTEXT_CACHE_DIR")
83
86
  if env_cache_dir:
84
87
  try:
85
88
  os.makedirs(env_cache_dir, exist_ok=True)
89
+ return os.path.join(env_cache_dir, ".diffcontext_cache.db")
86
90
  except OSError:
87
- pass
88
- return os.path.join(env_cache_dir, ".diffcontext_cache.db")
91
+ logger.warning(
92
+ "cache: DIFFCONTEXT_CACHE_DIR=%s is not writable; falling through cascade",
93
+ env_cache_dir,
94
+ )
89
95
 
90
96
  # 3. In-repo path (current behaviour, keeps cache locality)
91
97
  if repo_path:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffcontext
3
- Version: 0.5.5
3
+ Version: 0.5.6
4
4
  Summary: Static-analysis-powered repository context compiler for LLMs
5
5
  Author-email: Trakshan Mishra <trakshanmishra477@gmail.com>
6
6
  License: MIT
@@ -119,3 +119,32 @@ class TestReadOnlyRepoIndexing:
119
119
  os.chmod(root, 0o755)
120
120
  for f in files:
121
121
  os.chmod(os.path.join(root, f), 0o644)
122
+
123
+ def test_unwritable_env_var_falls_through(self, tmp_path, monkeypatch):
124
+ """DIFFCONTEXT_CACHE_DIR pointing to an unwritable path must NOT crash —
125
+ the cascade continues to tiers 3-5 instead of returning the bad path.
126
+
127
+ Previously, tiers 1/2 swallowed the OSError from makedirs but returned
128
+ the unusable path anyway, short-circuiting the cascade. This test pins
129
+ the fix: an explicit override that can't be honoured warns and degrades,
130
+ not crashes.
131
+ """
132
+ monkeypatch.setenv("DIFFCONTEXT_CACHE_DIR", "/nonexistent/unwritable/path")
133
+ monkeypatch.setenv("XDG_CACHE_HOME", "/also/nonexistent")
134
+
135
+ idx = index_repository(SIMPLE)
136
+ assert len(idx.symbols) > 0, (
137
+ "unwritable DIFFCONTEXT_CACHE_DIR must fall through to :memory:, "
138
+ "not crash with OperationalError"
139
+ )
140
+
141
+ def test_unwritable_cache_dir_flag_falls_through(self, tmp_path, monkeypatch):
142
+ """--cache-dir pointing to an unwritable path must NOT crash either."""
143
+ monkeypatch.delenv("DIFFCONTEXT_CACHE_DIR", raising=False)
144
+ monkeypatch.setenv("XDG_CACHE_HOME", "/also/nonexistent")
145
+
146
+ idx = index_repository(SIMPLE, cache_dir="/nonexistent/unwritable/path")
147
+ assert len(idx.symbols) > 0, (
148
+ "unwritable --cache-dir must fall through to :memory:, "
149
+ "not crash with OperationalError"
150
+ )
File without changes
File without changes
File without changes
File without changes