doubled-graph 3.0.3__tar.gz → 3.0.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.
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/PKG-INFO +18 -17
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/README.md +17 -16
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/pyproject.toml +1 -1
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/health.py +10 -2
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/integrations/cgc.py +157 -22
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/setup.py +64 -3
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/tools/analyze.py +15 -3
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_cgc_backend.py +254 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_cli_entrypoint.py +3 -3
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_health.py +45 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_setup_coverage.py +82 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_smoke.py +40 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/.gitignore +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/ARTICLE.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/INDEX.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/LICENSE +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/for-ai-existing-project/README.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/for-ai-maintenance/README.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/for-ai-new-project/README.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/for-humans/FAQ.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/for-humans/deep-dive.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/for-humans/getting-started.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/README.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/approval-checkpoints.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/artifacts.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/auto-scaling.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/ci-templates/github-actions.yml +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/ci-templates/gitlab-ci.yml +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/drift-and-priority.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/language-adapters/_template.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/language-adapters/csharp.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/language-adapters/go.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/language-adapters/java.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/language-adapters/python.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/language-adapters/rust.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/language-adapters/swift.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/language-adapters/typescript.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/principles.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/roles.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/runtime-adapters/_template.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/runtime-adapters/claude-code.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/runtime-adapters/codex.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/runtime-adapters/continue.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/runtime-adapters/cursor.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/runtime-adapters/local-llm.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/runtime-adapters/windsurf.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/tools.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/methodology/workflow.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/maintenance/on-after-edit.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/maintenance/on-before-edit.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/maintenance/on-drift-detected.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/maintenance/on-user-manual-edit.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/migrate-existing-project/00-entry-prompt.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/migrate-existing-project/01-discover.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/migrate-existing-project/02-reconstruct-intent.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/migrate-existing-project/03-draft-plan.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/migrate-existing-project/04-markup-codebase.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/migrate-existing-project/05-verification-and-logs.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/migrate-existing-project/06-validation-gates.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/new-project/00-entry-prompt.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/new-project/01-intent-interview.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/new-project/02-requirements.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/new-project/03-technology.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/new-project/04-development-plan.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/new-project/05-verification-plan.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/new-project/06-generate.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/new-project/07-post-init-sync.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/upgrade-methodology/00-entry-prompt.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/prompts/upgrade-methodology/01-content-gaps.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/__init__.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/__main__.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/cli.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/config.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/daemon/__init__.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/daemon/main.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/daemon/server.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/data/skills/doubled-graph-after-edit/SKILL.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/data/skills/doubled-graph-before-edit/SKILL.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/data/skills/doubled-graph-drift/SKILL.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/data/skills/doubled-graph-guide/SKILL.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/data/skills/doubled-graph-manual-edit/SKILL.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/data/skills/doubled-graph-refactor/SKILL.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/data/skills/doubled-graph-verify/SKILL.md +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/graphs/__init__.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/graphs/anchors.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/graphs/crossref.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/graphs/declared.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/graphs/grace4.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/hooks_installer.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/integrations/__init__.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/integrations/grace_cli.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/integrations/graphd.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/integrations/service.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/migrations/__init__.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/migrations/grace3_to_grace4.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/policy/__init__.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/policy/agents_md.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/policy/phase.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/server.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/storage/__init__.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/storage/paths.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/tools/__init__.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/tools/_meta.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/tools/context.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/tools/detect_changes.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/tools/impact.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/tools/post_tool.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/tools/provenance.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/src/doubled_graph/uninstall.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/__init__.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/conftest.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_anchors.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_bom_support.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_cgc_contract.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_cgc_lifecycle.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_cli_daemon.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_cli_surface.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_crossref_drift.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_daemon.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_daemon_main.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_declared_coverage.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_e2e_acceptance.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_grace4_artifacts.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_grace_cli_coverage.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_grace_cli_engine.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_graphd_client.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_hook_public_coverage.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_mcp_transport.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_mcp_validation.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_migration_coverage.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_migration_grace3_to_grace4.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_mutation_gate_script.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_mutation_kill_analyze.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_mutation_kill_cgc_edges.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_mutation_kill_cgc_fallback.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_mutation_kill_cgc_misc.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_mutation_kill_context.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_mutation_kill_crossref.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_mutation_kill_hooks.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_mutation_kill_impact.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_mutation_probes.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_packaging.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_platform_branches.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_provenance.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_release_script.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_repo_hygiene.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_service.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_setup_artifacts.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_setup_failure_semantics.py +0 -0
- {doubled_graph-3.0.3 → doubled_graph-3.0.4}/tests/test_uninstall.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: doubled-graph
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.4
|
|
4
4
|
Summary: MCP facade over CodeGraphContext + GRACE 4 (.grace artifacts): impact, context, drift-detect, migration for LLM-driven codebases.
|
|
5
5
|
Project-URL: Homepage, https://github.com/rour/doubled-graph-mcp
|
|
6
6
|
Project-URL: Repository, https://github.com/rour/doubled-graph-mcp
|
|
@@ -88,30 +88,30 @@ pipx ensurepath
|
|
|
88
88
|
|
|
89
89
|
### 2. Установить doubled-graph
|
|
90
90
|
|
|
91
|
-
На PyPI сейчас опубликована **3.0.1**. Версии **3.0.2 и 3.0.
|
|
92
|
-
опубликованы**, поэтому `pipx install doubled-graph` (без версии) на
|
|
91
|
+
На PyPI сейчас опубликована **3.0.1**. Версии **3.0.2, 3.0.3 и 3.0.4 в PyPI
|
|
92
|
+
ещё не опубликованы**, поэтому `pipx install doubled-graph` (без версии) на
|
|
93
93
|
поддерживаемом Python поставит 3.0.1, а `doubled-graph --version` покажет не
|
|
94
|
-
3.0.
|
|
95
|
-
3.0.
|
|
94
|
+
3.0.4. Чтобы поставить именно
|
|
95
|
+
3.0.4 из этого репозитория, соберите wheel поддерживаемым интерпретатором
|
|
96
96
|
(3.11–3.14) и установите его **с явным `--python`**: если сам pipx запущен
|
|
97
97
|
на 3.15, его venv тоже будет 3.15, и pip откажется ставить пакет.
|
|
98
98
|
|
|
99
99
|
```bash
|
|
100
100
|
python3.14 -m pip install build
|
|
101
101
|
python3.14 -m build --wheel
|
|
102
|
-
pipx install --python python3.14 --force dist/doubled_graph-3.0.
|
|
102
|
+
pipx install --python python3.14 --force dist/doubled_graph-3.0.4-py3-none-any.whl
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
Подойдёт любой минор из 3.11–3.14; `--python python3.14` — пример. После
|
|
106
106
|
публикации релиза команда станет обычной и точной:
|
|
107
107
|
|
|
108
108
|
```bash
|
|
109
|
-
pipx install --python python3.14 doubled-graph==3.0.
|
|
109
|
+
pipx install --python python3.14 doubled-graph==3.0.4 # до релиза — wheel выше
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
> Уже работаете в своём venv или conda-окружении? `python3.14 -m pip install
|
|
113
|
-
> doubled-graph` из PyPI тоже поставит 3.0.1; для 3.0.
|
|
114
|
-
> `python3.14 -m pip install dist/doubled_graph-3.0.
|
|
113
|
+
> doubled-graph` из PyPI тоже поставит 3.0.1; для 3.0.4 используйте wheel:
|
|
114
|
+
> `python3.14 -m pip install dist/doubled_graph-3.0.4-py3-none-any.whl`.
|
|
115
115
|
|
|
116
116
|
---
|
|
117
117
|
|
|
@@ -166,7 +166,7 @@ doubled-graph setup
|
|
|
166
166
|
> `pipx install --python python3.12|3.13|3.14 --force doubled-graph==<установленная
|
|
167
167
|
> версия>` (`setup.py::_auto_reinstall_on_working_python`). Версия
|
|
168
168
|
> **запинена**: команда без версии поставила бы опубликованную 3.0.1 и молча
|
|
169
|
-
> откатила 3.0.
|
|
169
|
+
> откатила текущую версию (3.0.4). Это единственная сетевая переустановка пакета; при `--dry-run`
|
|
170
170
|
> она только репортится (`status: "dry_run_reinstall"`), а при `pip install` в
|
|
171
171
|
> venv/CI не выполняется вовсе (`_looks_like_pipx_install()`). Если сети нет
|
|
172
172
|
> или такой версии ещё нет на PyPI, шаг честно возвращает `reinstall_failed`
|
|
@@ -223,7 +223,7 @@ head -1 "$(which doubled-graph)" # вывести shebang — это и ест
|
|
|
223
223
|
### 4. Проверить, что всё встало
|
|
224
224
|
|
|
225
225
|
```bash
|
|
226
|
-
doubled-graph --version # 3.0.
|
|
226
|
+
doubled-graph --version # 3.0.4 (после wheel-установки выше; 3.0.1 при pipx install из PyPI)
|
|
227
227
|
doubled-graph status --repo . # artifacts.project_kind = grace4, grace_engine.upgrade_required = false
|
|
228
228
|
doubled-graph daemon status # installed = true, running = true
|
|
229
229
|
doubled-graph health --repo . # cgc.ok = true (демон ответил)
|
|
@@ -235,7 +235,8 @@ doubled-graph migrate check --repo . # map_pending / placeholders — что
|
|
|
235
235
|
Если `upgrade_required` = `true` — движок старее 4.x: `npm install -g @osovv/grace-cli@4.2.1`, затем `setup` повторно.
|
|
236
236
|
Если `daemon.running` = `false`, а `health.cgc.ok` = `false` — демон не запущен: выполните `doubled-graph setup` в обычном шелле (из песочницы `launchctl`/`systemctl` могут быть запрещены), затем `daemon status`. Без демона графовые команды возвращают `CGC_BACKEND_FAIL` и rc=1 — это не «пустой граф».
|
|
237
237
|
Если `daemon status` показывает `installed: false`, `plist_present: true`, `loaded: false` — plist/unit записан, но job не загружен (launchd отключил сервис, `bootstrap` отклонён, остался stale-lock/сокет). С 3.0.3 это лечится само: `setup` и `daemon restart` останавливают старый процесс, удаляют discovery и stale-lock только при мёртвом PID-владельце, при необходимости выполняют `launchctl enable`/`systemctl unmask`, переписывают unit и делают `bootstrap`, а при отказе показывают реальный stderr супервизора и подсказку `log show --last 1m`. Ручная чистка `~/.doubled-graph` не требуется.
|
|
238
|
-
Если `health.cgc.diagnostic` = `FalkorDB Lite previously failed to start…` — в 3.0.0 это была памятка о прошлой неудаче, а не причина. В 3.0.1 кэш сбрасывается перед каждой попыткой, а мёртвый `falkordb.sock` и осиротевший `graph.settings` удаляются автоматически: первый `analyze`/`setup` чинит репозиторий сам, `health.cgc.repaired` перечисляет удалённое (в 3.0.3 этот список приходит из демона, а не всегда пуст). В 3.0.3 также `setup` всегда перезапускает демон, поэтому обновление не оставляет старый процесс со старым кэшем.
|
|
238
|
+
Если `health.cgc.diagnostic` = `FalkorDB Lite previously failed to start…` — в 3.0.0 это была памятка о прошлой неудаче, а не причина. В 3.0.1 кэш сбрасывается перед каждой попыткой, а мёртвый `falkordb.sock` и осиротевший `graph.settings` удаляются автоматически: первый `analyze`/`setup` чинит репозиторий сам, `health.cgc.repaired` перечисляет удалённое (в 3.0.3 этот список приходит из демона, а не всегда пуст). В 3.0.3 также `setup` всегда перезапускает демон, поэтому обновление не оставляет старый процесс со старым кэшем.
|
|
239
|
+
Если после этого движок всё равно падает с `Connection refused`, а `redis-server` в логах пишет `Can't handle RDB format version 13`, виновата сама база: файл `<db_path>` записан новее, чем умеет читать текущий `redis-server`. С 3.0.4 `_ensure` после двух неудач **переименовывает** его в `<db_path>.incompatible-<UTC timestamp>` (никогда не удаляет), один раз повторяет запуск на свежей базе, а `analyze` эмитит `CGC_ENGINE_DB_QUARANTINED`. `health.cgc.quarantined` перечисляет такие файлы, `health.cgc.repaired` — и их, и удалённые stale-файлы, а `setup` показывает `quarantined` в отчёте шага analyze (и `quarantine_candidate` в `--dry-run`). Если и третий запуск не удался, `CGCUnavailable` перечисляет все попытки и путь карантина; дальше — `daemon logs` и `cgc.backend`.
|
|
239
240
|
Если `lint` вернул `markup.module-map-missing` — это содержательная работа, промпт `prompts/upgrade-methodology/01-content-gaps.md`.
|
|
240
241
|
|
|
241
242
|
Полная проверка (ruff + unit + real-CGC E2E + diff/version): `bash scripts/verify.sh`; критерии готовности — [docs/VERIFICATION.md](docs/VERIFICATION.md).
|
|
@@ -451,10 +452,10 @@ Bun/Node-пакет 4.x: `bun remove -g @osovv/grace-cli` или
|
|
|
451
452
|
|
|
452
453
|
Пошагово с 2.x (или 1.9.x, если проект ещё на `docs/*.xml`):
|
|
453
454
|
|
|
454
|
-
1. **Поставьте именно 3.0.
|
|
455
|
-
**3.0.1**, а не 3.0.
|
|
455
|
+
1. **Поставьте именно 3.0.4.** `pipx upgrade doubled-graph` сейчас даёт
|
|
456
|
+
**3.0.1**, а не 3.0.4 (3.0.2, 3.0.3 и 3.0.4 ещё не в PyPI). Точный путь — wheel с явным
|
|
456
457
|
`--python`: см. [§Установка](#2-установить-doubled-graph). Убедитесь:
|
|
457
|
-
`doubled-graph --version` → `3.0.
|
|
458
|
+
`doubled-graph --version` → `3.0.4`.
|
|
458
459
|
2. **`cd your-project && doubled-graph setup`** — в **обычном** шелле, не из
|
|
459
460
|
песочницы. `setup` **всегда** останавливает и заново запускает сервис
|
|
460
461
|
`graphd` (stop → install/update unit → start), регистрирует проект,
|
|
@@ -483,9 +484,9 @@ Bun/Node-пакет 4.x: `bun remove -g @osovv/grace-cli` или
|
|
|
483
484
|
обновлением на 3.0:
|
|
484
485
|
|
|
485
486
|
```bash
|
|
486
|
-
# 1. поставить 3.0.
|
|
487
|
+
# 1. поставить 3.0.4 (pipx upgrade даст только 3.0.1 — см. §Установка)
|
|
487
488
|
python3.14 -m build --wheel
|
|
488
|
-
pipx install --python python3.14 --force dist/doubled_graph-3.0.
|
|
489
|
+
pipx install --python python3.14 --force dist/doubled_graph-3.0.4-py3-none-any.whl
|
|
489
490
|
cd your-project
|
|
490
491
|
doubled-graph setup # 2. движок, .grace и демон graphd — одной командой
|
|
491
492
|
```
|
|
@@ -47,30 +47,30 @@ pipx ensurepath
|
|
|
47
47
|
|
|
48
48
|
### 2. Установить doubled-graph
|
|
49
49
|
|
|
50
|
-
На PyPI сейчас опубликована **3.0.1**. Версии **3.0.2 и 3.0.
|
|
51
|
-
опубликованы**, поэтому `pipx install doubled-graph` (без версии) на
|
|
50
|
+
На PyPI сейчас опубликована **3.0.1**. Версии **3.0.2, 3.0.3 и 3.0.4 в PyPI
|
|
51
|
+
ещё не опубликованы**, поэтому `pipx install doubled-graph` (без версии) на
|
|
52
52
|
поддерживаемом Python поставит 3.0.1, а `doubled-graph --version` покажет не
|
|
53
|
-
3.0.
|
|
54
|
-
3.0.
|
|
53
|
+
3.0.4. Чтобы поставить именно
|
|
54
|
+
3.0.4 из этого репозитория, соберите wheel поддерживаемым интерпретатором
|
|
55
55
|
(3.11–3.14) и установите его **с явным `--python`**: если сам pipx запущен
|
|
56
56
|
на 3.15, его venv тоже будет 3.15, и pip откажется ставить пакет.
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
59
|
python3.14 -m pip install build
|
|
60
60
|
python3.14 -m build --wheel
|
|
61
|
-
pipx install --python python3.14 --force dist/doubled_graph-3.0.
|
|
61
|
+
pipx install --python python3.14 --force dist/doubled_graph-3.0.4-py3-none-any.whl
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
Подойдёт любой минор из 3.11–3.14; `--python python3.14` — пример. После
|
|
65
65
|
публикации релиза команда станет обычной и точной:
|
|
66
66
|
|
|
67
67
|
```bash
|
|
68
|
-
pipx install --python python3.14 doubled-graph==3.0.
|
|
68
|
+
pipx install --python python3.14 doubled-graph==3.0.4 # до релиза — wheel выше
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
> Уже работаете в своём venv или conda-окружении? `python3.14 -m pip install
|
|
72
|
-
> doubled-graph` из PyPI тоже поставит 3.0.1; для 3.0.
|
|
73
|
-
> `python3.14 -m pip install dist/doubled_graph-3.0.
|
|
72
|
+
> doubled-graph` из PyPI тоже поставит 3.0.1; для 3.0.4 используйте wheel:
|
|
73
|
+
> `python3.14 -m pip install dist/doubled_graph-3.0.4-py3-none-any.whl`.
|
|
74
74
|
|
|
75
75
|
---
|
|
76
76
|
|
|
@@ -125,7 +125,7 @@ doubled-graph setup
|
|
|
125
125
|
> `pipx install --python python3.12|3.13|3.14 --force doubled-graph==<установленная
|
|
126
126
|
> версия>` (`setup.py::_auto_reinstall_on_working_python`). Версия
|
|
127
127
|
> **запинена**: команда без версии поставила бы опубликованную 3.0.1 и молча
|
|
128
|
-
> откатила 3.0.
|
|
128
|
+
> откатила текущую версию (3.0.4). Это единственная сетевая переустановка пакета; при `--dry-run`
|
|
129
129
|
> она только репортится (`status: "dry_run_reinstall"`), а при `pip install` в
|
|
130
130
|
> venv/CI не выполняется вовсе (`_looks_like_pipx_install()`). Если сети нет
|
|
131
131
|
> или такой версии ещё нет на PyPI, шаг честно возвращает `reinstall_failed`
|
|
@@ -182,7 +182,7 @@ head -1 "$(which doubled-graph)" # вывести shebang — это и ест
|
|
|
182
182
|
### 4. Проверить, что всё встало
|
|
183
183
|
|
|
184
184
|
```bash
|
|
185
|
-
doubled-graph --version # 3.0.
|
|
185
|
+
doubled-graph --version # 3.0.4 (после wheel-установки выше; 3.0.1 при pipx install из PyPI)
|
|
186
186
|
doubled-graph status --repo . # artifacts.project_kind = grace4, grace_engine.upgrade_required = false
|
|
187
187
|
doubled-graph daemon status # installed = true, running = true
|
|
188
188
|
doubled-graph health --repo . # cgc.ok = true (демон ответил)
|
|
@@ -194,7 +194,8 @@ doubled-graph migrate check --repo . # map_pending / placeholders — что
|
|
|
194
194
|
Если `upgrade_required` = `true` — движок старее 4.x: `npm install -g @osovv/grace-cli@4.2.1`, затем `setup` повторно.
|
|
195
195
|
Если `daemon.running` = `false`, а `health.cgc.ok` = `false` — демон не запущен: выполните `doubled-graph setup` в обычном шелле (из песочницы `launchctl`/`systemctl` могут быть запрещены), затем `daemon status`. Без демона графовые команды возвращают `CGC_BACKEND_FAIL` и rc=1 — это не «пустой граф».
|
|
196
196
|
Если `daemon status` показывает `installed: false`, `plist_present: true`, `loaded: false` — plist/unit записан, но job не загружен (launchd отключил сервис, `bootstrap` отклонён, остался stale-lock/сокет). С 3.0.3 это лечится само: `setup` и `daemon restart` останавливают старый процесс, удаляют discovery и stale-lock только при мёртвом PID-владельце, при необходимости выполняют `launchctl enable`/`systemctl unmask`, переписывают unit и делают `bootstrap`, а при отказе показывают реальный stderr супервизора и подсказку `log show --last 1m`. Ручная чистка `~/.doubled-graph` не требуется.
|
|
197
|
-
Если `health.cgc.diagnostic` = `FalkorDB Lite previously failed to start…` — в 3.0.0 это была памятка о прошлой неудаче, а не причина. В 3.0.1 кэш сбрасывается перед каждой попыткой, а мёртвый `falkordb.sock` и осиротевший `graph.settings` удаляются автоматически: первый `analyze`/`setup` чинит репозиторий сам, `health.cgc.repaired` перечисляет удалённое (в 3.0.3 этот список приходит из демона, а не всегда пуст). В 3.0.3 также `setup` всегда перезапускает демон, поэтому обновление не оставляет старый процесс со старым кэшем.
|
|
197
|
+
Если `health.cgc.diagnostic` = `FalkorDB Lite previously failed to start…` — в 3.0.0 это была памятка о прошлой неудаче, а не причина. В 3.0.1 кэш сбрасывается перед каждой попыткой, а мёртвый `falkordb.sock` и осиротевший `graph.settings` удаляются автоматически: первый `analyze`/`setup` чинит репозиторий сам, `health.cgc.repaired` перечисляет удалённое (в 3.0.3 этот список приходит из демона, а не всегда пуст). В 3.0.3 также `setup` всегда перезапускает демон, поэтому обновление не оставляет старый процесс со старым кэшем.
|
|
198
|
+
Если после этого движок всё равно падает с `Connection refused`, а `redis-server` в логах пишет `Can't handle RDB format version 13`, виновата сама база: файл `<db_path>` записан новее, чем умеет читать текущий `redis-server`. С 3.0.4 `_ensure` после двух неудач **переименовывает** его в `<db_path>.incompatible-<UTC timestamp>` (никогда не удаляет), один раз повторяет запуск на свежей базе, а `analyze` эмитит `CGC_ENGINE_DB_QUARANTINED`. `health.cgc.quarantined` перечисляет такие файлы, `health.cgc.repaired` — и их, и удалённые stale-файлы, а `setup` показывает `quarantined` в отчёте шага analyze (и `quarantine_candidate` в `--dry-run`). Если и третий запуск не удался, `CGCUnavailable` перечисляет все попытки и путь карантина; дальше — `daemon logs` и `cgc.backend`.
|
|
198
199
|
Если `lint` вернул `markup.module-map-missing` — это содержательная работа, промпт `prompts/upgrade-methodology/01-content-gaps.md`.
|
|
199
200
|
|
|
200
201
|
Полная проверка (ruff + unit + real-CGC E2E + diff/version): `bash scripts/verify.sh`; критерии готовности — [docs/VERIFICATION.md](docs/VERIFICATION.md).
|
|
@@ -410,10 +411,10 @@ Bun/Node-пакет 4.x: `bun remove -g @osovv/grace-cli` или
|
|
|
410
411
|
|
|
411
412
|
Пошагово с 2.x (или 1.9.x, если проект ещё на `docs/*.xml`):
|
|
412
413
|
|
|
413
|
-
1. **Поставьте именно 3.0.
|
|
414
|
-
**3.0.1**, а не 3.0.
|
|
414
|
+
1. **Поставьте именно 3.0.4.** `pipx upgrade doubled-graph` сейчас даёт
|
|
415
|
+
**3.0.1**, а не 3.0.4 (3.0.2, 3.0.3 и 3.0.4 ещё не в PyPI). Точный путь — wheel с явным
|
|
415
416
|
`--python`: см. [§Установка](#2-установить-doubled-graph). Убедитесь:
|
|
416
|
-
`doubled-graph --version` → `3.0.
|
|
417
|
+
`doubled-graph --version` → `3.0.4`.
|
|
417
418
|
2. **`cd your-project && doubled-graph setup`** — в **обычном** шелле, не из
|
|
418
419
|
песочницы. `setup` **всегда** останавливает и заново запускает сервис
|
|
419
420
|
`graphd` (stop → install/update unit → start), регистрирует проект,
|
|
@@ -442,9 +443,9 @@ Bun/Node-пакет 4.x: `bun remove -g @osovv/grace-cli` или
|
|
|
442
443
|
обновлением на 3.0:
|
|
443
444
|
|
|
444
445
|
```bash
|
|
445
|
-
# 1. поставить 3.0.
|
|
446
|
+
# 1. поставить 3.0.4 (pipx upgrade даст только 3.0.1 — см. §Установка)
|
|
446
447
|
python3.14 -m build --wheel
|
|
447
|
-
pipx install --python python3.14 --force dist/doubled_graph-3.0.
|
|
448
|
+
pipx install --python python3.14 --force dist/doubled_graph-3.0.4-py3-none-any.whl
|
|
448
449
|
cd your-project
|
|
449
450
|
doubled-graph setup # 2. движок, .grace и демон graphd — одной командой
|
|
450
451
|
```
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "doubled-graph"
|
|
7
|
-
version = "3.0.
|
|
7
|
+
version = "3.0.4"
|
|
8
8
|
description = "MCP facade over CodeGraphContext + GRACE 4 (.grace artifacts): impact, context, drift-detect, migration for LLM-driven codebases."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -117,6 +117,7 @@ def build_health_report(repo: Path) -> dict[str, Any]:
|
|
|
117
117
|
a health report must degrade into a visible warning, never into a crash.
|
|
118
118
|
"""
|
|
119
119
|
from doubled_graph.graphs.declared import load_declared_graph
|
|
120
|
+
from doubled_graph.integrations.cgc import quarantined_paths
|
|
120
121
|
from doubled_graph.integrations.graphd import open_graph, probe_daemon
|
|
121
122
|
from doubled_graph.integrations.service import get_service_manager
|
|
122
123
|
from doubled_graph.policy.phase import read_phase
|
|
@@ -223,6 +224,11 @@ def build_health_report(repo: Path) -> dict[str, Any]:
|
|
|
223
224
|
}
|
|
224
225
|
)
|
|
225
226
|
|
|
227
|
+
# Engine files removed (or a database quarantined) to heal a failed
|
|
228
|
+
# start. `open_graph` is closed above, but `last_repair` is a plain list
|
|
229
|
+
# on the client, so it survives and stays reportable.
|
|
230
|
+
repaired = list(getattr(cgc, "last_repair", []) or [])
|
|
231
|
+
|
|
226
232
|
return {
|
|
227
233
|
"phase": read_phase(repo),
|
|
228
234
|
"artifacts": {
|
|
@@ -243,8 +249,10 @@ def build_health_report(repo: Path) -> dict[str, Any]:
|
|
|
243
249
|
"diagnostic": cgc_diag,
|
|
244
250
|
"daemon": daemon,
|
|
245
251
|
# Engine files the backend removed because a previous start died
|
|
246
|
-
# halfway
|
|
247
|
-
|
|
252
|
+
# halfway, and databases moved aside because the installed engine
|
|
253
|
+
# cannot read them: both repairs must be visible, not silent.
|
|
254
|
+
"repaired": repaired,
|
|
255
|
+
"quarantined": quarantined_paths(repaired),
|
|
248
256
|
},
|
|
249
257
|
"modules": {
|
|
250
258
|
"total": len(declared.modules),
|
|
@@ -25,6 +25,7 @@ import weakref
|
|
|
25
25
|
from collections import deque
|
|
26
26
|
from collections.abc import Iterable
|
|
27
27
|
from dataclasses import dataclass, field
|
|
28
|
+
from datetime import UTC, datetime
|
|
28
29
|
from pathlib import Path
|
|
29
30
|
from typing import Any, ClassVar, Self
|
|
30
31
|
|
|
@@ -393,6 +394,93 @@ def _repair_stale_engine_state(db_path: str) -> list[str]:
|
|
|
393
394
|
return removed
|
|
394
395
|
|
|
395
396
|
|
|
397
|
+
#: Prefix of a :attr:`CGC.last_repair` entry that names a database moved
|
|
398
|
+
#: aside because the engine could not read it. Kept separate from the
|
|
399
|
+
#: stale-file repairs: the two actions are very different, and callers report
|
|
400
|
+
#: them under different warning codes.
|
|
401
|
+
QUARANTINE_MARKER = "quarantined: "
|
|
402
|
+
|
|
403
|
+
#: ``REDIS`` plus a four-digit RDB format version, e.g. ``REDIS0013``.
|
|
404
|
+
_RDB_HEADER_LEN = 9
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
def rdb_format_version(db_path: str) -> int | None:
|
|
408
|
+
"""Return the RDB format version stored in *db_path*, or None.
|
|
409
|
+
|
|
410
|
+
A FalkorDB Lite database is a Redis RDB file: ``REDIS`` followed by a
|
|
411
|
+
four-digit format version. A ``redis-server`` that does not know the
|
|
412
|
+
version refuses it ("Can't handle RDB format version 13") and exits; the
|
|
413
|
+
wrapper then sees only "Connection refused" from the worker. Reading the
|
|
414
|
+
header turns that into a fact about the file that the error can name.
|
|
415
|
+
"""
|
|
416
|
+
try:
|
|
417
|
+
with open(db_path, "rb") as handle:
|
|
418
|
+
header = handle.read(_RDB_HEADER_LEN)
|
|
419
|
+
except OSError:
|
|
420
|
+
return None
|
|
421
|
+
if len(header) < _RDB_HEADER_LEN or not header.startswith(b"REDIS"):
|
|
422
|
+
return None
|
|
423
|
+
try:
|
|
424
|
+
return int(header[5:])
|
|
425
|
+
except ValueError:
|
|
426
|
+
return None
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
def _quarantine_target(path: Path, stamp: str) -> Path:
|
|
430
|
+
"""Pick a suffix that cannot overwrite an earlier quarantine."""
|
|
431
|
+
target = path.with_name(f"{path.name}.incompatible-{stamp}")
|
|
432
|
+
counter = 1
|
|
433
|
+
while target.exists():
|
|
434
|
+
target = path.with_name(f"{path.name}.incompatible-{stamp}-{counter}")
|
|
435
|
+
counter += 1
|
|
436
|
+
return target
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
def _quarantine_incompatible_db(
|
|
440
|
+
db_path: str, *, now: datetime | None = None
|
|
441
|
+
) -> str | None:
|
|
442
|
+
"""Move an unreadable engine database aside; never delete it.
|
|
443
|
+
|
|
444
|
+
Only an existing non-empty ``<db_path>`` file is renamed, and only once
|
|
445
|
+
per ``_ensure`` call. The data is the user's index: a *worker* that cannot
|
|
446
|
+
read it is the broken part, so the file is preserved under
|
|
447
|
+
``<db_path>.incompatible-<UTC timestamp>`` for inspection or recovery.
|
|
448
|
+
"""
|
|
449
|
+
path = Path(db_path)
|
|
450
|
+
try:
|
|
451
|
+
if not path.is_file() or path.stat().st_size == 0:
|
|
452
|
+
return None
|
|
453
|
+
except OSError:
|
|
454
|
+
return None
|
|
455
|
+
stamp = (now or datetime.now(UTC)).strftime("%Y%m%dT%H%M%SZ")
|
|
456
|
+
target = _quarantine_target(path, stamp)
|
|
457
|
+
try:
|
|
458
|
+
path.rename(target)
|
|
459
|
+
except OSError:
|
|
460
|
+
return None
|
|
461
|
+
return str(target)
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
def quarantined_paths(repairs: Iterable[str]) -> list[str]:
|
|
465
|
+
"""Extract the quarantined database paths from ``CGC.last_repair``."""
|
|
466
|
+
return [
|
|
467
|
+
entry[len(QUARANTINE_MARKER) :]
|
|
468
|
+
for entry in repairs
|
|
469
|
+
if entry.startswith(QUARANTINE_MARKER)
|
|
470
|
+
]
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
def _no_fallback_hint() -> str:
|
|
474
|
+
"""The shared tail of every backend-init failure message."""
|
|
475
|
+
return (
|
|
476
|
+
"No fallback to another backend is attempted: an embedded "
|
|
477
|
+
"fallback would open the same per-repo directory with a "
|
|
478
|
+
"different engine, which can lock or corrupt it. Fix the "
|
|
479
|
+
"backend, or set `cgc.backend` explicitly "
|
|
480
|
+
"(falkordb/kuzu/neo4j) and retry."
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
|
|
396
484
|
def _create_db_manager(db_path: str, db_type: str) -> Any:
|
|
397
485
|
"""Create exactly the requested backend; never accept a silent fallback.
|
|
398
486
|
|
|
@@ -610,41 +698,88 @@ class CGC:
|
|
|
610
698
|
self._db = _create_db_manager(db_path, db_type)
|
|
611
699
|
except CGCUnavailable:
|
|
612
700
|
raise
|
|
613
|
-
except Exception as e:
|
|
614
|
-
#
|
|
615
|
-
# half-written settings file next to the database; every later
|
|
701
|
+
except Exception as e: # noqa: BLE001 — every branch below raises or reopens
|
|
702
|
+
# Attempt 2: a start that died halfway leaves a dead socket and/or
|
|
703
|
+
# a half-written settings file next to the database; every later
|
|
616
704
|
# attempt then fails for good. Repair once and retry: `setup` and
|
|
617
705
|
# `analyze` must heal this without asking the user to delete
|
|
618
706
|
# `~/.codegraphcontext` by hand.
|
|
707
|
+
attempts = [f"start as-is failed: {type(e).__name__}: {e}"]
|
|
708
|
+
failure: Exception = e
|
|
619
709
|
repaired = (
|
|
620
710
|
_repair_stale_engine_state(db_path) if db_type == "falkordb" else []
|
|
621
711
|
)
|
|
622
712
|
if repaired:
|
|
623
713
|
self.last_repair = repaired
|
|
714
|
+
try:
|
|
715
|
+
self._db = _create_db_manager(db_path, db_type)
|
|
716
|
+
except Exception as retry_exc: # noqa: BLE001 — wrapped below
|
|
717
|
+
failure = retry_exc
|
|
718
|
+
attempts.append(
|
|
719
|
+
"retry after removing stale engine files "
|
|
720
|
+
f"({', '.join(repaired)}) failed: "
|
|
721
|
+
f"{type(retry_exc).__name__}: {retry_exc}"
|
|
722
|
+
)
|
|
723
|
+
if self._db is None:
|
|
724
|
+
# Attempt 3: the database file itself can be written in an RDB
|
|
725
|
+
# format this `redis-server` cannot read (macOS incident 3.0.4:
|
|
726
|
+
# a 3.0.3 daemon got only "Connection refused" from a worker
|
|
727
|
+
# that had exited on "Can't handle RDB format version 13").
|
|
728
|
+
# Move the file aside and retry once on a fresh database; the
|
|
729
|
+
# old one is preserved, never deleted.
|
|
730
|
+
rdb_version = (
|
|
731
|
+
rdb_format_version(db_path) if db_type == "falkordb" else None
|
|
732
|
+
)
|
|
733
|
+
quarantine = (
|
|
734
|
+
_quarantine_incompatible_db(db_path)
|
|
735
|
+
if db_type == "falkordb"
|
|
736
|
+
else None
|
|
737
|
+
)
|
|
738
|
+
if quarantine is None:
|
|
739
|
+
if repaired:
|
|
740
|
+
raise CGCUnavailable(
|
|
741
|
+
f"CGC backend {db_type!r} failed to initialise at "
|
|
742
|
+
f"{db_path} even after removing stale engine files "
|
|
743
|
+
f"({', '.join(repaired)}): "
|
|
744
|
+
f"{type(failure).__name__}: {failure}\n"
|
|
745
|
+
f"{_no_fallback_hint()}"
|
|
746
|
+
) from failure
|
|
747
|
+
raise CGCUnavailable(
|
|
748
|
+
f"CGC backend {db_type!r} failed to initialise at "
|
|
749
|
+
f"{db_path}: {type(failure).__name__}: {failure}\n"
|
|
750
|
+
f"{_no_fallback_hint()}"
|
|
751
|
+
) from failure
|
|
752
|
+
self.last_repair = [
|
|
753
|
+
*self.last_repair,
|
|
754
|
+
f"{QUARANTINE_MARKER}{quarantine}",
|
|
755
|
+
]
|
|
756
|
+
diagnosis = (
|
|
757
|
+
f"The database at {db_path} is written as RDB v{rdb_version}, "
|
|
758
|
+
"which the current redis-server cannot read; the file was "
|
|
759
|
+
f"preserved as {quarantine}."
|
|
760
|
+
if rdb_version is not None
|
|
761
|
+
else f"The database at {db_path} was not readable by the "
|
|
762
|
+
"current redis-server; the file was preserved as "
|
|
763
|
+
f"{quarantine}."
|
|
764
|
+
)
|
|
624
765
|
try:
|
|
625
766
|
self._db = _create_db_manager(db_path, db_type)
|
|
626
767
|
except Exception as retry_exc:
|
|
768
|
+
attempts.append(
|
|
769
|
+
f"retry after quarantining the database to {quarantine} "
|
|
770
|
+
f"failed: {type(retry_exc).__name__}: {retry_exc}"
|
|
771
|
+
)
|
|
772
|
+
listing = "\n".join(
|
|
773
|
+
f" {index}. {attempt}"
|
|
774
|
+
for index, attempt in enumerate(attempts, start=1)
|
|
775
|
+
)
|
|
627
776
|
raise CGCUnavailable(
|
|
628
|
-
f"CGC backend {db_type!r} failed to initialise at
|
|
629
|
-
f"
|
|
630
|
-
f"
|
|
631
|
-
f"{
|
|
632
|
-
"
|
|
633
|
-
"fallback would open the same per-repo directory with a "
|
|
634
|
-
"different engine, which can lock or corrupt it. Fix the "
|
|
635
|
-
"backend, or set `cgc.backend` explicitly "
|
|
636
|
-
"(falkordb/kuzu/neo4j) and retry."
|
|
777
|
+
f"CGC backend {db_type!r} failed to initialise at "
|
|
778
|
+
f"{db_path} after {len(attempts)} attempt(s):\n"
|
|
779
|
+
f"{listing}\n"
|
|
780
|
+
f"{diagnosis}\n"
|
|
781
|
+
f"{_no_fallback_hint()}"
|
|
637
782
|
) from retry_exc
|
|
638
|
-
else:
|
|
639
|
-
raise CGCUnavailable(
|
|
640
|
-
f"CGC backend {db_type!r} failed to initialise at {db_path}: "
|
|
641
|
-
f"{type(e).__name__}: {e}\n"
|
|
642
|
-
"No fallback to another backend is attempted: an embedded "
|
|
643
|
-
"fallback would open the same per-repo directory with a "
|
|
644
|
-
"different engine, which can lock or corrupt it. Fix the "
|
|
645
|
-
"backend, or set `cgc.backend` explicitly "
|
|
646
|
-
"(falkordb/kuzu/neo4j) and retry."
|
|
647
|
-
) from e
|
|
648
783
|
finally:
|
|
649
784
|
if previous_db_type is None:
|
|
650
785
|
os.environ.pop("CGC_RUNTIME_DB_TYPE", None)
|
|
@@ -116,7 +116,11 @@ def _summary(result: dict[str, Any]) -> str:
|
|
|
116
116
|
)
|
|
117
117
|
if status == "dry_run":
|
|
118
118
|
command = result.get("command") or result.get("cmd")
|
|
119
|
-
|
|
119
|
+
summary = f"dry-run ({command})" if command else "dry-run"
|
|
120
|
+
candidate = result.get("quarantine_candidate") or {}
|
|
121
|
+
if candidate.get("path"):
|
|
122
|
+
summary += f"; would quarantine {candidate['path']}"
|
|
123
|
+
return summary
|
|
120
124
|
if status == "no_package_manager":
|
|
121
125
|
return "skipped — no JS package manager (bun/npm/yarn/pnpm) found"
|
|
122
126
|
if status == "failed":
|
|
@@ -154,6 +158,13 @@ def _summary(result: dict[str, Any]) -> str:
|
|
|
154
158
|
# "unavailable" — the installation may be healthy.
|
|
155
159
|
return result.get("hint") or "service installed but daemon did not answer"
|
|
156
160
|
if status == "ok":
|
|
161
|
+
if result.get("quarantined"):
|
|
162
|
+
return (
|
|
163
|
+
"done (incompatible engine database quarantined: "
|
|
164
|
+
f"{', '.join(result['quarantined'])})"
|
|
165
|
+
)
|
|
166
|
+
if result.get("repaired"):
|
|
167
|
+
return f"done (engine state repaired: {', '.join(result['repaired'])})"
|
|
157
168
|
return "done"
|
|
158
169
|
if status == "manual":
|
|
159
170
|
return "manual step required — see JSON report"
|
|
@@ -1096,9 +1107,44 @@ _ANALYZE_FATAL_WARNINGS = frozenset(
|
|
|
1096
1107
|
)
|
|
1097
1108
|
|
|
1098
1109
|
|
|
1110
|
+
def _dry_run_quarantine(repo: Path) -> dict[str, Any] | None:
|
|
1111
|
+
"""Name the database a real run could quarantine on a failed start.
|
|
1112
|
+
|
|
1113
|
+
A dry run must not touch the engine, so it cannot know whether the next
|
|
1114
|
+
start fails. It can still report the one file the fallback would move
|
|
1115
|
+
aside: an existing ``<db_path>`` with a readable ``REDIS`` header. The
|
|
1116
|
+
backend is resolved first, because only FalkorDB keeps an RDB file there.
|
|
1117
|
+
"""
|
|
1118
|
+
from doubled_graph.config import load_config
|
|
1119
|
+
from doubled_graph.integrations.cgc import (
|
|
1120
|
+
_backend_db_type,
|
|
1121
|
+
_repo_db_dir,
|
|
1122
|
+
rdb_format_version,
|
|
1123
|
+
)
|
|
1124
|
+
|
|
1125
|
+
try:
|
|
1126
|
+
backend = _backend_db_type(load_config(repo).cgc.backend)
|
|
1127
|
+
except Exception: # noqa: BLE001 — a bad config is analyze's error to report
|
|
1128
|
+
return None
|
|
1129
|
+
if backend != "falkordb":
|
|
1130
|
+
return None
|
|
1131
|
+
db_path = _repo_db_dir(repo, create=False) / "graph"
|
|
1132
|
+
version = rdb_format_version(str(db_path))
|
|
1133
|
+
if version is None:
|
|
1134
|
+
return None
|
|
1135
|
+
return {"path": str(db_path), "rdb_version": version}
|
|
1136
|
+
|
|
1137
|
+
|
|
1099
1138
|
def _first_analyze(repo: Path, dry_run: bool) -> dict[str, Any]:
|
|
1100
1139
|
if dry_run:
|
|
1101
|
-
|
|
1140
|
+
result: dict[str, Any] = {
|
|
1141
|
+
"status": "dry_run",
|
|
1142
|
+
"cmd": "doubled-graph analyze --mode full",
|
|
1143
|
+
}
|
|
1144
|
+
candidate = _dry_run_quarantine(repo)
|
|
1145
|
+
if candidate is not None:
|
|
1146
|
+
result["quarantine_candidate"] = candidate
|
|
1147
|
+
return result
|
|
1102
1148
|
from doubled_graph.tools.analyze import analyze
|
|
1103
1149
|
|
|
1104
1150
|
try:
|
|
@@ -1111,15 +1157,30 @@ def _first_analyze(repo: Path, dry_run: bool) -> dict[str, Any]:
|
|
|
1111
1157
|
"hint": str(e),
|
|
1112
1158
|
}
|
|
1113
1159
|
warning_codes = [w.code for w in res.warnings]
|
|
1160
|
+
repaired = [
|
|
1161
|
+
getattr(w, "detail", "")
|
|
1162
|
+
for w in res.warnings
|
|
1163
|
+
if w.code == "CGC_ENGINE_REPAIRED"
|
|
1164
|
+
]
|
|
1165
|
+
quarantined = [
|
|
1166
|
+
getattr(w, "detail", "")
|
|
1167
|
+
for w in res.warnings
|
|
1168
|
+
if w.code == "CGC_ENGINE_DB_QUARANTINED"
|
|
1169
|
+
]
|
|
1114
1170
|
stats = getattr(res, "stats", None)
|
|
1115
1171
|
files_processed = int(getattr(stats, "files_processed", 0) or 0)
|
|
1116
1172
|
fatal = [code for code in warning_codes if code in _ANALYZE_FATAL_WARNINGS]
|
|
1117
|
-
result
|
|
1173
|
+
result = {
|
|
1118
1174
|
"status": "ok",
|
|
1119
1175
|
"mode_used": res.mode_used,
|
|
1120
1176
|
"duration_ms": res.duration_ms,
|
|
1121
1177
|
"files_processed": files_processed,
|
|
1122
1178
|
"warnings": warning_codes,
|
|
1179
|
+
# The engine may have healed itself during this very step. Keep the
|
|
1180
|
+
# evidence in the setup report: a silent repair looks like "it just
|
|
1181
|
+
# worked", and the next failure would be investigated from scratch.
|
|
1182
|
+
"repaired": repaired,
|
|
1183
|
+
"quarantined": quarantined,
|
|
1123
1184
|
}
|
|
1124
1185
|
if fatal or files_processed == 0:
|
|
1125
1186
|
# Fail closed: `analyze()` reports backend/parse failures as warnings,
|
|
@@ -22,6 +22,7 @@ from doubled_graph.graphs.grace4 import CODE_EXTENSIONS, DEFAULT_IGNORED_DIRS
|
|
|
22
22
|
from doubled_graph.integrations.cgc import (
|
|
23
23
|
CGC,
|
|
24
24
|
CGC_UNPARSEABLE_EXTENSIONS,
|
|
25
|
+
QUARANTINE_MARKER,
|
|
25
26
|
CGCUnavailable,
|
|
26
27
|
)
|
|
27
28
|
from doubled_graph.integrations.graphd import engine_mode, open_graph, probe_daemon
|
|
@@ -554,10 +555,21 @@ def _analyze_unlocked(
|
|
|
554
555
|
cgc.close()
|
|
555
556
|
|
|
556
557
|
# The backend may have healed a half-written engine state (dead socket,
|
|
557
|
-
# orphaned settings)
|
|
558
|
-
#
|
|
559
|
-
# investigated from scratch.
|
|
558
|
+
# orphaned settings) or moved an incompatible database aside before this
|
|
559
|
+
# run produced any data. Report it: a silent repair looks like "it just
|
|
560
|
+
# worked", and the next real failure would be investigated from scratch.
|
|
560
561
|
for repaired in getattr(cgc, "last_repair", []) or []:
|
|
562
|
+
if repaired.startswith(QUARANTINE_MARKER):
|
|
563
|
+
warnings.append(
|
|
564
|
+
AnalyzeWarning(
|
|
565
|
+
code="CGC_ENGINE_DB_QUARANTINED",
|
|
566
|
+
detail=(
|
|
567
|
+
"moved an incompatible engine database aside after a "
|
|
568
|
+
f"failed start: {repaired[len(QUARANTINE_MARKER):]}"
|
|
569
|
+
),
|
|
570
|
+
)
|
|
571
|
+
)
|
|
572
|
+
continue
|
|
561
573
|
warnings.append(
|
|
562
574
|
AnalyzeWarning(
|
|
563
575
|
code="CGC_ENGINE_REPAIRED",
|