doubled-graph 3.0.2__tar.gz → 3.0.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.
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/PKG-INFO +18 -17
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/README.md +17 -16
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/pyproject.toml +1 -1
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/cli.py +18 -7
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/daemon/main.py +10 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/daemon/server.py +139 -21
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/health.py +11 -6
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/integrations/graphd.py +28 -6
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/integrations/service.py +425 -48
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/setup.py +24 -14
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_cli_daemon.py +87 -2
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_cli_entrypoint.py +3 -3
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_daemon.py +289 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_daemon_main.py +20 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_graphd_client.py +19 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_health.py +33 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_service.py +523 -10
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/.gitignore +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/ARTICLE.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/INDEX.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/LICENSE +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/for-ai-existing-project/README.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/for-ai-maintenance/README.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/for-ai-new-project/README.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/for-humans/FAQ.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/for-humans/deep-dive.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/for-humans/getting-started.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/README.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/approval-checkpoints.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/artifacts.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/auto-scaling.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/ci-templates/github-actions.yml +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/ci-templates/gitlab-ci.yml +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/drift-and-priority.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/language-adapters/_template.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/language-adapters/csharp.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/language-adapters/go.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/language-adapters/java.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/language-adapters/python.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/language-adapters/rust.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/language-adapters/swift.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/language-adapters/typescript.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/principles.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/roles.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/runtime-adapters/_template.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/runtime-adapters/claude-code.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/runtime-adapters/codex.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/runtime-adapters/continue.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/runtime-adapters/cursor.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/runtime-adapters/local-llm.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/runtime-adapters/windsurf.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/tools.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/methodology/workflow.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/maintenance/on-after-edit.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/maintenance/on-before-edit.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/maintenance/on-drift-detected.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/maintenance/on-user-manual-edit.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/migrate-existing-project/00-entry-prompt.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/migrate-existing-project/01-discover.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/migrate-existing-project/02-reconstruct-intent.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/migrate-existing-project/03-draft-plan.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/migrate-existing-project/04-markup-codebase.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/migrate-existing-project/05-verification-and-logs.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/migrate-existing-project/06-validation-gates.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/new-project/00-entry-prompt.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/new-project/01-intent-interview.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/new-project/02-requirements.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/new-project/03-technology.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/new-project/04-development-plan.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/new-project/05-verification-plan.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/new-project/06-generate.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/new-project/07-post-init-sync.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/upgrade-methodology/00-entry-prompt.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/prompts/upgrade-methodology/01-content-gaps.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/__init__.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/__main__.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/config.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/daemon/__init__.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/data/skills/doubled-graph-after-edit/SKILL.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/data/skills/doubled-graph-before-edit/SKILL.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/data/skills/doubled-graph-drift/SKILL.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/data/skills/doubled-graph-guide/SKILL.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/data/skills/doubled-graph-manual-edit/SKILL.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/data/skills/doubled-graph-refactor/SKILL.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/data/skills/doubled-graph-verify/SKILL.md +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/graphs/__init__.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/graphs/anchors.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/graphs/crossref.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/graphs/declared.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/graphs/grace4.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/hooks_installer.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/integrations/__init__.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/integrations/cgc.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/integrations/grace_cli.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/migrations/__init__.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/migrations/grace3_to_grace4.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/policy/__init__.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/policy/agents_md.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/policy/phase.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/server.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/storage/__init__.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/storage/paths.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/tools/__init__.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/tools/_meta.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/tools/analyze.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/tools/context.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/tools/detect_changes.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/tools/impact.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/tools/post_tool.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/tools/provenance.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/src/doubled_graph/uninstall.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/__init__.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/conftest.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_anchors.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_bom_support.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_cgc_backend.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_cgc_contract.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_cgc_lifecycle.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_cli_surface.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_crossref_drift.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_declared_coverage.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_e2e_acceptance.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_grace4_artifacts.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_grace_cli_coverage.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_grace_cli_engine.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_hook_public_coverage.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_mcp_transport.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_mcp_validation.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_migration_coverage.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_migration_grace3_to_grace4.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_mutation_gate_script.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_mutation_kill_analyze.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_mutation_kill_cgc_edges.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_mutation_kill_cgc_fallback.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_mutation_kill_cgc_misc.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_mutation_kill_context.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_mutation_kill_crossref.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_mutation_kill_hooks.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_mutation_kill_impact.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_mutation_probes.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_packaging.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_platform_branches.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_provenance.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_release_script.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_repo_hygiene.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_setup_artifacts.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_setup_coverage.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_setup_failure_semantics.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/tests/test_smoke.py +0 -0
- {doubled_graph-3.0.2 → doubled_graph-3.0.3}/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.3
|
|
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**.
|
|
92
|
-
|
|
91
|
+
На PyPI сейчас опубликована **3.0.1**. Версии **3.0.2 и 3.0.3 в PyPI ещё не
|
|
92
|
+
опубликованы**, поэтому `pipx install doubled-graph` (без версии) на
|
|
93
93
|
поддерживаемом Python поставит 3.0.1, а `doubled-graph --version` покажет не
|
|
94
|
-
3.0.
|
|
95
|
-
3.0.
|
|
94
|
+
3.0.3. Чтобы поставить именно
|
|
95
|
+
3.0.3 из этого репозитория, соберите 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.3-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.3 # до релиза — 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.3 используйте wheel:
|
|
114
|
+
> `python3.14 -m pip install dist/doubled_graph-3.0.3-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.3. Это единственная сетевая переустановка пакета; при `--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.3 (после 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 (демон ответил)
|
|
@@ -234,7 +234,8 @@ doubled-graph migrate check --repo . # map_pending / placeholders — что
|
|
|
234
234
|
Если `project_kind` = `grace3` — артефакты ещё не перенесены: `doubled-graph setup --repo .`.
|
|
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` всегда перезапускает демон, поэтому обновление не оставляет старый процесс со старым кэшем. Если ошибка осталась — это настоящий сбой движка: `daemon logs` и `cgc.backend`.
|
|
238
239
|
Если `lint` вернул `markup.module-map-missing` — это содержательная работа, промпт `prompts/upgrade-methodology/01-content-gaps.md`.
|
|
239
240
|
|
|
240
241
|
Полная проверка (ruff + unit + real-CGC E2E + diff/version): `bash scripts/verify.sh`; критерии готовности — [docs/VERIFICATION.md](docs/VERIFICATION.md).
|
|
@@ -450,10 +451,10 @@ Bun/Node-пакет 4.x: `bun remove -g @osovv/grace-cli` или
|
|
|
450
451
|
|
|
451
452
|
Пошагово с 2.x (или 1.9.x, если проект ещё на `docs/*.xml`):
|
|
452
453
|
|
|
453
|
-
1. **Поставьте именно 3.0.
|
|
454
|
-
**3.0.1**, а не 3.0.
|
|
454
|
+
1. **Поставьте именно 3.0.3.** `pipx upgrade doubled-graph` сейчас даёт
|
|
455
|
+
**3.0.1**, а не 3.0.3 (3.0.2 и 3.0.3 ещё не в PyPI). Точный путь — wheel с явным
|
|
455
456
|
`--python`: см. [§Установка](#2-установить-doubled-graph). Убедитесь:
|
|
456
|
-
`doubled-graph --version` → `3.0.
|
|
457
|
+
`doubled-graph --version` → `3.0.3`.
|
|
457
458
|
2. **`cd your-project && doubled-graph setup`** — в **обычном** шелле, не из
|
|
458
459
|
песочницы. `setup` **всегда** останавливает и заново запускает сервис
|
|
459
460
|
`graphd` (stop → install/update unit → start), регистрирует проект,
|
|
@@ -482,9 +483,9 @@ Bun/Node-пакет 4.x: `bun remove -g @osovv/grace-cli` или
|
|
|
482
483
|
обновлением на 3.0:
|
|
483
484
|
|
|
484
485
|
```bash
|
|
485
|
-
# 1. поставить 3.0.
|
|
486
|
+
# 1. поставить 3.0.3 (pipx upgrade даст только 3.0.1 — см. §Установка)
|
|
486
487
|
python3.14 -m build --wheel
|
|
487
|
-
pipx install --python python3.14 --force dist/doubled_graph-3.0.
|
|
488
|
+
pipx install --python python3.14 --force dist/doubled_graph-3.0.3-py3-none-any.whl
|
|
488
489
|
cd your-project
|
|
489
490
|
doubled-graph setup # 2. движок, .grace и демон graphd — одной командой
|
|
490
491
|
```
|
|
@@ -47,30 +47,30 @@ pipx ensurepath
|
|
|
47
47
|
|
|
48
48
|
### 2. Установить doubled-graph
|
|
49
49
|
|
|
50
|
-
На PyPI сейчас опубликована **3.0.1**.
|
|
51
|
-
|
|
50
|
+
На PyPI сейчас опубликована **3.0.1**. Версии **3.0.2 и 3.0.3 в PyPI ещё не
|
|
51
|
+
опубликованы**, поэтому `pipx install doubled-graph` (без версии) на
|
|
52
52
|
поддерживаемом Python поставит 3.0.1, а `doubled-graph --version` покажет не
|
|
53
|
-
3.0.
|
|
54
|
-
3.0.
|
|
53
|
+
3.0.3. Чтобы поставить именно
|
|
54
|
+
3.0.3 из этого репозитория, соберите 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.3-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.3 # до релиза — 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.3 используйте wheel:
|
|
73
|
+
> `python3.14 -m pip install dist/doubled_graph-3.0.3-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.3. Это единственная сетевая переустановка пакета; при `--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.3 (после 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 (демон ответил)
|
|
@@ -193,7 +193,8 @@ doubled-graph migrate check --repo . # map_pending / placeholders — что
|
|
|
193
193
|
Если `project_kind` = `grace3` — артефакты ещё не перенесены: `doubled-graph setup --repo .`.
|
|
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` всегда перезапускает демон, поэтому обновление не оставляет старый процесс со старым кэшем. Если ошибка осталась — это настоящий сбой движка: `daemon logs` и `cgc.backend`.
|
|
197
198
|
Если `lint` вернул `markup.module-map-missing` — это содержательная работа, промпт `prompts/upgrade-methodology/01-content-gaps.md`.
|
|
198
199
|
|
|
199
200
|
Полная проверка (ruff + unit + real-CGC E2E + diff/version): `bash scripts/verify.sh`; критерии готовности — [docs/VERIFICATION.md](docs/VERIFICATION.md).
|
|
@@ -409,10 +410,10 @@ Bun/Node-пакет 4.x: `bun remove -g @osovv/grace-cli` или
|
|
|
409
410
|
|
|
410
411
|
Пошагово с 2.x (или 1.9.x, если проект ещё на `docs/*.xml`):
|
|
411
412
|
|
|
412
|
-
1. **Поставьте именно 3.0.
|
|
413
|
-
**3.0.1**, а не 3.0.
|
|
413
|
+
1. **Поставьте именно 3.0.3.** `pipx upgrade doubled-graph` сейчас даёт
|
|
414
|
+
**3.0.1**, а не 3.0.3 (3.0.2 и 3.0.3 ещё не в PyPI). Точный путь — wheel с явным
|
|
414
415
|
`--python`: см. [§Установка](#2-установить-doubled-graph). Убедитесь:
|
|
415
|
-
`doubled-graph --version` → `3.0.
|
|
416
|
+
`doubled-graph --version` → `3.0.3`.
|
|
416
417
|
2. **`cd your-project && doubled-graph setup`** — в **обычном** шелле, не из
|
|
417
418
|
песочницы. `setup` **всегда** останавливает и заново запускает сервис
|
|
418
419
|
`graphd` (stop → install/update unit → start), регистрирует проект,
|
|
@@ -441,9 +442,9 @@ Bun/Node-пакет 4.x: `bun remove -g @osovv/grace-cli` или
|
|
|
441
442
|
обновлением на 3.0:
|
|
442
443
|
|
|
443
444
|
```bash
|
|
444
|
-
# 1. поставить 3.0.
|
|
445
|
+
# 1. поставить 3.0.3 (pipx upgrade даст только 3.0.1 — см. §Установка)
|
|
445
446
|
python3.14 -m build --wheel
|
|
446
|
-
pipx install --python python3.14 --force dist/doubled_graph-3.0.
|
|
447
|
+
pipx install --python python3.14 --force dist/doubled_graph-3.0.3-py3-none-any.whl
|
|
447
448
|
cd your-project
|
|
448
449
|
doubled-graph setup # 2. движок, .grace и демон graphd — одной командой
|
|
449
450
|
```
|
|
@@ -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.3"
|
|
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" }
|
|
@@ -514,17 +514,28 @@ def _cmd_daemon(args: argparse.Namespace) -> int:
|
|
|
514
514
|
print(json.dumps(payload, indent=2, ensure_ascii=False))
|
|
515
515
|
return 0 if payload.get("status") in {"stopped"} else 2
|
|
516
516
|
if action == "restart":
|
|
517
|
-
# Explicit, unconditional stop → install/update
|
|
518
|
-
# uses the same operation; the command exists so a
|
|
519
|
-
# replaced without re-running the whole
|
|
520
|
-
|
|
517
|
+
# Explicit, unconditional stop → cleanup → enable → install/update →
|
|
518
|
+
# start. `setup` uses the same operation; the command exists so a
|
|
519
|
+
# stale daemon can be replaced without re-running the whole
|
|
520
|
+
# onboarding. The 60-second wait and the version check are part of the
|
|
521
|
+
# operation, so a supervisor that merely accepted the bootstrap cannot
|
|
522
|
+
# be reported as a successful restart.
|
|
523
|
+
from doubled_graph import __version__ as client_version
|
|
524
|
+
from doubled_graph.integrations.service import DEFAULT_WAIT_TIMEOUT_S
|
|
525
|
+
|
|
526
|
+
payload = manager.restart(
|
|
527
|
+
wait_timeout=DEFAULT_WAIT_TIMEOUT_S, expected_version=client_version
|
|
528
|
+
)
|
|
521
529
|
print(json.dumps(payload, indent=2, ensure_ascii=False))
|
|
522
530
|
return 0 if payload.get("status") == "restarted" else 2
|
|
523
531
|
|
|
524
|
-
# status — service state + live daemon + registry, in one report.
|
|
532
|
+
# status — service state + live daemon + registry, in one report. The
|
|
533
|
+
# supervisor snapshot goes into `probe_daemon` so `daemon.installed` means
|
|
534
|
+
# "unit present *and* loaded", not "a plist is on disk" (3.0.3).
|
|
525
535
|
from doubled_graph import __version__ as client_version
|
|
526
536
|
|
|
527
|
-
|
|
537
|
+
service_status = manager.status()
|
|
538
|
+
daemon = graphd.probe_daemon(service=service_status)
|
|
528
539
|
daemon["client_version"] = client_version
|
|
529
540
|
if daemon.get("version") and daemon["version"] != client_version:
|
|
530
541
|
# Both halves speak the same wire protocol, so a stale daemon is
|
|
@@ -537,7 +548,7 @@ def _cmd_daemon(args: argparse.Namespace) -> int:
|
|
|
537
548
|
"the service) or `doubled-graph daemon restart`."
|
|
538
549
|
)
|
|
539
550
|
payload: dict[str, Any] = {
|
|
540
|
-
"service":
|
|
551
|
+
"service": service_status,
|
|
541
552
|
"daemon": daemon,
|
|
542
553
|
}
|
|
543
554
|
if payload["daemon"].get("running"):
|
|
@@ -96,6 +96,10 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
96
96
|
def _handle_signal(_signum: int, _frame: object) -> None:
|
|
97
97
|
daemon.request_stop()
|
|
98
98
|
|
|
99
|
+
# SIGINT is handled exactly like SIGTERM: Ctrl-C on a foreground
|
|
100
|
+
# `doubled-graph daemon run` must close the listener and remove
|
|
101
|
+
# daemon.json/pid/socket in the same `finally` path, not die with a
|
|
102
|
+
# traceback that leaves the discovery files behind (3.0.3).
|
|
99
103
|
signal.signal(signal.SIGTERM, _handle_signal)
|
|
100
104
|
signal.signal(signal.SIGINT, _handle_signal)
|
|
101
105
|
try:
|
|
@@ -103,6 +107,12 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
103
107
|
except DaemonAlreadyRunning as exc:
|
|
104
108
|
logger.error("%s", exc)
|
|
105
109
|
return 2
|
|
110
|
+
except KeyboardInterrupt:
|
|
111
|
+
# Defensive: if a platform/embedding delivers Ctrl-C as an exception
|
|
112
|
+
# instead of calling the handler above, still run the ownership-aware
|
|
113
|
+
# cleanup and report the conventional SIGINT exit code.
|
|
114
|
+
daemon.stop()
|
|
115
|
+
return 130
|
|
106
116
|
|
|
107
117
|
|
|
108
118
|
if __name__ == "__main__": # pragma: no cover — process entry point
|
|
@@ -16,6 +16,7 @@ import json
|
|
|
16
16
|
import logging
|
|
17
17
|
import os
|
|
18
18
|
import secrets
|
|
19
|
+
import socket
|
|
19
20
|
import subprocess
|
|
20
21
|
import sys
|
|
21
22
|
import tempfile
|
|
@@ -467,6 +468,27 @@ def _pid_alive(pid: int) -> bool:
|
|
|
467
468
|
return True
|
|
468
469
|
|
|
469
470
|
|
|
471
|
+
def _socket_has_listener(path: Path) -> bool:
|
|
472
|
+
"""True when a live ``AF_UNIX`` listener accepts connections on *path*.
|
|
473
|
+
|
|
474
|
+
A socket file left behind by a SIGKILLed daemon is not a listener: the
|
|
475
|
+
kernel either refuses the connection (``ECONNREFUSED``) or the path is not
|
|
476
|
+
a socket at all (``ENOTSOCK``). Only a successful connect proves that
|
|
477
|
+
something is still serving, so the startup cleanup never deletes a live
|
|
478
|
+
daemon's socket (3.0.3).
|
|
479
|
+
"""
|
|
480
|
+
probe = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
481
|
+
try:
|
|
482
|
+
probe.settimeout(0.2)
|
|
483
|
+
probe.connect(str(path))
|
|
484
|
+
except OSError:
|
|
485
|
+
return False
|
|
486
|
+
else:
|
|
487
|
+
return True
|
|
488
|
+
finally:
|
|
489
|
+
probe.close()
|
|
490
|
+
|
|
491
|
+
|
|
470
492
|
def _coerce_pid(value: Any) -> int | None:
|
|
471
493
|
"""Parse a PID from a discovery/PID file without raising (P2-4).
|
|
472
494
|
|
|
@@ -687,6 +709,42 @@ class GraphDaemon:
|
|
|
687
709
|
except (FileNotFoundError, ValueError, OSError):
|
|
688
710
|
return None
|
|
689
711
|
|
|
712
|
+
def _recorded_owner_pids(self) -> list[int]:
|
|
713
|
+
"""PIDs recorded in ``graphd.pid`` and ``daemon.json``, deduplicated."""
|
|
714
|
+
pids: list[int] = []
|
|
715
|
+
pid = self._read_pid(self.pid_path)
|
|
716
|
+
if pid is not None and pid > 0:
|
|
717
|
+
pids.append(pid)
|
|
718
|
+
info = self._read_info()
|
|
719
|
+
info_pid = _coerce_pid(info.get("pid")) if info else None
|
|
720
|
+
if info_pid is not None and info_pid not in pids:
|
|
721
|
+
pids.append(info_pid)
|
|
722
|
+
return pids
|
|
723
|
+
|
|
724
|
+
def _reap_stale_lock(self) -> bool:
|
|
725
|
+
"""Remove ``graphd.lock`` when its recorded owner is dead (3.0.3).
|
|
726
|
+
|
|
727
|
+
An ``flock`` is released by the kernel when its owner exits, so a
|
|
728
|
+
normally-crashed daemon never blocks a restart. A lock file can still
|
|
729
|
+
be held by a process that is not serving this state directory any more
|
|
730
|
+
(a helper that inherited the descriptor, a container/host mismatch, an
|
|
731
|
+
old daemon killed without closing its fd). In that case the PID files
|
|
732
|
+
are the ownership evidence: with every recorded owner dead the lock is
|
|
733
|
+
stale, so it is unlinked and reopened.
|
|
734
|
+
"""
|
|
735
|
+
owners = self._recorded_owner_pids()
|
|
736
|
+
if not owners or any(_pid_alive(pid) for pid in owners):
|
|
737
|
+
# No proof of death: never unlink a lock that may belong to a live
|
|
738
|
+
# daemon (the recorded PID may simply be missing after cleanup).
|
|
739
|
+
return False
|
|
740
|
+
try:
|
|
741
|
+
self.lock_path.unlink()
|
|
742
|
+
except FileNotFoundError:
|
|
743
|
+
return True
|
|
744
|
+
except OSError:
|
|
745
|
+
return False
|
|
746
|
+
return True
|
|
747
|
+
|
|
690
748
|
def _acquire_instance_lock(self) -> bool:
|
|
691
749
|
"""Hold the daemon-lifetime state lock, or refuse a second daemon.
|
|
692
750
|
|
|
@@ -697,6 +755,10 @@ class GraphDaemon:
|
|
|
697
755
|
file cannot be opened (read-only state dir) startup falls through to
|
|
698
756
|
the PID probe and the bind error, not to a false "already running".
|
|
699
757
|
|
|
758
|
+
Since 3.0.3 a lock still held after its recorded owner died is reaped
|
|
759
|
+
instead of refusing every start forever (the incident left a
|
|
760
|
+
``graphd.lock`` from a daemon that no longer existed).
|
|
761
|
+
|
|
700
762
|
Returns ``True`` only when this process actually owns the lock: the
|
|
701
763
|
caller must not delete another daemon's discovery files otherwise
|
|
702
764
|
(P3).
|
|
@@ -705,17 +767,29 @@ class GraphDaemon:
|
|
|
705
767
|
fd = os.open(self.lock_path, os.O_RDWR | os.O_CREAT, 0o600)
|
|
706
768
|
except OSError:
|
|
707
769
|
return False
|
|
708
|
-
if
|
|
770
|
+
if _try_lock_fd(fd):
|
|
771
|
+
self._instance_lock_fd = fd
|
|
772
|
+
return True
|
|
773
|
+
if self._reap_stale_lock():
|
|
709
774
|
try:
|
|
710
775
|
os.close(fd)
|
|
711
776
|
except OSError:
|
|
712
777
|
pass
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
778
|
+
try:
|
|
779
|
+
fd = os.open(self.lock_path, os.O_RDWR | os.O_CREAT, 0o600)
|
|
780
|
+
except OSError:
|
|
781
|
+
return False
|
|
782
|
+
if _try_lock_fd(fd):
|
|
783
|
+
self._instance_lock_fd = fd
|
|
784
|
+
return True
|
|
785
|
+
try:
|
|
786
|
+
os.close(fd)
|
|
787
|
+
except OSError:
|
|
788
|
+
pass
|
|
789
|
+
raise DaemonAlreadyRunning(
|
|
790
|
+
f"another graphd holds the state lock ({self.lock_path}); "
|
|
791
|
+
f"state directory {self.home}"
|
|
792
|
+
)
|
|
719
793
|
|
|
720
794
|
def _release_instance_lock(self) -> None:
|
|
721
795
|
"""Drop the daemon-lifetime state lock (idempotent, never raises)."""
|
|
@@ -756,12 +830,32 @@ class GraphDaemon:
|
|
|
756
830
|
except OSError:
|
|
757
831
|
pass
|
|
758
832
|
if sys.platform != "win32":
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
833
|
+
self._remove_stale_socket()
|
|
834
|
+
|
|
835
|
+
def _remove_stale_socket(self) -> bool:
|
|
836
|
+
"""Unlink ``daemon.sock`` only when nothing is listening on it.
|
|
837
|
+
|
|
838
|
+
A socket file is not a process: a daemon killed with SIGKILL leaves
|
|
839
|
+
the inode behind, and ``Listener``/``bind`` then fails with
|
|
840
|
+
``Address already in use`` before the fresh process can start. Only a
|
|
841
|
+
successful connect proves a live listener, so a live foreground daemon
|
|
842
|
+
is never made unreachable by this cleanup (3.0.3).
|
|
843
|
+
|
|
844
|
+
Returns ``True`` when the path is gone (removed or absent), ``False``
|
|
845
|
+
when it still belongs to a live listener or could not be removed.
|
|
846
|
+
"""
|
|
847
|
+
path = self.socket_path
|
|
848
|
+
if not path.exists():
|
|
849
|
+
return True
|
|
850
|
+
if _socket_has_listener(path):
|
|
851
|
+
return False
|
|
852
|
+
try:
|
|
853
|
+
path.unlink()
|
|
854
|
+
except FileNotFoundError:
|
|
855
|
+
return True
|
|
856
|
+
except OSError:
|
|
857
|
+
return False
|
|
858
|
+
return True
|
|
765
859
|
|
|
766
860
|
def _read_info(self) -> dict[str, Any] | None:
|
|
767
861
|
try:
|
|
@@ -834,12 +928,25 @@ class GraphDaemon:
|
|
|
834
928
|
if transport == graphd.TRANSPORT_UNIX:
|
|
835
929
|
socket_file = self.socket_path
|
|
836
930
|
_ensure_private_dir(socket_file.parent)
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
931
|
+
# Re-check immediately before bind: `_check_not_running` ran
|
|
932
|
+
# earlier, but a crash between the two calls still leaves an inode
|
|
933
|
+
# that `bind` refuses. A live listener is deliberately kept and
|
|
934
|
+
# surfaces as `DaemonAlreadyRunning`, never as a deletion.
|
|
935
|
+
self._remove_stale_socket()
|
|
936
|
+
try:
|
|
937
|
+
listener = Listener(
|
|
938
|
+
str(socket_file),
|
|
939
|
+
family="AF_UNIX",
|
|
940
|
+
backlog=LISTENER_BACKLOG,
|
|
941
|
+
authkey=authkey,
|
|
942
|
+
)
|
|
943
|
+
except OSError as exc:
|
|
944
|
+
if _socket_has_listener(socket_file):
|
|
945
|
+
raise DaemonAlreadyRunning(
|
|
946
|
+
f"another daemon is already listening on {socket_file}; "
|
|
947
|
+
f"state directory {self.home}"
|
|
948
|
+
) from exc
|
|
949
|
+
raise
|
|
843
950
|
try:
|
|
844
951
|
socket_file.chmod(0o600)
|
|
845
952
|
except OSError:
|
|
@@ -905,8 +1012,13 @@ class GraphDaemon:
|
|
|
905
1012
|
return 1 if self._fatal_exit else 0
|
|
906
1013
|
|
|
907
1014
|
def run(self) -> int:
|
|
908
|
-
|
|
1015
|
+
# `start()` is inside the `try`: a SIGINT during a cold start (the
|
|
1016
|
+
# imports, the bind, the first discovery write) must run `stop()` too,
|
|
1017
|
+
# otherwise daemon.json/socket/pid survive a Ctrl-C and the next start
|
|
1018
|
+
# inherits them (3.0.3). `stop()` is ownership-aware, so a failed start
|
|
1019
|
+
# never deletes another daemon's files.
|
|
909
1020
|
try:
|
|
1021
|
+
self.start()
|
|
910
1022
|
self.serve_forever()
|
|
911
1023
|
finally:
|
|
912
1024
|
self.stop()
|
|
@@ -1078,13 +1190,19 @@ class GraphDaemon:
|
|
|
1078
1190
|
except OSError:
|
|
1079
1191
|
pass
|
|
1080
1192
|
if self._read_pid(self.pid_path) == os.getpid():
|
|
1193
|
+
pid_owned = True
|
|
1081
1194
|
try:
|
|
1082
1195
|
self.pid_path.unlink()
|
|
1083
1196
|
except FileNotFoundError:
|
|
1084
1197
|
pass
|
|
1085
1198
|
except OSError:
|
|
1086
1199
|
pass
|
|
1087
|
-
|
|
1200
|
+
else:
|
|
1201
|
+
pid_owned = False
|
|
1202
|
+
if self._transport == graphd.TRANSPORT_UNIX or owned or pid_owned:
|
|
1203
|
+
# `_transport` is only set once the listener was created; a SIGINT
|
|
1204
|
+
# between the discovery write and `serve_forever` leaves it None
|
|
1205
|
+
# while daemon.json/socket already belong to this PID (3.0.3).
|
|
1088
1206
|
try:
|
|
1089
1207
|
self.socket_path.unlink()
|
|
1090
1208
|
except FileNotFoundError:
|
|
@@ -188,17 +188,22 @@ def build_health_report(repo: Path) -> dict[str, Any]:
|
|
|
188
188
|
cgc.close()
|
|
189
189
|
|
|
190
190
|
# Daemon diagnostics for §7: `health.cgc.daemon` reports installed/running
|
|
191
|
-
# and the daemon version/protocol.
|
|
192
|
-
#
|
|
193
|
-
|
|
191
|
+
# and the daemon version/protocol. `installed` is the *service* fact
|
|
192
|
+
# (unit present **and** loaded by the supervisor), not merely "a plist is
|
|
193
|
+
# on disk": a refused `launchctl bootstrap` left a plist behind and made
|
|
194
|
+
# `health` claim a healthy installation while the job was never loaded
|
|
195
|
+
# (macOS incident, 3.0.3). `probe_daemon` itself only reads `daemon.json`
|
|
196
|
+
# and pings the existing socket.
|
|
197
|
+
service_status: dict[str, Any] | None = None
|
|
194
198
|
try:
|
|
195
|
-
|
|
196
|
-
get_service_manager().is_installed()
|
|
197
|
-
)
|
|
199
|
+
service_status = get_service_manager().status()
|
|
198
200
|
except Exception as exc: # noqa: BLE001 — a broken supervisor must not break health
|
|
199
201
|
# Do not swallow the failure: `installed` then reflects only the
|
|
200
202
|
# discovery file, and the report must say why (audit P3).
|
|
203
|
+
daemon = probe_daemon()
|
|
201
204
|
daemon["service_check_error"] = f"{type(exc).__name__}: {exc}"
|
|
205
|
+
else:
|
|
206
|
+
daemon = probe_daemon(service=service_status)
|
|
202
207
|
|
|
203
208
|
# A live daemon from a previous release keeps the old code (and its cached
|
|
204
209
|
# engine state) in memory; the wire protocol does not change between patch
|
|
@@ -366,16 +366,30 @@ def _finish_probe_version(result: dict[str, Any]) -> None:
|
|
|
366
366
|
|
|
367
367
|
|
|
368
368
|
#: How long ``ping`` may take when probing from ``health``/``daemon status``.
|
|
369
|
-
def probe_daemon(
|
|
369
|
+
def probe_daemon(
|
|
370
|
+
timeout: float = PING_TIMEOUT_S,
|
|
371
|
+
*,
|
|
372
|
+
service: dict[str, Any] | None = None,
|
|
373
|
+
) -> dict[str, Any]:
|
|
370
374
|
"""Best-effort daemon snapshot for diagnostics. Never raises.
|
|
371
375
|
|
|
372
376
|
Returns ``{"installed", "running", "version", "protocol", "pid",
|
|
373
377
|
"transport", "address", "port", "max_live", "protocol_mismatch",
|
|
374
|
-
"client_version", "version_mismatch", "
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
378
|
+
"client_version", "version_mismatch", "plist_present", "loaded",
|
|
379
|
+
"disabled", "error"}``.
|
|
380
|
+
|
|
381
|
+
``installed`` is the *service* fact when the caller supplies a supervisor
|
|
382
|
+
snapshot: the unit exists **and** the supervisor loaded it. A plist left
|
|
383
|
+
behind by a refused ``launchctl bootstrap`` is not an installation — that
|
|
384
|
+
false positive is exactly the macOS incident (3.0.3). Without ``service``
|
|
385
|
+
(the wait loop, ``analyze``) ``installed`` keeps its legacy meaning "a
|
|
386
|
+
discovery file exists", because probing launchd on every 0.1 s poll would
|
|
387
|
+
be both slow and wrong.
|
|
388
|
+
|
|
389
|
+
``plist_present``/``loaded``/``disabled`` are ``None`` when no supervisor
|
|
390
|
+
snapshot was supplied (or the platform has no such state). For the TCP
|
|
391
|
+
fallback ``address`` is the loopback host and ``port`` the integer port
|
|
392
|
+
(matching ``daemon.json``), never a stringified ``(host, port)`` tuple.
|
|
379
393
|
|
|
380
394
|
``version_mismatch`` is true when the live daemon runs a different
|
|
381
395
|
``doubled-graph`` release than this client. Nothing restarts it here:
|
|
@@ -396,8 +410,16 @@ def probe_daemon(timeout: float = PING_TIMEOUT_S) -> dict[str, Any]:
|
|
|
396
410
|
"protocol_mismatch": False,
|
|
397
411
|
"client_version": __version__,
|
|
398
412
|
"version_mismatch": False,
|
|
413
|
+
"plist_present": None,
|
|
414
|
+
"loaded": None,
|
|
415
|
+
"disabled": None,
|
|
399
416
|
"error": None,
|
|
400
417
|
}
|
|
418
|
+
if service is not None:
|
|
419
|
+
result["installed"] = bool(service.get("installed"))
|
|
420
|
+
result["plist_present"] = service.get("plist_present")
|
|
421
|
+
result["loaded"] = service.get("loaded")
|
|
422
|
+
result["disabled"] = service.get("disabled")
|
|
401
423
|
if info is None:
|
|
402
424
|
result["error"] = "daemon.json is missing or unreadable"
|
|
403
425
|
_finish_probe_version(result)
|