Skip to content

Commit a9946ce

Browse files
marcelsafinCopilot
andcommitted
docs: explain load-bearing pre-create loop in _reconcile_skills
The per-skill _validate_skill_subdir(create=True) loop looks like dead code (its result is unused), but it re-creates the tracked skill subdirectories that _unregister_skills just deleted so _register_skills's only-overwrite-existing gate passes during a historical-directory restore. Removing it fails test_skill_reconciliation_preserves_per_directory_names. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4324ebc commit a9946ce

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/specify_cli/presets/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,6 +2219,14 @@ def apply_to_dir(
22192219
continue
22202220
cmds_set = set(dir_cmds)
22212221
filtered_manifest = self._FilteredManifest(manifest, cmds_set)
2222+
# Not dead code: _register_skills only *overwrites* skill
2223+
# subdirectories that already exist (plus brand-new ones for
2224+
# the active ai_skills agent). For a restore into a
2225+
# historical directory, _unregister_skills has just deleted
2226+
# the retiring preset's subdirectory, so pre-create the
2227+
# tracked (dir_managed_names) subdirectories here — under
2228+
# the same symlink guard — or the surviving preset's
2229+
# override would be silently skipped (#2948).
22222230
for cmd_name in dir_cmds:
22232231
for skill_name in self._skill_names_for_command(cmd_name):
22242232
if skill_name not in dir_managed_names:

0 commit comments

Comments
 (0)