1098. line_editor: what an outside maintainer would fix before it leaves
Raised by a read-only outside review of line_editor, read the way a maintainer meeting it
for the first time would. It changes nothing; it lists what the next lanes change, and it puts the
one-way doors to the architect.
The review's accepted baseline is the disposition in the releasable-crates note
(notes/releasable-crates-*.md) when the review ran: line_editor moved after a cut, because its
component module linked nife's capability_plan. The note now gives the cut: line_editor
moves, terminal_contract joins the contract crates and line_editor_component stays. It takes the
crate name (ratified), Event::Suspend, Event::Tab and the badge and opcode values of proto as
settled, together with §232 (the line_editor swap contract) and §295 (the line editor's crate
root splits into module files). No review package existed for this crate under
notes/crate-reviews/ when the review ran, so the baseline is thinner than other crates'.
Three names #2797 ratified, LINE_MAXIMUM, PROMPT_MAXIMUM and RAW_QUEUE_MAXIMUM, are reopened here. The later unit rule (design/naming.md, "Units": a limit opens MAXIMUM_ and ends with its unit) contradicts them. The rule in force is that a release review rechecks a name ratified before a later rule.
Reuse: the template partsfoundry/crate-workflows and its helpers (spelled_out.py,
abbreviations.py, standalone.py), cargo-fuzz, Kani, cargo-mutants. No new tool.
Finding status
Every finding not Done blocks the first crates.io publish, under the publishing hold.
-
Item 1 (P0), the crate does not stand alone: Done, #4002.
-
Item 2 (P0), the cut: Done, #3587.
-
Item 3 (P1), public names the naming rules refuse: Done, #3965.
-
Item 4 (P1), names the template's gates refuse: Done, #3965.
terminal_contractandline_editor_componentkeep their own worklists, andprotois no longer a module of this crate. -
Item 5 (P1), bindings and limits a stranger can read: Done, #3566.
-
Item 6 (P1),
forbid(unsafe_code), fuzz targets and Kani harnesses: Done, #3566. -
Item 7 (P1), the handoff layout's version policy: Done, #3566.
-
Item 8 (P1), one
QUIESCED: Done, #3587. -
Item 9 (P2), stack copies: Done, #3566.
-
Item 10 (P2), the
csi_movebound: Done, #3566. -
Item 11 (P2), three repaints with one body: Done, #3566.
-
Item 12 (P2), the history depth: Done, #3566.
-
Item 13 (P2), the test terminal's row: Done, #3566.
-
Item 14 (P2),
Writer::fieldwidth: Done, #3566. -
Decision 1, where the cut falls: Done, #3587, ruled 2026-11-14 (UTC).
-
Decision 2,
LineEditorandHISTORY_LINES: Done, #3965, ruled 2026-11-14 (UTC) by the maintainer, provisional. -
Decision 3, the three limits take their unit: Done, #3965, ruled 2026-11-19 (UTC) by the maintainer, provisional.
-
Decision 4, an interface identity for
terminal_contract: Done, #3972, ruled 2026-11-19 (UTC), A, and frozen 2026-11-22 (UTC) as interface 25, version 1, with no magic. -
Decision 5, the name
terminal_contract: Done, #3965, ruled 2026-11-19 (UTC), A, in #3796. -
Decision 6, review clearance and the repositories: At the move. The architect cleared both
notes/crate-reviews/line-editor.mdandnotes/crate-reviews/terminal-contract.mdon 2026-11-22 (UTC).terminal_contractlives inpartsfoundry/terminal_contract, and nife depends on it by rev (#4015). The move ofline_editorwaits on its own remaining work. -
Decision 7, the reserved bits of the terminal's first request word: Done, #3972, ruled 2026-11-22 (UTC), A.
-
The move: Done, #4001. The crate lives in partsfoundry/line_editor, and nife depends on it by git and
rev, a commit on itsmain, withversion = "0.1.0". It keepspublish = false; no tag exists, and crates.io holds no release.
Open decisions
None.
Goal
A stranger who finds line_editor in its own repository can tell in one screen that it is a
sans-IO, allocation-free line editor for a serial terminal. The stranger can read every key binding and every
limit without opening another repository. The stranger can also trust that any byte sequence leaves the editor
in a consistent state. Nothing in the repository names nife, a milestone, a decision section or a
person. The template's gates are green for the crate's own reasons.
What was checked, and how
The tools run, the sources read and what was not run are in the appendix.
Prior art
The comparison with nearby work is in the appendix.
The items
Effort: S is half a day for a lane, M a day or two, L longer. A door is one-way when somebody outside the repository acts on it after the release (a public name, a published behavior, a layout or identity, a dependency); everything else is two-way and the maintainer decides it.
P0: blocks the move
-
The crate does not stand alone, and its text quotes and dates a person. Finding:
standalone.pylists what the template'sstandalonejob will refuse. The list is: no README, noLICENSE-MIT, noLICENSE-APACHE,license.workspace = true,lints.workspace = true, norust-version,publish = false, 48 milestone citations, 16 paths into the nife tree, 41 provenance lines, 8 lines naming the architect and 16 section citations. The manifest also carries nodescription,repository,readme,keywordsorcategories. Four doc comments quote a ruling by name and date in their body, outside anyName:block, which the move strips and the record rules refuse regardless of the move. Evidence:Cargo.tomllines 5 to 14;src/lib.rslines 8 to 9 and 23;src/line_disc.rslines 157 to 160 (nameskernel/src/user.rsandcomponents/src/line_editor.rs);src/proto.rslines 78, 99, 202 and 235;src/component.rslines 110, 150, 171, 226 and 234. Change: inlinelicense = "MIT OR Apache-2.0"and the two lints the template requires. Addrust-version,description,repository,readme. Add the two license files and a README (item 5 gives its content). Rewrite each citation as a statement of the rule in force or a link inside the repository. Delete the quoted rulings and keep the decision. Most of this falls away with item 2, sincecomponent.rsandproto.rshold 60 of the 129 findings. Door: two-way. Effort: M. -
The cut the disposition requires is not made:
component,protoand thecapability_plandependency are nife's terminal contract, not a line editor. Finding:componentdeclares slot orders, virtual addresses, page budgets and a supervisor protocol for one nife program, and pullscapability_plan(which pullsmoho_abi) into a crate whose engine needs neither.protois the IPC framing of the terminal contract: opcodes, badges, a quiesce handshake and a swap protocol that only nife programs speak. 32 of the 38 caller files reach only these two modules; the kernel links the crate forprotoalone. The "nothing that leaves references back" rule of milestone 1017 (the contract crates leave in this order) cannot hold whilecomponentnamesterminal_supervisor,system_initializeranddisplay_terminal. Evidence:Cargo.tomlline 14;src/lib.rslines 38 to 68;src/component.rswhole;src/proto.rslines 63 to 215;crates/hot_swap_contract/src/lib.rsline 49 (the duplicateQUIESCED). Change: as decision 1 below rules, built in #3587.handoffstays:saveandrestoreread the engine's private fields, and the crate documents the layout as its own. Door: one-way for the new crate's name and for the shape of the publishedline_editor(noprotomodule); decision 1 below. Effort: M.
P1: before the first tag
The P1 items are in the appendix.
P2: later
The P2 items are in the appendix.
Follow-on
- Done. Item 2, as decision 1 rules:
terminal_contractandline_editor_componentcarry the cut, andline_editordepends on nothing. Item 8: aconstassertion in theline_editorprogram holds the twoQUIESCEDvalues equal. Items 3 and 4 and decisions 2, 3 and 5: the engine's names and the crate root's ratification are built. - Done. The move to
partsfoundry/terminal_contract, #4015. - Recorded. The move to
partsfoundry/line_editor, with item 1 and the rest of its review package's "What still blocks the move". - Recorded. The externalization list:
crates/externalization-list.txtnamesline_editorand notterminal_contract, checked in that file on main.
Decisions for the architect
Decisions 1 to 7 are the rules in force.
Where the cut falls: proto and component leave the crate, handoff stays
Background. The disposition in force says line_editor moves after a cut that leaves component
in nife, because that module links capability_plan. component is not alone: proto is the
same kind of thing, the opcode and badge table of nife's terminal contract, and it is what 32 of
the 38 callers come for. handoff is different: its two cursor types depend on nothing, and
save/restore read the engine's private fields, so it is the engine's own serialization. Once
the crate leaves, the modules it carries are its public shape, which others build on.
Recommendation. Cut proto and component together into one nife wire-contract crate,
named terminal_contract (decision 5), and keep handoff in line_editor. The engine then has one
dependency (none) and one job; the contract crate joins milestone 1017's family and takes its
identity rule there. The alternative, cutting only component, leaves a published editor whose
largest module is an IPC table for a system the reader does not have.
Prior art. Linux keeps the tty line discipline (n_tty.c) apart from the termios ABI in
uapi; the ABI is what every program includes and the discipline is replaceable. In Rust, vte
is the parser and alacritty_terminal is the program that speaks to the OS; noline keeps its
sans-IO core apart from its sync and async fronts. In this tree, supervision_contract and
hot_swap_contract already hold protocols apart from the programs that serve them, and
video_terminal carries a component.rs facing the same cut.
Concrete example. kernel/Cargo.toml links line_editor to read proto::req and
proto::OPERATION_WRITE in kernel/src/user/terminal_print.rs; after the cut it links
terminal_contract and the kernel no longer depends on an editor.
Ruled 2026-11-14 (UTC): the cut falls in three places. proto, the terminal protocol's opcodes and
badges, is the wire-only leaf crate terminal_contract, with no dependencies; its name is
ratified (decision 5). The kernel,
std_runtime_contract, fixtures, system_initializer, system_tests and every program that
speaks the protocol depend on it, not on line_editor. component stays beside the terminal
programs as the nife-only crate line_editor_component (name provisional), and capability_plan
does not leave. handoff stays in the engine. line_editor depends on nothing
and is listed in crates/externalization-list.txt. The leaf states QUIESCED, and the
line_editor program holds it equal to hot_swap_contract::QUIESCED at compile time (item 8).
terminal_contract takes an interface identity (decision 4).
The engine's public type and constant names at release: LineEditor and HISTORY_LINES
Background. LineDisc is an abbreviation of "line discipline", a word the crate name ruling
refused as an overclaim; HIST is not a word and carries no Name: block. After the tag a rename is a breaking change to every user.
Recommendation. LineEditor for the type, matching the crate (a crate that holds a component's
logic takes the component's name) and the family (rustyline::Editor, noline::Editor);
HISTORY_LINES for the constant (a count of things names the things). Keep Event::Eof, the
standard library's spelling. No alias for the old spellings before the first release.
Prior art. rustyline and noline call the type Editor; linenoise calls its state
linenoiseState and its history size history_max_len; reedline uses the crate name.
Concrete example. components/src/swish/prompt.rs holds static mut EDITOR: line_editor::LineDisc;
after the rename the declaration reads line_editor::LineEditor.
Decided by the maintainer on 2026-11-14 (UTC), provisional: a two-way door before the first tag, which the architect may revisit. The recommendation is the rule. Item 3 is the work.
The three limits take their unit
Background. LINE_MAXIMUM (256), PROMPT_MAXIMUM (64) and RAW_QUEUE_MAXIMUM (64) are byte
lengths, and #2797 ratified them. The units rule came later: a limit opens MAXIMUM_ and ends with
its unit, and a release review rechecks a name ratified before a later rule. A completion buffer in
the shell declares [0u8; line_editor::LINE_MAXIMUM], and a reader cannot tell bytes from columns.
- A. Rename the three as the units rule spells them.
- B. Keep the ratified names and state the unit in each doc comment.
Prior art. POSIX's MAX_CANON and MAX_INPUT are the same two limits with the unit implied, and
linenoise has LINENOISE_MAX_LINE. The tree's own MAXIMUM_SURFACE_BYTES and
MAXIMUM_UDP_MESSAGE_BYTES carry it. Where nife differs: the unit is always in the name. Example:
[0u8; line_editor::MAXIMUM_LINE_BYTES].
Decided by the maintainer on 2026-11-19 (UTC), provisional: a two-way door until the first tag.
Rule A: MAXIMUM_LINE_BYTES, MAXIMUM_PROMPT_BYTES and MAXIMUM_RAW_QUEUE_BYTES, with no alias.
#3965 builds it with item 3.
An interface identity for terminal_contract
Background. terminal_contract holds the terminal protocol's opcodes, badges and quiesce value,
which the kernel and every program that speaks the protocol share. Other contract crates in
milestone 1017's family (the contract crates leave in this order) carry an interface number and a
version, which a program declares in its interfaces note and a server checks at spawn.
terminal_contract carried neither, so a program built against an older table passed unchecked.
- A. An interface number and a version, with no magic.
- B. No identity: the protocol is register-only, and the badges already gate the operations.
- C. An identity and a magic word, as the page contracts carry.
Prior art. In this tree entropy_contract (12, version 1) and resolver_contract (11, version 1)
took their identities before they moved. Linux, which has no such check, added termios2 and
TCGETS2 beside the old layout rather than change it. Where nife differs: the check runs at spawn,
not at the first call. Example: under A, the shell's note carries
(terminal_contract::INTERFACE_ID, 1).
Ruled 2026-11-19 (UTC): A. The crate takes an interface number and version 1, with no magic. Frozen 2026-11-22 (UTC): interface 25, version 1, row 25 of the table in milestone 956 (the linked interfaces carry checkable versions).
The reserved bits of the terminal's first request word
Background. A request's first word carries the operation in bits 63 to 56 and a length or count in bits 31 to 0; bits 55 to 32 carry no meaning, and a client sends zero there. Both terminal servers shifted and masked the bits away, so they served a request that set one as if the bits were zero. Once a client outside nife builds against the published crate, a later version could not give those bits a meaning without breaking it.
- A. Refuse the word with
BAD_REQUEST, through one crate function both servers decode with. - B. Keep ignoring the bits, and state that a future version may not give them a meaning.
Prior art. entropy_contract refuses an unknown operation and any reserved bit (decision 2 of
milestone 1071 (entropy_contract: what an outside maintainer would fix before 0.1.0)), and Linux's openat2 and clone3 refuse unknown flag bits with EINVAL so the
bits stay usable. Where nife differs: the refusal is the protocol's existing BAD_REQUEST reply, so
it adds no reply. Example: terminal_contract::decode(req(OPERATION_WRITE, 5) | 1 << 32) is None.
Ruled 2026-11-22 (UTC): A. A terminal refuses a first request word with any of bits 55 to 32 set,
answering BAD_REQUEST. line_editor and display_terminal decode through
terminal_contract::decode, and a host test pins the refusal.
The name terminal_contract
Background. The crate holds the terminal protocol. §323 (the binary interface, and the names of the project's layers) keeps crate names descriptive and gives the page-contract crates no common prefix, so nothing else decides it. The repository takes the name at creation.
- A.
terminal_contract. - B.
terminal_protocol, since it holds opcodes and no page layout.
Prior art. The tree's supervision_contract and hot_swap_contract name a protocol the same
way, and Linux's uapi headers name the interface by subsystem (termios.h). Where nife differs:
the suffix says the crate is the agreement both sides compile against. Example:
use terminal_contract::OPERATION_READLINE;.
Ruled 2026-11-19 (UTC): A. The architect ratifies the name terminal_contract, and the repository takes it at
creation.
Review clearance and the repositories
Background. Clearing a crate review is the go to create its repository under nifeos. line_editor
and terminal_contract leave; line_editor_component stays in nife.
- A. Clear both once the review package exists.
- B. Clear
line_editoralone first, since it depends on nothing. - C. Hold until a dry run also stages the move's own work (item 1).
Prior art. Three crates moved on a cleared review with no tag
(the partition-table review names them). Where nife differs: nothing outside nife links either crate.
Example: under A, the shell pins partsfoundry/line_editor by revision.
Decided by the maintainer on 2026-11-19 (UTC), provisional: a one-way door at repository creation,
and the clearance itself stays the architect's. Rule A: one review package covers line_editor and
terminal_contract, a lane writes it after this pull request, and the architect gives the go for
both from the package, with no tag and no publication.
Cleared 2026-11-22 (UTC): both packages, notes/crate-reviews/line-editor.md and
notes/crate-reviews/terminal-contract.md, as the go to create partsfoundry/line_editor and
partsfoundry/terminal_contract with publish = false, no tag and no publish. Each move waits on its own
remaining work.
Done when
The checks are in the appendix.
BUGS
- The review ran before this crate had a review package, so it had no list of accepted names and proposed items to measure itself against; it took the releasable-crates disposition, the two notes and #2797 as the baseline.
- The mutation figures come from records, not a re-run, and predate the module split and the unit renames; the census that confirms them belongs in the template's window.
- The behavior of
noline's initialization comes fromnotes/line-discipline.md, and the review did not re-verify it against its source. - Whether
abbreviations.pyis a gate or a report in the template'scheckjob stays unverified; item 4 lists its 40 findings either way.
Index row
An outside review of line_editor before it leaves. The cut has landed: terminal_contract and
line_editor_component hold the contract, and the engine depends on nothing. Thirteen of the
fourteen items have landed, the engine's renames among them, and the architect cleared both review packages.
terminal_contract has moved to its own repository; the move of line_editor remains.