Skip to content

feat!: infer ownership transfer for attaching helpers - #33

Merged
owenthcarey merged 6 commits into
mainfrom
feat/ownership-transfer-attaching-helpers
Sep 18, 2026
Merged

owenthcarey merged 6 commits into
mainfrom
feat/ownership-transfer-attaching-helpers

Conversation

@owenthcarey

@owenthcarey owenthcarey commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Implements the accepted design for inferring reusable memory contracts over stateful, recursive C workflows, and records its validation. Intended to be squash-merged as one commit.

RFC 0029 stays Accepted, not Implemented, as with RFCs 0007–0013 and 0018. The open items below are recorded in docs/validation-rfc0029.md (candidate 105) and are not waived.

Open acceptance items

  1. lua exceeds its 600-second checked deadline. Checked whole-program mode, user CPU, against the RFC 0028 baseline:

    project baseline now 600 s deadline
    log.c 0.2 0.12 inside
    cJSON-program 30.1 60.2 inside
    jansson 117.7 215.2 inside
    linenoise-program 16.9 267.7 inside
    lua 593.0 over 1,188, abandoned exceeded

    lua had 1.2% headroom before this milestone. The deadline is unchanged and still gates the flip to Implemented. The weekly corpus job runs ordinary analysis only, so it is not affected.

  2. The ordinary 1.10x time/RSS gate is unmeasured. Three runs on this machine spread from 149 to 197 seconds, too noisy to resolve 10%. It needs an isolated machine.

  3. Four upstream cJSON workflows (parse-delete, malformed-delete, nested-serialize, nested-print) still end checking-incomplete.

  4. The unregistered mixed-helper-frames probe has never passed: its two positive cases end checking-incomplete on every candidate since it was frozen, while its three negatives are correctly rejected. That makes it a precision gap, not a soundness one.

The recommended next milestone is checked per-analysis cost, tracked by checked_case_requests and user CPU on every candidate.

What is verified

  • All 1,709 CTest entries and all 205 lit tests (Debug).
  • Fixed evaluation: 44/44 bugs detected, 32/32 clean programs accepted.
  • Every registered RFC 0029 population reports its recorded outcomes, including the new attached-payload-transfer population through both source and ordinary objects.
  • Strict clang-tidy on every changed source, source/CMake formatting, the Core dependency boundary, and the documentation site build.
  • Unchanged upstream cJSON: the print lifecycle, the double-release negative, both construction output-release mutations and both lifetime-audit cases pass.

Breaking

Summary format 26, sidecar format 27, checked encoding 12, with no compatibility readers. Existing objects must be rebuilt and existing analysis caches discarded.

Suggested review order

  1. docs/rfcs/0029-compositional-recursive-workflows.md for the proof rules.
  2. docs/validation-rfc0029.md, particularly the last two sections.
  3. lib/Core for the portable records, then lib/Analysis.
  4. The frozen populations under test/evaluation/rfc0029/.

Adds the accepted design for inferring reusable memory contracts over
stateful, recursive C workflows, and the validation record covering its
103 implementation candidates.

The record is kept deliberately complete, including the candidates that
failed, the three false proofs found and corrected, and the first
re-measurement of the corpus completion and cost gates. That measurement
is a release blocker for the implementation and is documented as such:
checked contract mode regressed far past the mandatory 1.10x cost gate,
driven by a 6.6x growth in checked input-case requests, and one corpus
project now exceeds its 600-second deadline.

The design stays Accepted rather than Implemented, as its own acceptance
section requires while those gates are unmet.
Implements the accepted recursive-workflow design: semantic discovery of
buffer and cursor roles, relational inputs and outputs projected through
helpers, recursive contract groups checked as a unit, synchronous
callback requirements as caller obligations, and the byte-level reasoning
the parser workflows need.

The headline new capability is the attaching-helper transfer. A complete
attach now publishes the disjoint union of both owned inputs and the
payload it allocated itself, forwards that guarantee through a direct
return, and installs it on an immediate test of the call's result. This
verifies the unchanged upstream object and array attach lifecycles.

Also corrects four general defects found while validating it: a
recognized minimum losing its relation to its operands, a directly
returned fresh result settling no allocation, a complete release helper
not settling a represented allocation head, and an automatic-storage
write retiring a forest built entirely from this invocation's
allocations. The third of these had silently broken a mandatory upstream
client for roughly twenty candidates.

Portable records move to summary format 26, sidecar format 27 and
checked encoding 12, with no compatibility readers. Existing objects
must be rebuilt and existing analysis caches discarded.

Not ready to merge: checked contract mode fails the mandatory cost gate.
See docs/validation-rfc0029.md for the measurements and the diagnosis.
@owenthcarey
owenthcarey force-pushed the feat/ownership-transfer-attaching-helpers branch from d8e2c49 to 9be55b9 Compare September 17, 2026 22:19
Profiles the checked-mode regression against a checker rebuilt from
bbf14c3. On one linenoise unit, user CPU goes from 3.47 s to 74.35 s.
That 21x is 2.9x more function analyses times 7.3x cost per analysis,
and the per-analysis factor dominates.

Also records the invalidation churn found along the way (465 distinct
contexts analyzed 1,429 times, because one @callback-globals change
retires every dependent specialization) and a reverted scheduling
experiment that moved analyses between passes without reducing time.

The conclusion is that the mandatory 1.10x gate cannot be reached by
optimization; meeting it as written would require cutting scope. The
three available courses are recorded for the owner to choose, since this
RFC forbids silently reducing a resource bound.
Every integer range query that lacks a direct bound called equalsOf,
which linearly scanned all tracked relations and returned a freshly
allocated vector. Profiling the corpus put that query, integerRangeAt
and the allocator at the top of the profile.

Replaces it with a visitor that allocates nothing and skips the keys
that cannot name the queried place, since keys are canonical ordered
pairs. One linenoise unit falls from 74.35s to 60.76s of user CPU.

This is an internal index refinement, visiting exactly the same edges.
Behaviour is unchanged: 811 Analysis, 561 Core and 86 Frontend unit
tests, 205 lit tests, the 44/44 and 32/32 fixed evaluation, and
twenty-six frozen populations all report their existing outcomes.

Also corrects the validation record. It previously claimed checked mode
failed a mandatory 1.10x cost gate; that bound applies to ordinary
Release runs, which are unaffected. Checked projects carry a 600-second
deadline instead, which four of five meet. lua exceeds it, and that is
now the single demonstrated cost violation.
@owenthcarey
owenthcarey marked this pull request as ready for review September 18, 2026 03:21
@owenthcarey
owenthcarey merged commit fcc3b46 into main Sep 18, 2026
12 checks passed
@owenthcarey
owenthcarey deleted the feat/ownership-transfer-attaching-helpers branch September 18, 2026 04:51
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