From a346baf8c6a888d25ab7f1eca3a934509857aec2 Mon Sep 17 00:00:00 2001 From: The Code Learner <142033899+the-code-learner@users.noreply.github.com> Date: Fri, 13 Nov 2026 22:43:27 +0100 Subject: [PATCH 1/7] test: port strict fanout diagnostic onto updated main without gate waivers --- internal/api/performance_lab_test.go | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/internal/api/performance_lab_test.go b/internal/api/performance_lab_test.go index fd663ce2..58220d9a 100644 --- a/internal/api/performance_lab_test.go +++ b/internal/api/performance_lab_test.go @@ -47,8 +47,9 @@ type labNode struct { } type labCluster struct { - tb testing.TB - nodes []*labNode + tb testing.TB + nodes []*labNode + lastSubmitted []string } type labFaultTransport struct { @@ -200,6 +201,10 @@ func (c *labCluster) submitTransactions(transactions []tx.Envelope, workers int) if len(transactions) == 0 { return } + c.lastSubmitted = c.lastSubmitted[:0] + for _, envelope := range transactions { + c.lastSubmitted = append(c.lastSubmitted, tx.ID(envelope)) + } if workers <= 0 { workers = 1 } @@ -266,7 +271,19 @@ func (c *labCluster) waitForMempools(size int, timeout time.Duration) { for _, node := range c.nodes { counts = append(counts, node.server.ledger.MempoolSize()) } - c.tb.Fatalf("mempools did not converge to %d before timeout: %v", size, counts) + missing := make(map[int][]string, len(c.nodes)) + for index, node := range c.nodes { + seen := make(map[string]struct{}) + for _, entry := range node.server.ledger.Snapshot().Mempool { + seen[entry.ID] = struct{}{} + } + for _, id := range c.lastSubmitted { + if _, found := seen[id]; !found { + missing[index] = append(missing[index], id) + } + } + } + c.tb.Fatalf("mempools did not converge to %d before timeout: counts=%v missingTxIDsByNode=%v", size, counts, missing) } func (c *labCluster) driveUntilHeight(indices []int, height uint64, timeout time.Duration) time.Duration { From a33e2e03f76a1d1aa08ab67fdd41ee67de6cd6dc Mon Sep 17 00:00:00 2001 From: The Code Learner <142033899+the-code-learner@users.noreply.github.com> Date: Fri, 13 Nov 2026 22:43:30 +0100 Subject: [PATCH 2/7] test: port strict fanout diagnostic onto updated main without gate waivers --- .../legacy-seven-validator-fanout.yml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/legacy-seven-validator-fanout.yml diff --git a/.github/workflows/legacy-seven-validator-fanout.yml b/.github/workflows/legacy-seven-validator-fanout.yml new file mode 100644 index 00000000..4cee205e --- /dev/null +++ b/.github/workflows/legacy-seven-validator-fanout.yml @@ -0,0 +1,60 @@ +name: Legacy 7-Validator Mempool Fanout Diagnostic + +on: + pull_request: + paths: + - '.github/workflows/legacy-seven-validator-fanout.yml' + - 'internal/api/performance_lab_test.go' + - 'internal/api/peer_sync.go' + - 'internal/api/server.go' + - 'internal/api/peer_transport.go' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: legacy-fanout-${{ github.ref }} + cancel-in-progress: true + +jobs: + strict-fanout-stress: + name: Strict 3s mempool convergence (20 repeats, race) + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v7 + with: + go-version-file: go.mod + cache: false + - name: Record precise runner and commit + shell: bash + run: | + set -euo pipefail + mkdir -p evidence + { + echo "commit=$GITHUB_SHA" + echo "run_id=$GITHUB_RUN_ID" + echo "runner_os=$RUNNER_OS" + echo "runner_arch=$RUNNER_ARCH" + echo "cpu_count=$(nproc)" + echo "go_version=$(go version)" + echo "topology=seven-in-process-legacy-httptest-validators-one-GitHub-runner" + echo "acceptance=24-tx-on-all-seven-within-original-3s-no-timeout-change" + } > evidence/environment.txt + - name: Repeat strict mempool lab with race instrumentation + shell: bash + run: | + set -euo pipefail + go test -race ./internal/api \ + -run '^TestLabSevenValidatorsCertifiedFinality$' \ + -count=20 -timeout=14m -v 2>&1 | tee evidence/fanout-stress.log + - name: Upload strict diagnostics even on failure + if: always() + uses: actions/upload-artifact@v6 + with: + name: legacy-fanout-${{ github.sha }}-${{ github.run_attempt }} + path: evidence/ + if-no-files-found: warn + retention-days: 30 From a418ca71d5e97c1aa0c924d9d035c2838bf92007 Mon Sep 17 00:00:00 2001 From: The Code Learner <142033899+the-code-learner@users.noreply.github.com> Date: Fri, 13 Nov 2026 22:43:52 +0100 Subject: [PATCH 3/7] ci: repeat entire package suite to surface scheduler-related mempool fanout failures --- .../legacy-seven-validator-fanout.yml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/legacy-seven-validator-fanout.yml b/.github/workflows/legacy-seven-validator-fanout.yml index 4cee205e..d162cde7 100644 --- a/.github/workflows/legacy-seven-validator-fanout.yml +++ b/.github/workflows/legacy-seven-validator-fanout.yml @@ -58,3 +58,41 @@ jobs: path: evidence/ if-no-files-found: warn retention-days: 30 + + full-suite-contention: + name: Reproduce concurrent package test contention (5 complete passes) + runs-on: ubuntu-latest + timeout-minutes: 35 + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v7 + with: + go-version-file: go.mod + cache: false + - name: Record runner and unchanged original acceptance + shell: bash + run: | + set -euo pipefail + mkdir -p evidence + { + echo "commit=$GITHUB_SHA" + echo "runner_os=$RUNNER_OS" + echo "runner_arch=$RUNNER_ARCH" + echo "cpu_count=$(nproc)" + echo "go_version=$(go version)" + echo "test=go-test-all-packages-five-count" + echo "deadline=strict-original-3s-seven-validator-24tx" + } > evidence/environment.txt + - name: Repeat complete Go suite with native cross-package scheduling + shell: bash + run: | + set -euo pipefail + go test ./... -count=5 -timeout=15m 2>&1 | tee evidence/all-packages-repeat.log + - name: Preserve success and failure diagnostics + if: always() + uses: actions/upload-artifact@v6 + with: + name: all-packages-repeated-${{ github.sha }}-${{ github.run_attempt }} + path: evidence/ + if-no-files-found: warn + retention-days: 30 From dec74cdf136a3dcddad3cab1f0e9bff44e7c7e18 Mon Sep 17 00:00:00 2001 From: The Code Learner <142033899+the-code-learner@users.noreply.github.com> Date: Fri, 13 Nov 2026 23:49:38 +0100 Subject: [PATCH 4/7] test(legacy): drive independent validators concurrently without changing strict liveness limits --- internal/api/performance_lab_test.go | 29 ++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/internal/api/performance_lab_test.go b/internal/api/performance_lab_test.go index 58220d9a..f8505b22 100644 --- a/internal/api/performance_lab_test.go +++ b/internal/api/performance_lab_test.go @@ -296,14 +296,31 @@ func (c *labCluster) driveUntilHeight(indices []int, height uint64, timeout time ignoredCounts := make([]uint64, len(c.nodes)) lastIgnored := make([]string, len(c.nodes)) for time.Now().Before(deadline) { + // A production validator runs its own tick independently. Driving + // these seven HTTP servers serially artificially skews local clocks + // under CI scheduler contention. Start each tick concurrently but + // JOIN all results before inspecting finalized state; never relax + // the original wall-clock deadline or the certificate quorum. + type tickResult struct { + index int + err error + } + results := make(chan tickResult, len(c.nodes)) for index, node := range c.nodes { - if err := node.server.runConsensusAutomation(); err != nil { - if !ignoreConsensusAutomationError(err) { - c.tb.Fatalf("drive consensus on %s: %v", node.server.nodeID, err) - } - ignoredCounts[index]++ - lastIgnored[index] = err.Error() + go func(index int, node *labNode) { + results <- tickResult{index: index, err: node.server.runConsensusAutomation()} + }(index, node) + } + for range c.nodes { + result := <-results + if result.err == nil { + continue + } + if !ignoreConsensusAutomationError(result.err) { + c.tb.Fatalf("drive consensus on %s: %v", c.nodes[result.index].server.nodeID, result.err) } + ignoredCounts[result.index]++ + lastIgnored[result.index] = result.err.Error() } if c.indicesAtHeight(indices, height) { return time.Since(startedAt) From e065d37e78419f7f19734e61786b1fb08adf652c Mon Sep 17 00:00:00 2001 From: The Code Learner <142033899+the-code-learner@users.noreply.github.com> Date: Fri, 13 Nov 2026 23:52:11 +0100 Subject: [PATCH 5/7] test: retain strict serial finality gate and add separate concurrent scheduling diagnostic --- internal/api/performance_lab_test.go | 69 ++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/internal/api/performance_lab_test.go b/internal/api/performance_lab_test.go index f8505b22..0eff3888 100644 --- a/internal/api/performance_lab_test.go +++ b/internal/api/performance_lab_test.go @@ -287,6 +287,57 @@ func (c *labCluster) waitForMempools(size int, timeout time.Duration) { } func (c *labCluster) driveUntilHeight(indices []int, height uint64, timeout time.Duration) time.Duration { + c.tb.Helper() + startedAt := time.Now() + deadline := startedAt.Add(timeout) + // Fail-open errors are intentionally tolerated during normal lab + // progression. Preserve their LAST reason and count for diagnostics + // if finality does not arrive; do not change acceptance or deadlines. + ignoredCounts := make([]uint64, len(c.nodes)) + lastIgnored := make([]string, len(c.nodes)) + for time.Now().Before(deadline) { + for index, node := range c.nodes { + if err := node.server.runConsensusAutomation(); err != nil { + if !ignoreConsensusAutomationError(err) { + c.tb.Fatalf("drive consensus on %s: %v", node.server.nodeID, err) + } + ignoredCounts[index]++ + lastIgnored[index] = err.Error() + } + } + if c.indicesAtHeight(indices, height) { + return time.Since(startedAt) + } + time.Sleep(2 * time.Millisecond) + } + summaries := make([]string, 0, len(c.nodes)) + for index, node := range c.nodes { + status := node.server.ledger.Status() + view := node.server.ledger.Consensus() + round := node.server.ledger.RoundState() + proposals := node.server.ledger.ProposalsForHeight(view.NextHeight) + certificates := node.server.ledger.CertificatesForHeight(view.NextHeight) + tallies := node.server.ledger.VoteTalliesAt(view.NextHeight, view.CurrentRound) + lastLocalVote, hasLocalVote := node.server.ledger.LatestVoteByValidatorForHeight(view.NextHeight, node.signer.address) + var lastLocalVoteRound uint64 + if hasLocalVote { + lastLocalVoteRound = lastLocalVote.Round + } + // A proposer-only tally is ambiguous without each validator's + // local signed-vote history. Distinguish a missing local vote + // from an earlier-round vote or an accepted-but-undelivered vote. + votedActiveRound := node.server.ledger.HasVote(view.NextHeight, view.CurrentRound, node.signer.address) + roundAge := time.Duration(0) + if !round.StartedAt.IsZero() { + roundAge = time.Since(round.StartedAt) + } + summaries = append(summaries, fmt.Sprintf("node=%d height=%d mempool=%d next=%d round=%d roundHeight=%d roundAge=%s proposer=%s proposals=%d tallies=%+v certs=%d localVotedActive=%t localVotePresent=%t lastLocalVoteRound=%d ignoredAutomationErrors=%d lastIgnoredError=%q", index, status.Height, status.MempoolSize, view.NextHeight, view.CurrentRound, round.Height, roundAge.Round(time.Millisecond), view.NextProposer, len(proposals), tallies, len(certificates), votedActiveRound, hasLocalVote, lastLocalVoteRound, ignoredCounts[index], lastIgnored[index])) + } + c.tb.Fatalf("target height %d not reached before timeout; consensus=%v", height, summaries) + return 0 +} + +func (c *labCluster) driveUntilHeightConcurrent(indices []int, height uint64, timeout time.Duration) time.Duration { c.tb.Helper() startedAt := time.Now() deadline := startedAt.Add(timeout) @@ -802,6 +853,24 @@ func TestLabSevenValidatorsCertifiedFinality(t *testing.T) { t.Logf("7-validator certified finality: tx=%d finality=%s finalized_tps=%.2f", len(transactions), finality, float64(len(transactions))/finality.Seconds()) } +// The concurrent driver is a separate experimental model of independent +// process scheduling. Keep the original serial legacy conformance gate intact: +// its timing regression is an OPEN issue, not waived by this experiment. +func TestLabSevenValidatorsCertifiedFinalityConcurrentTickDiagnostic(t *testing.T) { + cluster := newLabCluster(t, 7) + defer cluster.Close() + + transactions := cluster.prepareTransactions(24) + cluster.fundTransactions(transactions) + cluster.submitTransactions(transactions, 12) + cluster.waitForMempools(len(transactions), 3*time.Second) + cluster.driveUntilHeightConcurrent(cluster.allIndices(), 1, 5*time.Second) + cluster.assertSameTip(cluster.allIndices(), 1) + if block := cluster.latestBlock(0); block.TransactionCount != len(transactions) { + t.Fatalf("expected %d finalized transactions, got %d", len(transactions), block.TransactionCount) + } +} + func TestLabSevenValidatorsStallWithoutQuorumThenRecoverWithPeerSync(t *testing.T) { cluster := newLabCluster(t, 7) defer cluster.Close() From 32b02af75eb14a42de365211475b019b3cbee408 Mon Sep 17 00:00:00 2001 From: The Code Learner <142033899+the-code-learner@users.noreply.github.com> Date: Fri, 13 Nov 2026 23:52:26 +0100 Subject: [PATCH 6/7] ci: compare original serial and independent concurrent ticks under same strict deadlines --- .../legacy-seven-validator-fanout.yml | 52 ++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/.github/workflows/legacy-seven-validator-fanout.yml b/.github/workflows/legacy-seven-validator-fanout.yml index d162cde7..eb20e989 100644 --- a/.github/workflows/legacy-seven-validator-fanout.yml +++ b/.github/workflows/legacy-seven-validator-fanout.yml @@ -19,7 +19,7 @@ concurrency: jobs: strict-fanout-stress: - name: Strict 3s mempool convergence (20 repeats, race) + name: Strict serial vs concurrent lab scheduling (20 repeats, race) runs-on: ubuntu-latest timeout-minutes: 30 steps: @@ -48,7 +48,55 @@ jobs: run: | set -euo pipefail go test -race ./internal/api \ - -run '^TestLabSevenValidatorsCertifiedFinality$' \ + -run '^TestLabSevenValidatorsCertifiedFinality(ConcurrentTickDiagnostic)? \ + -count=20 -timeout=14m -v 2>&1 | tee evidence/fanout-stress.log + - name: Upload strict diagnostics even on failure + if: always() + uses: actions/upload-artifact@v6 + with: + name: legacy-fanout-${{ github.sha }}-${{ github.run_attempt }} + path: evidence/ + if-no-files-found: warn + retention-days: 30 + + full-suite-contention: + name: Reproduce concurrent package test contention (5 complete passes) + runs-on: ubuntu-latest + timeout-minutes: 35 + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v7 + with: + go-version-file: go.mod + cache: false + - name: Record runner and unchanged original acceptance + shell: bash + run: | + set -euo pipefail + mkdir -p evidence + { + echo "commit=$GITHUB_SHA" + echo "runner_os=$RUNNER_OS" + echo "runner_arch=$RUNNER_ARCH" + echo "cpu_count=$(nproc)" + echo "go_version=$(go version)" + echo "test=go-test-all-packages-five-count" + echo "deadline=strict-original-3s-seven-validator-24tx" + } > evidence/environment.txt + - name: Repeat complete Go suite with native cross-package scheduling + shell: bash + run: | + set -euo pipefail + go test ./... -count=5 -timeout=15m 2>&1 | tee evidence/all-packages-repeat.log + - name: Preserve success and failure diagnostics + if: always() + uses: actions/upload-artifact@v6 + with: + name: all-packages-repeated-${{ github.sha }}-${{ github.run_attempt }} + path: evidence/ + if-no-files-found: warn + retention-days: 30 + \ -count=20 -timeout=14m -v 2>&1 | tee evidence/fanout-stress.log - name: Upload strict diagnostics even on failure if: always() From bd8b98c217089ab35aab9267ee17ebe9476fd8ac Mon Sep 17 00:00:00 2001 From: The Code Learner <142033899+the-code-learner@users.noreply.github.com> Date: Fri, 13 Nov 2026 23:53:03 +0100 Subject: [PATCH 7/7] ci: restore valid workflow and test both serial and concurrent strict labs --- .../legacy-seven-validator-fanout.yml | 50 +------------------ 1 file changed, 1 insertion(+), 49 deletions(-) diff --git a/.github/workflows/legacy-seven-validator-fanout.yml b/.github/workflows/legacy-seven-validator-fanout.yml index eb20e989..83913d24 100644 --- a/.github/workflows/legacy-seven-validator-fanout.yml +++ b/.github/workflows/legacy-seven-validator-fanout.yml @@ -48,55 +48,7 @@ jobs: run: | set -euo pipefail go test -race ./internal/api \ - -run '^TestLabSevenValidatorsCertifiedFinality(ConcurrentTickDiagnostic)? \ - -count=20 -timeout=14m -v 2>&1 | tee evidence/fanout-stress.log - - name: Upload strict diagnostics even on failure - if: always() - uses: actions/upload-artifact@v6 - with: - name: legacy-fanout-${{ github.sha }}-${{ github.run_attempt }} - path: evidence/ - if-no-files-found: warn - retention-days: 30 - - full-suite-contention: - name: Reproduce concurrent package test contention (5 complete passes) - runs-on: ubuntu-latest - timeout-minutes: 35 - steps: - - uses: actions/checkout@v6 - - uses: actions/setup-go@v7 - with: - go-version-file: go.mod - cache: false - - name: Record runner and unchanged original acceptance - shell: bash - run: | - set -euo pipefail - mkdir -p evidence - { - echo "commit=$GITHUB_SHA" - echo "runner_os=$RUNNER_OS" - echo "runner_arch=$RUNNER_ARCH" - echo "cpu_count=$(nproc)" - echo "go_version=$(go version)" - echo "test=go-test-all-packages-five-count" - echo "deadline=strict-original-3s-seven-validator-24tx" - } > evidence/environment.txt - - name: Repeat complete Go suite with native cross-package scheduling - shell: bash - run: | - set -euo pipefail - go test ./... -count=5 -timeout=15m 2>&1 | tee evidence/all-packages-repeat.log - - name: Preserve success and failure diagnostics - if: always() - uses: actions/upload-artifact@v6 - with: - name: all-packages-repeated-${{ github.sha }}-${{ github.run_attempt }} - path: evidence/ - if-no-files-found: warn - retention-days: 30 - \ + -run '^TestLabSevenValidatorsCertifiedFinality(ConcurrentTickDiagnostic)?$' \ -count=20 -timeout=14m -v 2>&1 | tee evidence/fanout-stress.log - name: Upload strict diagnostics even on failure if: always()