Skip to content

Commit b4406d7

Browse files
Deepjyoti-Sarmahsafishamsi
authored andcommitted
fix(skill): aider and devin --update populate .graphify_detect.json
Part A reads .graphify_detect.json and Step 9 deletes it, but the aider and devin --update sections never wrote it again, so Part A raised FileNotFoundError after any full build. The sections now write it from .graphify_incremental.json, as the generated references/update.md does, with each file's own path convention. The test no longer seeds the file; it asserts the update section wrote it. (cherry picked from commit ca090b6)
1 parent ea2bc68 commit b4406d7

8 files changed

Lines changed: 137 additions & 12 deletions

File tree

‎graphify/skill-aider.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,24 @@ if new_total > 0:
813813
"
814814
```
815815

816+
Then populate `.graphify_detect.json` so Steps 3A–6 (which read it unconditionally) see the right state for an incremental run. `files` carries the changed subset (what Part A and Part B's cache check read); `all_files` carries the full corpus for any step that needs corpus-wide context:
817+
818+
```bash
819+
$(cat graphify-out/.graphify_python) -c "
820+
import json
821+
from pathlib import Path
822+
r = json.loads(Path('.graphify_incremental.json').read_text())
823+
Path('.graphify_detect.json').write_text(json.dumps({
824+
'files': r.get('new_files', {}),
825+
'all_files': r.get('files', {}),
826+
'total_files': r.get('new_total', 0),
827+
'total_words': r.get('total_words', 0),
828+
'skipped_sensitive': r.get('skipped_sensitive', []),
829+
'needs_graph': True,
830+
}))
831+
"
832+
```
833+
816834
If new files exist, first check whether all changed files are code files:
817835

818836
```bash

‎graphify/skill-devin.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,24 @@ if new_total > 0:
952952
"
953953
```
954954

955+
Then populate `.graphify_detect.json` so Steps 3A–6 (which read it unconditionally) see the right state for an incremental run. `files` carries the changed subset (what Part A and Part B's cache check read); `all_files` carries the full corpus for any step that needs corpus-wide context:
956+
957+
```bash
958+
$(cat graphify-out/.graphify_python) -c "
959+
import json
960+
from pathlib import Path
961+
r = json.loads(Path('graphify-out/.graphify_incremental.json').read_text())
962+
Path('graphify-out/.graphify_detect.json').write_text(json.dumps({
963+
'files': r.get('new_files', {}),
964+
'all_files': r.get('files', {}),
965+
'total_files': r.get('new_total', 0),
966+
'total_words': r.get('total_words', 0),
967+
'skipped_sensitive': r.get('skipped_sensitive', []),
968+
'needs_graph': True,
969+
}))
970+
"
971+
```
972+
955973
If new files exist, first check whether all changed files are code files:
956974

957975
```bash

