Skip to content

[Bug]: Sirius parity harness validates only after all runs and loses failure artifacts #29244

Closed

Description

@XuPeng-SH

Summary

At current main 66da3877e9e77f01083c4aac0cb9f94ab6e11fe6, the Sirius parity harness executes the complete 1,860-run campaign before validating per-run evidence. An invalid first result is rejected only after all executions finish. That validation error also prevents this invocation from writing any campaign artifacts.

This is a harness efficiency/diagnostics issue, not a claim that Sirius produces incorrect SQL results. Related: #29211 and #28966. The approved performance matrix itself does not need to be reduced.

Reproduction (CPU-only, no database/GPU)

From a checkout of the revision above:

import sys
from pathlib import Path
from unittest import mock

sys.path.insert(0, "optools")
import sirius_parity as p
from sirius_parity_test import SiriusParityTest

fixture = SiriusParityTest()
campaign = p.build_campaign(fixture.provenance())
calls = 0

def runner(spec):
    global calls
    calls += 1
    output = fixture.output(spec)
    if calls == 1:
        output["fallback"] = True
    return output

runs = p.execute_campaign(campaign, runner)
with mock.patch.object(Path, "mkdir") as mkdir, \
     mock.patch.object(Path, "write_text") as write:
    try:
        p.write_artifacts(campaign, runs, Path("/unused-mocked-output"))
    except p.CampaignError as error:
        print(error)
    print(calls, mkdir.call_count, write.call_count)

Observed in a fresh in-memory load of the exact revision's harness and fixture:

fallback observed at sequence 1
1860 0 0

The output path is mocked; this reproduction does not write artifacts or invoke a real runner. No GPU runtime or elapsed-time saving is claimed.

Root cause

  • execute_campaign, lines 351–358 collects all outputs without checking per-run constraints.
  • _validate_output can detect forbidden fallback and invalid route/identity evidence immediately, but is called later through validate_runs.
  • write_artifacts calls summarize/validate_runs before creating or writing output files.
  • main catches the error and prints a message; the new invocation's accumulated evidence is not persisted by the harness.

Expected behavior / acceptance

  • Validate per-run hard constraints as results arrive; stop an invalid campaign before scheduling unrelated remaining work.
  • Compare cross-route results once the corresponding native oracle is available; do not require full performance statistics prematurely.
  • Preserve bounded, strictly sanitized failure diagnostics (sequence, route, validation category, completed-run count). Do not persist arbitrary runner fields, raw result rows, credentials, paths, or deployment-local data.
  • Keep the full valid-campaign schedule and existing correctness/performance gates unchanged.
  • Add deterministic fake-runner tests proving an early violation prevents later execution and yields useful sanitized diagnostics; include a valid-campaign control.
  • Keep diagnostic/continue-on-error behavior explicit if desired, rather than implicitly spending the entire campaign budget before rejecting invalid evidence.

Verification scope

Source inspection plus the deterministic fake-runner reproduction above. No live GPU, database, full BVT, or production performance measurements were run for this report.

Activity

  1. XuPeng-SH commented on Sep 22, 2026

    @XuPeng-SH
    ContributorAuthor

    修复、优化及下一步建议

    以下是实施建议,不代表已经完成修复或验证。优先用现有 harness 的小范围改动解决,不引入新的调度框架。

    1. 在正确的边界修复根因

    • 单条校验前移:runner 返回后,复用现有 _validate_output 检查 identity、route、fallback、execution stats 等硬约束;失败后不再调用后续 runner。
    • 保留统一校验逻辑:增量校验与最终 validate_runs 应共享检查函数,不能维护两套略有差异的规则。最终仍检查 schedule 完整性、顺序及最终统计条件。
    • 跨路线比较按就绪触发:复用现有 cell key 和结果比较函数;native oracle 与对应结果都到齐后立即比较。必须支持轮转顺序下 non-native 先返回的情况,不能将“oracle 尚未到达”误判为失败。
    • 失败诊断与成功汇总分离:失败产物不能依赖成功的 summarize。顶层失败出口负责保存最小、结构化、严格脱敏的诊断,再返回原来的失败语义;不得为输出报告而继续执行无效 campaign。

    2. 失败产物的最小契约

    建议记录:失败 sequence、预期 route、固定错误类别、attempted/validated 数量、campaign 状态(incomplete/invalid),以及可安全复用的 campaign 身份信息。

    • route 等标识优先来自可信 schedule,不直接复制未校验 runner 内容。
    • 不落盘原始 stdout/stderr、任意异常字符串、原始结果行、未知 runner 字段或部署私有信息;错误详情也需要脱敏,不能只脱敏正常结果。
    • 无效输出不应强行交给只接受完整合法结果的 serializer。初版只需最小失败记录;若保留已验证结果,必须复用现有白名单脱敏逻辑。
    • 诊断写入失败时,保留原始失败类别,并单独报告安全的写入失败状态,不能用次生异常覆盖根因。
    • 明确处理复用输出目录的情况,避免将上一次 PASS summary 误认成本次结果。可拒绝非空目标目录或采用独立运行目录;不自动递归删除用户目录。
    • 不生成看似完整、可用于验收的部分性能汇总。

    3. 正交的验收测试

    使用确定性的 fake runner 和临时目录,不需要 GPU/数据库,也不依赖耗时阈值:

    场景 必须证明
    首条硬约束违规 runner 仅调用 1 次,诊断落盘且字段正确
    第 k 条违规 调用恰好停在 k;attempted 与 validated 计数定义明确
    runner 异常/无效输出 停止后续调度,有安全诊断,原失败不被覆盖
    跨路线结果不一致 在 oracle 和目标结果都到齐时失败,覆盖两种到达顺序
    恶意/敏感 runner 字段 失败文件和错误输出不泄漏注入的测试秘密
    输出目录或写入失败 不混淆旧 PASS 产物,不丢失原失败类别
    全部合法 原 1,860 条 schedule、顺序、成功产物和判定保持兼容
    性能 gate 未通过 与证据无效区分;保留完整性能报告及原有退出码语义

    少量表驱动用例覆盖各硬约束即可,不需要每个非法字段都重新跑完整 campaign。

    4. 范围与实施顺序

    1. 补能暴露当前行为的回归测试,落实单条 fail-fast 与失败诊断。
    2. 在同一校验逻辑上实现 oracle 就绪时的结果比较。
    3. 跑现有 Python harness 测试及上述新增用例,检查成功路径、脱敏和 runner 清理行为未退化。
    4. PR 提供修改前/后调用次数及实际生成的脱敏诊断样例;不要把 fake runner 结果描述为 GPU parity 或性能验收。

    本次不缩减批准的性能矩阵,不改变 fallback 禁止策略,不放宽 provenance/capacity 检查,不增加自动重试、恢复执行、并行调度或默认 continue-on-error。原始结果内存占用优化可后续单独评估,不能在没有独立证据时与本问题捆绑扩大改造。

  2. added
    kind/bug
    on Sep 22, 2026
  3. added a commit that references this issue on Sep 23, 2026
    16d8e51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions