Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions admission_switch_a3_arm_noop_confirmation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,19 @@ import (
// on compact-origin trees for that witness -- the retirement precondition
// follow-up arm-deletion PRs need.
//
// RESULT, corrected from the finding: only Apex's witness confirms as a
// no-op. Perl, Python, and Ada's compat arms still perform real,
// load-bearing tree reshaping on compact-origin trees even after A3
// certification lands, on their own tied-election witnesses. The finding's
// "compact-raw equals compact-tailed on all six witnesses" claim does not
// reproduce for four of those six (perl push-list; python tuple assignment;
// both ada aggregates). It reproduces for the fifth, apex class-literal.
// RESULT, corrected from the finding: Python's tuple-assignment witnesses now
// confirm as no-op after C-ordered clean-tie selection moves the choice into
// the producer. Perl and Ada still perform load-bearing reshaping on their
// tied-election witnesses. Apex has a separate material-election decline.
//
// This is consistent with the arm taxonomy (spec.campaign.v7): apex's arm
// is a fixed derivation relabel that A3's primary-acceptance-derivation
// certification already subsumes at the scheduler level, so there is
// nothing left for the arm to do. Perl and Python's arms are
// scheduler-action arms that perform source-text-scanning list regrouping
// (ambiguous_function_call_expression / pattern_list-vs-expression_list) --
// a materially stronger transformation than picking among tied derivations.
// nothing left for the arm to do. Perl's arm is a scheduler-action arm that
// performs source-text-scanning list regrouping
// (ambiguous_function_call_expression). Python's former
// pattern_list-vs-expression_list rewrite is now an observed no-op on the
// certified tuple witnesses because the producer makes the C choice.
// Ada's arms (materialization-owned) relabel one aggregate production into
// another via a similar structural scan. None of these three
// transformations are subsumed by the admission-time election flags this
Expand Down Expand Up @@ -154,7 +152,7 @@ func TestA3ArmNoOpConfirmationPerlDoesNotConfirm(t *testing.T) {
}
}