‎tests/test_code_only_update_all_hosts.py‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
1010
Hosts: the 14 generated skills share one set of anchors (windows runs its PowerShell
1111
here-string bodies through the interpreter on stdin: it tests the Python and the step order,
12-
not PowerShell quoting). aider and devin are monoliths with their own anchors; neither update
13-
section writes ``.graphify_detect.json``, so the test seeds it for them.
12+
not PowerShell quoting). aider and devin are monoliths with their own anchors.
1413
"""
1514
from __future__ import annotations
1615

@@ -221,16 +220,8 @@ def test_code_only_update_follows_its_paragraph_and_merges_the_new_function(host
221220
ran.append(result.stdout)
222221
assert any("code_only: True" in text for text in ran), "the code_only check did not report True"
223222

224-
detect = out / ".graphify_detect.json"
225-
if not detect.exists():
226-
# aider and devin only: no block in their --update section writes it (a defect separate
227-
# from #4447). Seed what the shared block writes so this test isolates the extraction route.
228-
assert host in ("aider", "devin"), f"{host}: the update section never wrote .graphify_detect.json"
229-
inc = json.loads((out / ".graphify_incremental.json").read_text(encoding="utf-8"))
230-
detect.write_text(json.dumps({
231-
"files": inc["new_files"], "all_files": inc.get("files", {}), "total_files": inc["new_total"],
232-
"total_words": inc.get("total_words", 0), "skipped_sensitive": [], "needs_graph": True,
233-
}), encoding="utf-8")
223+
# Part A reads it, and Step 9 deleted it: the --update section has to write it again.
224+
assert (out / ".graphify_detect.json").exists(), "the --update section never wrote .graphify_detect.json"
234225

235226
# A sidecar left by an earlier run, where this host keeps it: must not reach the result.
236227
(out / ".graphify_semantic.json").write_text(json.dumps({

‎tools/skillgen/expected/graphify__skill-aider.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,24 @@ if new_total > 0:
813813
"
814814
```
815815

816+
Then populate `.graphify_detect.json` so Steps 3A–6 (which read it unconditionally) see the right state for an incremental run. `files` carries the changed subset (what Part A and Part B's cache check read); `all_files` carries the full corpus for any step that needs corpus-wide context:
817+
818+
```bash
819+
$(cat graphify-out/.graphify_python) -c "
820+
import json
821+
from pathlib import Path
822+
r = json.loads(Path('.graphify_incremental.json').read_text())
823+
Path('.graphify_detect.json').write_text(json.dumps({
824+
'files': r.get('new_files', {}),
825+
'all_files': r.get('files', {}),
826+
'total_files': r.get('new_total', 0),
827+
'total_words': r.get('total_words', 0),
828+
'skipped_sensitive': r.get('skipped_sensitive', []),
829+
'needs_graph': True,
830+
}))
831+
"
832+
```
833+
816834
If new files exist, first check whether all changed files are code files:
817835

818836
```bash

‎tools/skillgen/expected/graphify__skill-devin.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,24 @@ if new_total > 0:
952952
"
953953
```
954954

955+
Then populate `.graphify_detect.json` so Steps 3A–6 (which read it unconditionally) see the right state for an incremental run. `files` carries the changed subset (what Part A and Part B's cache check read); `all_files` carries the full corpus for any step that needs corpus-wide context:
956+
957+
```bash
958+
$(cat graphify-out/.graphify_python) -c "
959+
import json
960+
from pathlib import Path
961+
r = json.loads(Path('graphify-out/.graphify_incremental.json').read_text())
962+
Path('graphify-out/.graphify_detect.json').write_text(json.dumps({
963+
'files': r.get('new_files', {}),
964+
'all_files': r.get('files', {}),
965+
'total_files': r.get('new_total', 0),
966+
'total_words': r.get('total_words', 0),
967+
'skipped_sensitive': r.get('skipped_sensitive', []),
968+
'needs_graph': True,
969+
}))
970+
"
971+
```
972+
955973
If new files exist, first check whether all changed files are code files:
956974

957975
```bash

‎tools/skillgen/fragments/core/aider.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,24 @@ if new_total > 0:
813813
"
814814
```
815815

816+
Then populate `.graphify_detect.json` so Steps 3A–6 (which read it unconditionally) see the right state for an incremental run. `files` carries the changed subset (what Part A and Part B's cache check read); `all_files` carries the full corpus for any step that needs corpus-wide context:
817+
818+
```bash
819+
$(cat graphify-out/.graphify_python) -c "
820+
import json
821+
from pathlib import Path
822+
r = json.loads(Path('.graphify_incremental.json').read_text())
823+
Path('.graphify_detect.json').write_text(json.dumps({
824+
'files': r.get('new_files', {}),
825+
'all_files': r.get('files', {}),
826+
'total_files': r.get('new_total', 0),
827+
'total_words': r.get('total_words', 0),
828+
'skipped_sensitive': r.get('skipped_sensitive', []),
829+
'needs_graph': True,
830+
}))
831+
"
832+
```
833+
816834
If new files exist, first check whether all changed files are code files:
817835

818836
```bash

‎tools/skillgen/fragments/core/devin.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,24 @@ if new_total > 0:
952952
"
953953
```
954954

955+
Then populate `.graphify_detect.json` so Steps 3A–6 (which read it unconditionally) see the right state for an incremental run. `files` carries the changed subset (what Part A and Part B's cache check read); `all_files` carries the full corpus for any step that needs corpus-wide context:
956+
957+
```bash
958+
$(cat graphify-out/.graphify_python) -c "
959+
import json
960+
from pathlib import Path
961+
r = json.loads(Path('graphify-out/.graphify_incremental.json').read_text())
962+
Path('graphify-out/.graphify_detect.json').write_text(json.dumps({
963+
'files': r.get('new_files', {}),
964+
'all_files': r.get('files', {}),
965+
'total_files': r.get('new_total', 0),
966+
'total_words': r.get('total_words', 0),
967+
'skipped_sensitive': r.get('skipped_sensitive', []),
968+
'needs_graph': True,
969+
}))
970+
"
971+
```
972+
955973
If new files exist, first check whether all changed files are code files:
956974

957975
```bash

‎tools/skillgen/gen.py‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,31 @@ def _is_code_only_fast_path_fix_line(line: str) -> bool:
13101310
)
13111311

13121312

1313+
def _is_update_detect_populate_fix_line(line: str) -> bool:
1314+
"""Whether a line is part of the aider/devin ``--update`` detect block (found while fixing #4447).
1315+
1316+
Part A reads ``.graphify_detect.json``, Step 9 deletes it, and the monoliths'
1317+
``--update`` section never wrote it again, so Part A raised FileNotFoundError.
1318+
The section now writes it from ``.graphify_incremental.json``, as the generated
1319+
``references/update.md`` does. These are the lead-in sentence and the block's lines.
1320+
"""
1321+
s = line.strip()
1322+
return (
1323+
s.startswith("Then populate `.graphify_detect.json` so Steps 3A")
1324+
or (s.startswith("r = json.loads(Path(") and s.endswith(".graphify_incremental.json').read_text())"))
1325+
or (s.startswith("Path(") and s.endswith(".graphify_detect.json').write_text(json.dumps({"))
1326+
or s in (
1327+
"'files': r.get('new_files', {}),",
1328+
"'all_files': r.get('files', {}),",
1329+
"'total_files': r.get('new_total', 0),",
1330+
"'total_words': r.get('total_words', 0),",
1331+
"'skipped_sensitive': r.get('skipped_sensitive', []),",
1332+
"'needs_graph': True,",
1333+
"}))",
1334+
)
1335+
)
1336+
1337+
13131338
# Every line that may differ between a rendered monolith and its pristine v8
13141339
# baseline. Each predicate documents one sanctioned change-class; a blank line is
13151340
# allowed because the multi-line fix blocks insert spacing. Anything else failing
@@ -1338,6 +1363,7 @@ def _is_code_only_fast_path_fix_line(line: str) -> bool:
13381363
_is_worktree_visibility_note_line,
13391364
_is_semantic_origin_stamp_fix_line,
13401365
_is_code_only_fast_path_fix_line,
1366+
_is_update_detect_populate_fix_line,
13411367
)
13421368

13431369

0 commit comments

Comments
 (0)