Browse documentation
Watch a library consumer
Activate a tested edit while a refused candidate leaves the last accepted version serving.
The library watch loop checks edits and activates compatible candidates that pass their tests. Refused candidates leave the last accepted selection serving.
Use pricing from the library tutorial, two terminals and curl. Keep the generated development listener on 127.0.0.1; it includes control routes.
1. Check the project
effectful verify ./pricing
effectful test ./pricing
Keep the revision test. An untouched scaffold expects 1; after the tutorial edit, source and test expect 2.
2. Start watching
In the first terminal:
watch_work=$(mktemp -d)
effectful serve --app ./pricing --consumer example \
--state "$watch_work/state" --watch
Copy the address after listener graph. Leave this process running.
3. Request the result
In the second terminal, replace the placeholder with that address:
address='PASTE_LOOPBACK_HOST_AND_PORT'
curl -sS -H 'Content-Type: application/json' \
--data '[]' "http://$address/revision"
The response includes result and execution origin. For an untouched scaffold, the result is ["s64","1"].
4. Make a refused edit
Change the integer returned by revision() in pricing/packages/pricing/src/lib.rs. Leave the test unchanged.
The watch event reports the failed expectation. Request /revision again: the last accepted value and origin remain active.
5. Activate the intended change
Review the new value, then update pricing/consumers/example/tests/revision.json to match it. Wait for activated and repeat the request. Check the new result and origin.
The runtime checked, lowered, tested and activated this edit without a native application build. Route-schema changes can still be refused; the watch loop does not migrate arbitrary saved state.
6. Stop
curl -sS -X POST "http://$address/_loop/stop"
Keep the scratch state directory to retain its selection and history. Do not edit its files to switch source versions.