Repository navigation
Migrator contracts, step 1 (D159, #2615): the contracts artifact, beside each corpus, diffed by the drift lane - #2619
Merged
Merged
Conversation
added 4 commits
October 24, 2026 21:01
…rtifact first, then emission, then the generation bump and the STC re-promotion
…at each migrated function's body proves about its pointers, drawn once per corpus, written beside the modules, diffed by the drift lane CImport.ci_body_contract_evidence reads one body's C AST for `mutparam:` (a write through a parameter), `fieldstore:` (a parameter stored into a field of another), `freesmember:`/`memberarg:` (a field freed, or handed to a callee), and the out-parameter proof over the body's top-level statements (`outfull:` when `*p = …` precedes every return and every other use; `outcond:` with the reason otherwise). CiContracts resolves the verdicts over the whole corpus with D121's ownership proofs: receiver-mut:<R> (a1, direct or through a corpus callee, a fixpoint), out:<i>:<T> / out-record:<i>:<R> (a2), owned:<i> only when the field a parameter is stored into is freed by a corpus function (b, both halves; store alone is stored-unknown), ret-from:<i> (c), and unproved:<i>:<why> for everything else, a read-only handle included (not in the ruling). `with migrate --emit-contracts FILE` writes name<TAB>verdicts sorted; build/corpus.w asks for it beside the generated modules, promotion copies contracts.tsv, and the drift report prints changed contract lines one by one. No signature changes yet (step 2). Basic test bs_check_migrate_contracts covers each verdict and refusal. A compiler module calling List[str].sort() does not link stage1 (#2618), so the artifact sorts by insertion.
…nother package needs; pub-lint-check)
Contributor
Author
|
Seed-driven battery GREEN on 2e02048 (wall 647 s; the first run's only red was pub-lint-check on the new setter, made package-private). |
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.
D159 step 1 of 4 (#2615,
docs/proposals/migrator-contracts-plan.md): the contracts artifact. No signature changes yet.What a body proves (
CImport.ci_body_contract_evidence, over the C AST the migrator already has): writes through a parameter, a parameter stored into a field of another, a field freed or handed to a callee, and the out-parameter proof over the body's top-level statements (a whole write*p = …before everyreturnand before any other use ofp).The verdicts (
src/CiContracts.w, a corpus-wide pass after D107's nullability and D121's ownership proofs):receiver-mut:<R>(a1, direct or through a corpus callee, a fixpoint),out:<i>:<T>/out-record:<i>:<R>(a2),owned:<i>only when a corpus function frees the field the parameter was stored into (b, both halves; store alone isstored-unknown),ret-from:<i>(c), andunproved:<i>:<why>for everything else, read-only handles included (not in the ruling).The artifact.
with migrate --emit-contracts FILEwritesname<TAB>verdicts, sorted.build/corpus.wasks for it beside the generated modules; promotion copiescontracts.tsvinto the corpus; the drift report prints changed contract lines one by one (the ruling's second condition; the gate on a change is step 4, once promoted contracts exist).Evidence.
bs_check_migrate_contractscovers each verdict and refusal on a twelve-function corpus. A fresh STC migration (775 functions): 277 mutating receivers, 1 out-parameter, 9 borrowed returns, 0 owned (every slot push isstored-unknown: STC'si_keydropis a no-op, the facade owns the slot, as D148 built it), 427 unproved, mostly read-only handles.Found on the way: #2618 (a compiler module calling
List[str].sort()does not link stage1).Battery: seed-driven, posted below when green.