Skip to content

cleanup has no stated contract: shell counts every exit, perl counts return undef, cobol matches CLOSE inside paragraph names, and eight languages count the declaration of a cleanup routine as a use of one #2888

Closed

Description

@squid-protocol

Phase 3 family (#2812), next per the mechanical audit. Sheet row: cleanup — resources / site / Explicitly destroying state or releasing resources — planted, draft. One open cell: makefile 3 vs the planted 2 (cell_categories: cleanup/makefile = extraction). Baseline measured with rule_probe.py cleanup all on engine main 5eac04ea.

The failure shapes (rule_probe, crucible)

  • A declaration counted as a site (the args/api corollary-1 shape): python/embedded_python def close(self):, rust fn drop(&mut self) (9 of 22 hits), typescript dispose(): void; / dispose() { (~46 of 299), csharp public void Dispose(), dart void dispose() { (11 of 55), java private static void close(, perl sub finish {, objective-c - free, scala def close(): Unit, abap clear FOR zif~clear (an ALIASES line), zig fn deinit(.
  • Termination counted as release: shell 757 hits, ~300 of them exit — including -s exit:0 atf-test arguments and heredoc C code — while exit already belongs to panics_and_aborts (double-owned). agc EXIT (17) is a control transfer, unlike ENDOFJOB, which genuinely releases the job's core set in the executive model.
  • A name counted as a site: cobol 630 hits vs 570 functions — \bCLOSE\b fires inside hyphenated paragraph names (PERFORM 9000-DALYTRAN-CLOSE) and string literals (MOVE 'CLOSE CUR1' TO ...); scheme counts handler-table entries and (set-who! close-port argument positions; scala counts close inside log strings; matlab counts clear inside eval-string literals.
  • Placeholder counted as destruction: perl 527 hits, dominated by return undef; and undef, argument placeholders — only undef $var destroys.
  • Configuring the reclaimer counted as reclaiming: lua counts collectgarbage("stop") / ("restart") (27 hits) — suspending the collector is the opposite of collecting.
  • Double-owned tokens: go Unlock/RUnlock (~28 of 68) — sync_locks explicitly owns the Lock/Unlock family; js/ts delete — .delete( is state_mutation's container-mutator token (state_mutation has no stated contract: three incompatible definitions across 46 languages, and it governs the corpus's two worst metrics #2765); cobol END-DECLARATIVES is a structural closer, the exact family safety has no stated contract: 2 open cells are token-double-counts and one-owner misfires, and haskell's rule counts pure, return and type constructors as runtime guards #2869 removed from safety; makefile's open cell: the clean: target header counts for cleanup while the same construct counts for func_start (the manifest note prices it: c.mk 3 = clean: + two rm -f).
  • cleanup contract: destruction of external state has no owner — c remove() left io (#2841 C2) but c's cleanup rule does not claim it #2843 decided here: destruction of external state is cleanup's (the sqlite DROP TABLE/DELETE FROM precedent, yaml's rm -rf, powershell's Remove-Item) — c gains remove(, tcl gains file delete, shell gains non-root rm -f-family (the root form rm -rf / stays high_risk_execution's, same split makefile already has).

Corpus movement

makefile 3 → 2 (green; drop the target-header arm, C1+one-owner). shell's plant exit 0 is authored to a removed token → re-plant (rm -f scratch, screened). agc keeps ENDOFJOB/RESUME (executive-release fallback family). All other plants are already in call/statement form.

Part of #2812. Precedents: #2765, #2822, #2841, #2852, #2858, #2869, #2875, #2878, #2882.

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope:frontier

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions