Repository navigation
Domain: lifecycle states and the session's result line - #32
Merged
Merged
Conversation
Issue: #10 Both suites fail: ./lifecycle.ts and ./resultLine.ts do not exist yet.
…ure domain Issue: #10
Issue: #10 U+0085 is stripped and U+FEFF kept, as Rust's White_Space set says and JS trim does not. The comment on the 2^53 case now calls the divergence from u64 what it is: deliberate and unreachable.
… line Issue: #10 Pins the marker to the start of the line: a non-anchored match passed every ported test, because softfac's list only prefixes FACTORY-STOP.
rawphp
marked this pull request as ready for review
October 15, 2026 10:54
Author
|
Factory gate: passed (attempt 1, run by the factory in a fresh checkout of the pull request's head
|
…ker exports A whitespace run followed by other text made the `[...]+$` trim backtrack quadratically on untrusted session output (200k spaces ran past a minute). Trim with index loops over the same Rust White_Space set instead. DONE_MARKER, NEEDS_INFO_LINE and STUCK_LINE had no importer, which fails knip:check; they are module-private until a caller needs them.
Author
|
Factory gate: passed again (attempt 2, run by the factory in a fresh checkout of the pull request's head
|
transition threw a plain Error, so an Effect caller saw a stale or duplicate webhook's event as an untyped defect. It now returns a Result whose failure is a tagged InvalidTransition, as softfac's transition returns Result.
No event left needs-info, so setting factory:ready on an answered issue was an invalid transition. approved now moves needs-info to ready with no actions, as for proposed and stuck. softfac's table lacks this pair while its lifecycle doc promises it; this follows the doc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10
Contract
apps/server/src/factory/domain/lifecycle.tsis a pure(state, event)→{ next, actions }over the sevenfactory:*labels, with softfac's table (same action order) plus one deliberate addition,needs-info+approved→ready, which follows softfac's documented lifecycle where its table has no exit (17 valid pairs), labels, colours, descriptions and event names; an invalid pair returns a typedInvalidTransitionfailure with softfac's message.apps/server/src/factory/domain/resultLine.tsreads the last line of a session message as done / needs-info / stuck with softfac's exact reasons, marker rules and pull request URL rules. Both test files are ported fromsrc/lifecycle.rsandsrc/runner/tests.rsatrawphp/softfac@bf273a1.vp test run apps/server/src/factory→ pass (5 files, 53 tests)Acceptance criteria
lifecycle.tsis a pure function with softfac's table; tests ported —lifecycle.test.ts(27 cases, one per Rust test, incl.exactly the table pairs succeed,set label always matches next state,assignment follows the state entered)resultLine.tsreadsFACTORY-DONE: <url>,FACTORY-STOP: needs-info,FACTORY-STOP: stuckor none with softfac's rules; tests ported —resultLine.test.ts(13 ported cases plus helper and Unicode cases)apps/server/src/factory/domain/— both files have no imports at all;boundary.test.tspassesGate
vp test run apps/server/src/factory→ exit 0vp run --filter t3 typecheck→ exit 0Models
Review
note FACTORY-DONE: …,FACTORY-DONE: …,> FACTORY-DONE: …to the whole-last-line list so a non-anchored marker match failsNotes
e4bcce9f6toorigin/main(f1dba9a17) at Isolate; it had been cut before Factory skeleton: an empty FactoryLayer wired in through one seam #1 landed.docs/lifecycle.mdis not in this repo, so the description test pins the seven label-table rows as a literal instead of reading the doc.u64; no GitHub pull request number reaches that. Repo comparison lowercases ASCII only, as Rusteq_ignore_ascii_casedoes.apps/server/src/factory/domain/.Lessons
FACTORY-STOP, soincludesinstead ofstartsWithonFACTORY-DONEsurvived every ported test. Cause: a port copies the spec's cases and the spec's blind spots with them. Default: when naming mutants for a port, add one anchor mutant per marker or prefix the code checks, even where the reference has no case.Commits
9463426d0test(factory): port lifecycle and result-line tests from softfac— Make slice (red)f0a605da0feat(factory): lifecycle transitions and result-line parsing in the pure domain— Make slice (green)0768fc424test(factory): pin the Unicode whitespace rules of the result line— Check cycle 12ff87a206test(factory): text before FACTORY-DONE on the last line is no result line— Check cycle 2Files
transitionsrc/lifecycle.rstestssplitLastLine,pullRequestUrl,parseSessionResult, reason constantssrc/runner/tests.rsparser testsModel: Claude Fable 5.1 orchestrating, Sonnet 5.5 maker, Opus 5.5 reviewers. Harness: Claude Code in T3 Code.