Skip to content

[Bug]: Skill suggests --force on a refused shrink but never passes force=True to to_json() #4777

Open

Description

@ErwanBt

Pre-flight checks

  • I have checked the Troubleshooting section in the README

What happened?

When to_json() refuses to shrink graph.json (#479 shrink guard), the generated skill prints:

If this shrink is intentional (you deleted files), re-run a full build with --force.

Neither export in the skill passes force=True, although to_json(..., *, force=False) supports it:

  • Step 4: wrote = to_json(G, communities, 'graphify-out/graph.json')
  • Step 5 (re-export with community labels): wrote = to_json(G, communities, 'graphify-out/graph.json', community_labels=labels)

Source fragment on v8: tools/skillgen/fragments/core/core.md (lines 434 and 521 at 92741d1).

Following the advice therefore hits the same refusal, and the skill has no working recovery path for an intentional shrink (other than deleting graphify-out/graph.json by hand).

Expected: keep the shrink guard by default, and pass force=True to both exports only when the user explicitly invoked the skill with --force.

Steps to reproduce

mkdir repro && cd repro && mkdir graphify-out
python -c "
import networkx as nx
from graphify.export import to_json
big = nx.Graph()
for i in range(50): big.add_node(f'n{i}', label=f'n{i}', source_file=f'f{i}.py', file_type='code')
print('first write:', to_json(big, {0: list(big.nodes)}, 'graphify-out/graph.json'))
small = nx.Graph()
for i in range(10): small.add_node(f'n{i}', label=f'n{i}', source_file=f'f{i}.py', file_type='code')
--force
print('skill Step 4 write:', to_json(small, {0: list(small.nodes)}, 'graphify-out/graph.json'))
print('with force=True:', to_json(small, {0: list(small.nodes)}, 'graphify-out/graph.json', force=True))
"

Error output or graph output

[graphify] WARNING: Refusing to overwrite — saved semantic node(s) are missing from the new graph: n10, n11, ..., n49.
first write: True
skill Step 4 write: False
with force=True: True

Graphify version

0.9.95

Operating System

macOS

Python Version

3.13

Installation Method

uv tool install (recommended)

Additional Environment Details

Python 3.14.10 from the uv tool environment. No provider environment variables set. Reproduced in a fresh empty directory.

Additional context

Related but different: #2833 (update --force reporting), #2976 (graphify label path), #2436 (cluster-only success message when to_json refuses).

Activity

  1. github-actions commented on Oct 26, 2026

    @github-actions

    Thanks for opening this issue, @ErwanBt. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions