graphify icon indicating copy to clipboard operation
graphify copied to clipboard

update --force overwrites silently: report what it replaced

Open duncancrawford opened this issue 3 months ago • 4 comments

graphify update --force overwrites the graph without saying what it replaced. Because the guard it bypasses exists to catch a graph shrinking unexpectedly, forcing removes the only signal that a rebuild lost content.

The situation it leaves an operator in

The overwrite guard is good: it refuses when a rebuild would shrink the graph materially, and that refusal has caught real problems. But a legitimate rebuild also shrinks a graph — a repository removed from scope, a vendored tree newly excluded, a filter tightened. So --force is the normal way through, and after that:

  • a legitimate reduction and an accidental one look identical
  • the only way to tell them apart is to record the before-figures yourself, force, and compare

That comparison scaffolding gets written once per project and thrown away, which is usually the signal that a tool should do it rather than each consumer.

What would remove the need

Have --force report what it overwrote:

--force: replacing 12,431 nodes / 48,002 edges with 12,429 / 47,996 (-2 nodes, -6 edges)

Two nodes is the interesting case. A large reduction is usually intentional and gets scrutinised; a small one is what slips through, and it is exactly what the guard would have caught had it not been bypassed.

Better still, --force could report the reduction and the reason it was refused, so the operator sees which threshold was crossed rather than only that one was.

Why not just read the guard's message

The refusal names the threshold, but by the time you force you have decided to proceed — and the numbers are not carried into the run that actually writes. A reader of the resulting graph has no record that a shrink happened at all.

Related

The value of this is highest where a reduction is verifiable: if an operator can independently derive the number of nodes they expect to lose, an exact match justifies the force and a mismatch stops it. "It looks like a small drop" is not evidence; "it dropped exactly the count I derived separately" is. Reporting the delta is what makes that check possible without bespoke scripting.

duncancrawford avatar Aug 17 '26 19:08 duncancrawford

Working on this in fix/2833-force-overwrite-reporting. PR: https://github.com/Graphify-Labs/graphify/pull/2967

akshitj11 avatar Aug 23 '26 11:08 akshitj11

Hi @akshitj11, is there a specific reason for opening a separate PR for the same issue?

oleksii-tumanov avatar Aug 23 '26 15:08 oleksii-tumanov

No specific reason, I had not seen #2965 when I opened #2967. Your PR reports after the graph is written and only on actual shrinks, which matches the issue better. Closing #2967.

akshitj11 avatar Aug 24 '26 04:08 akshitj11

thank you @akshitj11

oleksii-tumanov avatar Aug 24 '26 15:08 oleksii-tumanov