Repository navigation
Lay out generated mocks from per-type facts and node records - #1209
Conversation
… switches, and read each lap's overrides Each test compares the laid-out mock with the walk's, and with the mock switches on the walk's side was laid out too, so the two agreed on everything and the expected creation-order differences failed. Its walk side is now pinned to the walk. Each test also overrides the values a later lap of the cycle builds (`A`'s log and reader, `T3`'s log and the session of the `T0` it is built beneath), so that a lap which read a fresh configuration instead of the root's, as the walk reads it, would differ: with re-entry of an entered place broken, both tests fail on those values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQHdCJMwsKrWH5L7aXs
… the override closure first A mock root laid out from node records built a call of another module's public mock, configured by an override closure, in a function returning the called type, while the closure returns the place's type: a place of a protocol the called type names in fulfillingAdditionalTypes failed to compile. The function now returns the property's type, as the walk's builder function does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMp5zzYKmR3a9KwHFX
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMp5zzYKmR3a9KwHFX
…hows production's order The shipped mock proof's report lists every pair that is not EQUAL. An entry claimed for a root in Scripts/mock-proof-allowances.tsv now allows that root's DIFFERENT pair only when the shard's comparison of the records' mock with production for that root (pairs.production-order.tsv) is EQUAL: order may follow production, and nothing else may differ. A claim without that comparison, or with production's order differing, stays listed with what is missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMifKg1WBCEn5ahSLi
…ose frame is now 2,408 bytes Under the 64 KB every generator function is held to, the function needs no line of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMR1grwX46174Pyxyn
…op Mutex from the comparator A `let` in a nested function that reads the name it binds now reads the enclosing binding, as Swift 6.2.1 does, rather than reporting a read before declaration. A field default that is a bare lowercase name is read as the static member of the type the configuration is nested in. The comparison's thread hands its verdict back through an NSLock, since Mutex needs macOS 15 and this target compiles for the package's platforms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQJFbZF6c8FbxzTFKUi
…on of the caller's A fill of another module's public mock that receives a value the called mock does not hold reads the caller's declaration, which one mock root may declare as a value and another lazily. Sharing the call's part across mock worlds spelled the first world's read in every world, so a root that holds the value lazily passed the wrapper where the fill takes the value. The call's part is now left to each world when any fill reads a caller's declaration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQKqaF9eRvqtwAFSdEZ
…roject-thread-xuc7xk-mock-proof-gate
… 35 for test pairs 0221 and 0508 A test's pair has no seed, so an allowance names a pattern of the pair folder's name: `<seed>-*-<module>-<type>` for a corpus root, the pair's own name for a test's. 0221 and 0508 are claimed for entry 35 (approved by the lead on the condition that order follows production); each is allowed only once the proof's comparison with production is EQUAL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMifKg1WBCEn5ahSLi
MockProgramComparison.compareWithProduction runs the records' mock with no override supplied, so every override's `if let` takes its `else`, against the root's production initializer read as a mock that returns the root. EQUAL says the mock makes the root's instances, reads and calls in production's order; DIFFERENT names the first event where they split. The approved-differences entry for mock creation order holds only where this is EQUAL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQJFbZF6c8FbxzTFKUi
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQJFbZF6c8FbxzTFKUi
…roject-thread-xuc7xk-mock-proof-gate
… its fills A call of another module's public mock spelled in place (one that fills the called mock's places) declared its function returning the called type whatever the record said, so where its override closure returns the place's type the function failed to compile, as the previous change fixed for a call built in a function of its own. The function now returns the property's type where the record does, erasing an erased place's value itself, and the binding then erases nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMp5zzYKmR3a9KwHFX
…to claude/project-thread-3rcexi-0395
…mparison A mock root that is not a production root has no production initializer to compare its order with. With SAFEDI_TEST_RECORD_PRODUCTION_TWINS set, a recording test run also generates the same sources with only `isRoot: true` added to the root's `@Instantiable` (MockProductionTwin), in a detached task without recording or compiling, and records the twin's initializer as `<Root>+SafeDI.twin.swift`. A root no twin can be made or generated for records none, and its order stays unproved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQJFbZF6c8FbxzTFKUi
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQJFbZF6c8FbxzTFKUi
… 2.4.6 cut
From the analysis of run 46782400275 ("Check Graph Fuzzer Corpus on Linux", job 143151646073) on
35c9ecb, applied with apply-fuzzer-pins: eight per-feature counts and twelve value
oracle counts of the base corpus. No fixture or partition hash moved, and the smoke jobs passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
…roject-thread-xuc7xk-mock-proof-gate
With mocks laid out from node records by default, a test that compares the records' mock with the walk's built both sides laid out, so it compared a mock with itself. Every walk side now runs inside generatingMocksByTheWalk, which turns the four switches off, and the tests of what the walk observes (tree names, root-level bindings, captures, the tree's checks of a mock root) carry the mocksByTheWalk trait. Both go with the tree in 2.4.7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
…//github.com/dfed/SafeDI into claude/project-thread-dab9up-mocks-on-146 # Conflicts: # Tests/SafeDIToolMockTests/SafeDIToolNodeRecordsMockCycleWalkTests.swift
Rewrites, with regenerate-expectations from runs of the switches off and on, the 339 expected literals of the 394 tests whose every changed mock the mock proof (MockProofPairsTests) judges EQUAL to the walk's: the same values, the same identities and the same creation order under every override. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
…roject-thread-dab9up-mocks-on-146
…m/dfed/SafeDI into claude/project-thread-dab9up-mocks-on-146
…erty's type The function a call spelled in place declares now depends on that flag (its return type and where it erases), so two calls that differ only there must not share one class's function text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMp5zzYKmR3a9KwHFX
…rowth as debt LPB's time grows about 2.1 times at the doubling, slightly faster than linear, as it has since the 2.4.5 release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMR1grwX46174Pyxyn
…ompiles do not share the runner's memory Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLHq43QvdYBYGWTdSo
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMp5zzYKmR3a9KwHFX
…ocks laid out The shared SafeDIMockConfiguration.swift declares the entered places wherever a laid-out mock enters one, in eight tests that expected it empty. Fifteen more tests of the tree's names and checks carry mocksByTheWalk. The world-sharing comparison writes no homes on either side, so it compares sharing alone. The chained-seams memory test counts the records' one builder function per seam. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
Timing of 66af20dWall times measured in this run. A wall time, peak memory, size or growth row over its limit is reported here and fails no check; a shape the tool cannot generate still fails "Check Generate Time on Linux". Every run rewrites this comment, and a check that did not run in it is not listed.
Reported and not failed:
Every shape and row
Growth, the head tool alone: each row at its layers and at 2 more, or at the two numbers it names; median of 3 alternating runs for time, and of 3 more with one allocator arena for peak memory. A measure fails at 2 times the smaller graph's, or at the limit beside it.
The compiler's time on single functions: 0 finding(s), reported and not failed. The compiler's time on single functions of SafeDICore, release build.
|
…ct-thread-knsfr2-nil-hole # Conflicts: # Sources/SafeDICore/Generators/NodeRecords/MockWorldsSharing+Homes.swift
…st turns them on Records of filled seam calls are now split in two switches. The production one (`recordsFilledCalls`) is off by default in every run, observed or not, so a production or seam world goes to its tree as on main and no run makes a record of each filled call; only a test that sets it sees records. Mock roots keep records of their filled calls on through `recordsMockFilledCalls`, which mocks laid out from records need. With the production switch off, the seam expectation of a nested call's Sendable fill returns to main's text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMp5zzYKmR3a9KwHFX
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQL2AyjmTVDPHyoJd4Z
…ndidate Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
A mock root that keeps its tree, and that calls another module's public mock whose fill reads a value of the root's own, is refused by its node records (fillReadsCallersOwnValue). It still built its facts world whole, to name it and to try those records, and its tree's checks asked that world too. The root's scopes now read the same rule the records read, at promotion, and such a root builds no world at all: its tree's checks walk its tree and its walk lays it out alone, as 2.4.5 did. Generated code is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMZDJu1is3zu4RPtRk
Public mock corpus seeds 93, 118, 272, 331, 371 and 402 change their RingScreen mock under the same renamings on 2.4.5, and build the values 2.4.5's mocks build in every naming. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
…ulfills (3395de0) into the mocks-on candidate Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
Public mock corpus ring seeds 509, 603, 620, 757, 808, 812, 975 and 995, and the twin draw's 619, 934 and 974, change their mock under the same renamings on 2.4.5, and build the values 2.4.5's mocks build in every naming. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
… seeds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMZDJu1is3zu4RPtRk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
A guarded read whose then branch reads another field, and a guarded read of a value that is no field of the handed configuration which both outcomes read alike, each stay a code difference. Each cell fails with its check removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQM13nkkC1XE7VC5mco
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
…mpares them with its world Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMZDJu1is3zu4RPtRk
… into the mocks-on candidate Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
…inside a Sendable function A mock laid out from node records hands a call of another module's public mock the builder mock() takes for the places it fills. It chose that builder's family from whether some route builds the call inside a @sendable function, which misses a call beneath a type that a @sendable cycle closer builds again. The copy of that type's function made @sendable then captured the plain builder, and the mock did not compile. The family now also follows the Sendable mark of the variant laid out, so that copy reads the @sendable builder, as 2.4.5's mock does, and the mock's signature is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMp5zzYKmR3a9KwHFX
…function (0c9add4) into the mocks-on candidate Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
…ills its builder These two tests asked whether records of filled calls are on, which since 281231b holds only for production roots under a test; a mock root's filled calls have a switch of their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
Production records of filled seam calls stay on, as the 2.4.7 line lays production roots out from records; mock roots' filled calls take #1209's switch of their own. The records' refusal of a call whose fill reads a value of the caller's own waits for its port onto the tree holdings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMR1grwX46174Pyxyn
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMR1grwX46174Pyxyn
…eads as a root SourceRuleTests' nodeRecordsRootLiteral rule reads `parts[0]` in a node records file as a root index. The binding place is the first part of a two-part sequence, so read it through `parts.first`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQM13nkkC1XE7VC5mco
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
The homes of a module were spelled in rounds: a home the pass's text could not spell was dropped, and the homes calling it spelled again without it. No test or corpus graph reaches that round, since the pass decides earlier which rows it lays out and which have homes. A home without a spelling now makes the module keep every world's row functions, as without homes, which is always correct, and the unreachable round is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQL2AyjmTVDPHyoJd4Z
Brings the head that landed on main as 61841fb: every world's functions kept where a mock home cannot be spelled, the root-literal reading of a sequence's first part, and main's #1218. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMR1grwX46174Pyxyn
main's tree at 61841fb equals #1209's final head 66af20d, merged just before, so this records main's history and changes no file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQMR1grwX46174Pyxyn
Turns on the mock planner that #1207 landed behind switches. Generated
mock()methods are now laid out from per-type facts and node records instead of the mock tree walk. Three switches flip on: laying out mock roots from their records, mock homes, and sharing mock worlds across a module's mock roots. Records of a production root's filled seam calls stay off outside the tests that turn them on, and mock roots keep their own records of filled calls. Production dependency trees are unchanged.What changes for adopters
A generated mock's builder functions are hoisted. Each scope's function becomes a sibling of the functions that call it and takes its
SafeDIMockConfiguration(or override closure) as an argument. Before, it was nested inside its caller and read its configuration by path fromsafeDIOverrides. The values a mock builds and the overrides it honors are unchanged. Themock()signature,SafeDIOverridesandSafeDIMockConfigurationare unchanged too, except for the differences registered as approved.The layout keeps the walk's code where a hoisted function could not compile:
@Sendablefunction, for a place a lazy cycle may enter left out, stays a local outside that function.mock()takes as a parameter) keeps no shared home, so it never passesnilfor that value.@Sendablefunction hands it a@Sendablebuilder where the laid-out place is in the@Sendablefamily.Tests
@Sendablebuilder of a cycle.MockProgramComparison) checks that the code laid out from records builds the same values as the walk's code.graph-fuzzer.yml'smock_proofcompiles each corpus graph's mocks with this branch's release tool and with SafeDI 2.4.5's tool, and requires every pair of values to be equal. As with every other job since Remove CI time limits from work, split each repeat pass in three, add a sweep workflow #1208, its jobs carry no time limit of their own.Found and not fixed
generateon the S12 shape with mocks needs about 1.3 times the peak memory of the base tool (202.6 MB against 156.0 MB on Linux), above the 1.1 the Generate Time check reports against. Accepted for this release. The check's limit is unchanged, and the memory work continues in a near-term follow-up release.🤖 Generated with Claude Code
https://claude.ai/code/session_01HLuVQLUV1Uw2VtgG1YvPSd
Generated by Claude Code