kantord / kantord/optative

esto watch: add dispatch (currently emit-only) and fix re-reconcile tight loop

Open
#109 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1
Forks
0
Avg merge
3d 5h
Merged PRs (30d)
17

Description

## Problem

`esto watch` starts with `[watch] starting — emit-only (no auto-dispatch)`: it re-reconciles on triggers but never calls `enter`/`update`/`exit`, so it detects changes without acting on them. For a script whose units *are* the side effects (e.g. an incremental site build where enter/update write output files), watch mode can currently never produce output — the dev loop falls back to manual `esto run` or an external watcher (watchexec/entr).

Observed with esto 0.0.9:

```
$ esto watch --on inotify:content/posts --on inotify:builder builder/build.op.tsx
[watch] starting — emit-only (no auto-dispatch)
reconciled: 0 enter, 0 update, 0 exit (3 unchanged)
[watch] re-reconciling
...
```

Also observed: with two `--on inotify:` triggers on directories that were not being written to, the watcher re-reconciled continuously in a tight loop (~30KB of `[watch] re-reconciling` log within ~4s) rather than idling until a trigger fired. Possibly the watcher reacting to its own reconcile pass, or a level-triggered loop — a second, separate misbehavior worth checking while in there.

## Proposal

A dispatch flag (or making dispatch the default with `--dry-run` retaining today's emit-only behavior, mirroring `esto run`): each trigger firing runs a full reconcile *with* enter/update/exit, same semantics as `esto run`, plus the existing burst debouncing.

## Motivating consumer

`esto watch --on inotify:content/ build.op.tsx` as a static-site dev loop: save a post, the reconciler rebuilds exactly the pages whose input signature moved. The incremental machinery already makes per-save work minimal; only the dispatch is missing.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the `esto watch` entry point and reproduce the provided inotify command, then trace how triggers invoke reconciliation and whether reconciliation causes another trigger. Done means trigger firings dispatch enter/update/exit with burst debouncing, while idle watchers do not re-reconcile continuously; verify both behaviors with the static-site scenario and the two-directory case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.