func TestA3ArmNoOpConfirmationPythonDoesNotConfirm(t *testing.T) {
func TestA3ArmNoOpConfirmationPythonConfirms(t *testing.T) {
lang := grammars.PythonLanguage()
if !lang.CompactPrimaryAcceptanceDerivationCertified || !lang.CompactConvergedReductionSplitDropsCertified {
t.Fatal("python did not receive its A3 certification")
Expand All @@ -163,7 +161,7 @@ func TestA3ArmNoOpConfirmationPythonDoesNotConfirm(t *testing.T) {
{"assignment_bare_tuple", "x, y, z = 1, 2, 3\nxyz = x, y, z\n"},
{"assignment_bare_pair", "a = 1\nb = 2\npair = a, b\n"},
} {
assertA3ArmNoOp(t, "python/"+tt.name, lang, []byte(tt.source), false)
assertA3ArmNoOp(t, "python/"+tt.name, lang, []byte(tt.source), true)
}
}

Expand Down
8 changes: 6 additions & 2 deletions cgo_harness/merge_event_census.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,10 @@ type mergeCensusTotals struct {
CLinkUnionAppended,
CLinkUnionRejected uint64

GoAttempts uint64
GoSuccesses uint64
GoAttempts uint64
GoSuccesses uint64
MixedRepresentationAttempts uint64
MixedRepresentationSuccesses uint64

RefuseNoGSSHead uint64
RefuseNoGSSHeadBoth uint64
Expand Down Expand Up @@ -704,6 +706,8 @@ func (t *mergeCensusTotals) add(row mergeCensusRow) {

t.GoAttempts += row.Go.Attempts
t.GoSuccesses += row.Go.Successes
t.MixedRepresentationAttempts += row.Go.MixedRepresentationMergeAttempts
t.MixedRepresentationSuccesses += row.Go.MixedRepresentationMergeSuccesses

t.RefuseNoGSSHead += row.Go.RefuseNoGSSHead
t.RefuseNoGSSHeadBoth += row.Go.RefuseNoGSSHeadBoth
Expand Down
19 changes: 13 additions & 6 deletions cgo_harness/merge_event_census_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ func TestMergeCensusTotalsAggregatesPhysicalHeadMergeTelemetry(t *testing.T) {
CompactPhysicalHeadMergeAttempts: 3,
CompactPhysicalHeadMergeSuccesses: 2,
CompactPhysicalHeadMergeInputLinks: 5,
MixedRepresentationMergeAttempts: 4,
MixedRepresentationMergeSuccesses: 1,
},
})
totals.add(mergeCensusRow{
Expand All @@ -48,12 +50,16 @@ func TestMergeCensusTotalsAggregatesPhysicalHeadMergeTelemetry(t *testing.T) {
CompactPhysicalHeadMergeAttempts: 7,
CompactPhysicalHeadMergeSuccesses: 4,
CompactPhysicalHeadMergeInputLinks: 9,
MixedRepresentationMergeAttempts: 6,
MixedRepresentationMergeSuccesses: 3,
},
})
if totals.CompactPhysicalAttempts != 10 || totals.CompactPhysicalSuccesses != 6 ||
totals.CompactPhysicalInputLinks != 14 {
t.Fatalf("physical merge totals=%d/%d/%d, want 10/6/14",
totals.CompactPhysicalInputLinks != 14 || totals.MixedRepresentationAttempts != 10 ||
totals.MixedRepresentationSuccesses != 4 {
t.Fatalf("merge totals physical=%d/%d/%d mixed=%d/%d, want physical=10/6/14 mixed=10/4",
totals.CompactPhysicalAttempts, totals.CompactPhysicalSuccesses, totals.CompactPhysicalInputLinks,
totals.MixedRepresentationAttempts, totals.MixedRepresentationSuccesses,
)
}
}
Expand Down Expand Up @@ -121,7 +127,7 @@ var mergeCensusBaselineConstructed = map[string]struct {
// Clean-suffix reset removes four redundant Kotlin merges. Exact C tree
// parity remains pinned by TestKotlinRecoverySuffixSourcesMatchC.
"kotlin": {Sources: 13, CMergeSuccesses: 54, GoSuccesses: 8, RefuseNoGSSHead: 2, RefuseScoreOrShifted: 0, RefuseDistinctShapes: 0, LinkPayloadShallowWouldAccept: 8, SourcesWhereGoOverMerges: 0, SourcesWhereCMergesAndGoDoesNot: 3},
"python": {Sources: 26, CMergeSuccesses: 2, GoSuccesses: 0, RefuseNoGSSHead: 9, RefuseScoreOrShifted: 0, RefuseDistinctShapes: 0, LinkPayloadShallowWouldAccept: 0, SourcesWhereGoOverMerges: 0, SourcesWhereCMergesAndGoDoesNot: 2},
"python": {Sources: 30, CMergeSuccesses: 2, GoSuccesses: 0, RefuseNoGSSHead: 9, RefuseScoreOrShifted: 0, RefuseDistinctShapes: 0, LinkPayloadShallowWouldAccept: 0, SourcesWhereGoOverMerges: 0, SourcesWhereCMergesAndGoDoesNot: 2},
}

// The M0 pinned aggregate over the five A3 sweep corpora's constructed
Expand All @@ -133,8 +139,8 @@ const (
mergeCensusBaselineCMerges uint64 = 191
mergeCensusBaselineGoMerges uint64 = 11
// mergeCensusBaselineSources is the constructed-source denominator, the
// same 104 sources D0 measures.
mergeCensusBaselineSources = 104
// same 108 sources D0 measures.
mergeCensusBaselineSources = 108
)

// TestMergeEventCensusBaseline publishes the M0 baseline: how many merges the
Expand Down Expand Up @@ -271,9 +277,10 @@ func TestMergeEventCensusBaseline(t *testing.T) {

func mergeCensusFormatTotals(label string, t *mergeCensusTotals) string {
return fmt.Sprintf(
"%-22s sources=%3d M_c=%6d M_p=%6d ratio=%-8s c-attempts=%7d go-attempts=%7d over-merge-sources=%d c-merges-go-does-not=%d | refusals: %s | tier2: %s | compact: accepted=%d union-attempts=%d union-appends=%d physical-attempts=%d physical-successes=%d physical-input-links=%d",
"%-22s sources=%3d M_c=%6d M_p=%6d ratio=%-8s c-attempts=%7d go-attempts=%7d over-merge-sources=%d c-merges-go-does-not=%d | mixed=%d/%d | refusals: %s | tier2: %s | compact: accepted=%d union-attempts=%d union-appends=%d physical-attempts=%d physical-successes=%d physical-input-links=%d",
label, t.Sources, t.CMergeSuccesses, t.GoSuccesses, t.ratioText(),
t.CMergeAttempts, t.GoAttempts, t.SourcesWhereGoOverMerges, t.SourcesWhereCMergesAndGoDoesNot,
t.MixedRepresentationAttempts, t.MixedRepresentationSuccesses,
t.refusalLine(), t.linkPayloadLine(),
t.CompactAccepted, t.CompactUnionAttempt, t.CompactUnionAppend,
t.CompactPhysicalAttempts, t.CompactPhysicalSuccesses, t.CompactPhysicalInputLinks,
Expand Down
45 changes: 18 additions & 27 deletions cgo_harness/python_a3_certification_sweep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
// certification-workstream (spec.campaign.v7, finding
// tied-election-family-compact-retirement) full-corpus verification receipt
// for Python. Python already shipped CompactConvergedReductionSplitDropsCertified;
// this sweep gates the added CompactPrimaryAcceptanceDerivationCertified
// grant (grammars/runtime_profiles.go) on zero unadjudicated compact-vs-C
// divergence across the real corpus plus the tied-election and known-gap
// tuple/f-string witnesses (python_scheduler_action_local_parity_test.go).
// this sweep gates the added compact acceptance grants
// (grammars/runtime_profiles.go) on zero unadjudicated compact-vs-C divergence
// across the real corpus plus the tied-election tuple/f-string witnesses
// (python_scheduler_action_local_parity_test.go).
func TestPythonA3CompactCertificationFullCorpusSweep(t *testing.T) {
lang := grammars.PythonLanguage()
if !lang.CompactPrimaryAcceptanceDerivationCertified {
Expand Down Expand Up @@ -63,30 +63,17 @@ func TestPythonA3CompactCertificationFullCorpusSweep(t *testing.T) {
// at all. The stale-entry ratchet in a3ReportSweep enforces this: it fails
// the sweep if a remaining entry stops matching a live divergence.
//
// The two f-string entries are family D (a first-class declared
// pattern_list/expression_list ambiguity; Go's reduceForkWindowPreference
// disagrees with C's ts_parser__select_tree on which side to keep). Not
// tied elections, not this gate's scope; repair lanes are tracked
// separately.
var pythonA3KnownDivergences = []a3KnownDivergence{
{
Witness: "fstring_interpolation_bare_tuple",
FirstPath: "/module/assignment[2]/string[2]/interpolation[1]/pattern_list[1]",
GoValue: "pattern_list", CValue: "expression_list", Family: "D",
},
{
Witness: "fstring_interpolation_splat",
FirstPath: "/module/assignment[1]/string[2]/interpolation[1]/pattern_list[1]",
GoValue: "pattern_list", CValue: "expression_list", Family: "D",
},
}
// The two former f-string entries were family D (a first-class declared
// pattern_list/expression_list ambiguity). C-ordered clean-tie selection now
// emits expression_list for the exact Python artifact, so these entries are
// retired from the active known-divergence list. The historical values remain
// in docs/root-normalization-retirement.md and the blocker receipt.
var pythonA3KnownDivergences = []a3KnownDivergence{}

// pythonA3AdversarialSources gathers Python's tied-election witness (the
// bare-tuple assignment right-hand side) plus its known-gap and neutral
// control sources
// (python_scheduler_action_local_parity_test.go), all already vetted as
// conflict-heavy shapes for this grammar's pattern_list/expression_list
// election.
// pythonA3AdversarialSources gathers Python's tied-election witnesses, the
// former f-string blocker shapes, and neutral controls
// (python_scheduler_action_local_parity_test.go). These sources exercise
// conflict-heavy pattern_list/expression_list choices for this grammar.
func pythonA3AdversarialSources() []a3CertificationSweepSource {
return []a3CertificationSweepSource{
{Name: "assignment_bare_tuple_real_corpus_witness", Source: []byte("x, y, z = 1, 2, 3\nxyz = x, y, z\n")},
Expand All @@ -109,10 +96,14 @@ func pythonA3AdversarialSources() []a3CertificationSweepSource {
{Name: "for_target_tuple_negative_control", Source: []byte("pairs = [(1, 2)]\nfor a, b in pairs:\n pass\n")},
{Name: "chained_assignment_lhs_negative_control", Source: []byte("a, b = c, d = 1, 2\n")},
{Name: "del_tuple_negative_control", Source: []byte("a = 1\nb = 2\ndel a, b\n")},
{Name: "with_multiple_as_targets", Source: []byte("with context() as a, other() as b:\n pass\n")},
{Name: "except_multiple_as_targets", Source: []byte("try:\n pass\nexcept E as a, F as b:\n pass\n")},
{Name: "walrus_in_comprehension", Source: []byte("data = [1, 2, 3]\nresult = [y for x in data if (y := x * 2) > 2]\n")},
{Name: "decorated_async_def", Source: []byte("import functools\n\n@functools.wraps\nasync def f(x, *, y=1, **kw):\n return x, y\n")},
{Name: "star_expr_unpack", Source: []byte("first, *rest = [1, 2, 3]\n")},
{Name: "lambda_tuple_return", Source: []byte("f = lambda x, y: (x, y)\n")},
{Name: "fstring_call_arguments", Source: []byte("s = f\"{foo(a, b)}\"\n")},
{Name: "fstring_parenthesized_tuple", Source: []byte("s = f\"{(x, y)}\"\n")},
{Name: "nested_fstring_conversion", Source: []byte("name = \"world\"\ns = f\"{name!r:>{10}}\"\n")},
}
}
Expand Down
Loading
Loading