Skip to content

graphify watch rejects --debounce, the flag its own module help documents #3061

Description

@Azeem1985

The gap

watch() takes a debounce argument (graphify/watch.py, default 3.0) and the module's own
help advertises it:

$ python -m graphify.watch --help
  --debounce DEBOUNCE   Seconds to wait after last change before updating (default: 3)

But the shipped sub-command never parses it — graphify/cli.py's watch branch accepts only
--semantic, --backend, --fallback-backend, and rejects everything else:

$ graphify watch /path --debounce 60
error: unknown watch option: --debounce        # exit 2

So the knob is documented and unreachable through the command people actually run, and
graphify --help does not list it either.

Why the default is not always right (measured)

On a vault watched by graphify watch --semantic, three files written 6 seconds apart
produced two batches → two AST rebuilds → two graph.json writes → two downstream view
renders. The second batch is unavoidable at debounce=3: the rebuild itself takes ~46 s, and
every event landing during it becomes a fresh batch the moment the loop is free.

With the same burst and --debounce 60: one batch, one rebuild, one render. On this box a
render rewrites 31k view files, so a needless second batch is not free.

Suggested fix

Parse --debounce N / --debounce=N in the watch branch, reject a non-number and a negative
with exit 2, and pass nothing when the flag is absent so the watcher's own default keeps
living in one place. One line in graphify --help next to --semantic.

Implemented and tested in our fork (8 tests: both spellings, zero, absent-means-default, combined
with --semantic/--backend, both rejection paths, and the still-rejected unknown option) —
happy to open a PR against v8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions