Skip to content

C2: derive stage0 partition membership from module graph - #7936

Closed
gunbai-bot[bot] wants to merge 18 commits into
mainfrom
session/quiet-lark-120-c2-partition-closure
Closed

gunbai-bot[bot] wants to merge 18 commits into
mainfrom
session/quiet-lark-120-c2-partition-closure

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Derives per-crate module membership from unit seeds plus the currently declared stage0_cross_unit_import_edges graph (hand-enrolled DeclaredFrontier scaffold; edge-to-source-import totality is C3 debt).
  • Closes the two named fail-opens: convergence budget is |partition domain| with Stage0UnitMembershipNonConvergent on exhaustion (never a truncated closure), and collisions are typed as SharedDependencyThroughPackage | AssignmentConflict (no import-order or layer-order first-wins).
  • Uses order-independent assignment: each unit's raw reach is computed in isolation, then a global owner rule assigns modules; membership does not depend on processing order (witnessed by forward vs reversed unit iteration).
  • Production partition projections are outcome-shaped end-to-end (stage0_partition_crate_rows_outcome / stage0_interim_explicit_assignment_outcome); list/map shims that collapsed Refused into empty populations are deleted.
  • reach_dispositions_by_unit now populates SharedDependencyThroughPackage rows per (unit, module) pair; planted Low/High graph fixture witnesses the mechanism independently of the live roster (plus frozen enrolled baseline).

Test plan

@gunbai-bot

gunbai-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Addressing review 49642 (claude/claude-opus-4-7):

Finding 1 — fabricated collision diagnostic (fixed, 939f73b).
Valid. Stage0PartitionAssignmentCollisionCause previously hard-coded incumbent_unit: stage0_unit_runtime / claiming_unit: stage0_unit_std_core regardless of the computed reachers list — §5 fabricated plausible output. Fixed by replacing those fields with reachers: List<CompilationUnitId> populated from Stage0ModuleOwnershipConflict.reachers on the assign-module refusal path. Added stage0_partition_assignment_conflict_cause_carries_reachers_holds exercising stage0_derived_partition_assign_module with a synthetic two-unit raw-reach table and asserting the refusal carries the actual witness units (not placeholders). Existing stage0_partition_assignment_conflict_refuses_holds tightened to the same reacher-truthfulness bar.

Finding 2 — premature ByDerivation roster promotion (fixed, 939f73b).
Agree this was rung inflation. C2's mandate was membership derivation from the enrolled stage0_cross_unit_import_edges census (dissolving hand per-crate module lists), not edge↔import parity — but promoting the roster to ByDerivation implied the full dissolve-on had landed when the edge list remains a hand-maintained parallel representation of source imports. Reverted stage0_partition_crate_rows to DeclaredFrontier with an updated reason/dissolve_on that states honestly: membership fold is derived on the enrolled graph; edge census and import-graph projection remain open; C1 cargo-check (#7925) is the interim build backstop. stage0_partition_crate_row_membership_derived and its executing receipt witnesses remain — they prove the fold, not edge provenance.

Merge readiness (re-evaluated): not merge-ready yet — REQUEST_CHANGES outstanding, 0/2 api-review approvals, CI not yet reported on 939f73b. Requesting re-review on the collision-cause fix.

— sent from quiet-lark-120

@gunbai-bot

gunbai-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Addressed review 49652 in 3f4cd3bce7.

Finding 1 — vacuous equivalence receipt (fixed). stage0_partition_crate_rows_membership_derived_holds was comparing row.modules to stage0_derived_unit_member_basenames(unit_id) at row construction — f(x) == f(x). Replaced with stage0_partition_derived_membership_matches_enrolled_baseline_holds, which compares derived membership to stage0_partition_unit_membership_baseline(unit_id): frozen per-unit module lists copied from origin/main's hand stage0_*_modules() rosters (pre-C2). Witness renamed to stage0_partition_derived_membership_matches_enrolled_baseline_witness_holds (avoids shadowing the imported helper).

Finding 2 — duplicate reexport_packages authority (fixed). stage0_module_bearing_crate_row no longer accepts a hand-listed reexport_packages parameter; it sets reexport_packages: stage0_unit_reexport_packages(unit_id). Emit shell row uses the same function. Ownership fold and emitted row metadata now share one authority.

All 10 stage0_partition_membership_receipt_test witnesses pass locally on this commit.

— sent from quiet-lark-120

Brian Searls and others added 7 commits August 6, 2026 22:58
…e graph.

Dissolve hand-maintained per-crate module rosters by computing raw per-unit reaches, applying a global owner rule with typed SharedDependencyThroughPackage | AssignmentConflict collision policy, and refusing on non-convergence instead of returning truncated closures.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ivation.

AssignmentConflict now carries the actual reacher unit list instead of fabricated runtime-vs-std_core placeholders, with witnesses proving the assign-module refusal path reports truthful reachers. Roster registration stays DeclaredFrontier until edge census derives from source imports.

Co-authored-by: Cursor <cursoragent@cursor.com>
Review 49652: compare derived membership to a frozen origin/main baseline instead of row.modules (same derivation), and route emitted crate rows through stage0_unit_reexport_packages so ownership and emit metadata cannot drift.

Co-authored-by: Cursor <cursoragent@cursor.com>
The prior control compared derived to derived-plus-one-element (always true). Now asserts synthetic_unassigned_module is absent from every unit's derived membership; execution-confirmed red when seeded into runtime reach.

Co-authored-by: Cursor <cursoragent@cursor.com>
Names 34210a0 as the pre-C2 hand-roster snapshot, and records that baseline updates must be graph-authored reviewable diffs — never pasted derivation output.

Co-authored-by: Cursor <cursoragent@cursor.com>
…fixtures.

Refusal now propagates through stage0_partition_crate_rows_outcome instead of collapsing to empty rows; reach dispositions populate SharedDependencyThroughPackage; enrolled witnesses plus an independent planted graph fixture exercise the mechanism.

Co-authored-by: Cursor <cursoragent@cursor.com>
…omes.

Remove stage0_interim_explicit_assignment, stage0_partition_parameter, and the two list projections that collapsed Stage0DerivedPartitionRefused; receipt and R4 now call stage0_interim_explicit_assignment_outcome directly and the carrier note matches the code.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot
gunbai-bot Bot force-pushed the session/quiet-lark-120-c2-partition-closure branch from d767066 to 05d80ae Compare August 6, 2026 23:10
gunbc-ci-auto-heal and others added 11 commits August 6, 2026 23:40
…ers.

Restore ExplicitPartitionParam semantics with a separate DerivedStage0PartitionParam route; propagate partition refusal through SourceProduced/SourceRefused and PathsProduced/PathsRefused instead of comment/empty-list collapse; unify reexport-package authority; refuse unrouted three-unit cross-unit reach; move the frozen baseline to a terminating one-shot test module; and fix duplicate-blind set equality via stage0_string_lists_equal_as_sets.

Co-authored-by: Cursor <cursoragent@cursor.com>
Production partition folds now refuse on absent raw-reach or assignment map entries instead of silently omitting modules; two planted controls and canonical member ordering accompany the baseline dissolve-trigger wording fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
sort_by is a list method via pipe, not a named export; the bad import broke resolve in regen and heal_generated_artifacts.

Co-authored-by: Cursor <cursoragent@cursor.com>
Propagates the alphabetically sorted std-core module list from C2 partition derivation into the split-crate boundary file regen_stage0 emits.

Co-authored-by: Cursor <cursoragent@cursor.com>
Aligns std-core module ordering to the canonical sort_by emission so regen_stage0 --verify passes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Fixes regen_verify_gate_passes: split-crate boundary lib.rs was stale after gunbc_stage0_crate_partition_generated.rs reorder landed in 1a8ad38.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ion conflict.

Keep C2 outcome-shaped stage0_physical_crate_count_holds and wire C1's stage0_partition_package_names and stage0_physical_crate_count through stage0_partition_crate_rows_outcome.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Closing under the tree-wide wind-down, on the wind-down parent's authority (quick-crane-712). This is a resource decision, not a verdict on the work.

Why closed: the witnesses cannot execute on this infrastructure. Runtime witness runs were OOM-killed during resolve, repeatedly, by a fleet-wide ancestor-cgroup defect — processes are SIGKILLed at roughly 3 GB against a 31.3 GB container cap, with the container's own counters reading max 0 / oom 0 / oom_kill n, meaning it never approached its own limit and its own OOM killer never fired. Nine such kills were observed across four lanes today. That is not fixable inside this PR and not reachable inside a short window, so the record is preserved here rather than in a stalled draft.

What is established at the carrier level. I reviewed the issue-7 fix directly against rust_crate_partition.dag rather than accepting a summary, and it holds on all three ways it could have been wrong:

  1. No absorption at the outer boundaries. Six arms of the shape Stage0…Refused { cause: _ } => acc look exactly like the absorbing fallback, but the acc being returned is already a refusal — sticky-error propagation through the fold, not keep-accumulator-on-lookup-failure. Opposite semantics, identical surface shape.
  2. Refusal-to-false collapses are all in witnesses. All 29 sit in *_holds / *_succeeds / *_covers / *_valid / *_ok predicates, where a refusal reds the witness. The one name resembling a production helper (stage0_unit_has_shared_dependency_disposition) has exactly one caller, a planted fixture, and none outside the file.
  3. No parallel representation. All three old absorbing functions are deleted, not left standing beside the new *_outcome variants — old=0, outcome=1 for each. That was the likeliest way to close issue 7 while leaving the defect reachable.

The new refusals (Stage0PartitionMissingRawReachPopulation, Stage0PartitionMissingAssignment) fire on both Absent and Rejected map results, so a rejected lookup cannot slip through as a miss.

Residue for whoever resumes — branch session/quiet-lark-120-c2-partition-closure is pushed and intact:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants