kantord / kantord/optative

esto/fs: lazy content claims — skip computation, not just writes

Open
#111 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/fs`'s `` claims take content **eagerly**: `h()` evaluates immediately, so by the time the supervisor compares hashes, every file's desired content has already been computed. The reconciler can therefore skip *writes* (unchanged hash ⇒ no-op), but never the *computation* of the content itself.

For expensive per-file computation (rendering a page, generating an image, calling a compiler), the valuable thing to skip is the computation. That currently requires abandoning `esto/fs` entirely and hand-rolling a unit:

```tsx
const Page = unit({
key: (i) => i.out,
value: (i) => i.sig, // hash of the *inputs*, cheap
reconciler: optativeSet({ observe }), // hand-rolled dist/ walk + verification
enter: (i) => { const bytes = i.render(); /* write bytes + metadata */ },
update: /* same */,
exit: /* rm */,
})
```

— which works (it's running a real site build today) but re-implements, in userland, things the supervisor already has: observation of the scope, pruning, conflict detection, circuit breakers.

## Proposal

Let a claim defer its content behind a signature:

```tsx
render(post)} />
```

Semantics: `sig` is the change-detection value (replacing content-hash comparison for this claim); the content thunk is only invoked on enter, or on update when `sig` differs from the recorded one. Requires the supervisor to persist the sig it built each file with — a natural fit for a sidecar or a supervisor-owned metadata file inside the scope, verified against the file's actual bytes on observe so out-of-band edits still reconverge.

Extracted from a working consumer the same way `optative` itself was extracted from tauler — the userland `Page` unit above is the prototype; happy to share its observe/verification details.

## Motivating consumer

Incremental static site builder: `value` = hash of (post source, builder tree, engine); render runs only for pages whose inputs moved. Verified end-to-end: no-op builds touch zero files, a post edit re-renders exactly one page.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the esto/fs File claim and the supervisor's reconciliation and observation paths; compare them with the userland Page unit prototype described in the issue. Trace how hashes and metadata are persisted and verified, then define the change as deferred content invocation on enter or changed sig, while preserving pruning, conflict detection, and out-of-band edit handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, typescript
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.