Skip to content

Migrator contracts, step 3 (D159, #2615): STC re-promoted, the facades call the engine's methods - #2624

Merged
ehartford merged 4 commits into
mainfrom
migrator-contracts-3
Oct 25, 2026
Merged

ehartford merged 4 commits into
mainfrom
migrator-contracts-3

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

D159 step 3 (#2615): the STC corpus re-promoted under migrator-pin:#2615; the facades call the engine's methods.

  • Two refusals the first promotion forced: a handle the body indexes or steps (refs[i], p + k), itself or through a corpus callee, is an array of records and no receiver (std.algorithms sorts n records through stc_slotrefs_sort(refs, n); a method on one would write past it); an iterator record's functions are named after it (stc_word_stack_next on stc_word_stack_iter is next). Both are basic-test rows.
  • The facades call methods — self.words.push(w), self.slots.pop(), cursor.next() — and 47 engine-call unsafe blocks are gone (370 → 323 across lib/std/collections). What stays unsafe is what the ruling left out: the read-only surface (a &self brief is the follow-up) and the slot pushes (stored-unknown).
  • Plan status in docs/proposals/migrator-contracts-plan.md.

Battery: seed-driven, posted below when green.

Eric Hartford added 4 commits October 25, 2026 02:34
…ator's functions are named after it

A first parameter the body indexes or steps (`p[k]`, `p + k`), itself or through a corpus callee (the sort wrapper hands its array to the indexer), is an array of records: `unproved: indexed as an array`, never `self` (a safe method on one element writing n of them would be unsafety). A function on an `_iter` record that carries the collection's prefix (`stc_word_stack_next` on `stc_word_stack_iter`) is `next`. Both are basic-test rows.
…all the engine's methods

The corpus and its test programs are today's migrator output: a mutating receiver is a `pub mut fn` of its shape. The collections call them as methods, no unsafe: `self.words.push(w)`, `self.slots.pop()`, `cursor.next()`; 47 engine-call unsafe blocks gone across the facades (370 to 323). What stays unsafe is the read-only surface (size, top, at, front, drop), which the ruling left out, and the slot pushes, which store a pointer the engine never frees (stored-unknown).
The first rewrite matched only `stc_word_`/`stc_slot_` calls wrapped in an `unsafe { }` on their line; `cbits_*` (STC's bit set) and a bare `stc_word_list_next` inside an `unsafe:` block were missed, and a generic body's stale call surfaces only at instantiation (the behavior tests, not the build). Facade unsafe: 370 to 318.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery green on bc6374a, seed-driven under nightly-20261025-local-1-c88f3eeff0bc (tools/battery.w: gate, uat, battery-checks); corpus-migrator-gate green on every corpus's fresh migration.

@ehartford
ehartford marked this pull request as ready for review October 25, 2026 07:00
@ehartford
ehartford merged commit b65c610 into main Oct 25, 2026
@ehartford
ehartford deleted the migrator-contracts-3 branch October 25, 2026 07:00
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