Skip to content

feat(term-state): implement bitty-term-state crate: Terminal Truth core - #13

Merged
Xuepoo merged 3 commits into
mainfrom
ctx-0010/feat-bitty-term-state
Aug 26, 2026
Merged

Xuepoo merged 3 commits into
mainfrom
ctx-0010/feat-bitty-term-state

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Implements CarryCtx task CTX-0010 (GitHub issue #11) against the accepted
Terminal State RFC sections 'Grid and state invariants', 'Damage tracking
model', and 'Deterministic replay guarantees', per ADR-0003 topology
(workspace deps: bitty-vt only).

  • State::apply(&TerminalAction) transition API; exhaustive, total over all
    actions; Unknown/OscUnknown inert with telemetry outside the state hash.
  • Grid/cursor/modes/scrollback/damage/replies/charsets/tabs modules with
    all eight RFC invariants mechanically enforced and debug-asserted after
    every batch; check_invariants() exposed for embedders and tests.
  • Damage model: generation counter per processed batch, coarse rectangles
    for erase/scroll, print runs coalesced at a fixed point, bounded history
    window for damage_since.
  • Bounded scrollback (oldest-first pruning, monotonic ids), reply cap with
    drop-and-flag, hyperlink table and zone log caps.
  • Device-status replies synthesized and queued (DSR/CPR/DA1); no I/O.
  • Canonical FNV-1a state hash over fixed-order little-endian encoding;
    damage bookkeeping generation excluded from truth hash.
  • Image store/placement: typed stub referencing OQ-008 / RFC open items.
  • Tests: unit invariant tests, proptest action-sequence invariants,
    double-run replay determinism (byte-identical damage streams + hashes),
    bitty-vt seeds integration asserting totality. Proptest surfaced two
    wide-pair orphan bugs (print overwrite; DCH/ICH source-boundary split),
    fixed via boundary pre-clears plus deterministic repair_row backstop.

Evidence

  • CarryCtx task: CTX-0010 (owner core-implementer, session 01M0YAKE, worktree .worktrees/ctx-0010-feat-bitty-term-state, commit ed55a73)
  • Contracts: bitty-docs/docs/specifications/terminal-state-rfc.md (accepted sections), ADR-0003 dependency row
  • Local gates (just check): cargo fmt --check, clippy --workspace --all-targets --locked -D warnings, test --workspace --all-targets --locked, actionlint, markdownlint — all green
  • gitleaks: no leaks found
  • Tests: 39 unit + 3 parser-seeds integration + 4 proptest invariants + 4 replay determinism (+ existing bitty-vt suites); proptest regression seeds checked in

Refs: CTX-0010, #11

Xuepoo added 3 commits August 26, 2026 16:39
Implements CarryCtx task CTX-0010 (GitHub issue #11) against the accepted
Terminal State RFC sections 'Grid and state invariants', 'Damage tracking
model', and 'Deterministic replay guarantees', per ADR-0003 topology
(workspace deps: bitty-vt only).

- State::apply(&TerminalAction) transition API; exhaustive, total over all
  actions; Unknown/OscUnknown inert with telemetry outside the state hash.
- Grid/cursor/modes/scrollback/damage/replies/charsets/tabs modules with
  all eight RFC invariants mechanically enforced and debug-asserted after
  every batch; check_invariants() exposed for embedders and tests.
- Damage model: generation counter per processed batch, coarse rectangles
  for erase/scroll, print runs coalesced at a fixed point, bounded history
  window for damage_since.
- Bounded scrollback (oldest-first pruning, monotonic ids), reply cap with
  drop-and-flag, hyperlink table and zone log caps.
- Device-status replies synthesized and queued (DSR/CPR/DA1); no I/O.
- Canonical FNV-1a state hash over fixed-order little-endian encoding;
  damage bookkeeping generation excluded from truth hash.
- Image store/placement: typed stub referencing OQ-008 / RFC open items.
- Tests: unit invariant tests, proptest action-sequence invariants,
  double-run replay determinism (byte-identical damage streams + hashes),
  bitty-vt seeds integration asserting totality. Proptest surfaced two
  wide-pair orphan bugs (print overwrite; DCH/ICH source-boundary split),
  fixed via boundary pre-clears plus deterministic repair_row backstop.
…unit tests

Covers alt-screen full-set roundtrip (invariant 5), origin-mode addressing,
invalid DECSTBM handling, scrollback capture only under screen-bottom
regions (invariant 4), origin-aware CPR synthesis, DECSTR subset, and
FullReset hash equality with a pristine state.
@Xuepoo
Xuepoo force-pushed the ctx-0010/feat-bitty-term-state branch from 082a3fd to db9f549 Compare August 26, 2026 08:41
@Xuepoo
Xuepoo merged commit 3f88dd9 into main Aug 26, 2026
@Xuepoo Xuepoo added feat Feature area:package Area: package lifecycle area:term Area: terminal state / VT P0 Priority: highest labels Aug 29, 2026
@Xuepoo Xuepoo added this to the v0.0.1 milestone Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:package Area: package lifecycle area:term Area: terminal state / VT feat Feature P0 Priority: highest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant