Skip to content

A need can ask for a fresh item: one produced since a person last acted - #139

Merged
gedaiu merged 1 commit into
mainfrom
need/fresh
Nov 24, 2026
Merged

gedaiu merged 1 commit into
mainfrom
need/fresh

Conversation

@gedaiu

@gedaiu gedaiu commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

The bag never drops an item. A later item of the same name replaces the earlier one, and that is all. So in a run that goes back to a person many times, a station was handed whatever was last produced under a name, however long ago. Two collection reviews found three cases of this: a stale description, a stale repository and verdict, and a stale briefing.

A need can now set fresh: true:

needs:
  - name: verdict
    kind: value
    optional: true
    fresh: true

A fresh need is filled only by an item produced by the visit at which a person last acted, or by a visit after it. A person acts at a human station's visit, or by starting a node by hand. An older item counts as not in the bag: an optional need is left out, and a required one refuses the visit with node "N": missing required need(s) X (not produced since a person last acted). Until a person acts, every item is fresh, the start items included. What the human station's own visit produced is fresh. A visit a person starts by hand opens with nothing fresh, because the person is acting now and the new visit has produced nothing.

Nothing is stored for this and nothing leaves the bag, so "the bag only grows" stays true and a run's history still explains every item. The boundary is the one an edge's unattended_max and the node ceiling already use. The kernel now exports it as personLastActedAt, and the node ceiling calls the same function. A station with no fresh need costs nothing extra when its visit opens. One with a fresh need costs a lookup of the line's station kinds.

The other way considered was a node that clears items when it reports. That would have said it once per line, where this makes each consumer mark its own need. It lost because it needs the fold to remove items and ends a property the storage design relies on.

A need cannot be both fresh and collect; the schema refuses it. fresh on a produce is an unknown key, which lint reports.

Limits, stated in the docs too. The floor's rules for a line and lint's need coverage do not know when a person acts, so a required fresh need that nothing produces after a person last acted passes them and is found when its visit opens, where the run ends as error. Studio's inspector lists the need but does not mark it as fresh.

Docs: the bag page, both specifications, the storage design document, the decision log, and the regenerated field table and JSON Schema.

Checked in one run with nothing else going on: every package's tests pass (assembly-lines 207, graph 316, store 418, pipeline 269, Studio 459, API 414, cluster-agent 132, docs-reference 37, and the three small ones), with the typecheck, ESLint on the whole repo and the docs check clean. I did not run a line with a fresh need against a live floor.

🤖 Generated with Claude Code

The bag never drops an item, so a run that goes back to a person many
times handed a station a verdict or a briefing from a round long past.

A need with fresh: true is filled only by an item produced by the visit
at which a person last acted, or by one after it: a human station's
visit, or a visit started by hand. An older item counts as not there,
so an optional need is left out and a required one refuses the visit,
naming the reason. Until a person acts, every item is fresh. A visit a
person starts by hand opens with nothing fresh.

Nothing is stored and nothing leaves the bag. The boundary is the one
an edge's unattended_max already uses, now exported by the kernel as
personLastActedAt. A need cannot be both fresh and collect.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@lore-agent

lore-agent Bot commented Nov 24, 2026

Copy link
Copy Markdown

Lore is reviewing this PR — 884c03f0-7d0d-4729-8769-4ce0b944cb91.

Submit a review that requests changes to have Lore push a fix for it. Comment @lore review to re-run the review.

@lore-agent

lore-agent Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Lore code review

Reviewed revision ece5216178fa02d9f7741c98fe8777e7684eeb63 · Approved · 0 gaps

The story the tests tell

A need on a station can now be marked fresh. A fresh need only takes a value produced since a person last acted, so stale machine output isn't passed on after a human has weighed in. A fresh need that nothing fresh can fill is left out if optional and reported missing if required.

The full story, with its tests

The change adds a way to mark a station's need as fresh. A fresh need accepts a value only if it was produced at or after the last visit where a person acted. To support that, a new function, personLastActedAt, returns the position of the last visit where a person acted, or -1 if nobody did. In the tests, a human-kind node counts as acting, as does a visit someone started by hand. With a human as the third of five visits, the answer is 2. When a named person starts the fourth visit by hand after the human, it is 3. It is -1 when only work and review ran. It is also -1 when the graph declares no node kinds and no visit was started by hand, even if a visit is named "human".

Tests: packages/assembly-lines/src/transition-revisit.test.ts (48)

When needs are resolved, a fresh need is checked against who produced the value. Suppose a person acted at visit-2 and the verdict came from visit-1. An optional fresh verdict is then left out. A required one is reported missing as "verdict (not produced since a person last acted)". A fresh verdict produced by the visit where the person acted is filled. So is a fresh verdict from an event such as a PR opening when nobody has acted yet. A need without the fresh flag still takes the older verdict, so nothing changes for existing stations.

Tests: packages/store/src/resolve.test.ts (9)

The store applies the same rule when it opens a visit. In a line where a judge station produces a verdict and then a human station acts, a later station with a fresh verdict need gets nothing in its brief if the judge produced it before the human reported. If the need is required, opening the visit is refused with a missing-need error that says the value was not produced since a person last acted. A fresh need for something the human did produce, such as feedback, is passed on. A fresh need for a start item is passed on when no human visit has happened yet. A visit opened by hand with no human visit yet leaves an optional fresh verdict out.

Tests: packages/store/src/open-visit-fresh.test.ts (71)

Definition validation knows about the flag too. Fresh is accepted on a need and reports no unknown key. On a produce it is reported as an unknown key. A station body is refused when a need is both fresh and collects, with the message that fresh is for a bag item and takes no collect.

Tests: packages/pipeline/src/collection/unknown-keys.test.ts (25, 32), packages/pipeline/src/definition-schemas.test.ts (11)

What the checks read

The story holds. personLastActedAt returns the last human or by-hand visit index, or -1. resolveNeeds leaves out a stale fresh optional need and reports a required one as missing with the stated label. The store opens visits under the same rule. Definition validation accepts fresh on a need and refuses it together with collect. I found no contradiction and no untested behaviour. I read only the story and code.json, and did not open tests.json, so I did not search the test files.

The story holds: personLastActedAt, fresh need resolution, store opening of visits, and definition validation (fresh on need, unknown on produce, fresh+collect refused) are all told, with no contradiction or untold behaviour.

All five statements about fresh needs match the code in packages/store, packages/assembly-lines and packages/pipeline, so no gaps were found.

@lore-agent lore-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lore review — Approved

The implementation, the issue and the changed documents tell the story the tests tell.

Must fix (0) · Consider (0) · Nits (0)

Reviewed by claude-sonnet-5-5

Submit a review that requests changes to have Lore push a fix for it. Comment @lore review to re-run the review.

Posted by floor, visit 79329f4c-7db4-4592-8daf-89a48f212bac.

@gedaiu
gedaiu merged commit 9dcbe18 into main Nov 24, 2026
22 checks passed
@gedaiu
gedaiu deleted the need/fresh branch November 24, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant