Repository navigation
feat(codegen): P77 — N3: module and @static values ready before use - #2742
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Closes deferred finding F16 of plan-775c50.
OutObservationTotalityFailures required When.Ready by name and took
every other ready time from ObservedWhenExclusion, the predicate that
also picks the generated cells, so a time moved into its exclusion arm
left the assertion green. The assertion now holds, for every cell of
the location product whose use is an observed operand and for every
OutObservation, that the observed cell is generated if and only if the
Read cell of the same holder, host form and kind at that time is a
control (the value is ready). A time with no Read cell is accepted as
not ready only where WhenExclusion names the read as excluded there;
otherwise it is a line. The by-name When.Ready check and the coverage
loop that iterated ObservedWhenExclusion are replaced by the iff, and a
non-vacuity line requires every stored holder and form to be observed
in every way at some time. Test code only: no cell, model, row or
allowlist entry moves (pool 1836, 668 rows).
mutation (the verifier's: ReadyAcrossAwait moved to the exclusion arm
of ObservedWhenExclusion): broken → red (3 of 27 failed:
Axes_AreTheImageOfTheirSources_AndThePoolIsFedByThem "6 totality
failure(s)", Totality_ACellDroppedListedTwiceOrRetagged_IsALine,
InitializerDependency_Sweep "6 failures", pool 1830; each line
"Location/{ModuleVar,StaticField,StaticField+Generic}/Int/OutOperand/
ReadyAcrossAwait/{InCallee,AfterThrow} is not generated, and .../Read/
ReadyAcrossAwait is a control"), restored by cp (cmp identical) → green
(27 passed, 0 failed, 0 skipped, 2.1 min).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
plan-775c50 D1 (#2420): delete ExecutionOrderAnalyzer.DetectInitializerDependencies. Predicate: the CodeGenInfo of a module-level VariableDeclaration does not depend on what its initializer reads. Before this, a module variable whose initializer named another non-const module value was marked "execution order issue", got IsModuleLevel: false, and was emitted as a Main() local, so a read from a lambda or a function was CS0103 (SPY0908). Retired with the arm: CollectReferencedIdentifiers and the state only it read (_typeAndFunctionNames, _assignmentVariables, the SymbolTable constructor parameter). CollectDeclarationNames is left collecting consts only, as a plain loop (CollectConstNames). The things ExecutionOrderAnalyzerTotalityTests and the two DispatchSiteInventory rows (CollectReferencedIdentifiers, CollectDeclarationNames) inventoried no longer exist, so the test file and both rows are deleted (lead's ruling). Re-pinned by direction in ExecutionOrderAnalyzerTests: the 14 tests that pinned the dependency arm now assert NotContain for the reader (19 assertions), each beside a positive control that the read name keeps its own issue kind (assignment-only, assigned-before-declared). The other issue kinds are unchanged. Allowlists drained (A1): initializer-dependency-differential 235 rows (every Reference row citing "#2420 ice"; Reference=750/red 0, red 433 = 668 - 235) and name-resolution-differential 3 rows (read/ModuleVar/ModuleInitializer/Lambda/Earlier/Bare/outer=None, seed/D10, seed/E06). Nothing else went stale, moved or newly red in the three harnesses. scorecard_metrics.py --lower: outside 1243 -> 1008, seed 2604 -> 2601. Classifier_AGeneratedCSharpFailure_IsIce: its specimen was #2420's program (k / g = lambda: k * 2 / print(g())), one of the drained rows, which now runs. The specimen moves to seed C36, #2151's store arm (P79; SPY0908 CS0103), with a comment for P79 to swap it again. The assertion is unchanged. M1 (restore DetectInitializerDependencies from a cp copy, null-safe ctor): broken -> red (16 of 57 failed: 14 ExecutionOrderAnalyzerTests, the initializer-dependency sweep with 235 failures, the name-resolution sweep with 3 non-allowlisted), restored -> green (309/0/0 over ExecutionOrderAnalyzer, the three stage-0 harnesses and DispatchSiteInventory). Classifier guard (ClassifySharpy without the IceCodes arm): broken -> red (9 of 50 Classifier_ tests, the new specimen's among them), restored -> green (50/50). Refs #2420 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
plan-775c50 task-decomposition rule 5: regeneration right after the first Semantic change (T1, fa33889), built at that commit. - spy-stdlib C# (build_tools/regenerate_spy_stdlib.sh): no diff. - spy-test C# (build_tools/regenerate_spy_tests.sh, 119 files): no diff. - stdlib docs (python3 -m build_tools stdlib generate --force, 69 files): no diff. - oracle ledger (cpython_oracle ledger --check): up to date. - .expected.cs snapshots (UPDATE_SNAPSHOTS=true FileBasedIntegrationTests, then regenerate_corpus_pins.sh --no-build): two files move, and the corpus pins do not. basics/arithmetic_operators and type_system/null_coalescing_0003: Main's reads of module variables whose initializers read other module variables (SumResult, DiffResult, ..., Y, B, DefaultName, Result) go from bare to global::<Ns>.<Ns>Module.X. This is T1's expected effect: those variables no longer carry HasExecutionOrderIssues, so they get the module-level reference spelling. No declaration, value or fixture output changed; FileBasedIntegrationTests 3702/0/0 (Compiler), 251/0/0 (Stdlib), 49/0/0 (Lsp). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
plan-775c50 T1 names 16 pins of DetectInitializerDependencies. fa33889 re-pinned the 14 in ExecutionOrderAnalyzerTests and missed two outside that file, which go red at fa33889 and are re-pinned here by direction: - CodeGenInfoIntegrationTests.VariableReferencingAssignmentVariable_IsModuleLevel - CodeGenInfoComputerTests.ComputeForModule_ModuleLevelVariable_ReferencesAssignmentVariable_IsModuleLevel Each pinned `x = 5 / y: int = x` -> y HasExecutionOrderIssues: true, IsModuleLevel: false. Each now asserts the opposite (D1: what an initializer reads is not an issue of the reader). The positive control of the remaining issue kind (assignment before declaration) is the test beside each, unchanged. Both asserted the old direction green at the base (a523fa0 gate 85360/0/10) and red at fa33889, so restoring the arm (M1) turns them red; measured green now with the related classes: 163/0 plus T2's pending classification row (NameResolutionService, EmitterMigration, CodeGenInfo*, ExecutionOrder*). Refs #2420 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
plan-775c50 D3 (A4, M4). One process-wide re-entrant lock (a Monitor). Per value a byte state (StaticInitState: Uninitialized 0, Initializing 1, Assigned 2, StoredInitializing 3, Ready 4); per host a StaticInitHost struct (NotStarted, Running, Done, Failed, Retrying). API: TryLoad (the Swept type initializer; Monitor.TryEnter, never waits), Load, Read (the slow path of a read), Store<T> (the slow path of x_set), Run (one sweep step), IsReady. A read of a value never given one, on the initializing thread, raises NameError "name 'x' is not defined" (CPython 3.15.2's text); a throw restores the state the run found and rethrows the original; a sweep runs once, its failure is delivered once, then each value retries on its read. Requiring a host whose sweep is running on this thread returns at once (import cycles, the lead's ruling); an empty sweep is valid. Tests: StaticInitTests, 20, hosts copying the emitted shape (nested Swept whose type initializer calls TryLoad), each body bounded at 20 s. StaticInit filter: 20/0/0 (measured). Mutations (Sharpy.Core.Tests, filter StaticInit, 20 tests), restored by cp from a copy, cmp identical: - skip the reset on throw: broken -> red (4 failed), restored -> green - skip the Initializing mark: broken -> red (3 failed), restored -> green - reset past an earlier store (reset to Uninitialized): broken -> red (1 failed), restored -> green - make TryLoad wait (Monitor.Enter): broken -> red (19 failed: the two-lazy-classes deadlock keeps the lock, later tests time out), restored -> green - deliver a failure to every read: broken -> red (6 failed), restored -> green - re-run a sweep already running on this thread (import cycle): broken -> red (9 failed), restored -> green Restored: 20/0/0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
plan-775c50 D2 (Rule 2; A2, M2). CodeGenInfoComputer records, and the incremental cache round-trips, the facts T4/T5 pick their arms by. No emission change: no snapshot moves. Facts - CodeGenInfo.StaticStorage (Const | Guarded | Plain | null) and CodeGenInfo.IsOnGenericHost (the host or an enclosing type declares a type parameter), classified once by StaticStorageFacts. Const is exactly IsConst && IsCompileTimeConstant (ConstEligibility, #1791). Guarded = an initializer and no C# const: a module variable, a computed const, a property default, a @static field, in every host. No initializer: Plain (Q4). - A class-level @static property: PropertySymbol.StaticStorage and PropertySymbol.IsOnGenericHost (lead's ruling), set in ProcessTypeMembers, round-tripped by CachedProperty. - HasSweep: each module records its own, declarer-side, on the project SemanticBinding keyed by normalized path (SetModuleHasSweep), persisted on FileCacheEntry.HasSweep and restored warm beside the layout. Transitive (a Guarded value in any host, or an import/from-import of a module that has one). ONE importer-side predicate (ImportedStaticFacts.ImportedSweep) copies it into the imported ModuleSymbol's CodeGenInfo.HasSweep (import m, and each submodule) and the from-import's ModuleLayout.HasSweep. Lead rulings applied - null StaticStorage for int/string enum members, instance fields and defaults, instance property defaults, function-style properties, and #2125's Main-local module variables (HasExecutionOrderIssues). - A deferred-cycle peer with no record yet reads HasSweep true (the conservative arm, named in ImportedSweep; T5 emits a load entry for every module). Single-file / registry / stdlib / reference imports read false until T8. - Ruling (a) on the cold identity split: a cold build's module VARIABLE export (`import lib; lib.mv`, and an alias clone's root) is ModuleLoader's extracted symbol, not the declared one; warm it is the restored declared symbol. The declaring module also records each module value's storage keyed by (path, name) (SemanticBinding.SetModuleValueStorage, in MergeFrom); the same predicate class's ImportedStorage reads the declaration's CodeGenInfo, else that record, into the from-imported name's CodeGenInfo and onto `import m`'s exported VariableSymbols (CopyImportedValueStorage). Copy sites cite the findings-ledger row (candidate class P78 / #2423), so the map is deleted with the cure. Schema: IncrementalCompilationCache.CurrentSchemaVersion 41 -> 42 (CachedCodeGenInfo StaticStorage / IsOnGenericHost / HasSweep, CachedProperty StaticStorage / IsOnGenericHost, FileCacheEntry.HasSweep). SymbolFactMirrorConformanceTests lists the three CodeGenInfo facts as RoundTrips; ColdWarmUpToDateCheckTests classifies FileCacheEntry.HasSweep. Test: StaticStorageFactsRoundTripTests — kind (7) x host (Module, Class, Struct, GenericClass, GenericStruct, NestedInClass, NestedInGenericClass) generated with a totality check, 42 cells, cold and warm (lib served from the cache, positive control asserted); HasSweep records and both carriers incl. transitive; the importer's `lib.x` exports and `from lib import mv as amv`; a deferred import cycle (each from-importer reads true) with an acyclic control (false). Mutations (A2 class, 3 tests; each restored by cp, cmp identical): - drop StaticStorage from SymbolSerializer (CodeGenInfo + property) -> red, 1 of 3 failed, 49 warm cell failures; restored -> green 3/3 - drop IsOnGenericHost from SymbolSerializer -> red, 1 of 3 failed, 18 warm cell failures (6 kinds x 3 generic hosts); restored -> green - drop HasSweep from FileCacheEntry -> red, 1 of 3 failed, 6 warm failures (3 records null, 3 importer carriers false); restored -> green - drop ImportedStorage's keyed-record arm (ruling (a)) -> red, 1 of 3 failed, 3 cold failures (lib.mv, lib.ni, amv); restored -> green - the cycle arm returning false -> red, the cycle test failed; restored -> green Measured @ 1eacf8c + this change: A2 + SymbolFactMirror|ColdWarm| SymbolSerializer|CodeGenInfo|IncrementalCompilation 426/0/0; FileBasedIntegrationTests (snapshots verified, none moved) 3706/0/0; stage-0 InitializerDependency|NameResolutionDifferential| StaticInitializerOrderMatrix 263/0/0; Sharpy.Lsp.Tests 22652/0/0; Sharpy.Cli.Tests (Incremental|Project) 85/0/0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
plan-775c50 D7 (A7, M7). TypeChecker.CheckModifiedArgument refused a ref/out operand by its shape alone, so a property or a const passed by reference reached Roslyn (CS0206 / CS1510 / CS0199 / CS8156 behind SPY0908). It now classifies the operand by the symbol the checker bound (the identifier's symbol, a module- or type-qualified member's resolution, or the member the receiver's resolved type declares, through DenotedTypeSymbolOf for every type-denoting spelling) and refuses with SPY0389: - a property (module, @static, instance; default or not) under ref, out and in (Q8); - a const under ref and out. A variable or field under any modifier and a computed const under `in` run. `in` on a literal const is not refused: it is the owner's open cell (SPY0908 CS8156, excluded with its program), left exactly as today. The shape refusal for a non-name operand under ref/out is unchanged. SPY0389's DiagnosticExplanations entry describes the rule by symbol kind. Aliased and qualified spellings get the one verdict (probed with the built sharpyc): `type E = D0` then `ref E.k`, `ref G[int].k`, `ref self.k`, `ref lib.k` / `ref lib.p`, `from lib import p as q` then `ref q` -> SPY0389. Allowlist: the 46 Operand rows (`#2422 ice`) drain; the other 46 Operand cells run (Operand=92/red 0). Scorecard outside-seed 1008 -> 962. Measured (src/Sharpy.Compiler.Tests, before T4's in-flight CodeGen edits appeared in the shared tree): InitializerDependencyDifferentialTests | ModifiedArgument | ParameterModifier | DiagnosticExplanation: 69/0/0. mutation M7a: refuse by shape alone (symbol rule removed) -> red (InitializerDependency_Sweep, 46 failures: Operand=92/red 46, Ice=46, the rows listed again); restored -> green (Operand red 0). mutation M7b: refuse every non-variable (a const under `in` too) -> red (2 of 27 failed: 16 sweep failures, the 4 Operand computed-const `in` cells and 12 Location computed-const InOperand cells FalseRefusal, plus Exclusions_ThatRestOnADiagnostic_StillDrawIt: the literal-const `in` program drew SPY0389 for SPY0908 CS8156); restored (cp, cmp identical) -> Operand red 0, no failure line names SPY0389 (the restored run's other reds are T4's uncommitted CodeGen edits in Location/Slot). Direction record (A10): no Integration fixture and no spec block is newly SPY0389 (FileBasedIntegrationTests: no failure names SPY0389; check_spec_blocks.sh: no SPY0389). The newly refused programs are the 46 generated Operand cells, each an internal error (SPY0908) before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
TypeChecker.CheckFor checked only an identifier or tuple target, so a member or element for-target (`for H.t in xs:`, `for o.x in xs:`, `for xs[0] in ys:`) recorded no resolution: the emitter could not read a Guarded @static target's storage fact (plan-775c50 D4). The target is now checked as the comprehension for-clause target already is (CheckExpression, then the element type), the with-as target's arm too. Test: ForTargetCheckTests — the three shapes, each beside its comprehension spelling as the positive control: H.t records its MemberAccessResolution, o.x and xs[0] their receiver's type. mutation: drop the arm's CheckExpression -> red (1 failed: "for target H.t: no member resolution recorded", o.x and xs[0] "receiver never checked"), restored -> green (1/1). No new diagnostic on valid programs: FileBasedIntegrationTests 3687/15/0 (measured, with T4's in-flight emitter edits in the tree); the 15 are 13 .expected.cs snapshot diffs and 2 static-init outputs from that emission, none holds a member or element for-target (none does in the corpus). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
D6 (plan-775c50): in an `async def` body, a use of a Guarded value that is neither a plain read nor a plain store is a node-keyed SemanticInfo fact, in MergeFrom, so the emitter hoists the ensure (or the `out` arm pick) before the statement and names the backing field: no accessor reference is live across an `await` (CS8178 under D4's by-ref accessor). - AsyncGuardedUseAnalyzer runs after CodeGenInfoComputer.ComputeForModule: a node naming a Guarded VariableSymbol (module variable, @static field, computed const; any spelling: bare, H.s, lib.u, aliased module, from-import, aliased from-import; storage via the binding, else ImportedStaticFacts) is recorded as OutOperand under `out`, Ensure under `ref` / `in`, or Ensure as the receiver root of a member / index path under a modifier, a store target, or a method call's receiver. Plain reads, plain stores on the name, nested def / lambda / class bodies and Guarded properties: none. - SemanticInfo.GetAsyncGuardedUse(Expression) -> AsyncGuardedUse(Node, Value, Kind); SetAsyncGuardedUse(node, value, kind). API agreed with the codegen agent (one table, node-keyed). Side-table ratchet 85 -> 86 with its plan line; dispatch roster rows for the analyzer's five switches. Test: AsyncGuardedUseFactTests — 18 use kinds x 7 spellings, 98 cells (28 excluded, each with its reason): 67 recorded (Ensure and OutOperand), 31 async read / plain-store cells unrecorded, every cell's plain-def twin unrecorded, a local and a Guarded module property unrecorded, no stray record in the file; project-merged and per-file views; roster totality. mutation: drop the method-call arm -> red (2 of 3 failed: MutatingCall and ParenthesizedCall on all six spellings, both views), restored -> green (3/3). Guards: AsyncGuardedUseFactTests, SemanticInfoMergeConformanceTests, SemanticInfoFreezeTests, ForTargetCheckTests 19/0/0 (measured); Semantic namespace + FileBasedIntegrationTests 15669/15/1 before the setter-signature fix, the 15 = SemanticInfoFreezeTests (fixed here), T4's in-flight emitter (13 snapshots, ExplicitInterfaceKeyCensus) and none from this change; DispatchSiteInventory red only on T7's two rows. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
T7 (5625ff9) added two kind dispatches to TypeChecker.Expressions.cs, ResolveModifiedOperandKind and DescribeOperand, without roster rows, so DispatchSiteInventoryTests.AllDispatchSites_MatchRosterExactly has been red on them since that commit; T7's filtered run did not include the inventory. Each gets a refusal-net row on InitializerDependencyDifferentialTests, whose generated Operand cells refuse every kind on every spelling (D7, SPY0389) and run each accepted operand. Guard record (the roster is the guard; the rows are the change): without the rows -> red (1 failed: UNROSTERED DescribeOperand, ResolveModifiedOperandKind; log dotnet-serialized-20261117-084836-9269), with the rows -> green (DispatchSiteInventoryTests 17/0/0; log dotnet-serialized-20261117-091915-8018). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
plan-775c50 T4 (D4; A3, A6; F14, W10). T6's D6 emission is folded in, on the semantic fact e2d1baf (lead ruling). Emission (RoslynEmitter.StaticValues.cs). The arm comes from CodeGenInfo.StaticStorage / PropertySymbol.StaticStorage and never from a type. Every Guarded value is emitted this way: a module variable, a @static field, a computed const and a property default, in a module, class, struct or interface. Each gets a backing field and a state byte with no initializer, N__init, N__slow, and a property of the value's own C# name. A variable or @static field returns `ref`, a computed const `ref readonly`, and a property default keeps get/set. N__set is the one plain-store seam: all five AST store nodes and the for/walrus rebinds, bare or qualified, and `x op= e` becomes N__set(x op e). An out operand on a Guarded value is N__out(out var spill): the storage once the value is Ready, a heap StrongBox before. N__commit stores the spill when the call returns, before the operand to its right (W10). An expression-statement call places its commits after the statement. Each host gets __host / __Sweep / __Swept, with sweep steps in declaration order. F15: the spill is a StrongBox, fix (3), so no [UnscopedRef] is needed on either target. T5 builds Sharpy.Stdlib on both targets. D6: in an async def body, an Ensure use hoists N__ensure() and names the backing field. An OutOperand use hoists `var spill = N__pick();` and emits `(spill == null ? call(out field) : N__commit(call(out spill.Value), spill))`, or the if/else form for a statement call. The backing field takes the value's accessibility. All 27 ReadyAcrossAwait controls are green. Harness (F14, W10, A3): - OutObservationCells generates the not-ready times with Q-F (a)'s models. - F16's iff is narrowed to the controls that carry a Rejected model. - SameExpressionCells adds the W10 controls. - The ForTarget-through-a-closed-generic exclusion (#2435, CS0305) retires: the for target now runs, so its 16 cells are generated, all green. - The ClassComputedConst cross exclusion moves CS0198 -> CS8331. It still rests on a drawn code. - New StaticInitializerCensusTests (A3): fixture corpus + pool, 4346 programs, with a positive control. Layout control moved by design: StaticInitializerOrderMatrixTests now asserts `static ref readonly int B` and its guard. Allowlists: - IDD 387 -> 190. 197 drained: Cross 67, ModuleVar 40, StaticField 40, StaticField+Generic 38, ClassComputedConst(+Generic) 8, ModuleComputedConst 4. - 181 IDD rows moved SilentWrong -> RuntimeThrow (NameError). Each carries a comment naming the commit that clears it: - 69 Location/Cross ReadBack + 6 non-refuse Slot: T5. - 106 must-refuse Slot cycle cells: T9 (D8, SPY0278). No new red. - NR: 165 stale rows drained. ModelsReadByNothing re-taken 45->39, 20->3, 25->18. - scorecard --lower: 962->766 / 2601->2436. - New rows: one inspection row (SyntaxFactory.NullableType, a false positive), two dispatch rows, sink/operand-order exemptions, 4 corpus pins. Direction (A10). Two fixtures move by N3, confirmed with `run`: - static_prop_default_calls_static_method_2396: 0 5 -> 5 5 - static_prop_in_static_init_2396: 4 4 4 0 -> 4 4 4 2 python3 3.15.2 gives NameError for both: a class body cannot name its own class, so neither has a twin. Transient reds (exactly 14, cleared by T5's one regen commit): - 13 .expected.cs snapshots: layout. - 1 ApiSurfaceComparisonTests.ApiSurface_NativeMethodsExistInMSBuild: the pre-regen Sharpy.Stdlib.dll lacks N__set/__ensure/__pick/__out/__commit. Measured @ e2d1baf+working tree: - trio + census: 265/0/0. - FileBasedIntegrationTests: 3689/13/0 (the 13 snapshots). - Sharpy.Compiler.Tests minus FileBased and the trio: 48753 passed, 2 failed, 6 skipped before the 2 h tool limit stopped the run in the Properties tail. The 2 failures were ModuleMemberQualificationMatrixTests (fixed and re-run green) and ApiSurface (transient, above). - Guard and fixed-test reruns: 259/0/0. Mutations (IDD sweep unless noted). Each: broken -> red, restored -> green. - M3, one Guarded `t` as an initialized field: census red (1 failed). - M6, return a copy: 158 failures, incl. CS1612 / CS0206 / CS8156. - M6, no D6 arm in an async def body: 27 failures, all CS8178. - M6, store sites left on the accessor: 88 failures (`5 5`, `5 5 7`, NameError). - M6, out left on the accessor: 31 failures (`42 42`, `42 42 7`, `43 42`). - M6, spill a Ready out: 84 failures, the 42 controls print `7 42` / `7 7`. - M6, drop the Assigned mark (Core): 35 failures (`7 7`, `7 7 7`). - M6, raise on a store to an Initializing value (Core): 52 controls raise. - M6, raise on a read after one (Core): 26 controls raise. - M6, return the field before any store (Core): 65 print a default. - F16, ReadyAcrossAwait into the exclusion: stays red (2 of 26, 6 totality failures). - M6, pick by the host's sweep: green at T4. It needs T5's Main and line sweeps; T5 re-runs it. All restored by cp, cmp identical. Restored: IDD sweep + census green (3/0/0). Ledger: an interface `@static t: int = 7` is an interface property in the symbol model (SPY0908 CS0120), outside CodeGen. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
The whole-solution gate at 1d90383 (run 44085983515) was red on three generated pins beyond T4's 14 named transient reds: - DoorCensusTests.T2_PathCapableMembersUnderNegativeRows_EqualTheCommittedCensus. T3's runtime (e7e6efd, Sharpy.Core StaticInit) calls Monitor.TryEnter(object). The System.Threading negative row is re-judged and holds: a lock call with no path parameter. Regenerated with UPDATE_DOOR_CENSUS=1 (8/0/0). - CodeActionShapeSweepTests Identity/Crlf totals. One moved row is explained by its source: T4 rewrote the header comment of classes/static_prop_default_calls_static_method_2396.spy, one line longer, so the sampled code-action positions moved. Its row leaves inline-function crlf (#2296) and joins extract-method identity (#2294), both open trackers. No other row moved. regenerate_corpus_pins.sh: 17081/0/0 and 49/0/0. Regenerated in a clean worktree at 1d90383. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
D5 (plan-775c50, T5; lead's ruling (a)): "by an importer's sweep at the import's position" needs, per import statement, the Sharpy modules Python runs for it. Which modules run depends on the statement's spelling (`import a.b.c` and `import a.b` both bind `a`), so the fact is node-keyed in SemanticInfo (Rule 2's (b) form), not on the bound ModuleSymbol. - SemanticInfo.GetImportRequirements(Statement) -> IReadOnlyList<ModuleLayout> (layout + HasSweep), on every module-level `import` and `from ... import`; null for any other statement; empty when every module is .NET, synthetic or unresolved. In MergeFrom (sequence comparer). Side-table cap 86 -> 87, citing D5's line and T5. - Python's order, CPython 3.15.2 measured on a package tree printing at import: `import a.b.c` -> a, a.b, a.b.c; `import a.b as x` -> a, a.b; aliases in turn, each module once; `from a.b import n` -> a, a.b, then a.b.n when n is no export of a.b and resolves as its submodule; `from a.b import *` -> a, a.b. Skipped: a .NET module and its chain, a namespace-only package (no __init__.spy: nothing recorded for it, its submodules still are), a file outside the compilation, the importer itself. - ImportResolver records the chain (file paths) on the shared SemanticBinding at resolution, with the module resolver and the .NET precedence of TryResolveNetModule; CodeGenInfoComputer turns it into layouts. Ancestors and from-import submodules add no dependency edge (so no new cycle): their HasSweep is ImportedStaticFacts.RequiredSweep, the record, else true (the T2 ruling's conservative arm); an imported module's is ImportedSweep. A required sweep makes the importer's own HasSweep true. Test: ImportRequirementsFactTests — Form (6) x depth 1-3 x .NET in the statement (2): 22 cells, 14 excluded with reasons; 10 extra rows (.NET only, .NET from, namespace-only x3, two chains, repeated ancestor, two modules, import from inside the package, a package importing its own submodule). Exact ordered list (each module's own recorded layout + literal HasSweep) per cell, in the cold merged, cold per-file and warm merged views (every tree module served from the cache); a def beside each import has no record; the submodule-by-name cells (SPY0301 today, findings ledger) in their own project with the diagnostic as positive control; generator totality. mutation: drop the ancestor walk in AppendImportChain -> red (2 of 3 failed: the run test's d2/d3 import, import-as and from-name cells in every view, and the refused project's FromSubmodule/d3), restored (cp, cmp) -> green 3/3. Both runs at 13:06 and 13:10 on touched sources, before the 13:13 Core mutation window. Guards: ImportRequirementsFactTests, SemanticInfoMergeConformanceTests, SemanticInfoFreezeTests, StaticStorageFactsRoundTripTests, AsyncGuardedUseFactTests 24/0/0 (measured, sources touched). Semantic + Project + FileBasedIntegrationTests + roster/carrier tests: 17093/163/1 (measured on the tree with T5's in-flight CodeGen edits; not controlled at the base): 160 .expected.cs snapshot diffs (Main() prelude), DispatchSiteInventory (CodeGen AddImportRequirements), EmitterCarrierOnly (ModuleClass.cs:228), ExplicitInterfaceKeyCensus: all in in-flight CodeGen files, no stdout change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
An import statement's requirement list (plan-775c50 D5) now also names each Sharpy module imported by reference (D10). These are every regenerated Sharpy.Stdlib module and any referenced Sharpy library. A module is listed when discovery finds a load entry for it, read only from Sharpy.SharpyLoadEntryAttribute (ModuleRegistry.GetModuleLoadEntry, which forwards to CachedModuleDiscovery). The list keeps S3's chain rules: Python's order, a package before its submodule, each module once, and source and by-reference modules interleaved in statement order. A .NET namespace or a hand-written C# [SharpyModule] with no entry adds nothing. ModuleLayout gains ClrMembersClass, the members class's CLR full name. ModuleLayout.ByReference(clr, hasSweep) has empty NamespaceSegments, the simple class name and the entry's HasSweep. MembersClassFullName returns ClrMembersClass when it is set. Consumers checked: - record equality and MergeFrom's sequence comparer cover the new field; - the incremental cache stores only a file's own layout (its segments and class name), never an import requirement, so there is no cache version bump; - Guarded facts are not carried over: a by-reference value stays Plain. The side-table cap stays 87 (no new table). This depends on CachedModuleDiscovery.GetModuleLoadEntry and ModuleLoadEntry. Both are in the codegen agent's T5/T8 change, which lands next. Test: ImportRequirementsFactTests.ByReferenceModules_* runs 16 cells in three views (cold merged, cold per-file, warm merged). The cells cover: - import math / math as mm / from math import pi / from math import *; - a repeated alias; - import os.path and from os.path import join (os, then os.path: two entries); - by-reference and source chains mixed, both ways; - a Sharpy library built by the harness and consumed by reference, with and without a sweep; - a hand-written C# [SharpyModule] assembly with no entry, giving []. Mutation (private worktree, files touched before each run): - ByReference() made to return null: red, ByReference fact failed with "expected [clr:Sharpy.MathModule.MathModuleModule/... sweep=True], got []" (the other 3 facts stayed green); - restored from the cp copy: green, 4/4. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
T5 (D5; A5, A6, M5) and T8 (D10; A8, M8) in one commit (lead ruling: T8 folds into T5 as T6 folded into T4; T5's regen cannot be green without D10). 55cd533 (S4) builds only with this commit: it calls CachedModuleDiscovery.GetModuleLoadEntry / ModuleLoadEntry, added here. D5 (CodeGen). Each host's __Sweep runs its steps in declaration order: a value's StaticInit.Run, or a requirement (another host's load entry). - Module: [CompilerGenerated, SharpyLoadEntry(hasSweep)] public static void __Load(). It is empty for a module with nothing to sweep (no host, sweep or Swept class is emitted then). - A non-generic type with values: an internal __Load_<Type>(), required by the sweep around it at its line. A type with no values passes its requirements up. A generic host is swept by first use only. - Imports: every import's requirements come from S3/S4's SemanticInfo.GetImportRequirements (one source per position), in python's order. - A source module is required under the project namespace. - A by-reference one is required by its ModuleLayout.ClrMembersClass. - An entry point's main() calls __Load() first. - F15: - N__field = default! and spill.Value! keep the shape nullable-clean. - Sharpy.Stdlib builds 0 errors / 0 warnings on net10.0 and netstandard2.1. D10 (Discovery, Sharpy.Core). - Every member D4/D5 adds carries [CompilerGenerated] and is internal, or private / private protected when its value's access is narrower. - Core adds SharpyStaticStorageAttribute(StaticStorageKind) on a Guarded value's property and SharpyLoadEntryAttribute(hasSweep) on the entry. - Discovery: - skips [CompilerGenerated] module members; - reads the load entry by its attribute (GetModuleLoadEntry); - reads a value's storage by its attribute alone (IsModuleFieldGuarded: a C# `ref` static property is Plain); - maps a by-reference property / return type to its element type (ClrTypeHelper.ValueTypeOf: ClrTypeBridge, ClrMemberTypeResolver, OverloadIndexBuilder, ClrDeclaredNullability). - Index cache format v26. - Storage is observed where discovery holds it (lead ruling): an importer's symbol stays Plain. Tests. - StaticInitSweepProjectTests (5 project controls; python3 3.15.2 twins). - ByReferenceInteropTests (A8: a hand-written C# module with ref / ref readonly properties, a ref-returning method, a ref indexer and instance property, and [CompilerGenerated] public members; and a Sharpy library dll). - SharpyStaticStorageAttributeTests (Core). - InitializerDependencyDifferentialTests.Locations: F14's cross half (the not-ready-yet exclusion removed; the owed observed cells are generated). - StdlibModuleGlobalRosterTests' census reads a Guarded value by its property: its storage is the field the getter returns by ref, and its generated members are its machinery. A write is a call to its store seam (D4: N__set / N__out) from user code. The positive control's kind is now "store-call ._Random__set" (D4's plain store; was SimpleAssignmentExpression). Rows drained: - initializer-dependency-differential: 80 (69 Location/Cross ReadBack RuntimeThrow, 6 Slot non-refuse, 5 Location Plain>Module UserFirst SilentWrong). 110 left: - 106 must-refuse Slot RuntimeThrow: cleared by T9 (D8's graph; T9 note on each); - 4 FalseRefusal SPY0618 InInitializerText (StaticField±Generic, ComprehensionTarget / OutOperand), route and cite as measured: cleared by T9 (D9: SPY0618 retires in D8's commit). - name-resolution-differential: 12 (read/order-observation 11, seed 1). - scorecard --lower: outside 766 -> 686, seed 2436 -> 2424. Transient reds turned green, each measured here: - T4's 14 named reds: 13 .expected.cs snapshots and ApiSurfaceComparisonTests. The snapshots are regenerated (160 files now: the Main prelude, the entry, the guarded shape). ApiSurfaceComparisonTests skips [CompilerGenerated] methods, as discovery does. - Found by the broad run (T4/T5 layout), now green: - ModuleClassMergeMatrix 24, RoslynEmitterModule 6 and RoslynEmitterNamespace 6: no host for a sweepless module. - NamespaceLevelTypes 1: D4's `public static ref int Counter`. - LayoutFactConsumerScan 2: RequirementPath and AddImportRequirements rostered, 15 -> 17. - SinkPushingTotality 1: LoadStatement rostered. - StaticInitializerCensus 1: `N__field = default!` is no user expression. - ExplicitInterfaceKeyCensus: ModuleClass.cs:134 -> 135. - Stdlib.Tests: 18 snapshots and 5 StdlibModuleGlobalRoster. Regen: - build_tools/regenerate_spy_stdlib.sh: 18 modules, every Guarded value in D4's shape, every module with its entry. - regenerate_spy_tests.sh: 119 files. - Import steps: os 19, math 10, random 4, re 3, csv 3, string 1, socket 1. - Snapshots: Compiler 160, Stdlib 18. - Corpus pins: no change. Stdlib docs: no change. - The new public members are needed by D4's shape: the value's ref property and the module's entry. Every helper is internal. Measured on this tree (base 55cd533): - trio + census 265/0/0 (10.4 min); - FileBased + ApiSurface + Project + Discovery 5623/0/0; - Stdlib.Tests 4538/0/0; Core.Tests 4238/0/0; - Lsp.Tests 22652/0/0; Cli.Tests 1131/0/1; - CodeGen + Discovery + Project + ApiSurface slice 3533/0/0 (re-run after the last Discovery edit). Mutations, each in a private worktree; broken -> red, restored -> green, same base per batch. - Batch 1 @ 440c2ef + T5 diff (IDD sweep + 4 project controls; base 5/5): - mutation: drop Main's requirement → red (2 of 5 failed, 82 IDD failures + MainRequiresItsModule); restored → green (5/5) - mutation: reverse the sweep → red (4 of 5 failed, 131 failures); restored → green - mutation: initialize only the value a use names (Read without Require) → red (1 failed, 29 failures); restored → green - mutation: leave a generic host unswept → red (1 failed, 314 failures); restored → green - mutation: drop a generic host's Swept check → red (1 failed, 293 failures); restored → green - mutation: hold its state outside the generic type → red (1 failed, 96 failures); restored → green - mutation: pick by the host's sweep → red (1 failed, 4 failures); restored → green - Store without Require stays green (5/5). It is not a plan mutation: Store's Require is unobserved by the cells. - Batch 3 @ 55cd533 + this diff (IDD sweep + 5 project + 5 A8; base 11/11): - mutation: M5, drop a class's RequireStep at its line → red (2 of 11 failed: nested class prints O.a O.b C.v, 51 IDD failures); restored → green (11/11) - mutation: take only an import's last module → red (1 failed: `m1 pkg.sub m2 …`, no pkg); restored → green - mutation: M8.1, drop the [CompilerGenerated] skip → red (1 failed: extra names "hidden", "hidden_count"); restored → green - mutation: M8.2, drop the SharpyLoadEntry attribute → red (2 failed: load entry null; the order control prints m1 m2 lib.x); restored → green - mutation: M8.3, classify by CLR shape (ByRef is Guarded) → red (1 failed: refshapes.x imports as Guarded, observed by CachedModuleDiscovery.IsModuleFieldGuarded); restored → green - mutation: keep a ByRef member type → red (4 failed: element type, every-kind run, order control, 4 IDD); restored → green - A writable-ref setter rule in the index stayed green (11/11), so it was dropped, not landed. The ref indexer store is a ledger row. - F15 arm, wt regen + Stdlib build both TFMs (base 0 errors): - mutation: drop `= default!` → red (34 errors, CS8618 on both targets); restored → green (0 errors) - mutation: drop the box `!` → red (34 errors, CS8601 + CS8604 on net10.0); restored → green (0 errors) - Batch 4, StdlibModuleGlobalRosterTests (base 20/20): - mutation: count a value's own machinery as writes → red (3 of 20 failed); restored → green (20/20) - mutation: a store-seam call is no write → red (3 of 20 failed, PositiveControl_GeneratedRandomSeedIsAWrite among them); restored → green (20/20) Ledger rows (findings-ledger, not filed here): - a read-only discovered module member is assignable (CS0200 / CS8331 ICE; get-only pre-existing); - a `ref` indexer store is SPY0320 (false refusal; semantic keys on GetSetMethod); - the dotted-import package member row (S3's; seen again). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Residue of f719b40 (gate 85400/1/10, run 44136488505; Python Build Tools run 44136493864). 1. corpus-pin-inventory: the LayoutFactConsumerScanTests row is re-keyed to `ReaderCount = 17`. Its reason, code-site-roster, still holds: the constant counts compiler/LSP/Stdlib reader rows, and T5 added two. 2. Class: every tool that reads member types of the generated C# or of Sharpy.Stdlib.dll must read a `ref`/`ref readonly` member as its element type (D10, the same rule as discovery's ByRef unwrap). - generate_stdlib_docs.py rendered `ref int`, `ref str`, ... for every Guarded value. Fixed with member_value_type(), applied to property types and method returns. - Discovery: ClrTypeHelper.ValueTypeOf (T8), already correct. - LSP hover/signature/symbol paths read SemanticType, not CLR reflection. Measured with a new hover test over math.pi and string.digits under the server reference set: green. - ApiSurfaceComparisonTests compares methods only (getters are special names): green. - Playground: no reflection reads. build_tools: no other tool reads Stdlib member types (spy_none_default_audit reads .spy only). The generator also skips [CompilerGenerated] members (D10: __Load). 3. random._random/_lock and socket._default_timeout/_lock: D4 did not widen accessibility. At 55cd533 they were already `public static ... _Random = ...;` fields. The generator ignored mutable public fields but matches ref properties, so T5 made them visible to it. D4's shape is untouched. The docs skip python-private (`_name`) static values; a new roster test guards it. 4. The leaked cref `Result{T,E}` (`E`) was caused by T5: math's `public static ref double E` now matches _MEMBER_DECL_RE, so `E` entered _DECLARED_MEMBERS (pre-T5 `public static double E = ...;` did not). The cref heuristic now treats type-argument positions as type parameters, not member references. Docs regenerated (`stdlib generate --force`): csv, math, os, re, socket, string gain a Properties table of public module values with element types; `--check` reports up to date. Gates (worktree at 38a24a5 + this diff): - pytest test_generate_stdlib_docs.py: 320 passed - CorpusPinInventoryTests + ApiSurfaceComparisonTests: 15/0/0 - StdlibDocFieldNameBindingTests: 7/0/0 (every documented value binds) - Lsp HoverTests: 42/0/0 mutation: unwrap identity in the docs generator → red (1 failed, roster; --check drift on string.md), restored → green (320) mutation: [CompilerGenerated] skip removed → red (1 failed, new test), restored → green (320) mutation: python-private skip removed → red (2 failed), restored → green (320) mutation: cref type-argument exemption removed → red (1 failed), restored → green (320) mutation: ClrTypeHelper.ValueTypeOf → identity → red (1 failed: hover shows "Double&"), restored → green (1/0/0) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
P77 makes NameResolutionDifferential_Sweep, one xunit test, run past the 10-minute --blame-hang-timeout. It took 10 m 06 s (passed) at d01ef5a and 10 m 29 s (killed) at 410a688; dev's last three runs took 6 m 25 s to 8 m 13 s. No program hangs: a local run with per-cell logging passed in 10 m 30 s, slowest cell 3 s, with a 2.5 s run of the cell that was in flight at a 6-minute cut. Per #2458's rule (a limit at least 2x the slowest duration), this step's hang timeout goes 10m -> 20m and the sweeps-quick job 25 -> 40 (it took 19 m 40 s and 17 m 17 s). The owner ruled this on 2026-11-18: "raise then shard after to claw back". Sharding the sweep into pool slices is the follow-up, posted on #2458. build_tools/tests pass, apart from test_real_lines_on_real_history, which needs history this shallow clone lacks. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Review 5 of #2742, findings 1 and 2. 866a9a2 bound `D.s` to a base's static field whenever the subclass's own Fields lacked the name, so a subclass's property, method or nested type of that name lost to the base's field (`D.s = 6` wrote C.s). Its generic-base exclusion and the untyped nested qualifier left `GD.s` and `Outer.C.s` / `Outer.D.s` unbound, and in an async def they reached Roslyn as CS8178. Class: which static value a member access through a type-denoting receiver binds. One resolver now answers it, BindStaticValueThroughType, reached by every receiver spelling before the type-member arms: - the receiver reduces to its type by DenotedTypeSymbolOf (bare, imported, subclass, nested chain, constructed generic, alias, module-qualified, struct); - the member binds by TypeHierarchyService.FindStaticValueField: the first type on the chain that declares the name, as any member kind, decides, and only a static or const field there binds (Python MRO); - a generic owner reached through a receiver that spells no closed type (`GD.s` of `class GD(G[int])`) is spelled at the closed instantiation the base chain pins (the receiver's denoted type, `G<int>.S`). The binding is recorded once, on the member-access resolution that GetBoundValueSymbol, the emitter, MemberAccessSymbolResolver and InitializerCycleValidator read. TryResolveTypeMemberAccess binds no static field of its own. The same first-declaration rule now gates the instance route, the generic-instance route and the SPY0290 instance-member refusal. Nested types resolve through the chain (FindNestedType: `L.s.z` where a base declares `class s`), in DenotedTypeSymbolOf and the cycle validator. Sibling cell in the contract: a nested class's base named by a sibling (`class Outer: class C; class D(C)`) resolved to a module-level `C` first, while the emitted C# base clause bound `Outer.C`. The binding would have read the module class's field. ResolveBaseReference now walks the enclosing chain before the module scope (CPython: 2 1). Tests: - StaticValueRedeclarationTests: redeclaration {none, field, property, method, nested type} x level {subclass, intermediate base} x use {read, store, async +=, async out, instance read}, run against the model, plus the nested-sibling cell. - StaticValueSpellingNavigationTests: definition on 8 spellings lands on the bound field. Mutation pairs (cp + cmp restore): - M1 rule 1 reverted (FindStaticValueField binds the first FIELD on the chain, not the first declaration): StaticValueRedeclarationTests red (1 failed / 3); restored green (3 / 3). - M6 module scope first in ResolveBaseReference: NestedSubclass_OfASibling_BindsTheSiblingsField red; restored green. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Review 5 of #2742, finding 2 (b, c). A Guarded static that an async def body names through a spelling the checker left unbound reached Roslyn as CS8178 behind SPY0908. That happened three rounds running. Guard: AsyncGuardedUseAnalyzer.RequireBound. In an async def, a member access in a D6 position (an out / ref operand, a store, an augmented or receiver-root target) that names a Guarded static through a type-denoting receiver must carry a bound value symbol, or the compilation is an internal error at that node. The guard reads the receiver STRUCTURALLY (a type name, a module's exported type, a nested type by name through the chain, a constructed generic's definition, a recorded type reference), never through the checker's resolver, so a spelling the resolver misses fires the guard instead of CS8178. It is armed only for a module the checker did not refuse, so a refusal is never masked. Rostered on the dispatch-site inventory. Generator: AsyncGuardedOutCallPathTests' Spelling axis gains nested own, nested subclass, generic-base subclass, constructed generic, alias of a constructed generic, from-import subclass, local subclass of another module's class, and struct. That is 14 spellings crossed with route x callee x form x inline. The redeclaring hosts are in StaticValueRedeclarationTests. Mutation pairs (cp + cmp restore): - M2 the resolver drops nested receivers (`|| typeSymbol.DeclaringType != null`): AsyncGuardedOutCallPathTests 12 failed / 14, each an InternalCompilerErrorException from RequireBound ("'s' names the Guarded value 's' through 'C' ... bound no value symbol"), not CS8178; restored 14 / 14. - M3 the resolver drops the generic-base closing (`GD.s`): 12 failed / 14 by the guard's ICE ("through 'GD16'"); restored 14 / 14. - M4 with M2 in place, the guard disarmed: the same cells fail as CS8178 ('O12.C.S.get' cannot be preserved across 'await'), so the guard is what fires; re-armed, ICE again; M2 restored, 14 / 14. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Review 5 of #2742, finding 3. 4dc2d7f inferred the pipe route's signature (InferFunctionTypeSignature) but kept only the parameter types and returned the FunctionType's open return. So `r = "s" |> Box().gm()` with `def gm[U](self, x: U) -> U` was typed `U`, and `y: str = r` was refused SPY0220. The pipe's FunctionType arm now returns the return type at the same inferred arguments, as the direct call (CheckLambdaCall) does. Test: PipeOperatorTests.PipeForward_IntoAGenericMethod_IsTypedAtTheInferredReturn. Its axes are host {plain class, generic class}, a further argument after the piped one, and the piped type {str, int}. Mutation pair (cp + cmp restore): - M5 `return ft.ReturnType;`: the 4 new theory rows red (SPY0220); restored 13 / 13. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
#2458's rule is a limit of at least 2x the slowest measured duration. The slowest run was 10 m 29 s, so the limit must be at least 20 m 58 s; a808824's 20m was just under that (review of 410a688..f792078). The header now says every test run but this one has 10m. The latest run took 6 m 41 s (run 44415725512). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
This was referenced Nov 18, 2026
Review 6 of #2742, F1. The tip hung on `class C` / `class Outer: class C(C)`: ResolveBaseReference searched the enclosing chain's nested types before the module, so the nested C named itself, and the cycle walk (keyed by name) saw no cycle. A true cycle (`class A(B)`, `class B(A)`, then `A().zz`) hung on every build: SPY0288 was reported but the edge stayed, and the member lookup walked it forever. CPython's rule, now the name resolver's: a class statement's base list is evaluated in the immediately enclosing scope before the new name binds, so a nested class's bare base is a sibling declared EARLIER in the same body, else the module (then builtins). Never the class itself, a later sibling, or an outer class's body. When neither scope has the name, the enclosing chain is kept (#1371). The rest of the pipeline agrees on that one base: - RecordBaseListReference records the bound definition on the base annotation instead of re-resolving it in the class's scope, so the emitter spells the bound base (`class C : global::...C`, not CS0146). - IsSameType compares names WITH their declaring types: the module's C and Outer.C were one type, so `o: C = Outer.D()` was accepted. - A member absent from a nested type's whole Sharpy chain (`Outer.D.s`) is SPY0203, not CS0117 behind SPY0908. - DetectCircularInheritance walks by identity and removes the base edge of every class it reports, so no later walk runs on the cycle. Test: NestedClassBaseScopeTests, 6 run cells (outputs are CPython 3.15's twins) and 4 refused cells (bounded by a 120 s timeout). Mutation pairs (cp + cmp restore, NestedClassBaseScopeTests, 10): - sibling order ignored (drop IsDeclaredBefore): LaterSibling red, 1 failed; restored 10/10. - sibling search off: EarlierSibling, NotTheModulesSubtype, AbsentFromTheSiblingsChain red, 3 failed; restored 10/10. - IsSameType by bare name: NotTheModulesSubtype red; restored 10/10. - base list re-resolved: OwnName and Cousin CS0146, plus OuterBodyOfTheEnclosing and LaterSibling, 4 failed; restored 10/10. - absent-member refusal off: AbsentFromTheSiblingsChain red (CS0117); restored 10/10. - cycle edges kept: ModuleCycle and NestedCycle time out (the hang), 2 failed in 4 m; restored 10/10. - cycle walk by name: OwnName and Cousin falsely SPY0288; restored. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Review 6 of #2742, F2-F4. Three spellings of a Guarded static escaped the one resolver, BindStaticValueThroughType: - A type nested under a constructed generic (`G[int].N.s`) was declined, so `.append(await ...)` was a false ICE from the totality guard, `take(out ..., await ...)` too, and `+= await` was CS8178: the guard did not cover a store or augmented target. - An import alias (`from lib import LC as CC`) is a clone of the loader's extraction, whose fields are not the declared ones carrying the storage fact, so `CC.s` / `D2.s` (`class D2(CC)`) across an await was CS8178; the owner was spelled `Lib.CC` (CS0234), the plain `CC.s` on dev too. Fix: - The resolver binds a static of a type nested under a generic, its type closed by the arguments the receiver chain constructs, and marks the access (SemanticInfo, joins MergeFrom) so the emitter spells the receiver by its own chain (`G<int>.N.S`). - An aliased type import's origin ends at THIS compilation's declaration (the variable twin's rule, P21i D5); the resolver binds the declaration's field and keeps the clone as owner, which the emitter spells by its OriginalImportName (`Lib.LC`). - RequireBound also covers a store site (a plain or augmented target), and fires when the access is bound to anything but the Guarded declaration's field (read through the origin chain). Generator: AsyncGuardedStaticSpellingTests, 16 receiver spellings (own, subclass, alias, nested own/subclass, generic-base subclass, G[int], its alias, G[int].N, from-import subclass, from-import alias and its subclass, local subclass of lib's class, lib.LC, lib.LD, struct) x {out operand, +=, mutating call, store}, each across an await and as a plain-def twin: 61 cells, 3 excluded (+= through G[int] / lib.LC / lib.LD: CS0119 in a plain def too, #2435). ClosedByReceiverChain is rostered on the dispatch-site inventory. Mutation pairs (cp + cmp restore): - M1 nested-under-generic binding dropped: the generator red by the guard's ICE ("'s' ... through 'N' ... bound no value symbol"); by sharpyc, the guard fires on all four async forms (out, +=, append, store) and the plain twin runs; restored, 2/2. - M1 plus the store-site arm dropped: `+=` and the store reach CS8178 (out and append still the guard's ICE), so the store-site arm is what fires; restored. - M2 the resolver keeps the alias clone's field: the guard fires ("bound 's', which is not the Guarded declaration", CC78); before the guard read the declaration's field it was CS8178; restored 2/2. - M3 the alias's origin not re-pointed: CS8178 on CC78 (the guard cannot see a declaration the clone does not reach); restored 2/2. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Review 6 of #2742, F7 (b, c). - StaticValueRedeclarationTests gains a Level: a generic intermediate base closed by the leaf's base list (`class M[T](C)` redeclares, `class L(M[int])`), the resolver's generic-closing path. 1 cell excluded: a generic's static read through an instance spells the open generic (CS0305) with no subclass at all, `G[int]().s` (#2435, findings ledger). - The definition negative accepted null, so it passed whatever the handler did. It now asserts the real target: `Q.s()` of a subclass redeclaring the name as a static method lands on Q's method, not C's field. The property twin (`P.s`) is null on definition; that is ledgered, not asserted. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
3fed7cb added a SemanticInfo side table (_chainSpelledStaticReceivers) and broke the E2 ratchet (SemanticInfoMergeConformanceTests: 88 > 87, #2443: the count may only fall, raised only on the owner's word). The mark is a property of the one binding the resolver records, so it moves onto _memberAccessResolutions as a third element (SetMemberAccessResolution(..., chainSpelledReceiver: true)); the public GetMemberAccessResolution keeps its shape, and IsChainSpelledStaticReceiver reads the flag. The count is 87 again. Measured: SemanticInfoMerge*, AsyncGuarded*, StaticValueRedeclaration*, EmitterCarrierOnly*, DispatchSiteInventory*, NestedClassBaseScope*: 82/0/0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Sixth review of #2742, finding 1: two round-6 comments said a bare `N.s` inside `G[T]` is spelled by its own chain. Only a receiver chain that constructs the generic (`G[int].N.s`) is; the bare name inside the generic still emits the open `G.N` (CS0305 behind SPY0908, at the base and the tip), the class tracked on #1941. Comments only. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
This was referenced Nov 19, 2026
This was referenced Nov 19, 2026
antonsynd
pushed a commit
that referenced
this pull request
Nov 19, 2026
Appends the Implementation Verification Record: five refuting auditors over 6d6c5c9..f968835 (the merge of #2742), no regression found, six completeness gaps and two vacuous assertions fixed on this lane, eleven cells posted to seven open trackers, no issue filed. Gate, the last code commit's: 85541/0/10 @ 5a5adce (measured, run 44554132404), Python Build Tools green (run 44554139066). Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGMKZW5iXgCkmJYFuSUhUm
This was referenced Nov 19, 2026
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.
P77 — N3: values ready before use
Implements plan-775c50 (tier
full, CONVERGED, Adequacy CLASS, one group; generator built first).What changes. Every module value and
@staticvalue with an initializer is now Guarded (D2, D4):N__init/N__slow, and a property of the same C# name that returns byref. A plain store isN__set(v).__Load. The sweep runs the host's initializers in declaration order the first time the host is required: byMain, by an importer at the import's position, by the sweep around a nested class, or by the first use of one of its values (D5). Anawaitcannot suspend between a value's check and its use (D6).ExecutionOrderAnalyzer.DetectInitializerDependenciesis deleted (codegen: calling a module function-typed variable whose lambda reads a module var emits the raw name — CS0103 behind SPY0908 #2420).Sharpy.CoregainsSharpy.StaticInit, the readiness runtime (T3).Refs #2422, #2412, #2420. These are not closed by this PR; the plan's close criteria are measured below.
Close criteria (plan "Issues to Close")
DetectInitializerDependenciesdeleted (T1, fa33889)Owner rulings made during implementation
constwhile an outer binding holds the name, or while the read sits in a comprehension.SemanticInfoMergeConformanceTests.MaximumSideTableFieldCountgoes 85 → 87, for_asyncGuardedUses(D6) and_importRequirements(D5).after_setobserver's old-value read of a Guarded property initializes it first, as every other read does.devit takes 6m25s–8m13s. A local run logging each program finished in 10m30s, and no single program took over 3 s, so it is not a hang.--blame-hang-timeoutto 22m and the sweeps job'stimeout-minutesto 40. That follows tooling band from the 2026-11-06 audit: CLAUDE.md, wrapper logs, CI hygiene #2458's rule that a limit is at least twice the slowest measured run.Known remaining cells (not regressions; already allowlisted on
devunder #2423, P78's)constunder an outer binding.k: int = 9/class Host: @static a: int = k + 1/const k: int = 7prints8; CPython 3.15.2 prints10. The comprehension twin prints[7, 7]against[9, 9]. The narrowed SPY0618 covers non-compile-time consts only, as the ruling words it.ComprehensionElement/…/outer=ModuleVaris refused by SPY0618 (a false refusal, exactly its row ondev). Leaving it unrefused would have made it silently wrong.Fixed during final verification
The standalone verifier found that the store arm depended on declaration position.
@staticvalue was emitted asH.T = 42, a store through therefproperty that initializestfirst. It printed1 42where D4/D5, C#'s order and Python's twin print1 7.CheckClass/CheckStructreplaced each field with awithcopy on entering the body, so an earlier use bound a symbol without the class's recorded facts.FunctionPositionaxis: pool 2718 → 3267, 87 cells red without the fix and 0 with it.MemberSymbolPositionTestscells are red; restored, 7/7 pass.Unknown, which gives SPY0908 where SPY0260 is expected. It is filed on #2249.A12 benchmark (report only, Q10)
bench_ab.py bench/p77-v0 claude/p77 --filter '*StaticValueBenchmarks*' --job short --rounds 14, re-run at fd42fc5. V0 is a523fa0 plus the benchmark commit. 14 pooled rounds in both positions, after discarding the first 4. Figures are ns per operation, the mean of each arm's pooled rounds.+=constreadHost[int].countreadHost[int].countstore0 of 8 benchmarks show a measurable delta. The earlier run, at f477054, measured module store at 4.26× and
+=at 5.14×: the JIT did not inline the module host'sX__setat tier 1. The/simplifycommit ecff618 moved the store's slow path out of line, and that cost is gone. The open question filed on #2422 is answered by this measurement.Gates
85360/0/10 @ a523fa013.85402/0/10 @ 0ad265766;85405/1/10 @ 086a550a7(red, fixed by 1264626 and 85fa0be);85406/0/10 @ 85fa0be9f;85406/0/10 @ fb420d1de;85415/0/10 @ 93b3acf3f(after mergingdev).85421/0/10 @ f47705416 (measured, run 44239505358), after the position fix and a seconddevmerge.85477/6/10 @ b4dd1f362(red: 4 LSP corpus pins, a static-initializer check and a layout-fact check; fixed in round 2);85494/0/10 @ d01ef5a1c(run 44347230877);85529/0/10 @ f792078a4(run 44415725512).85541/0/10 @ fd42fc58f (measured, run 44465453665). The tip after it, 9e39086, changes comments only.check_spy_stalenessandcheck_spy_tests_staleness: up to date;dotnet format whitespace --verify-no-changesover the 114 changed C# files: clean;check_spec_blocks.sh: pool 1294, output-mismatch 0, failing 0;check_plan_refs: OK.check_allowlist_issue_state.shreturns "gh failed" in this cloud session because itsgh issuecalls get 403. Thedev-stalenessworkflow covers it.Mutation records for each task are in the plan's checklist and in each commit body. The lead re-ran the largest one per wave in a clean worktree: T5 (M5), T4 docs
ref, T9 (M9, 32 mixed-ring controls), the narrowed SPY0618 arm (NR 26 + matrix 1), M ("Store without Require", 9 cells), the position fix (M1, 87 cells), and one per review round (table below).Issues filed and cells posted
@static.None-returning function is refused with SPY0603), lsp: go-to-definition on a static property named through a type receiver (P.s) returns null; the field and method twins resolve #2749 (LSP go-to-definition on a static property).+=CS0200, all behind SPY0908 #2494: narrowed-use exclusions.out, partial-application pipe and pipedout.H._hp.+=through a constructed generic or a module-qualified type.@privatestatic through a subclass.CC.sthrough an import alias. Its claim that this PR fixesD2(CC)andCC.swas verified at the round-6 tip./simplifypass (before the gate and the first review)At the owner's request (2026-11-18), four
/simplifyreviewers read the product diff: reuse, simplification, efficiency and altitude. What was applied:SemanticInfoaccessor. The cycle validator walks a module's stores only after it has found a cycle.X__set(see the benchmark below).ref fieldargument had been counted as a read, which gave every Guarded property setter an initialize-first prelude.Skipped, with reasons:
PropertySymbolis an immutable record, so the change can't be made narrowly.HasSweepdefaulted where its record can be missing. They go to architecture(compiler): the lowering IR is the emitter's only input — SemanticInfo frozen after validation, MergeFrom disjoint, node-keyed tables ratchet down from 88 (E2 port resumed; owner-ruled 2026-11-06) #2443's IR migration, and/verify-plannow asks these questions (process(skills): /simplify before the gate; /verify-plan altitude checks #2743, merged).Independent reviews and fix rounds
Each reviewer was read-only, worked in a private worktree, and had only the diff and the CPython 3.15 oracle, never the plan. After each round the lead re-ran its largest mutation in a clean worktree.
• H1, H2: false ICEs on a narrowed Guarded value and on an inline
outbeside anoutGuarded operand inasync def• H3: two roster reds from the simplify refactor
• M1 is #2443's class
• L2 is on #2427
• L1: owner ruling "Keep D4 as is"
• F1: corpus pins
• F2: the checker records an inline
out's resolved type, and the emitter no longer infers it• F3: every
outcall commits at one seam, with an ICE guard• F5: citations
• F6: per-arm rename
• a dead check
• F4 is a sync cell that predates P77; filed on #2025
• pipe-route inline
outfor every callee kind•
H._hprename regression reverted; the census now finds storage by its sweep registration• subclass spelling
D.s• generator split into route × callee × spelling
• optional layout-fact-check cleanup, not cleanly separable
• the subclass binding ignored other member kinds (silently wrong value) → one MRO first-declaration resolver
•
Outer.C.s/Outer.D.s/GD.sacrossawait→ a totality guard (RequireBound)• pipe into a generic method left
U• F1: compile hang on
class Outer: class C(C)→ CPython's base-scope rule, plus a cycle guard that removes the edge• F2, F3: nested-under-generic binding; the guard covers stores and
+=• F4: alias subclass
D2(CC)• F6: nested-base scope cells
• F7: tests
Also the NR blame limit to 22m (985b5e3)
• F5 is
+=throughG[int].s/lib.LC.s, CS0119 ondevin plaindeftoo; filed on #2435• two comments overstated what the chain spelling covers (9e39086, comments only)
dev20909f7:• bare
NinsideG[T]andG[int].H[str].hh→ #1941• alias-nested type and alias-vs-direct identity → #2402
•
#1371fallback test gap: nitIndependent review @ 4383f02: merge after fixes; 3 applied, 3 declined; second review @ b4dd1f3: merge after fixes; 6 applied, 1 declined; third review @ d01ef5a: merge after fixes; 4 applied, 1 declined; fourth review @ 410a688: do not merge; 3 applied, 0 declined; fifth review @ f792078: merge after fixes; 6 applied, 1 declined; final review @ fd42fc5: merge; 1 applied, 4 declined (reasons above); fixes fd42fc5..9e39086 read by the lead
https://claude.ai/code/session_01LGMKZVPaJNNntZNLLiymdp
Generated by Claude Code