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.
- {diffcontext-0.5.5 → diffcontext-0.5.6}/PKG-INFO +1 -1
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/__init__.py +1 -1
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/cache.py +10 -4
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext.egg-info/PKG-INFO +1 -1
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_cache_fallback.py +29 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/LICENSE +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/README.md +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/_warn_once.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/cli/__init__.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/context/__init__.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/context/compiler.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/context/selector.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/diff/__init__.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/diff/git_diff.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/diff/state_manager.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/graph_builder.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/history.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/impact/__init__.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/impact/blast_radius.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/impact/scoring.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/impact/traversal.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/impact/visualizer.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/languages/__init__.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/languages/typescript.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/lexical.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/mcp_server.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/models.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/parser.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/pipeline.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/py.typed +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/rerank/__init__.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/rerank/features.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/rerank/model.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/resolver.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/scanner.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/symbols.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/verify/__init__.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/verify/cases.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/verify/history.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext/verify/sufficiency.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext.egg-info/SOURCES.txt +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext.egg-info/dependency_links.txt +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext.egg-info/entry_points.txt +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext.egg-info/requires.txt +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/diffcontext.egg-info/top_level.txt +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/pyproject.toml +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/setup.cfg +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_cache.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_compiler_meta.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_core.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_cutoff.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_determinism.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_downstream_eval.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_git_diff.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_harness_api.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_history.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_incremental.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_index_scoping.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_lexical.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_mcp_server.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_rerank.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_semantic_ablation.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_semantic_audit.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_semantic_gap.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_semantic_metrics.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_semantic_mine.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_service_clone.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_src_layout.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_stats.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_token_budget.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_typescript_adapter.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_verify.py +0 -0
- {diffcontext-0.5.5 → diffcontext-0.5.6}/tests/test_version.py +0 -0
|
@@ -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.
|
|
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
|
-
|
|
79
|
-
|
|
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
|
-
|
|
88
|
-
|
|
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:
|
|
@@ -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
|
|
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
|