diff --git a/.dockerignore b/.dockerignore index cc28ea4..69f2c89 100644 --- a/.dockerignore +++ b/.dockerignore @@ -13,5 +13,12 @@ forge_audit.db .forge web/static/charts/*.html tests/accuracy/results +tools/benchmarks/accuracy/results +tools/benchmarks/spider2/data +tools/benchmarks/spider2/results +tools/benchmarks/synthetic/benchmark.db +tools/benchmarks/synthetic/benchmark.registry.json +tools/benchmarks/synthetic/results +tools/benchmarks/text_to_sql_failures/*.db website/node_modules website/dist diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 283bf8a..8da7bfa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,11 +17,38 @@ jobs: python-version: "3.11" - name: Install dependencies - run: pip install -e ".[dev]" + run: pip install -c constraints/ci-python311.txt -e ".[dev]" - name: Run tests run: pytest -q + distribution: + runs-on: ubuntu-latest + strategy: + matrix: + artifact: [wheel, sdist] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Build wheel from sdist with verified build dependencies + env: + PIP_CONSTRAINT: ${{ github.workspace }}/constraints/ci-python311.txt + run: | + pip install -c constraints/ci-python311.txt build + python -m build + - name: Install a non-editable distribution + env: + ARTIFACT: ${{ matrix.artifact }} + PIP_CONSTRAINT: ${{ github.workspace }}/constraints/ci-python311.txt + run: | + if [ "$ARTIFACT" = wheel ]; then pip install dist/*.whl; else pip install dist/*.tar.gz; fi + - name: Exercise installed import, resources, CLI and synthetic Quickstart + run: | + cd "$(mktemp -d)" + python "$GITHUB_WORKSPACE/scripts/package_smoke.py" "$GITHUB_WORKSPACE"/dist/* + pi-contracts: runs-on: ubuntu-latest steps: @@ -76,7 +103,7 @@ jobs: python-version: "3.11" - name: Install dependencies - run: pip install -e ".[dev]" + run: pip install -c constraints/ci-python311.txt -e ".[dev]" - name: SQLite compatibility smoke run: pytest tests/test_database_compatibility.py -v --tb=short diff --git a/.gitignore b/.gitignore index bf9a7f9..297b7c2 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,17 @@ local_sqlite.zip tests/benchmark/benchmark.db tests/benchmark/results/ +# Benchmark source moved to tools; existing local data stays at old paths. +# No database, private result, or downloaded dataset migration is performed. +tests/text-to-sql-failures/*.db +tests/benchmark/benchmark.registry.json +tools/benchmarks/accuracy/results/ +tools/benchmarks/spider2/data/ +tools/benchmarks/spider2/results/ +tools/benchmarks/synthetic/benchmark.db +tools/benchmarks/synthetic/benchmark.registry.json +tools/benchmarks/synthetic/results/ +tools/benchmarks/text_to_sql_failures/*.db *.pkl .mcp.json web/static/charts/*.html diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ea5cb7a..1633ff8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -63,6 +63,31 @@ Use the [Quickstart adoption report](https://github.com/shisuidata/Forge/issues/ Forge sends no telemetry. The receipt excludes hostnames, usernames, paths, SQL rows, credentials, and private schemas. Its checksum detects drift and supports deduplication; it does not attest identity. The GitHub-authored report supplies public provenance. Maintainer-authored runs, stars, and forks do not satisfy the external-adoption gate. +## Repository layout + +| Location | Ownership and placement rule | +|---|---| +| `forge/` | Trusted data runtime; runtime resources live with their owning package, including `forge/templates/poc/`. | +| `agent/`, `registry/`, `web/` | Existing Agent adapters, Registry capabilities and Web/channel adapters; do not add a second orchestrator. | +| `services/pi-orchestrator/` | Pi Task authority and its TypeScript tests; generated cross-language schemas remain in `agent/contracts/`. | +| `tests/` | Automated regressions and shared versioned fixtures in `tests/datasets/`; not standalone model experiments. | +| `tools/benchmarks/` | Manual accuracy, synthetic, Spider2 and failure-case research tools. Running these can call models; they are not part of ordinary pytest or the Forge package. | +| Other `tools/` projects | Isolated, reproducible UI/chart experiments with their own dependencies. | +| `scripts/`, `demo/` | Development/operations/verification entry points versus synthetic data generators. Run generators only against explicitly isolated stores. | +| `docs/`, `docs/archive/` | Current state, stable guides and the active plan versus completed evidence and superseded plans. Existing course, diagrams and devlog keep their own directories. | +| `website/`, `examples/`, `constraints/`, `.github/` | Documentation site, public API examples, verified dependency constraints and repository automation. | + +Keep public startup/configuration entry points at the repository root. Do not add nesting solely to reduce a file count. Runtime code must not depend on benchmark tooling or pytest fixtures for general execution. Update imports, resource declarations, command examples and local links together when relocating a file. + +The [file-governance manifest](docs/file-structure-governance-2026-09-07.json) records old/new paths and content hashes. Historical JSON paths describe the original run and are not rewritten; use the manifest to locate relocated evidence. Ignored local databases, credentials, caches and previous run outputs were deliberately not migrated. Inspect and authorize any private-data migration separately; never replay model runs to recreate history. + +## Evidence and decision records + +Treat test reports, negative results, rejected approaches and recorded design decisions as durable project assets. Refactoring, superseded plans and a passing current suite do not make historical evidence disposable. Preserve the original context, limits and decision rationale; append dated corrections or new evidence instead of rewriting historical results. + +Use the [knowledge-asset index and maintenance rules](docs/README.md#长期知识资产) and append user decisions to [requirements history](docs/requirements-pool.md). Keep sanitized public records separate from private originals. Local files are not proof of a Git checkpoint or off-machine backup; obtain explicit authorization before committing, publishing or copying private evidence. + + ## Tests Run the Python suite before opening a pull request: diff --git a/README.md b/README.md index add7937..7452606 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Forge sits between an upstream agent and a database. It accepts Direct SQL or co > **Project status: early-stage and actively maintained.** Suitable for evaluation and controlled deployments with human review and read-only credentials; not feature-complete or HA-ready. The latest complete structured GPT-5.6 BIRD run was sealed at **57.4% EA vs 62.8% Direct SQL**. A later compiler replay of the **same candidates** reached **62.6% vs 62.8%**, not a new generation result or demonstrated accuracy advantage. Results are version- and dataset-specific. See [current state](docs/current-project-state.md), [benchmark results](#benchmark-results), and the [report index](docs/README.md). -**Upgrade note (2026-09-07):** shared Assurance is now `query-assurance-v10`. Physical-table authorization follows each SQL scope; a nested same-name CTE cannot hide an unauthorized table. The current flat Registry does not authorize schema/catalog-qualified sources. Old v9 QueryRuns fail approval with `assurance_revision_drift`: prepare and review a new QueryRun rather than upgrading old evidence in place. See the [release verification](docs/release-verification-2026-09-07.json). +**Upgrade note (2026-09-07):** shared Assurance is now `query-assurance-v11` with `scoped-policy-v1`. Physical-table/CTE authorization remains fail-closed; benchmark-specific conventions require an explicit, revision-bound Registry `assurance_profile` instead of rejecting unrelated schemas. Existing QueryRuns from earlier revisions must be prepared and reviewed again; do not rewrite historical evidence. Execution outcomes use explicit success/error codes, not rendered text. Evaluate never reads a production URL: use an explicit supported dialect for Forge JSON; unbound `auto` returns `dialect_required`. See [architecture](docs/architecture.md) and [benchmark policy/version guidance](docs/benchmarks.md). --- @@ -347,7 +347,7 @@ The BIRD snapshot has been exposed during development and is now **R**, a regres REQ-058 also had Direct 3/4 → 2/4 with identical Direct inputs. Its 67,367 total tokens were fully observed; treatment total tokens rose 8.57%, Forge tokens per correct answer rose 13.11%, and four-observation generation P95 rose 41.53%. The latter two cost/latency gates failed. Neither prompt example is enabled by default; date, grain, and value context options remain off. No replacement calls or automatic repair are implied. -**Every published report—including preparation, offline replay, negative results, and incomplete runs—is indexed in the [documentation index](docs/README.md).** Start with the [historical run ledger](docs/benchmark-historical-runs-2026-09-07.json), [CTE experiment](docs/benchmark-luna-cte-interface-2026-09-07.json), and [benchmark protocol](docs/benchmarks.md). The [publication manifest](docs/report-publication-2026-09-07.json) distinguishes public redacted copies from preserved originals. Private runtime databases, provider sessions, and third-party dataset files are not included in a clone; local artifact paths are not public download links. +**Every published report—including preparation, offline replay, negative results, and incomplete runs—is indexed in the [documentation index](docs/README.md).** Start with the [historical run ledger](docs/archive/benchmarks/benchmark-historical-runs-2026-09-07.json), [CTE experiment](docs/archive/benchmarks/benchmark-luna-cte-interface-2026-09-07.json), and [benchmark protocol](docs/benchmarks.md). The [publication manifest](docs/archive/engineering/report-publication-2026-09-07.json) distinguishes public redacted copies from preserved originals. Private runtime databases, provider sessions, and third-party dataset files are not included in a clone; local artifact paths are not public download links. ### Historical suites are not a leaderboard diff --git a/README.zh-CN.md b/README.zh-CN.md index 2d4cd24..dc83293 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -32,7 +32,7 @@ Forge 位于上游 Agent 与数据库之间。它接收 Direct SQL 或受约束 > **项目状态:early-stage,持续维护。** 当前适合评估、贡献和带人工审核/只读账号的受控部署,不代表功能完备或高可用。最新完整 Structured GPT-5.6 BIRD 运行封存成绩为 **Forge EA 57.4% / Direct SQL 62.8%**;随后对**同一批候选**修复编译器并离线重评为 **62.6% / 62.8%**,不是新生成成绩,也不证明 Forge JSON 的准确率优势。详见 [当前状态](docs/current-project-state.md)、[基准规范](docs/benchmarks.md) 与 [每轮报告索引](docs/README.md)。 -**升级注意(2026-09-07):** 共享Assurance已升为`query-assurance-v10`,按SQL作用域校验真实物理来源,不能借嵌套同名CTE绕过表权限。当前扁平Registry未建模的schema/catalog限定来源失败关闭。旧v9 QueryRun审批返回`assurance_revision_drift`,需重新prepare和人工审核,不原地升级旧证据。见[版本验证报告](docs/release-verification-2026-09-07.json)。 +**升级注意(2026-09-07):** 共享Assurance已升为`query-assurance-v10`,按SQL作用域校验真实物理来源,不能借嵌套同名CTE绕过表权限。当前扁平Registry未建模的schema/catalog限定来源失败关闭。旧v9 QueryRun审批返回`assurance_revision_drift`,需重新prepare和人工审核,不原地升级旧证据。见[版本验证报告](docs/archive/engineering/release-verification-2026-09-07.json)。 --- @@ -288,7 +288,7 @@ flowchart LR - CTE接口范例16次对照:Forge两指标3/4→3/4,md-199新增正确、md-079回退;Direct两指标3/4→2/4,其输入未变,波动不能归因于Forge范例。总67367 tokens;Forge每正确答案成本+13.11%、四次采样生成P95+41.53%,门槛失败,不启用。 - 日期、粒度、取值上下文仍默认off。已曝光BIRD为R回归集,小样本D与隔离S不代表独立H;外部采用门禁仍未通过。 -[逐轮报告索引](docs/README.md)保留准备、生成、离线修复、负结果和未完成实验;[早期运行汇总](docs/benchmark-historical-runs-2026-09-07.json)与[最新CTE报告](docs/benchmark-luna-cte-interface-2026-09-07.json)分别标明来源和限制。[公开处理清单](docs/report-publication-2026-09-07.json)记录原件/公开副本hash;本机路径和个人联系样本脱敏,分数、成本与失败状态不改。原始运行数据库、Provider会话与第三方数据集不随仓库分发,本地工件路径不等于公开下载地址。 +[逐轮报告索引](docs/README.md)保留准备、生成、离线修复、负结果和未完成实验;[早期运行汇总](docs/archive/benchmarks/benchmark-historical-runs-2026-09-07.json)与[最新CTE报告](docs/archive/benchmarks/benchmark-luna-cte-interface-2026-09-07.json)分别标明来源和限制。[公开处理清单](docs/archive/engineering/report-publication-2026-09-07.json)记录原件/公开副本hash;本机路径和个人联系样本脱敏,分数、成本与失败状态不改。原始运行数据库、Provider会话与第三方数据集不随仓库分发,本地工件路径不等于公开下载地址。 ### 已落地功能 @@ -372,15 +372,15 @@ tests/ | [架构设计](docs/architecture.md) | 系统整体架构与模块职责的精简入口 | | [产品北极星](docs/product-north-star.md) | Forge 为什么存在、服务谁,以及正确性、共识、数据事实与产品边界的长期指导 | | [产品设计与阶段路线重建提案](docs/product-design-roadmap-2026-08-25.md) | Human Control Plane、Agent Data Runtime、产品对象、信息架构与长期阶段方向 | -| [短期 Product Spine 历史计划](docs/short-term-product-spine-plan-2026-08-25.md) | SP0–SP5 已完成实施与验证记录;仅作历史溯源,不是当前待办 | -| [Product Spine SP5 集成门禁证据](docs/product-spine-sp5-evidence-2026-08-25.md) | 真实 Pi/Forge/Report 三连 Golden Journey、restart/idempotency/offline、Atlas candidate 与失败关闭反证 | +| [短期 Product Spine 历史计划](docs/archive/plans/short-term-product-spine-plan-2026-08-25.md) | SP0–SP5 已完成实施与验证记录;仅作历史溯源,不是当前待办 | +| [Product Spine SP5 集成门禁证据](docs/archive/engineering/product-spine-sp5-evidence-2026-08-25.md) | 真实 Pi/Forge/Report 三连 Golden Journey、restart/idempotency/offline、Atlas candidate 与失败关闭反证 | | [Product Projection v1 Contract](docs/product-projection-contracts.md) | Conversation、Task、Action、Workspace、Report 的版本化只读边界、状态、bounds、redaction 与 SP1 入口 | | [产品公理](docs/product-axioms.md) | 以第一性原理约束身份、证据、协同、记忆、成本与可信行动 | | [AI Native 企业长期论证](docs/ai-native-enterprise-thesis.md) | Data Agent、组织协同、统一记忆、企业 AI Infra 的论证、反证与待验证假设 | -| [产品方向与架构复审](docs/product-direction-architecture-review-2026-08-24.md) | 按产品公理审核当前实现、四平面缺口、目标架构与分阶段建议 | +| [产品方向与架构复审](docs/archive/engineering/product-direction-architecture-review-2026-08-24.md) | 按产品公理审核当前实现、四平面缺口、目标架构与分阶段建议 | | [企业演进主动计划](docs/forge-enterprise-evolution-plan.md) | 唯一主动计划;当前阶段为 S0 Design Partner / Problem Baseline | | [需求池](docs/requirements-pool.md) | 新需求的澄清、评估、接受、延期、拒绝、计划与验证记录 | -| [M0 Governance Contract 评审](docs/governance-contract-review-2026-08-24.md) | 跨 Contract 语义、Threat Model、迁移/回滚与 M1A 前置结论 | +| [M0 Governance Contract 评审](docs/archive/engineering/governance-contract-review-2026-08-24.md) | 跨 Contract 语义、Threat Model、迁移/回滚与 M1A 前置结论 | | [工作原理与 DSL 能力](docs/how-it-works.md) | 执行流程详解、DSL 特性表、Schema RAG | | [基准测试详情](docs/benchmarks.md) | 版本演化、跨模型 EA 对比、Spider2 结果 | | [设计哲学与工程洞察](docs/philosophy.md) | 核心哲学、工程经验、开放问题 | @@ -389,7 +389,7 @@ tests/ | [兼容性矩阵](docs/compatibility-matrix.md) | 数据库、数据仓库、Agent 入口、LLM 服务的支持边界 | | [客户 PoC 执行手册](docs/poc-playbook.md) | 客户域 golden questions、failure triage 和交付物 | | [外部 Agent 集成边界](docs/agent-integration.md) | MCP / OpenAI Agents / Claude Desktop 等外部入口的 prepare-query 只读边界 | -| [交付前综合评估](docs/delivery-assessment-2026-05-07.md) | 业务板块、文档、目录、工作流、三轮测试和交付优化方案 | +| [交付前综合评估](docs/archive/engineering/delivery-assessment-2026-05-07.md) | 业务板块、文档、目录、工作流、三轮测试和交付优化方案 | | [生产交付部署说明](docs/production-deployment.md) | 生产 compose、env、只读数据库账号、readiness、运维建议 | | [DSL 形式化语义](docs/dsl-semantics.md) | DSL 的形式化定义 | | [构建你的语义库](docs/registry.md) | Registry 结构层 + 语义层三文件详解,从零构建指南 | diff --git a/agent/agent.py b/agent/agent.py index e9a0c8e..b0d3df9 100644 --- a/agent/agent.py +++ b/agent/agent.py @@ -45,7 +45,6 @@ from config import cfg from forge.assurance import QueryAssuranceError, assure_query -from forge.cache import cache from forge.normalization import ( bind_unambiguous_single_cte_scan, complete_unambiguous_ratio_alias, @@ -53,6 +52,7 @@ from registry.validator import validate_metric from registry.staging_sync import write_staging_record from agent.memory import memory +from forge.dialects import resolve_dialect from agent.model_config import LLMConfigurationError, LLMNotConfiguredError from agent import llm @@ -61,7 +61,6 @@ # 编译失败后最多重试次数(不含首次尝试) # 设为 3:首次失败后最多再做 3 次有界修复尝试。 MAX_RETRIES = 3 -_ALLOWED_DIALECTS = {"auto", "sqlite", "postgresql", "mysql", "bigquery", "snowflake"} _PREPARE_TIMEOUT_MESSAGE = "查询准备超时,请稍后重试或缩小问题范围。" _MODEL_QUOTA_MESSAGE = "模型服务额度已用完,请在额度恢复后重新发起。" _MODEL_RATE_LIMIT_MESSAGE = "模型服务当前请求繁忙,请稍后重新发起。" @@ -80,27 +79,6 @@ def _remaining_call_budget(deadline: float) -> float: return remaining -def resolve_dialect(dialect_override: str | None = None) -> str: - """Resolve cfg.SQL_DIALECT, including auto-detection from DATABASE_URL.""" - dialect = (dialect_override or getattr(cfg, "SQL_DIALECT", "sqlite") or "sqlite").lower() - if dialect not in _ALLOWED_DIALECTS: - raise ValueError( - "dialect must be one of: auto, sqlite, postgresql, mysql, bigquery, snowflake" - ) - if dialect != "auto": - return dialect - - db_url = (getattr(cfg, "DATABASE_URL", "") or "").lower() - if db_url.startswith("postgresql") or db_url.startswith("postgres"): - return "postgresql" - if db_url.startswith("mysql"): - return "mysql" - if db_url.startswith("bigquery"): - return "bigquery" - if db_url.startswith("snowflake"): - return "snowflake" - return "sqlite" - def prepare_query(user_id: str, question: str, dialect: str | None = None) -> dict: """Public prepare-only surface; model selection always comes from ActiveBinding.""" @@ -137,8 +115,10 @@ def _prepare_query( "retrieval_trace": None, } try: - resolved_dialect = resolve_dialect(dialect) + resolution = resolve_dialect(dialect, configured_dialect=cfg.SQL_DIALECT, database_url=cfg.DATABASE_URL) + resolved_dialect = resolution.resolved payload["dialect"] = resolved_dialect + payload["dialect_resolution"] = resolution.to_dict() except Exception as exc: payload["error"] = str(exc) return payload @@ -442,7 +422,7 @@ def process(user_id: str, user_text: str) -> AgentResponse: assurance = assure_query( forge_json, effective_text, - dialect=resolve_dialect(), + dialect=resolve_dialect(configured_dialect=cfg.SQL_DIALECT, database_url=cfg.DATABASE_URL).resolved, allowed_tables=_allowed_tables, model_revision=result.get("model_revision", model_snapshot.revision), ) @@ -533,6 +513,7 @@ def approve(user_id: str) -> AgentResponse: Returns: action=approved 并携带 sql;若无 pending SQL 则返回 action=error。 """ + from forge.cache import cache sql = memory.get_state(user_id, "pending_sql") forge_json = memory.get_state(user_id, "pending_forge") if not sql: @@ -589,6 +570,7 @@ def cache_verify(user_id: str) -> AgentResponse: verified 条目可在后续问题中通过 embedding 相似度命中,直接复用 SQL。 高频 verified 条目还可作为语义层指标的候选定义(suggest_metrics)。 """ + from forge.cache import cache cache_id = memory.get_state(user_id, "pending_cache_id") if not cache_id: return AgentResponse(text="没有待反馈的查询缓存。", action="error") @@ -604,6 +586,7 @@ def cache_verify(user_id: str) -> AgentResponse: def cache_reject(user_id: str) -> AgentResponse: """Stage 2 👎:用户标记查询结果不准确。""" + from forge.cache import cache cache_id = memory.get_state(user_id, "pending_cache_id") if not cache_id: return AgentResponse(text="没有待反馈的查询缓存。", action="error") diff --git a/agent/audit.py b/agent/audit.py index 94bed1d..26a1028 100644 --- a/agent/audit.py +++ b/agent/audit.py @@ -281,3 +281,64 @@ async def update_latest_pending( execution_ms=execution_ms, ) return record_id + + +async def projection(*, scopes: list[tuple[str, str]], status: str = "", keyword: str = "", limit: int = 50, offset: int = 0) -> dict[str, Any]: + """Read-only union of existing sources; never materialize a second audit truth. + + Missing/unreadable stores remain unavailable, not an empty successful result. + SQL text, result rows, model input, and raw exception text are not selected. + """ + limit = min(max(limit, 1), 100) + offset = max(offset, 0) + rows: list[dict[str, Any]] = [] + sources: dict[str, dict[str, Any]] = {} + today = datetime.now(timezone.utc).date().isoformat() + for source, path in (("query_run", cfg.QUERY_RUN_DB_PATH), ("legacy", getattr(cfg, "AUDIT_DB_PATH", DB_PATH))): + params: list[Any] = [] + conditions: list[str] = [] + if source == "query_run": + table = "query_runs" + fields = "query_run_id AS id, task_run_id, user_id, created_at AS timestamp, status, model_revision, row_count, execution_ms" + if not scopes: + conditions.append("0") + else: + conditions.append("(" + " OR ".join("(org_id = ? AND team_id = ?)" for _ in scopes) + ")") + params.extend(value for scope in scopes for value in scope) + search_fields = ("query_run_id", "task_run_id") + timestamp = "created_at" + else: + table = "audit_log" + fields = "id, NULL AS task_run_id, user_id, timestamp, status, NULL AS model_revision, row_count, execution_ms" + search_fields = ("CAST(id AS TEXT)", "user_id") + timestamp = "timestamp" + base = " WHERE " + " AND ".join(conditions) if conditions else "" + try: + uri = Path(str(path)).expanduser().resolve().as_uri() + "?mode=ro" + async with aiosqlite.connect(uri, uri=True) as db: + db.row_factory = aiosqlite.Row + counts_cursor = await db.execute(f"SELECT status, COUNT(*) AS count FROM {table}{base} GROUP BY status", params) + counts = {row["status"]: row["count"] for row in await counts_cursor.fetchall()} + today_cursor = await db.execute(f"SELECT COUNT(*) FROM {table}{base}{' AND ' if base else ' WHERE '}{timestamp} >= ?", params + [today]) + today_count = (await today_cursor.fetchone())[0] + if status: + conditions.append("status = ?") + params.append(status) + if keyword: + conditions.append("(" + " OR ".join(f"{field} LIKE ?" for field in search_fields) + ")") + params.extend([f"%{keyword}%"] * len(search_fields)) + where = " WHERE " + " AND ".join(conditions) if conditions else "" + total_cursor = await db.execute(f"SELECT COUNT(*) FROM {table}{where}", params) + total = (await total_cursor.fetchone())[0] + cursor = await db.execute(f"SELECT {fields} FROM {table}{where} ORDER BY {timestamp} DESC, id DESC LIMIT ?", params + [offset + limit]) + for row in await cursor.fetchall(): + rows.append({**dict(row), "id": str(row["id"]), "source": source, "usage_status": "unknown"}) + sources[source] = {"availability": "ready", "total": total, "today": today_count, "counts": counts} + except (OSError, aiosqlite.Error): + sources[source] = {"availability": "unavailable", "total": None, "today": None, "counts": None} + rows.sort(key=lambda row: (row["timestamp"], row["source"], row["id"]), reverse=True) + complete = all(item["availability"] == "ready" for item in sources.values()) + available_total = sum(item["total"] or 0 for item in sources.values()) + return {"records": rows[offset:offset + limit], "sources": sources, "availability": "ready" if complete else "partial", + "total": available_total if complete else None, "available_total": available_total, + "today": sum(item["today"] for item in sources.values()) if complete else None} diff --git a/agent/contracts/__init__.py b/agent/contracts/__init__.py index aa37c62..5f2b8ca 100644 --- a/agent/contracts/__init__.py +++ b/agent/contracts/__init__.py @@ -13,6 +13,9 @@ from jsonschema import FormatChecker from jsonschema.validators import validator_for +from .artifact_semantics import ( + STRUCTURED_ARTIFACT_CONTRACTS, structured_artifact_format_checker, validate_artifact_semantics, +) _CONTRACT_FILES = { "task_run": "task-run.schema.json", @@ -74,7 +77,8 @@ def _compiled_validator(name: str) -> Any: schema = load_contract(name) validator_class = validator_for(schema) validator_class.check_schema(schema) - return validator_class(schema, format_checker=FormatChecker()) + checker = structured_artifact_format_checker if name in STRUCTURED_ARTIFACT_CONTRACTS else FormatChecker() + return validator_class(schema, format_checker=checker) def validate_contract(name: str, instance: Any) -> None: @@ -84,3 +88,5 @@ def validate_contract(name: str, instance: Any) -> None: and orchestration layers can translate it into their own bounded error type. """ _compiled_validator(name).validate(instance) + if name in STRUCTURED_ARTIFACT_CONTRACTS: + validate_artifact_semantics(name, instance) diff --git a/agent/contracts/advisory-artifact.schema.json b/agent/contracts/advisory-artifact.schema.json index df06f43..d775b52 100644 --- a/agent/contracts/advisory-artifact.schema.json +++ b/agent/contracts/advisory-artifact.schema.json @@ -1,10 +1,5 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://forge.local/contracts/advisory-artifact.schema.json", - "title": "AdvisoryArtifact", - "description": "Bounded output of an explicitly authorized professional Skill.", "type": "object", - "additionalProperties": false, "required": [ "artifact_id", "artifact_type", @@ -20,9 +15,11 @@ "pattern": "^ar_[A-Za-z0-9_-]+$" }, "artifact_type": { + "type": "string", "const": "advisory" }, "schema_version": { + "type": "number", "const": 1 }, "task_run_id": { @@ -39,7 +36,6 @@ }, "payload": { "type": "object", - "additionalProperties": false, "required": [ "status", "skill_name", @@ -54,9 +50,15 @@ ], "properties": { "status": { - "enum": [ - "complete", - "incomplete" + "anyOf": [ + { + "type": "string", + "const": "complete" + }, + { + "type": "string", + "const": "incomplete" + } ] }, "skill_name": { @@ -75,7 +77,6 @@ "type": "array", "items": { "type": "object", - "additionalProperties": false, "required": [ "statement", "evidence_refs", @@ -88,27 +89,36 @@ }, "evidence_refs": { "type": "array", - "uniqueItems": true, "items": { "type": "string", "pattern": "^(?:qr_[A-Za-z0-9_-]+#.+|ctx_[a-f0-9]{24})$" - } + }, + "uniqueItems": true }, "confidence": { - "enum": [ - "high", - "medium", - "low" + "anyOf": [ + { + "type": "string", + "const": "high" + }, + { + "type": "string", + "const": "medium" + }, + { + "type": "string", + "const": "low" + } ] } - } + }, + "additionalProperties": false } }, "recommendations": { "type": "array", "items": { "type": "object", - "additionalProperties": false, "required": [ "action", "rationale", @@ -124,45 +134,57 @@ "minLength": 1 }, "priority": { - "enum": [ - "immediate", - "high", - "medium", - "low" + "anyOf": [ + { + "type": "string", + "const": "immediate" + }, + { + "type": "string", + "const": "high" + }, + { + "type": "string", + "const": "medium" + }, + { + "type": "string", + "const": "low" + } ] } - } + }, + "additionalProperties": false } }, "assumptions": { "type": "array", - "uniqueItems": true, "items": { "type": "string", "minLength": 1 - } + }, + "uniqueItems": true }, "limitations": { "type": "array", - "uniqueItems": true, "items": { "type": "string", "minLength": 1 - } + }, + "uniqueItems": true }, "open_questions": { "type": "array", - "uniqueItems": true, "items": { "type": "string", "minLength": 1 - } + }, + "uniqueItems": true }, "deliverables": { "type": "array", "items": { "type": "object", - "additionalProperties": false, "required": [ "name", "content" @@ -176,10 +198,15 @@ "type": "string", "minLength": 1 } - } + }, + "additionalProperties": false } } - } + }, + "additionalProperties": false } - } + }, + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://forge.local/contracts/advisory-artifact.schema.json", + "additionalProperties": false } diff --git a/agent/contracts/analysis-artifact.schema.json b/agent/contracts/analysis-artifact.schema.json index 864e9f8..4858a84 100644 --- a/agent/contracts/analysis-artifact.schema.json +++ b/agent/contracts/analysis-artifact.schema.json @@ -1,10 +1,5 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://forge.local/contracts/analysis-artifact.schema.json", - "title": "AnalysisArtifact", - "description": "Evidence-bound output of a professional data analysis skill.", "type": "object", - "additionalProperties": false, "required": [ "artifact_id", "artifact_type", @@ -15,15 +10,32 @@ "payload" ], "properties": { - "artifact_id": {"type": "string", "pattern": "^ar_[A-Za-z0-9_-]+$"}, - "artifact_type": {"const": "analysis"}, - "schema_version": {"const": 1}, - "task_run_id": {"type": "string", "pattern": "^tr_[A-Za-z0-9_-]+$"}, - "producer": {"type": "string", "minLength": 1}, - "created_at": {"type": "string", "format": "date-time"}, + "artifact_id": { + "type": "string", + "pattern": "^ar_[A-Za-z0-9_-]+$" + }, + "artifact_type": { + "type": "string", + "const": "analysis" + }, + "schema_version": { + "type": "number", + "const": 1 + }, + "task_run_id": { + "type": "string", + "pattern": "^tr_[A-Za-z0-9_-]+$" + }, + "producer": { + "type": "string", + "minLength": 1 + }, + "created_at": { + "type": "string", + "format": "date-time" + }, "payload": { "type": "object", - "additionalProperties": false, "required": [ "status", "method_summary", @@ -35,103 +47,241 @@ "suggested_queries" ], "properties": { - "status": {"type": "string", "enum": ["complete", "incomplete"]}, + "status": { + "anyOf": [ + { + "type": "string", + "const": "complete" + }, + { + "type": "string", + "const": "incomplete" + } + ] + }, "method_summary": { "type": "object", - "additionalProperties": false, - "required": ["objective", "dimensions", "comparison_baseline", "approach_steps"], + "required": [ + "objective", + "dimensions", + "comparison_baseline", + "approach_steps" + ], "properties": { - "objective": {"type": "string", "minLength": 1}, - "dimensions": {"type": "array", "items": {"type": "string", "minLength": 1}, "uniqueItems": true}, - "comparison_baseline": {"type": "string", "minLength": 1}, - "approach_steps": {"type": "array", "minItems": 1, "maxItems": 6, "items": {"type": "string", "minLength": 1}} - } + "objective": { + "type": "string", + "minLength": 1 + }, + "dimensions": { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + }, + "uniqueItems": true + }, + "comparison_baseline": { + "type": "string", + "minLength": 1 + }, + "approach_steps": { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + }, + "minItems": 1, + "maxItems": 6 + } + }, + "additionalProperties": false + }, + "summary": { + "type": "string", + "minLength": 1 }, - "summary": {"type": "string", "minLength": 1}, "findings": { "type": "array", "items": { "type": "object", - "additionalProperties": false, - "required": ["statement", "evidence_refs", "confidence"], + "required": [ + "statement", + "evidence_refs", + "confidence" + ], "properties": { - "statement": {"type": "string", "minLength": 1}, + "statement": { + "type": "string", + "minLength": 1 + }, "evidence_refs": { "type": "array", + "items": { + "type": "string", + "pattern": "^qr_[A-Za-z0-9_-]+#.+$" + }, "minItems": 1, - "items": {"type": "string", "pattern": "^qr_[A-Za-z0-9_-]+#.+$"}, "uniqueItems": true }, - "confidence": {"type": "string", "enum": ["high", "medium", "low"]} - } + "confidence": { + "anyOf": [ + { + "type": "string", + "const": "high" + }, + { + "type": "string", + "const": "medium" + }, + { + "type": "string", + "const": "low" + } + ] + } + }, + "additionalProperties": false } }, "hypotheses": { "type": "array", "items": { "type": "object", - "additionalProperties": false, - "required": ["statement", "evidence_refs", "status"], + "required": [ + "statement", + "evidence_refs", + "status" + ], "properties": { - "statement": {"type": "string", "minLength": 1}, + "statement": { + "type": "string", + "minLength": 1 + }, "evidence_refs": { "type": "array", - "items": {"type": "string", "pattern": "^qr_[A-Za-z0-9_-]+#.+$"}, + "items": { + "type": "string", + "pattern": "^qr_[A-Za-z0-9_-]+#.+$" + }, "uniqueItems": true }, "status": { - "type": "string", - "enum": ["supported", "plausible", "unverified", "rejected"] + "anyOf": [ + { + "type": "string", + "const": "supported" + }, + { + "type": "string", + "const": "plausible" + }, + { + "type": "string", + "const": "unverified" + }, + { + "type": "string", + "const": "rejected" + } + ] } - } + }, + "additionalProperties": false } }, "recommendations": { "type": "array", "items": { "type": "object", - "additionalProperties": false, - "required": ["action", "rationale", "priority"], + "required": [ + "action", + "rationale", + "priority" + ], "properties": { - "action": {"type": "string", "minLength": 1}, - "rationale": {"type": "string", "minLength": 1}, - "priority": { + "action": { + "type": "string", + "minLength": 1 + }, + "rationale": { "type": "string", - "enum": ["immediate", "high", "medium", "low"] + "minLength": 1 + }, + "priority": { + "anyOf": [ + { + "type": "string", + "const": "immediate" + }, + { + "type": "string", + "const": "high" + }, + { + "type": "string", + "const": "medium" + }, + { + "type": "string", + "const": "low" + } + ] } - } + }, + "additionalProperties": false } }, "limitations": { "type": "array", - "items": {"type": "string", "minLength": 1}, + "items": { + "type": "string", + "minLength": 1 + }, "uniqueItems": true }, "suggested_queries": { "type": "array", "items": { "type": "object", - "additionalProperties": false, - "required": ["question", "reason", "priority"], + "required": [ + "question", + "reason", + "priority" + ], "properties": { - "question": {"type": "string", "minLength": 1}, - "reason": {"type": "string", "minLength": 1}, - "priority": {"type": "string", "enum": ["high", "medium", "low"]} - } + "question": { + "type": "string", + "minLength": 1 + }, + "reason": { + "type": "string", + "minLength": 1 + }, + "priority": { + "anyOf": [ + { + "type": "string", + "const": "high" + }, + { + "type": "string", + "const": "medium" + }, + { + "type": "string", + "const": "low" + } + ] + } + }, + "additionalProperties": false } } }, - "allOf": [ - { - "if": { - "properties": {"status": {"const": "incomplete"}}, - "required": ["status"] - }, - "then": { - "properties": {"suggested_queries": {"minItems": 1}} - } - } - ] + "additionalProperties": false } - } + }, + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://forge.local/contracts/analysis-artifact.schema.json", + "additionalProperties": false } diff --git a/agent/contracts/artifact_semantics.py b/agent/contracts/artifact_semantics.py new file mode 100644 index 0000000..2f13379 --- /dev/null +++ b/agent/contracts/artifact_semantics.py @@ -0,0 +1,89 @@ +"""Semantic checks for TypeBox-owned structured artifacts, after JSON Schema. + +Keep these in agreement with structured-artifact-tools.ts via the shared +structured-artifact-fixtures.v1.json corpus. Context ownership (supplied evidence, +report source identity) is enforced separately by the executing stage. +""" +from __future__ import annotations + +import calendar +import re +from typing import Any + +from jsonschema import FormatChecker, ValidationError + +STRUCTURED_ARTIFACT_CONTRACTS = frozenset({ + "clarification_artifact", "metric_definition_artifact", "query_result_artifact", + "analysis_artifact", "advisory_artifact", "rendered_output_artifact", +}) + +structured_artifact_format_checker = FormatChecker() +_DATE_TIME = re.compile( + r"^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):" + r"([0-9]{2}(?:\.[0-9]+)?)(?:Z|([+-])([0-9]{2}):([0-9]{2}))$", re.IGNORECASE, +) + + +@structured_artifact_format_checker.checks("date-time") +def _date_time(value: Any) -> bool: + # TypeBox IsDateTime semantics, including timezone offsets and leap seconds. + # jsonschema otherwise silently skips this format without optional extras. + if not isinstance(value, str): + return True + match = _DATE_TIME.match(value) + if match is None: + return False + year, month, day, hour, minute = map(int, match.group(1, 2, 3, 4, 5)) + if not 1 <= month <= 12 or not 1 <= day <= calendar.monthrange(year, month)[1]: + return False + second = float(match.group(6)) + sign = -1 if match.group(7) == "-" else 1 + offset_hour, offset_minute = int(match.group(8) or 0), int(match.group(9) or 0) + if offset_hour > 23 or offset_minute > 59: + return False + if hour <= 23 and minute <= 59 and second < 60: + return True + utc_minute = minute - offset_minute * sign + utc_hour = hour - offset_hour * sign - (1 if utc_minute < 0 else 0) + return utc_hour in {23, -1} and utc_minute in {59, -1} and second < 61 + +# ASCII word boundaries match JavaScript RegExp's \b (not Python Unicode \w). +_CAUSAL = re.compile( + r"(可排除|已经排除|直接导致|证明了|确定(?:的)?原因|直接来源|必然导致|" + r"\bcaused by\b|\bproves?\b|\brules? out\b|\bdefinitely\b)", re.IGNORECASE | re.ASCII, +) +_DISCLOSURE = re.compile( + r"(?:|chain[- ]of[- ]thought|system prompt|tool call|" + r"思考过程\s*[::]|内部分析\s*[::]|推理过程\s*[::])", re.IGNORECASE, +) + + +def validate_artifact_semantics(name: str, instance: dict[str, Any]) -> None: + payload = instance["payload"] + texts: list[str] = [] + if name == "query_result_artifact": + if payload["row_count"] != len(payload["rows"]): + raise ValidationError("row_count must equal persisted rows length") + if any(len(row) != len(payload["columns"]) for row in payload["rows"]): + raise ValidationError("every result row must match the columns length") + elif name == "analysis_artifact": + method = payload["method_summary"] + visible = [method["objective"], method["comparison_baseline"], + *method["dimensions"], *method["approach_steps"], payload["summary"], + *(item["statement"] for item in payload["findings"]), + *(item["statement"] for item in payload["hypotheses"]), *payload["limitations"]] + if any(_DISCLOSURE.search(text) for text in visible): + raise ValidationError("analysis contains hidden reasoning, prompt, or tool transcript disclosure") + if payload["status"] == "incomplete" and not payload["suggested_queries"]: + raise ValidationError("incomplete analysis requires at least one suggested query") + texts = [payload["summary"], *(item["statement"] for item in payload["findings"])] + elif name == "advisory_artifact": + if payload["status"] == "incomplete" and not payload["open_questions"]: + raise ValidationError("incomplete advisory requires at least one open question") + texts = [payload["summary"], *(item["statement"] for item in payload["findings"])] + elif name == "rendered_output_artifact": + texts = [payload["executive_summary"], + *(text for item in payload["key_findings"] + for text in (item["statement"], item["interpretation"]))] + if any(_CAUSAL.search(text) for text in texts): + raise ValidationError("artifact uses unsupported causal certainty") diff --git a/agent/contracts/benchmark-failure-v1.schema.json b/agent/contracts/benchmark-failure-v1.schema.json index 42a3de1..8c44391 100644 --- a/agent/contracts/benchmark-failure-v1.schema.json +++ b/agent/contracts/benchmark-failure-v1.schema.json @@ -38,6 +38,7 @@ "unknown_column", "unknown_schema_reference", "dialect_unsupported", + "dialect_required", "execution_timeout", "execution_failed", "gold_execution_failed", diff --git a/agent/contracts/clarification-artifact.schema.json b/agent/contracts/clarification-artifact.schema.json index 374dc77..b81a0e1 100644 --- a/agent/contracts/clarification-artifact.schema.json +++ b/agent/contracts/clarification-artifact.schema.json @@ -1,10 +1,5 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://forge.local/contracts/clarification-artifact.schema.json", - "title": "ClarificationArtifact", - "description": "Structured output of the data requirement clarification stage.", "type": "object", - "additionalProperties": false, "required": [ "artifact_id", "artifact_type", @@ -15,15 +10,32 @@ "payload" ], "properties": { - "artifact_id": {"type": "string", "pattern": "^ar_[A-Za-z0-9_-]+$"}, - "artifact_type": {"const": "clarification"}, - "schema_version": {"const": 1}, - "task_run_id": {"type": "string", "pattern": "^tr_[A-Za-z0-9_-]+$"}, - "producer": {"type": "string", "minLength": 1}, - "created_at": {"type": "string", "format": "date-time"}, + "artifact_id": { + "type": "string", + "pattern": "^ar_[A-Za-z0-9_-]+$" + }, + "artifact_type": { + "type": "string", + "const": "clarification" + }, + "schema_version": { + "type": "number", + "const": 1 + }, + "task_run_id": { + "type": "string", + "pattern": "^tr_[A-Za-z0-9_-]+$" + }, + "producer": { + "type": "string", + "minLength": 1 + }, + "created_at": { + "type": "string", + "format": "date-time" + }, "payload": { "type": "object", - "additionalProperties": false, "required": [ "status", "goal", @@ -36,48 +48,125 @@ ], "properties": { "status": { + "anyOf": [ + { + "type": "string", + "const": "needs_input" + }, + { + "type": "string", + "const": "needs_confirmation" + }, + { + "type": "string", + "const": "confirmed" + } + ] + }, + "goal": { "type": "string", - "enum": ["needs_input", "needs_confirmation", "confirmed"] + "minLength": 1 }, - "goal": {"type": "string", "minLength": 1}, "known_facts": { "type": "array", - "items": {"type": "string", "minLength": 1}, + "items": { + "type": "string", + "minLength": 1 + }, "uniqueItems": true }, "assumptions": { "type": "array", - "items": {"type": "string", "minLength": 1}, + "items": { + "type": "string", + "minLength": 1 + }, "uniqueItems": true }, "open_questions": { "type": "array", - "items": {"type": "string", "minLength": 1}, + "items": { + "type": "string", + "minLength": 1 + }, "uniqueItems": true }, "dimensions": { "type": "array", - "items": {"type": "string", "minLength": 1}, + "items": { + "type": "string", + "minLength": 1 + }, "uniqueItems": true }, "time_range": { "type": "object", - "additionalProperties": false, - "required": ["description"], + "required": [ + "description" + ], "properties": { - "description": {"type": "string", "minLength": 1}, - "start": {"type": ["string", "null"], "format": "date-time"}, - "end": {"type": ["string", "null"], "format": "date-time"}, - "timezone": {"type": ["string", "null"]}, - "granularity": {"type": ["string", "null"]} - } + "description": { + "type": "string", + "minLength": 1 + }, + "start": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ] + }, + "end": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ] + }, + "timezone": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "granularity": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false }, "acceptance_criteria": { "type": "array", - "items": {"type": "string", "minLength": 1}, + "items": { + "type": "string", + "minLength": 1 + }, "uniqueItems": true } - } + }, + "additionalProperties": false } - } + }, + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://forge.local/contracts/clarification-artifact.schema.json", + "additionalProperties": false } diff --git a/agent/contracts/forge-output-descriptions-v1.json b/agent/contracts/forge-output-descriptions-v1.json new file mode 100644 index 0000000..2279c19 --- /dev/null +++ b/agent/contracts/forge-output-descriptions-v1.json @@ -0,0 +1,20 @@ +{ + "schema_version": "forge-output-descriptions-v1", + "canonical_schema_revision": "sha256:e9b56c6f98d08c8b866bd4f49ab0076ff55510711429025d397a5acd9188e723", + "profiles": { + "off": { + "wire_schema_revision": "sha256:01f2abbe6608b33610f4106f1acf8705ffca38a4aa3c8d990bc7b6f7fe739b8d", + "descriptions": {} + }, + "interfaces-v1": { + "wire_schema_revision": "sha256:d3d56c36a2a8fd0322e61474a1ae8602d40244bdba5d6a00a50095f0c254848f", + "descriptions": { + "scan": "The FROM source of this query block. Bind a local table, CTE or derived query with scan or joins before referencing its columns; declaring a CTE alone is not a FROM binding. Correlated references may use a visible enclosing scope.", + "cte": "Named query blocks. Each query.select defines its exported columns; downstream blocks may reference only those exported names. A CTE definition does not add the CTE to scan or joins.", + "agg": "Aggregate definitions local to this query block. Refer to a definition by its exact as alias. Defining an aggregate does not add it to select or export it to another query block.", + "window": "Window definitions local to this query block. Refer to a definition by its exact as alias. Use qualify for filtering them in this block. Downstream blocks can reference a window result only if select exports it.", + "select": "The output interface of this query block. In a CTE, explicitly select the columns or expressions needed downstream. In the final query, return only the requested answer columns or expressions, not intermediate counts or helper values unless requested." + } + } + } +} diff --git a/agent/contracts/metric-definition-artifact.schema.json b/agent/contracts/metric-definition-artifact.schema.json index 6c53b4b..fdb9f34 100644 --- a/agent/contracts/metric-definition-artifact.schema.json +++ b/agent/contracts/metric-definition-artifact.schema.json @@ -1,10 +1,5 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://forge.local/contracts/metric-definition-artifact.schema.json", - "title": "MetricDefinitionArtifact", - "description": "A reviewable business metric definition produced before querying.", "type": "object", - "additionalProperties": false, "required": [ "artifact_id", "artifact_type", @@ -15,15 +10,32 @@ "payload" ], "properties": { - "artifact_id": {"type": "string", "pattern": "^ar_[A-Za-z0-9_-]+$"}, - "artifact_type": {"const": "metric_definition"}, - "schema_version": {"const": 1}, - "task_run_id": {"type": "string", "pattern": "^tr_[A-Za-z0-9_-]+$"}, - "producer": {"type": "string", "minLength": 1}, - "created_at": {"type": "string", "format": "date-time"}, + "artifact_id": { + "type": "string", + "pattern": "^ar_[A-Za-z0-9_-]+$" + }, + "artifact_type": { + "type": "string", + "const": "metric_definition" + }, + "schema_version": { + "type": "number", + "const": 1 + }, + "task_run_id": { + "type": "string", + "pattern": "^tr_[A-Za-z0-9_-]+$" + }, + "producer": { + "type": "string", + "minLength": 1 + }, + "created_at": { + "type": "string", + "format": "date-time" + }, "payload": { "type": "object", - "additionalProperties": false, "required": [ "status", "metric_name", @@ -37,39 +49,133 @@ ], "properties": { "status": { + "anyOf": [ + { + "type": "string", + "const": "draft" + }, + { + "type": "string", + "const": "needs_confirmation" + }, + { + "type": "string", + "const": "confirmed" + }, + { + "type": "string", + "const": "rejected" + } + ] + }, + "metric_name": { + "type": "string", + "minLength": 1 + }, + "business_definition": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "numerator": { + "type": "string", + "minLength": 1 + }, + "denominator": { "type": "string", - "enum": ["draft", "needs_confirmation", "confirmed", "rejected"] + "minLength": 1 + }, + "grain": { + "type": "string", + "minLength": 1 + }, + "window": { + "type": "string", + "minLength": 1 }, - "metric_name": {"type": "string", "minLength": 1}, - "business_definition": {"type": ["string", "null"]}, - "numerator": {"type": "string", "minLength": 1}, - "denominator": {"type": "string", "minLength": 1}, - "grain": {"type": "string", "minLength": 1}, - "window": {"type": "string", "minLength": 1}, "filters": { "type": "array", "items": { "type": "object", - "additionalProperties": false, - "required": ["field", "operator", "value"], + "required": [ + "field", + "operator", + "value" + ], "properties": { - "field": {"type": "string", "minLength": 1}, - "operator": {"type": "string", "minLength": 1}, - "value": {} - } + "field": { + "type": "string", + "minLength": 1 + }, + "operator": { + "type": "string", + "minLength": 1 + }, + "value": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "null" + }, + { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "null" + } + ] + } + } + ] + } + }, + "additionalProperties": false } }, "boundary_conditions": { "type": "array", - "items": {"type": "string", "minLength": 1}, + "items": { + "type": "string", + "minLength": 1 + }, "uniqueItems": true }, "open_questions": { "type": "array", - "items": {"type": "string", "minLength": 1}, + "items": { + "type": "string", + "minLength": 1 + }, "uniqueItems": true } - } + }, + "additionalProperties": false } - } + }, + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://forge.local/contracts/metric-definition-artifact.schema.json", + "additionalProperties": false } diff --git a/agent/contracts/product-projection-fixtures.v1.json b/agent/contracts/product-projection-fixtures.v1.json index 073cffb..020fa8b 100644 --- a/agent/contracts/product-projection-fixtures.v1.json +++ b/agent/contracts/product-projection-fixtures.v1.json @@ -336,7 +336,10 @@ "started_at": "2026-08-25T08:00:10Z", "finished_at": "2026-08-25T08:01:00Z", "elapsed_ms": 50000, - "safe_error": null + "safe_error": null, + "request_id": "req_synthetic_prepare", + "usage_status": "unknown", + "skill_policy_version": 1 } ], "artifacts": [ @@ -526,6 +529,27 @@ ] }, "invalid": [ + { + "case_id": "attempt_usage_status_rejects_unknown_enum", + "base_case_id": "task_waiting_query_approval", + "contract": "task_detail_projection_v1", + "expected_code": "contract.invalid", + "mutation": {"op": "set", "path": ["attempts", 0, "usage_status"], "value": "free"} + }, + { + "case_id": "attempt_request_identity_is_nonempty", + "base_case_id": "task_waiting_query_approval", + "contract": "task_detail_projection_v1", + "expected_code": "contract.invalid", + "mutation": {"op": "set", "path": ["attempts", 0, "request_id"], "value": ""} + }, + { + "case_id": "attempt_policy_version_is_nonnegative", + "base_case_id": "task_waiting_query_approval", + "contract": "task_detail_projection_v1", + "expected_code": "contract.invalid", + "mutation": {"op": "set", "path": ["attempts", 0, "skill_policy_version"], "value": -1} + }, { "case_id": "unknown_display_state", "base_case_id": "conversation_needs_input", diff --git a/agent/contracts/product-projection-v1.schema.json b/agent/contracts/product-projection-v1.schema.json index f665023..8739990 100644 --- a/agent/contracts/product-projection-v1.schema.json +++ b/agent/contracts/product-projection-v1.schema.json @@ -2606,6 +2606,42 @@ "type": "null" } ] + }, + "request_id": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "usage_status": { + "anyOf": [ + { + "type": "string", + "const": "not_started" + }, + { + "type": "string", + "const": "known" + }, + { + "type": "string", + "const": "unknown" + } + ] + }, + "model_revision": { + "anyOf": [ + { + "type": "string", + "minLength": 1 + }, + { + "type": "null" + } + ] + }, + "skill_policy_version": { + "type": "integer", + "minimum": 0 } }, "additionalProperties": false diff --git a/agent/contracts/query-result-artifact.schema.json b/agent/contracts/query-result-artifact.schema.json index 9191a8f..de3e3dd 100644 --- a/agent/contracts/query-result-artifact.schema.json +++ b/agent/contracts/query-result-artifact.schema.json @@ -1,10 +1,5 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://forge.local/contracts/query-result-artifact.schema.json", - "title": "QueryResultArtifact", - "description": "A Forge-owned, auditable query result passed to downstream skills.", "type": "object", - "additionalProperties": false, "required": [ "artifact_id", "artifact_type", @@ -15,15 +10,32 @@ "payload" ], "properties": { - "artifact_id": {"type": "string", "pattern": "^ar_[A-Za-z0-9_-]+$"}, - "artifact_type": {"const": "query_result"}, - "schema_version": {"const": 1}, - "task_run_id": {"type": "string", "pattern": "^tr_[A-Za-z0-9_-]+$"}, - "producer": {"const": "forge"}, - "created_at": {"type": "string", "format": "date-time"}, + "artifact_id": { + "type": "string", + "pattern": "^ar_[A-Za-z0-9_-]+$" + }, + "artifact_type": { + "type": "string", + "const": "query_result" + }, + "schema_version": { + "type": "number", + "const": 1 + }, + "task_run_id": { + "type": "string", + "pattern": "^tr_[A-Za-z0-9_-]+$" + }, + "producer": { + "type": "string", + "const": "forge" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, "payload": { "type": "object", - "additionalProperties": false, "required": [ "query_run_id", "sql_hash", @@ -37,33 +49,111 @@ "executed_at" ], "properties": { - "query_run_id": {"type": "string", "pattern": "^qr_[A-Za-z0-9_-]+$"}, - "sql_hash": {"type": "string", "pattern": "^sha256:[a-f0-9]{64}$"}, + "query_run_id": { + "type": "string", + "pattern": "^qr_[A-Za-z0-9_-]+$" + }, + "sql_hash": { + "type": "string", + "pattern": "^sha256:[a-f0-9]{64}$" + }, "columns": { "type": "array", - "items": {"type": "string", "minLength": 1}, + "items": { + "type": "string", + "minLength": 1 + }, "uniqueItems": true }, "rows": { "type": "array", - "items": {"type": "array"} + "items": { + "type": "array", + "items": {} + } + }, + "row_count": { + "type": "integer", + "minimum": 0 + }, + "truncated": { + "type": "boolean" }, - "row_count": {"type": "integer", "minimum": 0}, - "truncated": {"type": "boolean"}, "dialect": { + "anyOf": [ + { + "type": "string", + "const": "sqlite" + }, + { + "type": "string", + "const": "postgresql" + }, + { + "type": "string", + "const": "mysql" + }, + { + "type": "string", + "const": "bigquery" + }, + { + "type": "string", + "const": "snowflake" + } + ] + }, + "registry_version": { + "type": "string", + "minLength": 1 + }, + "assurance_report_hash": { + "type": "string", + "pattern": "^sha256:[a-f0-9]{64}$" + }, + "assurance_revision": { + "type": "string", + "minLength": 1 + }, + "policy_revision": { + "type": "string", + "minLength": 1 + }, + "model_revision": { + "type": "string", + "minLength": 1 + }, + "assurance_registry_revision": { + "type": "string", + "minLength": 1 + }, + "execution_ms": { + "type": "integer", + "minimum": 0 + }, + "executed_at": { "type": "string", - "enum": ["sqlite", "postgresql", "mysql", "bigquery", "snowflake"] + "minLength": 1, + "format": "date-time" }, - "registry_version": {"type": "string", "minLength": 1}, - "assurance_report_hash": {"type": "string", "pattern": "^sha256:[a-f0-9]{64}$"}, - "assurance_revision": {"type": "string", "minLength": 1}, - "policy_revision": {"type": "string", "minLength": 1}, - "model_revision": {"type": "string", "minLength": 1}, - "assurance_registry_revision": {"type": "string", "minLength": 1}, - "execution_ms": {"type": "integer", "minimum": 0}, - "executed_at": {"type": "string", "format": "date-time"}, - "result_contract": {"type": ["object", "null"], "additionalProperties": true} - } + "result_contract": { + "anyOf": [ + { + "type": "object", + "patternProperties": { + "^.*$": {} + } + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false } - } + }, + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://forge.local/contracts/query-result-artifact.schema.json", + "additionalProperties": false } diff --git a/agent/contracts/rendered-output-artifact.schema.json b/agent/contracts/rendered-output-artifact.schema.json index fdd9bbe..3b3daba 100644 --- a/agent/contracts/rendered-output-artifact.schema.json +++ b/agent/contracts/rendered-output-artifact.schema.json @@ -1,10 +1,5 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://forge.local/contracts/rendered-output-artifact.schema.json", - "title": "RenderedOutputArtifact", - "description": "Evidence-bound report rendered from a validated AnalysisArtifact.", "type": "object", - "additionalProperties": false, "required": [ "artifact_id", "artifact_type", @@ -15,15 +10,32 @@ "payload" ], "properties": { - "artifact_id": {"type": "string", "pattern": "^ar_[A-Za-z0-9_-]+$"}, - "artifact_type": {"const": "rendered_output"}, - "schema_version": {"const": 1}, - "task_run_id": {"type": "string", "pattern": "^tr_[A-Za-z0-9_-]+$"}, - "producer": {"type": "string", "minLength": 1}, - "created_at": {"type": "string", "format": "date-time"}, + "artifact_id": { + "type": "string", + "pattern": "^ar_[A-Za-z0-9_-]+$" + }, + "artifact_type": { + "type": "string", + "const": "rendered_output" + }, + "schema_version": { + "type": "number", + "const": 1 + }, + "task_run_id": { + "type": "string", + "pattern": "^tr_[A-Za-z0-9_-]+$" + }, + "producer": { + "type": "string", + "minLength": 1 + }, + "created_at": { + "type": "string", + "format": "date-time" + }, "payload": { "type": "object", - "additionalProperties": false, "required": [ "status", "title", @@ -37,60 +49,154 @@ "markdown" ], "properties": { - "status": {"type": "string", "enum": ["complete", "incomplete"]}, - "title": {"type": "string", "minLength": 1}, - "audience": {"type": "string", "minLength": 1}, - "executive_summary": {"type": "string", "minLength": 1}, + "status": { + "anyOf": [ + { + "type": "string", + "const": "complete" + }, + { + "type": "string", + "const": "incomplete" + } + ] + }, + "title": { + "type": "string", + "minLength": 1 + }, + "audience": { + "type": "string", + "minLength": 1 + }, + "executive_summary": { + "type": "string", + "minLength": 1 + }, "key_findings": { "type": "array", "items": { "type": "object", - "additionalProperties": false, - "required": ["statement", "interpretation", "evidence_refs", "confidence"], + "required": [ + "statement", + "interpretation", + "evidence_refs", + "confidence" + ], "properties": { - "statement": {"type": "string", "minLength": 1}, - "interpretation": {"type": "string", "minLength": 1}, + "statement": { + "type": "string", + "minLength": 1 + }, + "interpretation": { + "type": "string", + "minLength": 1 + }, "evidence_refs": { "type": "array", + "items": { + "type": "string", + "pattern": "^qr_[A-Za-z0-9_-]+#.+$" + }, "minItems": 1, - "items": {"type": "string", "pattern": "^qr_[A-Za-z0-9_-]+#.+$"}, "uniqueItems": true }, - "confidence": {"type": "string", "enum": ["high", "medium", "low"]} - } + "confidence": { + "anyOf": [ + { + "type": "string", + "const": "high" + }, + { + "type": "string", + "const": "medium" + }, + { + "type": "string", + "const": "low" + } + ] + } + }, + "additionalProperties": false } }, "recommendations": { "type": "array", "items": { "type": "object", - "additionalProperties": false, - "required": ["action", "rationale", "priority"], + "required": [ + "action", + "rationale", + "priority" + ], "properties": { - "action": {"type": "string", "minLength": 1}, - "rationale": {"type": "string", "minLength": 1}, - "priority": {"type": "string", "enum": ["immediate", "high", "medium", "low"]} - } + "action": { + "type": "string", + "minLength": 1 + }, + "rationale": { + "type": "string", + "minLength": 1 + }, + "priority": { + "anyOf": [ + { + "type": "string", + "const": "immediate" + }, + { + "type": "string", + "const": "high" + }, + { + "type": "string", + "const": "medium" + }, + { + "type": "string", + "const": "low" + } + ] + } + }, + "additionalProperties": false } }, "limitations": { "type": "array", - "items": {"type": "string", "minLength": 1}, + "items": { + "type": "string", + "minLength": 1 + }, "uniqueItems": true }, "next_steps": { "type": "array", - "items": {"type": "string", "minLength": 1}, + "items": { + "type": "string", + "minLength": 1 + }, "uniqueItems": true }, "source_artifact_ids": { "type": "array", + "items": { + "type": "string", + "pattern": "^ar_[A-Za-z0-9_-]+$" + }, "minItems": 1, - "items": {"type": "string", "pattern": "^ar_[A-Za-z0-9_-]+$"}, "uniqueItems": true }, - "markdown": {"type": "string", "minLength": 1} - } + "markdown": { + "type": "string", + "minLength": 1 + } + }, + "additionalProperties": false } - } + }, + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://forge.local/contracts/rendered-output-artifact.schema.json", + "additionalProperties": false } diff --git a/agent/contracts/structured-artifact-fixtures.v1.json b/agent/contracts/structured-artifact-fixtures.v1.json new file mode 100644 index 0000000..a7411aa --- /dev/null +++ b/agent/contracts/structured-artifact-fixtures.v1.json @@ -0,0 +1,1431 @@ +{ + "schema_version": 1, + "cases": [ + { + "id": "clarification-valid", + "contract": "clarification_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "clarification", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "needs_input", + "goal": "Define comparison", + "known_facts": [], + "assumptions": [], + "open_questions": [ + "Which period?" + ], + "dimensions": [], + "time_range": { + "description": "Pending", + "start": null, + "end": "2026-09-07T08:00:00+08:00" + }, + "acceptance_criteria": [] + } + } + }, + { + "id": "metric_definition-valid", + "contract": "metric_definition_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "metric_definition", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "draft", + "metric_name": "Conversion", + "numerator": "buyers", + "denominator": "visitors", + "grain": "day", + "window": "week", + "filters": [], + "boundary_conditions": [], + "open_questions": [] + } + } + }, + { + "id": "query_result-valid", + "contract": "query_result_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + } + } + }, + { + "id": "analysis-valid", + "contract": "analysis_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "analysis", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "complete", + "method_summary": { + "objective": "Compare channels", + "dimensions": [ + "channel" + ], + "comparison_baseline": "Current period", + "approach_steps": [ + "Compare observed values" + ] + }, + "summary": "Web has one observation.", + "findings": [ + { + "statement": "Web value is one.", + "evidence_refs": [ + "qr_corpus#row:1" + ], + "confidence": "high" + } + ], + "hypotheses": [], + "recommendations": [], + "limitations": [], + "suggested_queries": [] + } + } + }, + { + "id": "advisory-valid", + "contract": "advisory_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "advisory", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "complete", + "skill_name": "data-doc-writer", + "title": "Guide", + "summary": "The supplied context defines the metric.", + "findings": [ + { + "statement": "Definition is available.", + "evidence_refs": [ + "ctx_aaaaaaaaaaaaaaaaaaaaaaaa" + ], + "confidence": "high" + } + ], + "recommendations": [], + "assumptions": [], + "limitations": [], + "open_questions": [], + "deliverables": [] + } + } + }, + { + "id": "rendered_output-valid", + "contract": "rendered_output_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "rendered_output", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "complete", + "title": "Report", + "audience": "Analyst", + "executive_summary": "Web has one observation.", + "key_findings": [ + { + "statement": "Web value is one.", + "interpretation": "Inspect additional periods.", + "evidence_refs": [ + "qr_corpus#row:1" + ], + "confidence": "high" + } + ], + "recommendations": [], + "limitations": [], + "next_steps": [], + "source_artifact_ids": [ + "ar_analysis" + ], + "markdown": "# Trusted rendered report" + } + } + }, + { + "id": "query-empty", + "contract": "query_result_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [], + "row_count": 0, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + } + } + }, + { + "id": "query-truncated-counts-persisted-only", + "contract": "query_result_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": true, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + } + } + }, + { + "id": "query-zero-columns", + "contract": "query_result_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [], + "rows": [ + [] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + } + } + }, + { + "id": "query-row-count-mismatch", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 99, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + } + } + }, + { + "id": "query-truncated-count-mismatch", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 99, + "truncated": true, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + } + } + }, + { + "id": "query-short-row", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web" + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + } + } + }, + { + "id": "query-long-row", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1, + 2 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + } + } + }, + { + "id": "query-duplicate-column", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "v", + "v" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + } + } + }, + { + "id": "query-boolean-count", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": true, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + } + } + }, + { + "id": "query-invalid-timestamp", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "yesterday" + } + } + }, + { + "id": "query-non-forge-producer", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + } + } + }, + { + "id": "envelope-unknown-version", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 2, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + } + } + }, + { + "id": "envelope-unknown-property", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + }, + "database_password": "synthetic" + } + }, + { + "id": "payload-unknown-property", + "contract": "clarification_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "clarification", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "needs_input", + "goal": "Define comparison", + "known_facts": [], + "assumptions": [], + "open_questions": [ + "Which period?" + ], + "dimensions": [], + "time_range": { + "description": "Pending", + "start": null, + "end": "2026-09-07T08:00:00+08:00" + }, + "acceptance_criteria": [], + "sql": "SELECT 1" + } + } + }, + { + "id": "clarification-invalid-date", + "contract": "clarification_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "clarification", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "needs_input", + "goal": "Define comparison", + "known_facts": [], + "assumptions": [], + "open_questions": [ + "Which period?" + ], + "dimensions": [], + "time_range": { + "description": "Pending", + "start": "yesterday", + "end": "2026-09-07T08:00:00+08:00" + }, + "acceptance_criteria": [] + } + } + }, + { + "id": "analysis-incomplete-missing-query", + "contract": "analysis_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "analysis", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "incomplete", + "method_summary": { + "objective": "Compare channels", + "dimensions": [ + "channel" + ], + "comparison_baseline": "Current period", + "approach_steps": [ + "Compare observed values" + ] + }, + "summary": "Web has one observation.", + "findings": [ + { + "statement": "Web value is one.", + "evidence_refs": [ + "qr_corpus#row:1" + ], + "confidence": "high" + } + ], + "hypotheses": [], + "recommendations": [], + "limitations": [], + "suggested_queries": [] + } + } + }, + { + "id": "analysis-incomplete-with-query", + "contract": "analysis_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "analysis", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "incomplete", + "method_summary": { + "objective": "Compare channels", + "dimensions": [ + "channel" + ], + "comparison_baseline": "Current period", + "approach_steps": [ + "Compare observed values" + ] + }, + "summary": "Web has one observation.", + "findings": [ + { + "statement": "Web value is one.", + "evidence_refs": [ + "qr_corpus#row:1" + ], + "confidence": "high" + } + ], + "hypotheses": [], + "recommendations": [], + "limitations": [], + "suggested_queries": [ + { + "question": "Compare prior period?", + "reason": "Need baseline", + "priority": "high" + } + ] + } + } + }, + { + "id": "analysis-disclosure", + "contract": "analysis_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "analysis", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "complete", + "method_summary": { + "objective": "System prompt: secret", + "dimensions": [ + "channel" + ], + "comparison_baseline": "Current period", + "approach_steps": [ + "Compare observed values" + ] + }, + "summary": "Web has one observation.", + "findings": [ + { + "statement": "Web value is one.", + "evidence_refs": [ + "qr_corpus#row:1" + ], + "confidence": "high" + } + ], + "hypotheses": [], + "recommendations": [], + "limitations": [], + "suggested_queries": [] + } + } + }, + { + "id": "analysis-causal-finding", + "contract": "analysis_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "analysis", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "complete", + "method_summary": { + "objective": "Compare channels", + "dimensions": [ + "channel" + ], + "comparison_baseline": "Current period", + "approach_steps": [ + "Compare observed values" + ] + }, + "summary": "Web has one observation.", + "findings": [ + { + "statement": "This proves causation.", + "evidence_refs": [ + "qr_corpus#row:1" + ], + "confidence": "high" + } + ], + "hypotheses": [], + "recommendations": [], + "limitations": [], + "suggested_queries": [] + } + } + }, + { + "id": "analysis-causal-hypothesis-remains-unverified", + "contract": "analysis_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "analysis", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "complete", + "method_summary": { + "objective": "Compare channels", + "dimensions": [ + "channel" + ], + "comparison_baseline": "Current period", + "approach_steps": [ + "Compare observed values" + ] + }, + "summary": "Web has one observation.", + "findings": [ + { + "statement": "Web value is one.", + "evidence_refs": [ + "qr_corpus#row:1" + ], + "confidence": "high" + } + ], + "hypotheses": [ + { + "statement": "This caused by change is unverified.", + "evidence_refs": [], + "status": "unverified" + } + ], + "recommendations": [], + "limitations": [], + "suggested_queries": [] + } + } + }, + { + "id": "analysis-empty-finding-evidence", + "contract": "analysis_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "analysis", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "complete", + "method_summary": { + "objective": "Compare channels", + "dimensions": [ + "channel" + ], + "comparison_baseline": "Current period", + "approach_steps": [ + "Compare observed values" + ] + }, + "summary": "Web has one observation.", + "findings": [ + { + "statement": "Web value is one.", + "evidence_refs": [], + "confidence": "high" + } + ], + "hypotheses": [], + "recommendations": [], + "limitations": [], + "suggested_queries": [] + } + } + }, + { + "id": "advisory-incomplete-missing-question", + "contract": "advisory_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "advisory", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "incomplete", + "skill_name": "data-doc-writer", + "title": "Guide", + "summary": "The supplied context defines the metric.", + "findings": [ + { + "statement": "Definition is available.", + "evidence_refs": [ + "ctx_aaaaaaaaaaaaaaaaaaaaaaaa" + ], + "confidence": "high" + } + ], + "recommendations": [], + "assumptions": [], + "limitations": [], + "open_questions": [], + "deliverables": [] + } + } + }, + { + "id": "advisory-incomplete-with-question", + "contract": "advisory_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "advisory", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "incomplete", + "skill_name": "data-doc-writer", + "title": "Guide", + "summary": "The supplied context defines the metric.", + "findings": [ + { + "statement": "Definition is available.", + "evidence_refs": [ + "ctx_aaaaaaaaaaaaaaaaaaaaaaaa" + ], + "confidence": "high" + } + ], + "recommendations": [], + "assumptions": [], + "limitations": [], + "open_questions": [ + "Which source?" + ], + "deliverables": [] + } + } + }, + { + "id": "advisory-causal-english", + "contract": "advisory_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "advisory", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "complete", + "skill_name": "data-doc-writer", + "title": "Guide", + "summary": "Definitely the cause.", + "findings": [ + { + "statement": "Definition is available.", + "evidence_refs": [ + "ctx_aaaaaaaaaaaaaaaaaaaaaaaa" + ], + "confidence": "high" + } + ], + "recommendations": [], + "assumptions": [], + "limitations": [], + "open_questions": [], + "deliverables": [] + } + } + }, + { + "id": "advisory-causal-cjk-boundary", + "contract": "advisory_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "advisory", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "complete", + "skill_name": "data-doc-writer", + "title": "Guide", + "summary": "结果proves因果", + "findings": [ + { + "statement": "Definition is available.", + "evidence_refs": [ + "ctx_aaaaaaaaaaaaaaaaaaaaaaaa" + ], + "confidence": "high" + } + ], + "recommendations": [], + "assumptions": [], + "limitations": [], + "open_questions": [], + "deliverables": [] + } + } + }, + { + "id": "advisory-causal-substring-not-word", + "contract": "advisory_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "advisory", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "complete", + "skill_name": "data-doc-writer", + "title": "Guide", + "summary": "The reprovescence term is not a causal claim.", + "findings": [ + { + "statement": "Definition is available.", + "evidence_refs": [ + "ctx_aaaaaaaaaaaaaaaaaaaaaaaa" + ], + "confidence": "high" + } + ], + "recommendations": [], + "assumptions": [], + "limitations": [], + "open_questions": [], + "deliverables": [] + } + } + }, + { + "id": "report-causal-interpretation", + "contract": "rendered_output_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "rendered_output", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "complete", + "title": "Report", + "audience": "Analyst", + "executive_summary": "Web has one observation.", + "key_findings": [ + { + "statement": "Web value is one.", + "interpretation": "直接导致下降", + "evidence_refs": [ + "qr_corpus#row:1" + ], + "confidence": "high" + } + ], + "recommendations": [], + "limitations": [], + "next_steps": [], + "source_artifact_ids": [ + "ar_analysis" + ], + "markdown": "# Trusted rendered report" + } + } + }, + { + "id": "report-invalid-evidence", + "contract": "rendered_output_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "rendered_output", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "synthetic-skill", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "status": "complete", + "title": "Report", + "audience": "Analyst", + "executive_summary": "Web has one observation.", + "key_findings": [ + { + "statement": "Web value is one.", + "interpretation": "Inspect additional periods.", + "evidence_refs": [ + "ctx_aaaaaaaaaaaaaaaaaaaaaaaa" + ], + "confidence": "high" + } + ], + "recommendations": [], + "limitations": [], + "next_steps": [], + "source_artifact_ids": [ + "ar_analysis" + ], + "markdown": "# Trusted rendered report" + } + } + }, + { + "id": "timestamp-valid-leap-day", + "contract": "query_result_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2024-02-29T12:30:00Z" + } + } + }, + { + "id": "timestamp-invalid-calendar-day", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2023-02-29T12:30:00Z" + } + } + }, + { + "id": "timestamp-requires-timezone", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T12:30:00" + } + } + }, + { + "id": "timestamp-valid-leap-second", + "contract": "query_result_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-06-30T23:59:60Z" + } + } + }, + { + "id": "timestamp-invalid-leap-second-position", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-06-30T12:30:60Z" + } + } + }, + { + "id": "timestamp-invalid-offset", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T12:30:00+24:00" + } + } + }, + { + "id": "timestamp-lowercase-and-fraction", + "contract": "query_result_artifact", + "accepted": true, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "2026-09-07T00:00:00Z", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07t12:30:00.123z" + } + } + }, + { + "id": "envelope-invalid-timestamp", + "contract": "query_result_artifact", + "accepted": false, + "instance": { + "artifact_id": "ar_corpus", + "artifact_type": "query_result", + "schema_version": 1, + "task_run_id": "tr_corpus", + "producer": "forge", + "created_at": "yesterday", + "payload": { + "query_run_id": "qr_corpus", + "sql_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "columns": [ + "channel", + "value" + ], + "rows": [ + [ + "web", + 1 + ] + ], + "row_count": 1, + "truncated": false, + "dialect": "sqlite", + "registry_version": "synthetic-v1", + "execution_ms": 1, + "executed_at": "2026-09-07T00:00:00Z" + } + } + } + ] +} diff --git a/agent/llm.py b/agent/llm.py index 1ee7171..1655cbb 100644 --- a/agent/llm.py +++ b/agent/llm.py @@ -34,6 +34,8 @@ from forge.schema_builder import build_tool_schema from forge.retriever import SchemaRetriever, make_embed_fn, make_query_embed_fn +from diagnostics import model_usage, record + logger = logging.getLogger(__name__) RUNTIME_CONTEXT_REVISION = "runtime-context-v9" @@ -448,10 +450,14 @@ def _call_anthropic( request["tool_choice"] = {"type": "tool", "name": tools[0]["name"]} try: client = anthropic.Anthropic(**kwargs) + record("model_request", model_revision=config.revision, usage_status="unknown") response = client.messages.create(**request) + record("model_response", model_revision=config.revision, **model_usage(getattr(response, "usage", None), anthropic=True)) except anthropic.APITimeoutError as exc: + record("model_failure", model_revision=config.revision, error_code="model_timeout", usage_status="unknown") raise LLMRequestTimeoutError("LLM Provider 调用超时") from exc except Exception as exc: + record("model_failure", model_revision=config.revision, error_code="model_unavailable", usage_status="unknown") raise LLMCompatibilityError( "LLM Provider 调用失败,请检查协议、Base URL、模型和凭证" ) from exc @@ -525,6 +531,7 @@ def _call_openai( endpoint = f"{base_url.rstrip('/')}/chat/completions" try: + record("model_request", model_revision=config.revision, usage_status="unknown") r = httpx.post( endpoint, headers=headers, @@ -534,9 +541,11 @@ def _call_openai( r.raise_for_status() body = r.json() except httpx.TimeoutException as exc: + record("model_failure", model_revision=config.revision, error_code="model_timeout", usage_status="unknown") raise LLMRequestTimeoutError("LLM Provider 调用超时") from exc except httpx.HTTPStatusError as exc: status = exc.response.status_code if exc.response is not None else "unknown" + record("model_failure", model_revision=config.revision, error_code="model_rejected", status_code=status, usage_status="unknown") provider_code = "" if exc.response is not None: try: @@ -555,12 +564,15 @@ def _call_openai( f"LLM Provider 拒绝请求(HTTP {status}),请检查协议、模型和凭证" ) from exc except httpx.RequestError as exc: + record("model_failure", model_revision=config.revision, error_code="model_unavailable", usage_status="unknown") raise LLMCompatibilityError( "无法连接 LLM Provider,请检查 Base URL、网络和协议配置" ) from exc except (TypeError, ValueError) as exc: + record("model_failure", model_revision=config.revision, error_code="model_contract_invalid", usage_status="unknown") raise LLMCompatibilityError("Provider 返回的响应不是合法 JSON。") from exc + record("model_response", model_revision=config.revision, **model_usage(body.get("usage") if isinstance(body, dict) else None)) choices = body.get("choices") if isinstance(body, dict) else None if not choices: raise LLMCompatibilityError("Provider 响应缺少非空 choices。") diff --git a/agent/memory/__init__.py b/agent/memory/__init__.py index 716e0d8..f9b5490 100644 --- a/agent/memory/__init__.py +++ b/agent/memory/__init__.py @@ -26,6 +26,7 @@ import logging from typing import Any +from functools import cached_property from agent.memory.ems import EpisodicMemoryStore from agent.memory.smp import SemanticMemoryPool @@ -43,11 +44,21 @@ class MemoryManager: 不直接操作 EMS / SMP / WMB / Extractor。 """ - def __init__(self): - self.ems = EpisodicMemoryStore() - self.smp = SemanticMemoryPool() - self.wmb = WorkingMemoryBuffer(self.ems, self.smp) - self.extractor = Extractor(self.ems, self.smp) + @cached_property + def ems(self): + return EpisodicMemoryStore() + + @cached_property + def smp(self): + return SemanticMemoryPool() + + @cached_property + def wmb(self): + return WorkingMemoryBuffer(self.ems, self.smp) + + @cached_property + def extractor(self): + return Extractor(self.ems, self.smp) # ── EMS 代理:记录 ──────────────────────────────────────────────────────── diff --git a/constraints/ci-python311.txt b/constraints/ci-python311.txt new file mode 100644 index 0000000..5584e6b --- /dev/null +++ b/constraints/ci-python311.txt @@ -0,0 +1,62 @@ +# Verified Python 3.11 distribution/Quickstart baseline, 2026-09-07. +# Application CI constraint only; library metadata retains supported ranges. +aiosqlite==0.22.1 +annotated-doc==0.0.5 +annotated-types==0.8.0 +anthropic==1.4.0 +anyio==4.15.1 +attrs==26.1.0 +build==1.6.0 +certifi==2026.7.22 +charset-normalizer==3.5.1 +click==8.5.0 +docstring-parser==0.18.0 +fastapi==0.141.1 +h11==0.16.0 +httpcore==1.0.9 +httpcore2==2.12.0 +httpx==0.28.1 +httpx2==2.12.0 +idna==3.19 +iniconfig==2.3.0 +jinja2==3.1.6 +jiter==0.16.0 +jsonschema==4.26.0 +jsonschema-specifications==2025.9.1 +lark-oapi==1.7.3 +lxml==6.1.3 +markupsafe==3.0.3 +numpy==2.4.6 +packaging==26.3 +pillow==12.3.0 +pluggy==1.6.0 +psycopg2-binary==2.9.12 +pycryptodome==3.23.0 +pydantic==2.13.5 +pydantic-core==2.46.5 +pygments==2.21.0 +pymysql==1.2.0 +pyproject-hooks==1.2.0 +pytest==9.1.1 +pytest-asyncio==1.4.0 +python-dotenv==1.2.3 +python-multipart==0.0.32 +python-pptx==1.0.2 +pyyaml==6.0.3 +referencing==0.37.0 +requests==2.34.2 +requests-toolbelt==1.0.0 +rpds-py==2026.6.3 +setuptools==84.0.0 +sniffio==1.3.1 +socksio==1.0.0 +sqlalchemy==2.0.52 +sqlglot==29.0.1 +starlette==1.6.0 +truststore==0.10.4 +typing-extensions==4.16.0 +typing-inspection==0.4.4 +urllib3==2.7.0 +uvicorn==0.52.4 +websockets==15.0.1 +xlsxwriter==3.2.9 diff --git a/demo/seed.py b/demo/seed.py index 8a562c0..617476f 100644 --- a/demo/seed.py +++ b/demo/seed.py @@ -4,7 +4,7 @@ Schema: users, orders, order_items, products -Covers all test cases in tests/text-to-sql-failures/: +Covers all test cases in tools/benchmarks/text_to_sql_failures/: A1 — users with zero orders (LEFT JOIN demo) A2 — orders with no items (ANTI JOIN demo) B1 — VIP filter across cities diff --git a/scripts/seed_mock_data.py b/demo/seed_mock_data.py similarity index 99% rename from scripts/seed_mock_data.py rename to demo/seed_mock_data.py index ed1f719..610e43e 100644 --- a/scripts/seed_mock_data.py +++ b/demo/seed_mock_data.py @@ -13,8 +13,8 @@ - knowledge_sources: 知识源配置 用法: - python scripts/seed_mock_data.py # 填充到默认数据库 - python scripts/seed_mock_data.py --clean # 清空后重新填充 + python demo/seed_mock_data.py # 填充到默认数据库 + python demo/seed_mock_data.py --clean # 清空后重新填充 """ from __future__ import annotations diff --git a/diagnostics.py b/diagnostics.py new file mode 100644 index 0000000..8ef8ded --- /dev/null +++ b/diagnostics.py @@ -0,0 +1,52 @@ +"""Payload-free diagnostic context shared by domain and channel adapters.""" +from __future__ import annotations + +import json +import logging +import re +from contextvars import ContextVar +from uuid import uuid4 + +request_id: ContextVar[str | None] = ContextVar("request_id", default=None) +_ID = re.compile(r"^[A-Za-z0-9_.:-]{1,128}$") + + +def safe_id(value: object) -> str | None: + return value if isinstance(value, str) and _ID.fullmatch(value) else None + + +def current_request_id() -> str: + value = request_id.get() + if value is None: + value = f"req_{uuid4().hex}" + request_id.set(value) + return value + + +def record(event: str, **fields: object) -> None: + """Only accept diagnostic identifiers and bounded scalar measurements, never payloads.""" + allowed = { + "task_run_id", "query_run_id", "attempt_id", "command_id", "delivery_id", + "correlation_id", "stage", "model_revision", "skill_policy_version", + "usage_status", "input_tokens", "output_tokens", "error_code", "status_code", + "duration_ms", "delivery_status", "operation", "source", + } + data: dict[str, object] = {"event": safe_id(event) or "diagnostic", "request_id": current_request_id()} + for key, value in fields.items(): + if key in allowed and (value is None or isinstance(value, (int, float)) or safe_id(value)): + data[key] = value + logging.getLogger("forge.diagnostics").info(json.dumps(data, separators=(",", ":"))) + + +def model_usage(usage: object, *, anthropic: bool = False) -> dict[str, object]: + def value(name: str) -> object: + return usage.get(name) if isinstance(usage, dict) else getattr(usage, name, None) + + input_tokens = value("input_tokens" if anthropic else "prompt_tokens") + output_tokens = value("output_tokens" if anthropic else "completion_tokens") + known = all(type(n) is int and n >= 0 for n in (input_tokens, output_tokens)) + return { + "usage_status": "known" if known else "unknown", + "input_tokens": input_tokens if known else None, + "output_tokens": output_tokens if known else None, + } diff --git a/docs/README.md b/docs/README.md index 82e00e2..5522431 100644 --- a/docs/README.md +++ b/docs/README.md @@ -14,6 +14,19 @@ 按任务需要读取,不要在每次会话中扫描全部历史文档。 +## 长期知识资产 + +测试证据、失败结论和沟通中形成的决策是项目核心资产,不是实现完成后即可清理的附属物。归档改变文档角色,不降低其保留优先级。 + +| 资产 | 保存位置与用途 | +|---|---| +| 测试结论、反例与验证报告 | [Benchmark归档](archive/benchmarks/)、[工程归档](archive/engineering/);下方逐文件索引保留原实验、离线复算、失败与未完成记录。 | +| 用户表达、授权、取舍与决策 | [需求池](requirements-pool.md)保留沟通原话与决策依据;[产品公理](product-axioms.md)、[北极星](product-north-star.md)及[架构边界](platform-architecture.md)承接已确认的稳定结论。 | +| 方法、设计推演与复盘 | [Benchmark方法](benchmarks.md)、[架构课程](architecture-course/index.md)、[设计讨论](pipeline-architecture.md)、[Devlog](devlog/);设计讨论中的历史方案不是当前实施授权。 | +| 被替代路线与否决依据 | [历史计划](archive/plans/)及下方历史产品/架构评审;保留当时背景,不恢复为当前待办。 | + +当前状态页是可更新的摘要,不能替代原报告或需求历史。原始表达、证据结论与后续提炼分别保留,未知和缺失不补造;执行下方维护规则。 + ## 稳定工程说明 | 文档 | 角色 | @@ -33,34 +46,43 @@ - [`product-axioms.md`](product-axioms.md):产品和工程决策公理。 - [`commercial-readiness.md`](commercial-readiness.md)、[`commercialization-plan.md`](commercialization-plan.md):商业化参考,不覆盖当前 R0 开源采用门禁。 -## 历史计划与证据 -以下文档保留用于溯源,不是当前待办: +## 历史计划与证据归档 + +归档只按文档角色和已完成/已替代状态划分,不按日期机械搬移;以下材料用于溯源,不是当前待办: -- `pi-forge-integration-plan.md` -- `short-term-product-spine-plan-2026-08-25.md` -- `product-spine-sp*-evidence-2026-08-25.md` -- `product-direction-architecture-review-2026-08-24.md` -- `governance-contract-review-2026-08-24.md` -- `delivery-assessment-*.md` -- `devlog/` +- [`archive/benchmarks/`](archive/benchmarks/):已完成的 Accuracy / Benchmark 报告、准备快照、负结果与历史失败分析;逐轮索引见下文。另保留早期 [Method K 公开报告](archive/benchmarks/report_2026-03-15_185406.md)。 +- [`archive/engineering/`](archive/engineering/):工程、测试、发布、验收与评估报告;[REQ-060 原始评估](archive/engineering/architecture-quality-review-2026-09-07.json)与[实施报告](archive/engineering/architecture-quality-implementation-2026-09-07.json)各自保留原始 JSON 字节,不覆盖基线。 +- [`archive/plans/`](archive/plans/):已被替代的 [Pi 集成计划](archive/plans/pi-forge-integration-plan.md)、[Product Spine 计划](archive/plans/short-term-product-spine-plan-2026-08-25.md)、[Web Product Shell 计划](archive/plans/web-product-shell-plan-2026-08-24.md)与[早期 EA 优化计划](archive/plans/optimization_plan_2026-03-19.md)。 +- [`devlog/`](devlog/) 与 [`architecture-course/`](architecture-course/) 保持原位;长期产品路线图及上述战略参考也保持原位,不因带日期而自动归档。 + +归档 Markdown 仅重定位必要的可点击链接,历史命令、代码/报告字符串、原始路径与验证结论按当时上下文保留。JSON 内的路径和 hash 是历史证据,不是当前工作目录相对路径;不得为让旧路径可执行而迁移本地数据、补造结果或创建旧路径包装文件。 文件名中的日期、完成项或旧路线不能替代文档顶部状态和 [`current-project-state.md`](current-project-state.md)。 +文件结构职责见[CONTRIBUTING](../CONTRIBUTING.md#repository-layout);本轮保留/迁移/归档/待确认决策、逐文件路径与SHA-256及本地验证见[REQ-061治理记录](file-structure-governance-2026-09-07.json)。旧本地数据与缓存不随目录归位自动搬迁。 + +## 候选分支交付(2026-09-08) + +- [REQ-063候选交付记录](candidate-delivery-2026-09-08.json):公开范围审查、既有接口文档维护、候选分支/PR与远端CI;不代表已合并、Release、部署或外部采用。 +- [Python/打包原始审查](archive/engineering/candidate-python-publication-audit-2026-09-08.json):67份当前文件及审查边界;原始静态审查不重写为后续CI结果。 +- [Pi/Web/工具原始审查](archive/engineering/candidate-pi-web-publication-audit-2026-09-08.json):179份当前文件、公开前身与40份合成Gold CSV;保留继承的低风险观察。 +- [文档原始扫描](archive/engineering/candidate-documentation-publication-audit-2026-09-08.json):107份文档与原始疑似项;最终处置、三份原件SHA-256及后续变更见候选交付记录。三份原件均按原字节保留,不构成独立安全认证。 + ## 本次仓库版本交付(2026-09-07) -- [发布验证报告](release-verification-2026-09-07.json):本地Python/Pi、Quickstart、站点构建、Assurance v10升级边界及未覆盖范围;远端CI以对应commit为准。 -- [报告公开说明](report-publication-2026-09-07.json):逐文件原件/公开版hash、最小脱敏规则、数据来源与许可边界。 +- [发布验证报告](archive/engineering/release-verification-2026-09-07.json):本地Python/Pi、Quickstart、站点构建、Assurance v10升级边界及未覆盖范围;远端CI以对应commit为准。 +- [报告公开说明](archive/engineering/report-publication-2026-09-07.json):逐文件原件/公开版hash、最小脱敏规则、数据来源与许可边界。 以下是历史实验与验收报告;本次发布报告与公开说明不计为新的模型实验。 ## Accuracy / Benchmark 逐轮报告 -本节覆盖所有 `accuracy-*.json` 与 `benchmark-*` 正式报告、准备清单和同名简报:**40份JSON+15份Markdown,共55个文件**(含1份早期运行文档重建汇总)。同一实验的JSON与简报不是两轮;新生成、旧候选离线重放、准备快照及失败未完成记录分别标明。下方另列16份早期测试/工程验收报告,避免因文件名前缀遗漏。 +本节REQ-028–058历史部分覆盖当时所有 `accuracy-*.json` 与 `benchmark-*` 正式报告、准备清单和同名简报:**40份JSON+15份Markdown,共55个文件**(含1份早期运行文档重建汇总);后续REQ-064–066材料单列追加,不回写历史计数。同一实验的JSON与简报不是两轮;新生成、旧候选离线重放、准备快照及失败未完成记录分别标明。下方另列16份早期测试/工程验收报告,避免因文件名前缀遗漏。 ### 公开报告与本地原始证据边界 -- 相对链接指向仓库报告或公开投影,不承诺其依赖的原始运行数据随仓库提供。公开处理规则、原件/公开副本SHA-256映射见 [报告公开说明](report-publication-2026-09-07.json);历史报告内的原始hash仍绑定原件,不能当作脱敏副本hash。 +- 相对链接指向仓库报告或公开投影,不承诺其依赖的原始运行数据随仓库提供。公开处理规则、原件/公开副本SHA-256映射见 [报告公开说明](archive/engineering/report-publication-2026-09-07.json);历史报告内的原始hash仍绑定原件,不能当作脱敏副本hash。 - `.forge/`、`artifact://`、`local://`、个人绝对路径及内部预览地址仅是维护者本地证据定位,不是公网下载链接或全新克隆可复现承诺。原候选、会话、日志、原始数据库与第三方数据集不随索引复制;不得为补齐链接而提交凭证或运行目录。 - 原报告审查发现个人工作目录路径及公共BIRD样本中的个人联系字段;公开来源不等于可直接再披露,公开投影与原件分开核对。未检出实际密钥不等于完成独立安全认证;数据来源、许可与脱敏边界以公开说明为准。 - 结果口径遵循 [Benchmark标准](benchmarks.md):EX/Contract分开,Gold阻塞保留未知与完整分母,未派发不伪装成有效候选;已知tokens不是含未知usage的完整成本,也不是结算金额。表内请求/派发遵循原报告计数,不替代独立Provider HTTP实测。 @@ -68,7 +90,7 @@ ### REQ-028–033 早期运行记录 -汇总入口:[早期逐轮汇总 JSON](benchmark-historical-runs-2026-09-07.json) 仅从 [需求池](requirements-pool.md)、[Benchmark说明](benchmarks.md) 和 [当前状态](current-project-state.md) 重建历史记录,**不是新复测或原始运行导出**。保留已知Run ID、来源、离线/新生成边界;缺失分数、用量与Run ID为null,不访问本地数据库补造。 +汇总入口:[早期逐轮汇总 JSON](archive/benchmarks/benchmark-historical-runs-2026-09-07.json) 仅从 [需求池](requirements-pool.md)、[Benchmark说明](benchmarks.md) 和 [当前状态](current-project-state.md) 重建历史记录,**不是新复测或原始运行导出**。保留已知Run ID、来源、离线/新生成边界;缺失分数、用量与Run ID为null,不访问本地数据库补造。 | 需求 | 证据类别与保留结论 | |---|---| @@ -85,47 +107,59 @@ REQ-035为规划;REQ-042/043为目标与方向讨论,不是遗漏的模型 | 需求 | 报告文件 | 类别 | 结果与限制(报告时点) | |---|---|---|---| -| REQ-034 | [`benchmark-sol-error-triage-2026-09-05.json`](benchmark-sol-error-triage-2026-09-05.json) | 旧候选离线归因 | 209题、373失败臂;Agent初判而非人审裁决或纠正后准确率。 | -| REQ-036 | [`benchmark-sol-metric-replay-2026-09-05.json`](benchmark-sol-metric-replay-2026-09-05.json) | 旧候选离线重评 | Official EA仍313/500 vs314/500;Contract v2为284/500 vs294/500,只是评价器纠错。 | -| REQ-036 | [`accuracy-evaluation-cohorts-2026-09-05.json`](accuracy-evaluation-cohorts-2026-09-05.json) | 冻结清单/准备 | D50/R500/S27冻结;H/P未就绪,独立审核门禁未完成。 | -| REQ-037 | [`accuracy-holdout-source-audit-2026-09-05.json`](accuracy-holdout-source-audit-2026-09-05.json) | 离线来源审计/准备 | 1011条候选池不等于H;最终H样本0,标签和独立审核未就绪。 | -| REQ-037 | [`accuracy-metadata-treatment-audit-2026-09-05.json`](accuracy-metadata-treatment-audit-2026-09-05.json) | 离线假设审计 | format+PK对D16没有新增有效取值证据,不运行该假设。 | -| REQ-037 | [`accuracy-metadata-binding-fix-2026-09-05.json`](accuracy-metadata-binding-fix-2026-09-05.json) | 离线输入修复 | 恢复48列已有元数据;新生成0,不宣称准确率收益。 | -| REQ-037 | [`accuracy-csv-binding-experiment-card-2026-09-05.json`](accuracy-csv-binding-experiment-card-2026-09-05.json) | 实验卡/已回填诊断 | 保留准备与授权历史;22请求、20候选,诊断未晋级,不重复计作一轮。 | -| REQ-037 | [`benchmark-luna-binding-2026-09-05.json`](benchmark-luna-binding-2026-09-05.json) | 新生成/负结果 | 22请求含2次参数拒绝;Forge 3/5→2/5、Direct 3/5→3/5;有效生成tokens 28611→38709。 | -| REQ-038 | [`benchmark-luna-strict-output-2026-09-05.json`](benchmark-luna-strict-output-2026-09-05.json) | 新生成 canary | 2次Luna请求验证strict协议链路;不是准确率提升或跨Provider证明。 | -| REQ-039 | [`benchmark-luna-alias-fix-2026-09-05.json`](benchmark-luna-alias-fix-2026-09-05.json) | 旧候选离线维护 | 新生成0;仅处理组md-052 Forge恢复,处理组2/5→3/5;不重写旧成绩。 | -| REQ-040 | [`benchmark-luna-strict-paired-2026-09-05.json`](benchmark-luna-strict-paired-2026-09-05.json) | 新生成+原响应恢复 | 20请求;Forge 2/5→3/5、Direct 3/5→3/5;保留栈溢出、3819 tokens原响应恢复及Assurance拒绝,无补跑。 | -| REQ-041 | [`benchmark-luna-expanded-regression-2026-09-05.json`](benchmark-luna-expanded-regression-2026-09-05.json) | 新生成扩展回归 | 20请求、81030 tokens;Forge EA6/10、Contract5/10,Direct均7/10;无旧配置对照或泛化结论。 | -| REQ-044 | [`benchmark-luna-projection-instructions-2026-09-05.json`](benchmark-luna-projection-instructions-2026-09-05.json) | 新生成/不采用 | 20请求、72546 tokens;Forge 4/5→4/5、Direct 4/5→5/5;候选Prompt不采用。 | -| REQ-045 | [`benchmark-standards-engineering-2026-09-05.json`](benchmark-standards-engineering-2026-09-05.json) | 离线工程验证 | 新生成0;CLI/协议与十个旧候选重放,不是新准确率成绩。 | -| REQ-045 | [`benchmark-luna-standard-d20-2026-09-05.json`](benchmark-luna-standard-d20-2026-09-05.json) | 新生成/失败未完成 | 40派发、39候选;1次超时usage未知,已知149300 tokens非完整总量;md-340 Gold阻塞,不发布正式准确率。 | -| REQ-046 | [`benchmark-luna-mixed-d20-2026-09-05.json`](benchmark-luna-mixed-d20-2026-09-05.json) · [简报](benchmark-luna-mixed-d20-2026-09-05.md) | 新生成 seed43/评分不完整 | 38派发/38候选、139490 tokens;md-340留20题分母零调用,Gold未知,run failed。 | -| REQ-046 | [`benchmark-luna-mixed-d20-seed44-2026-09-05.json`](benchmark-luna-mixed-d20-seed44-2026-09-05.json) · [简报](benchmark-luna-mixed-d20-seed44-2026-09-05.md) | 新生成 seed44/评分不完整 | 38派发/38候选、134585 tokens;Gold阻塞;延续题两臂EX无净增,恢复与回退并存。 | -| REQ-046 | [`benchmark-luna-mixed-d20-seed45-2026-09-05.json`](benchmark-luna-mixed-d20-seed45-2026-09-05.json) · [简报](benchmark-luna-mixed-d20-seed45-2026-09-05.md) | 新生成 seed45/评分不完整 | 38派发/38候选、137028 tokens;Gold阻塞;同配置再生成,不是优化因果。 | -| REQ-046 | [`benchmark-luna-offline-triage-2026-09-05.json`](benchmark-luna-offline-triage-2026-09-05.json) · [简报](benchmark-luna-offline-triage-2026-09-05.md) | 旧候选离线归因 | 17延续题含1题Gold阻塞;不是纠正后准确率,部分归因由REQ-047后续复核收紧。 | -| REQ-047 | [`benchmark-luna-date-context-2026-09-05.json`](benchmark-luna-date-context-2026-09-05.json) · [简报](benchmark-luna-date-context-2026-09-05.md) | 新生成/门槛失败 | 20请求、73565 tokens;Forge 2/5→3/5、Direct 3/5→3/5;新增通过无日期补充,不计日期收益,默认off。 | -| REQ-047 | [`benchmark-luna-output-contract-review-2026-09-06.json`](benchmark-luna-output-contract-review-2026-09-06.json) · [简报](benchmark-luna-output-contract-review-2026-09-06.md) | 旧候选离线契约复核 | 新生成0;粒度提示不等于业务确认,Gold范围/表示差异保留;不改历史评分。 | -| REQ-046 | [`benchmark-luna-mixed-d20-seed46-2026-09-06.json`](benchmark-luna-mixed-d20-seed46-2026-09-06.json) · [简报](benchmark-luna-mixed-d20-seed46-2026-09-06.md) | 新生成 seed46/评分不完整 | 38派发/38候选、136237 tokens;Gold阻塞,Direct出现回退,不是完整基线。 | -| REQ-048 | [`benchmark-luna-grain-context-preparation-2026-09-06.json`](benchmark-luna-grain-context-preparation-2026-09-06.json) | 准备快照 | 新生成0;冻结两条件,准备状态不等于已完成实验;后续执行另列。 | -| REQ-048 | [`benchmark-luna-grain-context-2026-09-06.json`](benchmark-luna-grain-context-2026-09-06.json) · [简报](benchmark-luna-grain-context-2026-09-06.md) | 新生成/配对未完成 | 授权76,实际52派发/48候选、24臂未派发;已知172108 tokens+4次未知;共同有效5题无增益,Gold阻塞保留。 | -| REQ-048 | [`benchmark-luna-grain-maintenance-2026-09-06.json`](benchmark-luna-grain-maintenance-2026-09-06.json) | 旧候选离线维护 | 新生成0;修复未派发/未评分状态及失败证据保存,80臂重放;不回填旧未知usage。 | -| REQ-049 | [`benchmark-luna-scalar-cte-fix-2026-09-06.json`](benchmark-luna-scalar-cte-fix-2026-09-06.json) | 旧候选离线Compiler维护 | 新生成0;原md-199 Forge候选从超时恢复,其他79臂不变;不是新生成准确率收益。 | -| REQ-046 | [`benchmark-luna-mixed-d20-seed48-2026-09-06.json`](benchmark-luna-mixed-d20-seed48-2026-09-06.json) · [简报](benchmark-luna-mixed-d20-seed48-2026-09-06.md) | 新生成 seed48/失败未完成 | 授权38,实际32派发/30候选、6臂未启动;已知107160 tokens+2次未知;Gold阻塞,不补跑或回填。 | -| REQ-050 | [`benchmark-luna-cancellation-evidence-fix-2026-09-06.json`](benchmark-luna-cancellation-evidence-fix-2026-09-06.json) | 离线运行时维护 | 新生成0;修复取消终止证据竞态,保留超时/零重试/失败评分;不恢复旧未知usage。 | -| REQ-051 | [`benchmark-luna-generation-stages-2026-09-06.json`](benchmark-luna-generation-stages-2026-09-06.json) · [简报](benchmark-luna-generation-stages-2026-09-06.md) | 新生成定向诊断 | 4请求、19831 tokens;均可执行但EX/Contract 0/4,未复现旧超时,不宣称时延改善。 | -| REQ-052 | [`benchmark-luna-cte-binding-fix-2026-09-06.json`](benchmark-luna-cte-binding-fix-2026-09-06.json) · [简报](benchmark-luna-cte-binding-fix-2026-09-06.md) | 旧候选离线Compiler/Assurance维护 | 新生成0;合法CTE绑定与漏字段拒绝修复;原候选评分不变,不自动补列。 | -| REQ-053 | [`benchmark-r500-v8-binding-audit-2026-09-06.json`](benchmark-r500-v8-binding-audit-2026-09-06.json) · [简报](benchmark-r500-v8-binding-audit-2026-09-06.md) | 旧候选离线R500诊断/不完整 | 1000旧候选、996臂可评分;md-340/md-393两臂Gold超时,已评分无对错转换;不覆盖旧313/314或晋级完整可比成绩。 | -| REQ-054 | [`benchmark-luna-value-context-ready-2026-09-06.json`](benchmark-luna-value-context-ready-2026-09-06.json) · [简报](benchmark-luna-value-context-ready-2026-09-06.md) | 准备/离线实现 | 新生成0、默认off;准备时未授权的16次提案与后续获批结果分开,不改历史准备状态。 | -| REQ-054 | [`benchmark-luna-value-context-2026-09-06.json`](benchmark-luna-value-context-2026-09-06.json) · [简报](benchmark-luna-value-context-2026-09-06.md) | 新生成/门槛失败 | 16请求、35572 tokens、未知usage 0;Forge 2/4→3/4、Direct 3/4→4/4,目标3/4未达4/4,默认off。 | -| REQ-055 | [`benchmark-luna-from-scope-fix-2026-09-07.json`](benchmark-luna-from-scope-fix-2026-09-07.json) · [简报](benchmark-luna-from-scope-fix-2026-09-07.md) | 旧候选离线Assurance维护 | 新生成0;1016历史SQL仅新增拒绝漏FROM绑定臂,输出/SQL/EX/Contract不变;非准确率收益。 | -| REQ-056 | [`benchmark-denominator-scope-ready-2026-09-07.json`](benchmark-denominator-scope-ready-2026-09-07.json) | 准备快照 | 新生成0;16次提案待独立授权的历史快照,不等于实跑结果。 | -| REQ-056 | [`benchmark-luna-denominator-scope-2026-09-07.json`](benchmark-luna-denominator-scope-2026-09-07.json) | 新生成/门槛失败 | 16请求、53058 tokens、未知usage 0;Forge 2/4→3/4、Direct 2/4→2/4;正确对照回退,默认不启用。 | -| REQ-057 | [`benchmark-cte-expression-binding-fix-2026-09-07.json`](benchmark-cte-expression-binding-fix-2026-09-07.json) | 旧候选离线Compiler维护 | 新生成0;548候选五方言2740项编译不变,上一轮16候选评分不变,缺失别名仍拒绝;非生成收益。 | -| REQ-058 | [`benchmark-cte-interface-ready-2026-09-07.json`](benchmark-cte-interface-ready-2026-09-07.json) | 准备快照 | 新生成0;CTE接口范例与16次独立授权提案,保留准备时状态;不替代生成报告。 | -| REQ-058 | [`benchmark-luna-cte-interface-2026-09-07.json`](benchmark-luna-cte-interface-2026-09-07.json) | 新生成/门槛失败 | 16请求、67367 tokens、未知usage 0;Forge EX/Contract 3/4→3/4、Direct 3/4→2/4;目标/零回退及Forge每正确答案tokens、生成P95护栏失败,默认不启用。 | - -最新REQ-058:Forge目标一题恢复、一题回退,Direct输入不变仍发生回退,不能归因于Forge范例;处理总tokens +8.57%、Forge每正确答案tokens +13.11%、生成P95 +41.53%,后两项护栏失败。**默认不启用,不补跑、不扩样、不自动返修;历史滚动父Run仍seed48。** 准备快照与最终负结果均保留,不把16次开发对照视为新的完整基线。 +| REQ-034 | [`archive/benchmarks/benchmark-sol-error-triage-2026-09-05.json`](archive/benchmarks/benchmark-sol-error-triage-2026-09-05.json) | 旧候选离线归因 | 209题、373失败臂;Agent初判而非人审裁决或纠正后准确率。 | +| REQ-036 | [`archive/benchmarks/benchmark-sol-metric-replay-2026-09-05.json`](archive/benchmarks/benchmark-sol-metric-replay-2026-09-05.json) | 旧候选离线重评 | Official EA仍313/500 vs314/500;Contract v2为284/500 vs294/500,只是评价器纠错。 | +| REQ-036 | [`archive/benchmarks/accuracy-evaluation-cohorts-2026-09-05.json`](archive/benchmarks/accuracy-evaluation-cohorts-2026-09-05.json) | 冻结清单/准备 | D50/R500/S27冻结;H/P未就绪,独立审核门禁未完成。 | +| REQ-037 | [`archive/benchmarks/accuracy-holdout-source-audit-2026-09-05.json`](archive/benchmarks/accuracy-holdout-source-audit-2026-09-05.json) | 离线来源审计/准备 | 1011条候选池不等于H;最终H样本0,标签和独立审核未就绪。 | +| REQ-037 | [`archive/benchmarks/accuracy-metadata-treatment-audit-2026-09-05.json`](archive/benchmarks/accuracy-metadata-treatment-audit-2026-09-05.json) | 离线假设审计 | format+PK对D16没有新增有效取值证据,不运行该假设。 | +| REQ-037 | [`archive/benchmarks/accuracy-metadata-binding-fix-2026-09-05.json`](archive/benchmarks/accuracy-metadata-binding-fix-2026-09-05.json) | 离线输入修复 | 恢复48列已有元数据;新生成0,不宣称准确率收益。 | +| REQ-037 | [`archive/benchmarks/accuracy-csv-binding-experiment-card-2026-09-05.json`](archive/benchmarks/accuracy-csv-binding-experiment-card-2026-09-05.json) | 实验卡/已回填诊断 | 保留准备与授权历史;22请求、20候选,诊断未晋级,不重复计作一轮。 | +| REQ-037 | [`archive/benchmarks/benchmark-luna-binding-2026-09-05.json`](archive/benchmarks/benchmark-luna-binding-2026-09-05.json) | 新生成/负结果 | 22请求含2次参数拒绝;Forge 3/5→2/5、Direct 3/5→3/5;有效生成tokens 28611→38709。 | +| REQ-038 | [`archive/benchmarks/benchmark-luna-strict-output-2026-09-05.json`](archive/benchmarks/benchmark-luna-strict-output-2026-09-05.json) | 新生成 canary | 2次Luna请求验证strict协议链路;不是准确率提升或跨Provider证明。 | +| REQ-039 | [`archive/benchmarks/benchmark-luna-alias-fix-2026-09-05.json`](archive/benchmarks/benchmark-luna-alias-fix-2026-09-05.json) | 旧候选离线维护 | 新生成0;仅处理组md-052 Forge恢复,处理组2/5→3/5;不重写旧成绩。 | +| REQ-040 | [`archive/benchmarks/benchmark-luna-strict-paired-2026-09-05.json`](archive/benchmarks/benchmark-luna-strict-paired-2026-09-05.json) | 新生成+原响应恢复 | 20请求;Forge 2/5→3/5、Direct 3/5→3/5;保留栈溢出、3819 tokens原响应恢复及Assurance拒绝,无补跑。 | +| REQ-041 | [`archive/benchmarks/benchmark-luna-expanded-regression-2026-09-05.json`](archive/benchmarks/benchmark-luna-expanded-regression-2026-09-05.json) | 新生成扩展回归 | 20请求、81030 tokens;Forge EA6/10、Contract5/10,Direct均7/10;无旧配置对照或泛化结论。 | +| REQ-044 | [`archive/benchmarks/benchmark-luna-projection-instructions-2026-09-05.json`](archive/benchmarks/benchmark-luna-projection-instructions-2026-09-05.json) | 新生成/不采用 | 20请求、72546 tokens;Forge 4/5→4/5、Direct 4/5→5/5;候选Prompt不采用。 | +| REQ-045 | [`archive/benchmarks/benchmark-standards-engineering-2026-09-05.json`](archive/benchmarks/benchmark-standards-engineering-2026-09-05.json) | 离线工程验证 | 新生成0;CLI/协议与十个旧候选重放,不是新准确率成绩。 | +| REQ-045 | [`archive/benchmarks/benchmark-luna-standard-d20-2026-09-05.json`](archive/benchmarks/benchmark-luna-standard-d20-2026-09-05.json) | 新生成/失败未完成 | 40派发、39候选;1次超时usage未知,已知149300 tokens非完整总量;md-340 Gold阻塞,不发布正式准确率。 | +| REQ-046 | [`archive/benchmarks/benchmark-luna-mixed-d20-2026-09-05.json`](archive/benchmarks/benchmark-luna-mixed-d20-2026-09-05.json) · [简报](archive/benchmarks/benchmark-luna-mixed-d20-2026-09-05.md) | 新生成 seed43/评分不完整 | 38派发/38候选、139490 tokens;md-340留20题分母零调用,Gold未知,run failed。 | +| REQ-046 | [`archive/benchmarks/benchmark-luna-mixed-d20-seed44-2026-09-05.json`](archive/benchmarks/benchmark-luna-mixed-d20-seed44-2026-09-05.json) · [简报](archive/benchmarks/benchmark-luna-mixed-d20-seed44-2026-09-05.md) | 新生成 seed44/评分不完整 | 38派发/38候选、134585 tokens;Gold阻塞;延续题两臂EX无净增,恢复与回退并存。 | +| REQ-046 | [`archive/benchmarks/benchmark-luna-mixed-d20-seed45-2026-09-05.json`](archive/benchmarks/benchmark-luna-mixed-d20-seed45-2026-09-05.json) · [简报](archive/benchmarks/benchmark-luna-mixed-d20-seed45-2026-09-05.md) | 新生成 seed45/评分不完整 | 38派发/38候选、137028 tokens;Gold阻塞;同配置再生成,不是优化因果。 | +| REQ-046 | [`archive/benchmarks/benchmark-luna-offline-triage-2026-09-05.json`](archive/benchmarks/benchmark-luna-offline-triage-2026-09-05.json) · [简报](archive/benchmarks/benchmark-luna-offline-triage-2026-09-05.md) | 旧候选离线归因 | 17延续题含1题Gold阻塞;不是纠正后准确率,部分归因由REQ-047后续复核收紧。 | +| REQ-047 | [`archive/benchmarks/benchmark-luna-date-context-2026-09-05.json`](archive/benchmarks/benchmark-luna-date-context-2026-09-05.json) · [简报](archive/benchmarks/benchmark-luna-date-context-2026-09-05.md) | 新生成/门槛失败 | 20请求、73565 tokens;Forge 2/5→3/5、Direct 3/5→3/5;新增通过无日期补充,不计日期收益,默认off。 | +| REQ-047 | [`archive/benchmarks/benchmark-luna-output-contract-review-2026-09-06.json`](archive/benchmarks/benchmark-luna-output-contract-review-2026-09-06.json) · [简报](archive/benchmarks/benchmark-luna-output-contract-review-2026-09-06.md) | 旧候选离线契约复核 | 新生成0;粒度提示不等于业务确认,Gold范围/表示差异保留;不改历史评分。 | +| REQ-046 | [`archive/benchmarks/benchmark-luna-mixed-d20-seed46-2026-09-06.json`](archive/benchmarks/benchmark-luna-mixed-d20-seed46-2026-09-06.json) · [简报](archive/benchmarks/benchmark-luna-mixed-d20-seed46-2026-09-06.md) | 新生成 seed46/评分不完整 | 38派发/38候选、136237 tokens;Gold阻塞,Direct出现回退,不是完整基线。 | +| REQ-048 | [`archive/benchmarks/benchmark-luna-grain-context-preparation-2026-09-06.json`](archive/benchmarks/benchmark-luna-grain-context-preparation-2026-09-06.json) | 准备快照 | 新生成0;冻结两条件,准备状态不等于已完成实验;后续执行另列。 | +| REQ-048 | [`archive/benchmarks/benchmark-luna-grain-context-2026-09-06.json`](archive/benchmarks/benchmark-luna-grain-context-2026-09-06.json) · [简报](archive/benchmarks/benchmark-luna-grain-context-2026-09-06.md) | 新生成/配对未完成 | 授权76,实际52派发/48候选、24臂未派发;已知172108 tokens+4次未知;共同有效5题无增益,Gold阻塞保留。 | +| REQ-048 | [`archive/benchmarks/benchmark-luna-grain-maintenance-2026-09-06.json`](archive/benchmarks/benchmark-luna-grain-maintenance-2026-09-06.json) | 旧候选离线维护 | 新生成0;修复未派发/未评分状态及失败证据保存,80臂重放;不回填旧未知usage。 | +| REQ-049 | [`archive/benchmarks/benchmark-luna-scalar-cte-fix-2026-09-06.json`](archive/benchmarks/benchmark-luna-scalar-cte-fix-2026-09-06.json) | 旧候选离线Compiler维护 | 新生成0;原md-199 Forge候选从超时恢复,其他79臂不变;不是新生成准确率收益。 | +| REQ-046 | [`archive/benchmarks/benchmark-luna-mixed-d20-seed48-2026-09-06.json`](archive/benchmarks/benchmark-luna-mixed-d20-seed48-2026-09-06.json) · [简报](archive/benchmarks/benchmark-luna-mixed-d20-seed48-2026-09-06.md) | 新生成 seed48/失败未完成 | 授权38,实际32派发/30候选、6臂未启动;已知107160 tokens+2次未知;Gold阻塞,不补跑或回填。 | +| REQ-050 | [`archive/benchmarks/benchmark-luna-cancellation-evidence-fix-2026-09-06.json`](archive/benchmarks/benchmark-luna-cancellation-evidence-fix-2026-09-06.json) | 离线运行时维护 | 新生成0;修复取消终止证据竞态,保留超时/零重试/失败评分;不恢复旧未知usage。 | +| REQ-051 | [`archive/benchmarks/benchmark-luna-generation-stages-2026-09-06.json`](archive/benchmarks/benchmark-luna-generation-stages-2026-09-06.json) · [简报](archive/benchmarks/benchmark-luna-generation-stages-2026-09-06.md) | 新生成定向诊断 | 4请求、19831 tokens;均可执行但EX/Contract 0/4,未复现旧超时,不宣称时延改善。 | +| REQ-052 | [`archive/benchmarks/benchmark-luna-cte-binding-fix-2026-09-06.json`](archive/benchmarks/benchmark-luna-cte-binding-fix-2026-09-06.json) · [简报](archive/benchmarks/benchmark-luna-cte-binding-fix-2026-09-06.md) | 旧候选离线Compiler/Assurance维护 | 新生成0;合法CTE绑定与漏字段拒绝修复;原候选评分不变,不自动补列。 | +| REQ-053 | [`archive/benchmarks/benchmark-r500-v8-binding-audit-2026-09-06.json`](archive/benchmarks/benchmark-r500-v8-binding-audit-2026-09-06.json) · [简报](archive/benchmarks/benchmark-r500-v8-binding-audit-2026-09-06.md) | 旧候选离线R500诊断/不完整 | 1000旧候选、996臂可评分;md-340/md-393两臂Gold超时,已评分无对错转换;不覆盖旧313/314或晋级完整可比成绩。 | +| REQ-054 | [`archive/benchmarks/benchmark-luna-value-context-ready-2026-09-06.json`](archive/benchmarks/benchmark-luna-value-context-ready-2026-09-06.json) · [简报](archive/benchmarks/benchmark-luna-value-context-ready-2026-09-06.md) | 准备/离线实现 | 新生成0、默认off;准备时未授权的16次提案与后续获批结果分开,不改历史准备状态。 | +| REQ-054 | [`archive/benchmarks/benchmark-luna-value-context-2026-09-06.json`](archive/benchmarks/benchmark-luna-value-context-2026-09-06.json) · [简报](archive/benchmarks/benchmark-luna-value-context-2026-09-06.md) | 新生成/门槛失败 | 16请求、35572 tokens、未知usage 0;Forge 2/4→3/4、Direct 3/4→4/4,目标3/4未达4/4,默认off。 | +| REQ-055 | [`archive/benchmarks/benchmark-luna-from-scope-fix-2026-09-07.json`](archive/benchmarks/benchmark-luna-from-scope-fix-2026-09-07.json) · [简报](archive/benchmarks/benchmark-luna-from-scope-fix-2026-09-07.md) | 旧候选离线Assurance维护 | 新生成0;1016历史SQL仅新增拒绝漏FROM绑定臂,输出/SQL/EX/Contract不变;非准确率收益。 | +| REQ-056 | [`archive/benchmarks/benchmark-denominator-scope-ready-2026-09-07.json`](archive/benchmarks/benchmark-denominator-scope-ready-2026-09-07.json) | 准备快照 | 新生成0;16次提案待独立授权的历史快照,不等于实跑结果。 | +| REQ-056 | [`archive/benchmarks/benchmark-luna-denominator-scope-2026-09-07.json`](archive/benchmarks/benchmark-luna-denominator-scope-2026-09-07.json) | 新生成/门槛失败 | 16请求、53058 tokens、未知usage 0;Forge 2/4→3/4、Direct 2/4→2/4;正确对照回退,默认不启用。 | +| REQ-057 | [`archive/benchmarks/benchmark-cte-expression-binding-fix-2026-09-07.json`](archive/benchmarks/benchmark-cte-expression-binding-fix-2026-09-07.json) | 旧候选离线Compiler维护 | 新生成0;548候选五方言2740项编译不变,上一轮16候选评分不变,缺失别名仍拒绝;非生成收益。 | +| REQ-058 | [`archive/benchmarks/benchmark-cte-interface-ready-2026-09-07.json`](archive/benchmarks/benchmark-cte-interface-ready-2026-09-07.json) | 准备快照 | 新生成0;CTE接口范例与16次独立授权提案,保留准备时状态;不替代生成报告。 | +| REQ-058 | [`archive/benchmarks/benchmark-luna-cte-interface-2026-09-07.json`](archive/benchmarks/benchmark-luna-cte-interface-2026-09-07.json) | 新生成/门槛失败 | 16请求、67367 tokens、未知usage 0;Forge EX/Contract 3/4→3/4、Direct 3/4→2/4;目标/零回退及Forge每正确答案tokens、生成P95护栏失败,默认不启用。 | + +REQ-058当时结论:Forge目标一题恢复、一题回退,Direct输入不变仍发生回退,不能归因于Forge范例;处理总tokens +8.57%、Forge每正确答案tokens +13.11%、生成P95 +41.53%,后两项护栏失败。**默认不启用,不补跑、不扩样、不自动返修;历史滚动父Run仍seed48。** 准备快照与最终负结果均保留,不把16次开发对照视为新的完整基线。 + +### REQ-064 生成优化研究(不计新模型实验) + +- [调研与离线复算](archive/benchmarks/forge-json-generation-research-2026-09-08.json):旧500题配对统计、当前strict Schema说明/键序审计、500候选重排键的编译烟测及六项一手方法。新增模型/SQL/Gold执行均0;不是新EX或优化采用证据。 +- [原始需求与评估](requirements-pool.md#req-2026-09-08-064以超过direct-sql的ex为目标重评forge-json生成优化):优先单变量DSL说明,再研究答案规划;键序与有界返修分别验证,研究时64次开发设计仅为提案,后续准备及实跑见REQ-065。主动计划、H与R0.6不变;上方55份历史报告计数与负结果保留。 + +### REQ-065–066 关键DSL说明实验与限定样本里程碑 + +- [零调用准备卡](archive/benchmarks/benchmark-luna-schema-descriptions-ready-2026-09-08.json):默认off的五字段说明、v5跨语言冻结与严格比较;45项SQLite语义检查、500题默认输入、原候选/真实SDK合成HTTP闭环。当时真实生成未授权的历史状态保留,不替代后续实跑。 +- [64次真实ABBA报告](archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.json) · [技术简报](archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.md):8题各两重复,处理Forge EX/Contract12/16 vsDirect10/16,两重复各6/8 vs5/8;原响应/重放一致。无同一目标题稳定恢复且有控制回退,采用门槛未过,保持off。 +- [里程碑文案草稿](devlog/2026-09-08-forge-schema-descriptions-milestone.md):解释本轮五字段接口说明、局部得分突破及限制;未发布,不声称总体或历史首次优势。 +- [本次公开处理记录](archive/engineering/schema-descriptions-publication-2026-09-08.json):三份JSON的原件/公开副本hash与最小路径脱敏;原始SSE、状态库、凭据和数据集不入Git。用户仅授权当前分支commit/push,不发布版本。 ### 其他历史测试与工程验收报告 @@ -133,22 +167,33 @@ REQ-035为规划;REQ-042/043为目标与方向讨论,不是遗漏的模型 | 报告文件 | 范围与限制 | |---|---| -| [`benchmark_failure_analysis_2026-03-18.md`](benchmark_failure_analysis_2026-03-18.md) | 历史large 40题失败归因;不是BIRD或当前模型成绩。 | -| [`test-report-2026-05-05.md`](test-report-2026-05-05.md) | 历史DeepSeek两轮large 40题及API/E2E;GLM-5.1因余额不足未完成。 | -| [`test-report-2026-05-06.md`](test-report-2026-05-06.md) | 历史Method AF、40题×3次;EA(any)/EA(all)/Run ACC分开,不与BIRD单次协议比較。 | -| [`test-report-2026-07-13.md`](test-report-2026-07-13.md) | 历史Method AI、40题×3次120/120;不承诺开放世界100%正确。 | -| [`delivery-assessment-2026-05-07.md`](delivery-assessment-2026-05-07.md) | 历史受控交付评估;缺客户业务域等条件,不替代当前R0.6。 | -| [`chart-engine-bakeoff-2026-08-24.md`](chart-engine-bakeoff-2026-08-24.md) | 隔离图表引擎选型验证,不是生产Runtime批准。 | -| [`chart-storytelling-r0-evidence-2026-08-24.md`](chart-storytelling-r0-evidence-2026-08-24.md) | 自动门禁通过、用户视觉/交互门禁失败。 | -| [`chart-storytelling-echarts-focused-evidence-2026-08-24.md`](chart-storytelling-echarts-focused-evidence-2026-08-24.md) | 候选自动门禁通过,等待用户视觉/信息价值确认。 | -| [`golden-journey-acceptance-2026-08-24.md`](golden-journey-acceptance-2026-08-24.md) | 物理链路PASS、可信产品结果FAIL;仅桌面范围。 | -| [`golden-journey-p0-closure-2026-08-24.md`](golden-journey-p0-closure-2026-08-24.md) | 三项声明P0关闭;P1、移动端和丰富可视化不在结论内。 | -| [`web-product-shell-w3a-evidence-2026-08-24.md`](web-product-shell-w3a-evidence-2026-08-24.md) | 自动门禁PASS、用户IA/交互门禁待确认;隔离原型。 | -| [`product-spine-sp1-evidence-2026-08-25.md`](product-spine-sp1-evidence-2026-08-25.md) | SP1只读Product Projection历史验证。 | -| [`product-spine-sp2-evidence-2026-08-25.md`](product-spine-sp2-evidence-2026-08-25.md) | SP2 Product BFF与带scope的Report Index历史验证。 | -| [`product-spine-sp3-evidence-2026-08-25.md`](product-spine-sp3-evidence-2026-08-25.md) | SP3 Product Shell基础历史验证。 | -| [`product-spine-sp4-evidence-2026-08-25.md`](product-spine-sp4-evidence-2026-08-25.md) | SP4真实页面通过SP5入口,不替代完整采用验收。 | -| [`product-spine-sp5-evidence-2026-08-25.md`](product-spine-sp5-evidence-2026-08-25.md) | 自动化/真实链路PASS;用户Atlas CHANGE修复后仍待复验。 | +| [`archive/benchmarks/benchmark_failure_analysis_2026-03-18.md`](archive/benchmarks/benchmark_failure_analysis_2026-03-18.md) | 历史large 40题失败归因;不是BIRD或当前模型成绩。 | +| [`archive/engineering/test-report-2026-05-05.md`](archive/engineering/test-report-2026-05-05.md) | 历史DeepSeek两轮large 40题及API/E2E;GLM-5.1因余额不足未完成。 | +| [`archive/engineering/test-report-2026-05-06.md`](archive/engineering/test-report-2026-05-06.md) | 历史Method AF、40题×3次;EA(any)/EA(all)/Run ACC分开,不与BIRD单次协议比較。 | +| [`archive/engineering/test-report-2026-07-13.md`](archive/engineering/test-report-2026-07-13.md) | 历史Method AI、40题×3次120/120;不承诺开放世界100%正确。 | +| [`archive/engineering/delivery-assessment-2026-05-07.md`](archive/engineering/delivery-assessment-2026-05-07.md) | 历史受控交付评估;缺客户业务域等条件,不替代当前R0.6。 | +| [`archive/engineering/chart-engine-bakeoff-2026-08-24.md`](archive/engineering/chart-engine-bakeoff-2026-08-24.md) | 隔离图表引擎选型验证,不是生产Runtime批准。 | +| [`archive/engineering/chart-storytelling-r0-evidence-2026-08-24.md`](archive/engineering/chart-storytelling-r0-evidence-2026-08-24.md) | 自动门禁通过、用户视觉/交互门禁失败。 | +| [`archive/engineering/chart-storytelling-echarts-focused-evidence-2026-08-24.md`](archive/engineering/chart-storytelling-echarts-focused-evidence-2026-08-24.md) | 候选自动门禁通过,等待用户视觉/信息价值确认。 | +| [`archive/engineering/golden-journey-acceptance-2026-08-24.md`](archive/engineering/golden-journey-acceptance-2026-08-24.md) | 物理链路PASS、可信产品结果FAIL;仅桌面范围。 | +| [`archive/engineering/golden-journey-p0-closure-2026-08-24.md`](archive/engineering/golden-journey-p0-closure-2026-08-24.md) | 三项声明P0关闭;P1、移动端和丰富可视化不在结论内。 | +| [`archive/engineering/web-product-shell-w3a-evidence-2026-08-24.md`](archive/engineering/web-product-shell-w3a-evidence-2026-08-24.md) | 自动门禁PASS、用户IA/交互门禁待确认;隔离原型。 | +| [`archive/engineering/product-spine-sp1-evidence-2026-08-25.md`](archive/engineering/product-spine-sp1-evidence-2026-08-25.md) | SP1只读Product Projection历史验证。 | +| [`archive/engineering/product-spine-sp2-evidence-2026-08-25.md`](archive/engineering/product-spine-sp2-evidence-2026-08-25.md) | SP2 Product BFF与带scope的Report Index历史验证。 | +| [`archive/engineering/product-spine-sp3-evidence-2026-08-25.md`](archive/engineering/product-spine-sp3-evidence-2026-08-25.md) | SP3 Product Shell基础历史验证。 | +| [`archive/engineering/product-spine-sp4-evidence-2026-08-25.md`](archive/engineering/product-spine-sp4-evidence-2026-08-25.md) | SP4真实页面通过SP5入口,不替代完整采用验收。 | +| [`archive/engineering/product-spine-sp5-evidence-2026-08-25.md`](archive/engineering/product-spine-sp5-evidence-2026-08-25.md) | 自动化/真实链路PASS;用户Atlas CHANGE修复后仍待复验。 | + +### 历史产品与架构讨论 + +这些评审保留沟通中形成的约束、取舍和未完成条件,不以当时估计或批准范围替代当前状态: + +| 文档 | 保存价值与边界 | +|---|---| +| [产品方向与架构复审](archive/engineering/product-direction-architecture-review-2026-08-24.md) | 四平面框架与产品公理的评审依据;保留从判断到架构决策的过程。 | +| [目标差距重评估](archive/engineering/forge-goal-gap-assessment-2026-08-24.md) | 历史目标差距和优先级取舍;阶段百分比不是当前完成度、准确率或商业成功率。 | +| [Governance Contract正式评审](archive/engineering/governance-contract-review-2026-08-24.md) | Contract评审范围与威胁模型;当时只批准作为M1A提案输入,不批准实施或证明Runtime覆盖。 | +| [Web主体内容审计](archive/engineering/web-product-content-audit-2026-08-24.md) | 主体内容与宣传文案的判定依据及历史检查范围;版本化旧报告不原地重写。 | ## 维护规则 @@ -157,3 +202,8 @@ REQ-035为规划;REQ-042/043为目标与方向讨论,不是遗漏的模型 - 实施进度、验证结果和风险写回主动计划及当前状态页;不要堆进 `AGENTS.md`。 - 历史文档不删除;被替代时明确标记历史/已吸收/未批准。 - 测试数量、候选地址和临时工作区状态属于易变证据,不作为长期导航文案。 +- 结论应保留问题、条件/版本、证据出处、结果、限制,以及采纳或否决的理由;成功、负结果、未知和未完成均保留,不能只留下最佳数字。 +- 后续纠错或新实跑另记日期、依据及与原结论的关系;不回填历史成绩,不覆盖hash绑定的原始证据。可读提炼链接原报告,不能用总结替换原文。 +- 重要沟通按需求池既有模式追加原话、判断与明确授权;不能仅留在临时聊天或artifact链接中,也不把局部记录说成完整会话备份。 +- 代码重构、目录治理、方案被否决或新版本测试通过,都不是删除历史知识的理由。公开脱敏副本与受限原件分开,不因长期保留而复制凭证、客户数据或私有会话到公开仓库。 +- 本地落盘、Git提交与异地备份是不同事实。只有实际执行并核验后才能宣称相应状态;未经明确授权不commit、push、外传或迁移原始运行数据。 diff --git a/docs/agent-integration.md b/docs/agent-integration.md index 7606980..2da8b95 100644 --- a/docs/agent-integration.md +++ b/docs/agent-integration.md @@ -1,15 +1,49 @@ # 外部 Agent 集成边界 -Forge 可以作为企业数据查询工具暴露给外部 Agent,但第一版只开放 **prepare-query** 能力:生成可审核 SQL,不直接执行数据库。这个接口让 Forge 成为其他 Agent 的可信问数组件,而不是让外部 Agent 直接接触数据库。 +Forge 是既有 Agent 的可信数据执行层。已有 Direct SQL 或 Forge JSON 候选时,使用公共、版本化的 **Evaluate → Enforce → Explain** API;不要求先转成自然语言、Forge JSON 或接入 Pi。下方 `prepare-query` 是只生成待审核 SQL 的兼容入口,不代表当前公共 API 的全部能力。 -## 设计原则 +## 当前推荐接入路径 + +| 步骤 | 公共接口 | 执行与权限边界 | +|---|---|---| +| Evaluate | `POST /api/v1/evaluate` | 校验候选、Policy/Assurance及可选的预期/实际结果对;不执行SQL,`execution_authorized`恒为false。 | +| 创建受控运行 | `POST /api/v1/enforce/query-runs` | 校验Principal、Purpose、Resource Scope与可选Mandate,创建待审核QueryRun;不是执行许可。 | +| 回读审核材料 | `GET /api/v1/enforce/query-runs/{query_run_id}` | 使用创建凭证回读实际SQL、状态及绑定hash,不创建第二份运行状态。 | +| 人工批准 | `POST /api/v1/enforce/query-runs/{query_run_id}/approve` | 提交审核过的SQL、Assurance和Enforcement Context hashes及人工责任主体;服务端重新校验后才执行。 | +| Explain | `GET /api/v1/explain/query-runs/{query_run_id}` | 使用创建凭证读取同一QueryRun的Evidence、lineage、完整性与限制;只读,不新增执行权。 | + +候选使用[query-candidate-v1](../agent/contracts/query-candidate-v1.schema.json),Direct SQL与Forge JSON互斥。Enforce的完整输入、批准和返回形状分别见[请求契约](../agent/contracts/enforce-query-request-v1.schema.json)、[批准契约](../agent/contracts/enforce-query-approval-v1.schema.json)、[运行投影](../agent/contracts/enforce-query-response-v1.schema.json);Explain见[证据响应](../agent/contracts/explain-query-response-v1.schema.json)。运行服务的`/docs`列出实际HTTP输入及响应。 + +- 对外部署应启用认证,调用端使用`X-API-Key`。创建/回读凭证与配置在`ENFORCE_REVIEWER_API_KEYS`中的reviewer凭证分开;普通调用凭证不能自批。Reviewer凭证由可信人工审核端持有,不交给模型生成步骤。 +- Principal的认证上下文由服务端绑定到当前凭证。客户端填写Principal字段不等于完成企业身份认证;QueryRun回读和Explain继续校验创建凭证绑定。 +- 创建和批准均携带稳定的`Idempotency-Key`。遇到结果未知先回读运行,不换新key盲目重放审批/执行;`retryable`也不等于副作用重放授权。 +- 只读身份、执行开关、Registry/Policy/Assurance、SQL与审核有效期仍由Forge校验;任一适用条件不满足则失败关闭。Evaluate通过不能跳过Enforce,Evidence verified也不证明业务语义必然正确。 +- 外部Agent保留自身任务编排;Forge只持有受控QueryRun。不要使用内部Pi服务凭证,也不要在外部适配器中复制Forge的审批/执行状态机。 + +## 无模型的本地入口验证 + +在全新克隆中,按[README](../README.md)安装后运行: + +```bash +forge quickstart --workdir .forge/independent-run +``` + +Quickstart使用隔离合成SQLite,先证明写候选被拒绝,再完成只读候选的Evaluate、SQL人工审核、受控执行和Explain;不需要模型Key、Pi或已有数据库。其本地演示关闭认证,不能把该配置用于共享部署。自动化检查可显式使用`--yes --json`,但不把自动批准当作生产人工审核。 + +这验证的是现有公共API,不是某个外部Agent框架的适配器或外部采用证明。[#8](https://github.com/shisuidata/Forge/issues/8)的独立适配器仍未完成;未参与实现者的试跑/失败回执按[#9](https://github.com/shisuidata/Forge/issues/9)收集。维护者自己的烟测不关闭R0.6。 + +## 兼容入口:prepare-query + +以下约束只适用于`/api/prepare-query`:它接收自然语言,生成可审核SQL而不创建公共Enforce运行或直接执行数据库。需要从生成结果继续执行时,应作为新候选显式进入上面的公共Enforce审核链,不能直接送旧`/api/approve`。 + +### prepare-query 设计原则 - 外部 Agent 只能提交自然语言问题和可选上下文。 - Forge 返回 Forge JSON、编译后的 SQL、方言、Registry 版本和需要人工确认的状态。 - 数据库执行默认关闭;执行必须来自 Forge 内部审核流,并有审计记录。 - 外部 Agent 不接收数据库账号、API Key、Cookie 或完整客户敏感结果集。 -## prepare_query HTTP 契约 +### prepare-query HTTP 契约 Endpoint: @@ -57,11 +91,11 @@ POST /api/prepare-query `review_required` 在 v1 恒为 `true`,`can_execute` 在 v1 恒为 `false`。`dialect` 只允许 `auto / sqlite / postgresql / mysql / bigquery / snowflake`,省略时沿用 Forge 配置。 -`prepare_query` 不会创建可由 `/api/approve` 消费的 pending SQL。即使返回了 SQL,外部 Agent 也只能拿它进入自己的审核流,不能借 Forge 的 approve 接口直接执行。若未来需要执行,必须增加人工批准记录、用户身份、数据源权限、审计关联 ID 和部署级开关。 +`prepare_query` 不会创建可由 `/api/approve` 消费的 pending SQL。即使返回了 SQL,也不能借旧 approve 接口直接执行;公共 Enforce 是独立的显式请求,仍要求完整 Principal、Resource Scope、审核 hash 和部署级权限条件。 审计日志中,成功的 prepare-query 记录使用 `needs_external_review` 状态,而不是内部审核流的 `pending`。只有 Forge Web/飞书内部生成、可由 `/api/approve` 消费的 SQL 才能进入 `pending`。 -## 适用入口 +### prepare-query 适用入口 - MCP / Claude Desktop:作为只生成 SQL 的工具。 - OpenAI Agents / ChatGPT Apps:作为企业内网 Action,默认只返回待审核 SQL。 diff --git a/docs/architecture-course/11-evidence.md b/docs/architecture-course/11-evidence.md index 3d78396..73148d7 100644 --- a/docs/architecture-course/11-evidence.md +++ b/docs/architecture-course/11-evidence.md @@ -28,7 +28,7 @@ summary: 正确阅读 120/120、Spider2 与兼容性证据 - Run ACC:120/120; - 生成/编译失败:0/120。 -原始说明见[测试报告](https://github.com/shisuidata/Forge/blob/main/docs/test-report-2026-07-13.md)。 +原始说明见[测试报告](https://github.com/shisuidata/Forge/blob/main/docs/archive/engineering/test-report-2026-07-13.md)。 **正确解读**:当前代码、模型、Provider、Registry、规则和 40 题数据集组合在该次实验中全部通过。 @@ -83,7 +83,7 @@ Spider2-Lite SQLite 子集历史结果:编译成功率 97.6%,EA 9.2%。其 教材只集中维护证据卡,详细分类与历史演化链接到: - [基准测试总览](https://github.com/shisuidata/Forge/blob/main/docs/benchmarks.md) -- [最新 Method AI 报告](https://github.com/shisuidata/Forge/blob/main/docs/test-report-2026-07-13.md) +- [最新 Method AI 报告](https://github.com/shisuidata/Forge/blob/main/docs/archive/engineering/test-report-2026-07-13.md) - [兼容性矩阵](https://github.com/shisuidata/Forge/blob/main/docs/compatibility-matrix.md) 更新基准时,先更新原始报告,再更新证据卡和 README,避免多处数字漂移。 diff --git a/docs/architecture-course/12-labs.md b/docs/architecture-course/12-labs.md index 2ba7616..dd09467 100644 --- a/docs/architecture-course/12-labs.md +++ b/docs/architecture-course/12-labs.md @@ -186,7 +186,7 @@ pytest tests/test_compiler.py tests/test_compiler_extended.py tests/test_compile pytest tests/test_executor.py tests/test_lint.py -q ``` -阅读 `tests/text-to-sql-failures/`,将失败归为生成、业务或算法逻辑错误。 +阅读 `tools/benchmarks/text_to_sql_failures/`,将失败归为生成、业务或算法逻辑错误。 **练习**:编译测试全部通过,能否说明客户问数准确? diff --git a/docs/architecture.md b/docs/architecture.md index 4ee24ee..4759523 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,27 +1,23 @@ # Forge 架构总览 -> 本页是稳定入口。完整教材见 [`docs/architecture-course/`](architecture-course/index.md)。 +> 本页是当前架构的稳定入口(2026-09-07)。[`architecture-course/`](architecture-course/index.md) 保留早期 Agent/DSL 教材;其中旧调度图不是当前运行时真相。长期目标见 [`platform-architecture.md`](platform-architecture.md),产品边界见 [`product-north-star.md`](product-north-star.md)。 -Forge 是面向数据团队的**可信 AI 问数中间层与 Agent**。它把自然语言查询拆成可治理的链路,而不是让 LLM 直接连接数据库: +Forge 是 **Trust Runtime**:接收外部 Direct SQL 或 Forge JSON 候选,提供 Evaluate → Enforce → Explain。生成候选与授予执行权是两件事,Evaluate 可以独立采用而不接 Pi 或模型。 ```text -Web / 飞书 / 外部 API - → Agent(澄清、调度、重试) - → Registry + Schema RAG + WMB - → LLM Structured Output - → Forge JSON - → Lint + JSON Schema + 确定性 Compiler - → 待审核 SQL - → 用户确认 - → 只读 Executor(timeout / row cap) - → Result + Audit + Feedback + Memory +外部候选 / 本地 CLI ───────────────┐ + ▼ +Web / 飞书 → Pi Task / Attempt → Forge Trust Runtime + │ Evaluate:契约、编译、Assurance、结果比较;不执行 + │ Enforce:身份与 ACL 交集、Policy、不可变审批、只读执行 + └─ Artifact ◀──── Explain:同一 QueryRun 的 Evidence、血缘、完整性与限制 ``` -![Forge 当前系统上下文](architecture-course/assets/01-system-context.svg) +Pi 是多阶段 Task/Attempt/Artifact 的权威;Forge QueryRun 是受治理查询及审批/执行的权威。Web 是认证适配和只读投影,不另建一份 Task。Explain 的历史完整性验证不替代 Enforce 的当前授权。 ## 核心架构原则 -1. **意图与执行分离**:LLM 表达 Forge JSON,Compiler 负责 SQL 语法。 +1. **意图与执行分离**:候选可为 Direct SQL 或 Forge JSON;Compiler 只编译后者,不授予执行权。 2. **组织语义外置**:指标、歧义、字段约定和业务上下文进入 Registry。 3. **高风险动作由人决定**:SQL 与组织事实默认审核后执行/入库。 4. **数据库权限是最终边界**:应用层只读检查不能替代只读账号。 @@ -32,23 +28,25 @@ Web / 飞书 / 外部 API | 层 | 模块 | 职责 | |---|---|---| -| 入口 | `web/`, `agent/feishu.py` | Chat/Admin/API/飞书、认证与交互 | -| 调度 | `agent/agent.py` | Query/Define、澄清、重试、review state | -| 上下文 | `agent/llm.py`, `forge/retriever.py` | Registry、RAG、ACL 与 Provider 调用 | -| 中间表示 | `forge/schema.json`, `forge/schema_builder.py` | 静态 DSL 与动态 Tool Schema | -| 确定性核心 | `forge/compiler.py`, `forge/lint.py` | 校验、coerce、方言编译和规则检查 | -| 执行 | `forge/executor.py` | 只读校验、超时、结果上限与查询执行 | -| 知识 | `registry/`, `agent/memory/` | 组织知识、EMS/SMP/WMB 和记忆提炼 | -| 编排 | `agent/pipeline.py` | Query/Analyze/Visualize/Report Artifact 流 | -| 治理 | `agent/tenant.py`, `agent/audit.py` | team ACL、审计、反馈与回放 | -| 交付 | `forge/readiness.py`, `forge/poc.py` | dev/PoC/prod 门禁和交付证据 | +| 公共能力 | `forge/evaluate.py`, `forge/enforce.py`, `forge/explain.py` | Evaluate / Enforce / Explain;HTTP 适配在 `web/routes/` | +| 当前编排 | `services/pi-orchestrator/src/application.ts` | Task、Attempt、Artifact、取消/重试与阶段状态 | +| 查询真相 | `forge/query_runs.py`, `forge/executor.py` | 审批 hash、幂等、执行 lease、只读执行与结果 | +| 确定性核心 | `forge/compiler.py`, `forge/lint.py`, `forge/assurance.py` | 契约、规则、Registry/ACL 与编译 | +| 方言选择 | `forge/dialects.py` | 纯 requested/resolved/provenance 解析;调用者显式提供可信绑定 | +| Benchmark | `forge/bird_benchmark.py`, `forge/benchmark_service.py` | 冻结协议、离线 replay、context/评分;不依赖 Web DTO | +| 当前入口 | `main.py`, `web/routes/`, `web/pi_client.py` | Web/Pi 渠道、认证、投影和公共 Runtime API | +| Registry / 治理 | `registry/`, `forge/context.py`, `agent/tenant.py` | 权威结构、知识与 tenant ACL;scope 权限只能取交集 | +| 兼容能力 | `agent/agent.py`, `agent/pipeline.py`, `agent/memory/` | 旧 Query/Define、EMS/WMB、Pipeline;不是当前主编排 | +| 交付 | `forge/quickstart.py`, `forge/readiness.py`, `forge/poc.py` | 合成数据 Golden Path、部署门禁与证据 | ## 当前状态与目标状态 -- **已实现并有测试的主线**:查询/定义、DSL/Compiler、Registry、Retriever、审核执行、Audit/Feedback、Web/Admin、认证、Memory、team ACL 和 readiness。 -- **已有代码路径、仍需客户验收**:分析/可视化/报告 Pipeline、知识收集、多租户治理。 -- **兼容层级**:SQLite/PostgreSQL/MySQL 有 smoke 证据;BigQuery/Snowflake 主要是编译路径,不能等同完整执行支持。 -- **正式规模交付前重点**:客户域 accuracy suite、规则租户化、Registry 版本/回滚、企业权限和运维 runbook。 +- **Current**:Trust Runtime 公共接口、Pi 主 Task 链、QueryRun 审批/执行和 Product BFF。 +- **Legacy**:旧 `/api/chat`、`/api/approve`、`/api/cancel` 默认禁用,仅 `LEGACY_AGENT_API_ENABLED=true` 显式回滚;合法 Memory 管理与 prepare-only 能力仍保留。旧 Memory 存储按首次使用初始化,模块导入不连接旧数据库;logging 在 lifespan 配置,飞书 dispatcher 在收到 webhook 时按配置装配。 +- **Experimental / 目标**:企业横向平面与完整跨渠道部署不因已有类或接口就视为交付。长期图中的钉钉等能力按各自运行证据验收。 +- **方言契约**:Evaluate 不读取生产 URL。Direct 的省略/auto 仅选择 generic SQL parser,不声称已生成目标方言 SQL;Forge JSON 无可信绑定时返回 `dialect_required`,显式支持方言才编译。Enforce 显式传入受信配置/数据源绑定,记录来源而不记录 URL。 +- **分发**:wheel/sdist 声明 DSL Schema 与 Web 模板/静态资源,运行时以 `importlib.resources` 读取;生成 charts、数据库和私有配置不入包。CI 使用独立约束快照并在非源码 cwd 非 editable 安装后实际运行 import/CLI/合成 Quickstart,库依赖仍保留范围。 +- **兼容证据**:SQLite/PostgreSQL/MySQL 的既有 smoke 与 BigQuery/Snowflake 的编译支持分开,不等同生产认证。本次发行验证使用本地合成 SQLite,不调用模型或外部渠道。 ## 教材入口 diff --git a/docs/accuracy-csv-binding-experiment-card-2026-09-05.json b/docs/archive/benchmarks/accuracy-csv-binding-experiment-card-2026-09-05.json similarity index 100% rename from docs/accuracy-csv-binding-experiment-card-2026-09-05.json rename to docs/archive/benchmarks/accuracy-csv-binding-experiment-card-2026-09-05.json diff --git a/docs/accuracy-evaluation-cohorts-2026-09-05.json b/docs/archive/benchmarks/accuracy-evaluation-cohorts-2026-09-05.json similarity index 100% rename from docs/accuracy-evaluation-cohorts-2026-09-05.json rename to docs/archive/benchmarks/accuracy-evaluation-cohorts-2026-09-05.json diff --git a/docs/accuracy-holdout-source-audit-2026-09-05.json b/docs/archive/benchmarks/accuracy-holdout-source-audit-2026-09-05.json similarity index 100% rename from docs/accuracy-holdout-source-audit-2026-09-05.json rename to docs/archive/benchmarks/accuracy-holdout-source-audit-2026-09-05.json diff --git a/docs/accuracy-metadata-binding-fix-2026-09-05.json b/docs/archive/benchmarks/accuracy-metadata-binding-fix-2026-09-05.json similarity index 100% rename from docs/accuracy-metadata-binding-fix-2026-09-05.json rename to docs/archive/benchmarks/accuracy-metadata-binding-fix-2026-09-05.json diff --git a/docs/accuracy-metadata-treatment-audit-2026-09-05.json b/docs/archive/benchmarks/accuracy-metadata-treatment-audit-2026-09-05.json similarity index 100% rename from docs/accuracy-metadata-treatment-audit-2026-09-05.json rename to docs/archive/benchmarks/accuracy-metadata-treatment-audit-2026-09-05.json diff --git a/docs/benchmark-cte-expression-binding-fix-2026-09-07.json b/docs/archive/benchmarks/benchmark-cte-expression-binding-fix-2026-09-07.json similarity index 100% rename from docs/benchmark-cte-expression-binding-fix-2026-09-07.json rename to docs/archive/benchmarks/benchmark-cte-expression-binding-fix-2026-09-07.json diff --git a/docs/benchmark-cte-interface-ready-2026-09-07.json b/docs/archive/benchmarks/benchmark-cte-interface-ready-2026-09-07.json similarity index 100% rename from docs/benchmark-cte-interface-ready-2026-09-07.json rename to docs/archive/benchmarks/benchmark-cte-interface-ready-2026-09-07.json diff --git a/docs/benchmark-denominator-scope-ready-2026-09-07.json b/docs/archive/benchmarks/benchmark-denominator-scope-ready-2026-09-07.json similarity index 100% rename from docs/benchmark-denominator-scope-ready-2026-09-07.json rename to docs/archive/benchmarks/benchmark-denominator-scope-ready-2026-09-07.json diff --git a/docs/benchmark-historical-runs-2026-09-07.json b/docs/archive/benchmarks/benchmark-historical-runs-2026-09-07.json similarity index 100% rename from docs/benchmark-historical-runs-2026-09-07.json rename to docs/archive/benchmarks/benchmark-historical-runs-2026-09-07.json diff --git a/docs/benchmark-luna-alias-fix-2026-09-05.json b/docs/archive/benchmarks/benchmark-luna-alias-fix-2026-09-05.json similarity index 100% rename from docs/benchmark-luna-alias-fix-2026-09-05.json rename to docs/archive/benchmarks/benchmark-luna-alias-fix-2026-09-05.json diff --git a/docs/benchmark-luna-binding-2026-09-05.json b/docs/archive/benchmarks/benchmark-luna-binding-2026-09-05.json similarity index 100% rename from docs/benchmark-luna-binding-2026-09-05.json rename to docs/archive/benchmarks/benchmark-luna-binding-2026-09-05.json diff --git a/docs/benchmark-luna-cancellation-evidence-fix-2026-09-06.json b/docs/archive/benchmarks/benchmark-luna-cancellation-evidence-fix-2026-09-06.json similarity index 100% rename from docs/benchmark-luna-cancellation-evidence-fix-2026-09-06.json rename to docs/archive/benchmarks/benchmark-luna-cancellation-evidence-fix-2026-09-06.json diff --git a/docs/benchmark-luna-cte-binding-fix-2026-09-06.json b/docs/archive/benchmarks/benchmark-luna-cte-binding-fix-2026-09-06.json similarity index 100% rename from docs/benchmark-luna-cte-binding-fix-2026-09-06.json rename to docs/archive/benchmarks/benchmark-luna-cte-binding-fix-2026-09-06.json diff --git a/docs/benchmark-luna-cte-binding-fix-2026-09-06.md b/docs/archive/benchmarks/benchmark-luna-cte-binding-fix-2026-09-06.md similarity index 100% rename from docs/benchmark-luna-cte-binding-fix-2026-09-06.md rename to docs/archive/benchmarks/benchmark-luna-cte-binding-fix-2026-09-06.md diff --git a/docs/benchmark-luna-cte-interface-2026-09-07.json b/docs/archive/benchmarks/benchmark-luna-cte-interface-2026-09-07.json similarity index 100% rename from docs/benchmark-luna-cte-interface-2026-09-07.json rename to docs/archive/benchmarks/benchmark-luna-cte-interface-2026-09-07.json diff --git a/docs/benchmark-luna-date-context-2026-09-05.json b/docs/archive/benchmarks/benchmark-luna-date-context-2026-09-05.json similarity index 100% rename from docs/benchmark-luna-date-context-2026-09-05.json rename to docs/archive/benchmarks/benchmark-luna-date-context-2026-09-05.json diff --git a/docs/benchmark-luna-date-context-2026-09-05.md b/docs/archive/benchmarks/benchmark-luna-date-context-2026-09-05.md similarity index 100% rename from docs/benchmark-luna-date-context-2026-09-05.md rename to docs/archive/benchmarks/benchmark-luna-date-context-2026-09-05.md diff --git a/docs/benchmark-luna-denominator-scope-2026-09-07.json b/docs/archive/benchmarks/benchmark-luna-denominator-scope-2026-09-07.json similarity index 100% rename from docs/benchmark-luna-denominator-scope-2026-09-07.json rename to docs/archive/benchmarks/benchmark-luna-denominator-scope-2026-09-07.json diff --git a/docs/benchmark-luna-expanded-regression-2026-09-05.json b/docs/archive/benchmarks/benchmark-luna-expanded-regression-2026-09-05.json similarity index 100% rename from docs/benchmark-luna-expanded-regression-2026-09-05.json rename to docs/archive/benchmarks/benchmark-luna-expanded-regression-2026-09-05.json diff --git a/docs/benchmark-luna-from-scope-fix-2026-09-07.json b/docs/archive/benchmarks/benchmark-luna-from-scope-fix-2026-09-07.json similarity index 100% rename from docs/benchmark-luna-from-scope-fix-2026-09-07.json rename to docs/archive/benchmarks/benchmark-luna-from-scope-fix-2026-09-07.json diff --git a/docs/benchmark-luna-from-scope-fix-2026-09-07.md b/docs/archive/benchmarks/benchmark-luna-from-scope-fix-2026-09-07.md similarity index 100% rename from docs/benchmark-luna-from-scope-fix-2026-09-07.md rename to docs/archive/benchmarks/benchmark-luna-from-scope-fix-2026-09-07.md diff --git a/docs/benchmark-luna-generation-stages-2026-09-06.json b/docs/archive/benchmarks/benchmark-luna-generation-stages-2026-09-06.json similarity index 100% rename from docs/benchmark-luna-generation-stages-2026-09-06.json rename to docs/archive/benchmarks/benchmark-luna-generation-stages-2026-09-06.json diff --git a/docs/benchmark-luna-generation-stages-2026-09-06.md b/docs/archive/benchmarks/benchmark-luna-generation-stages-2026-09-06.md similarity index 100% rename from docs/benchmark-luna-generation-stages-2026-09-06.md rename to docs/archive/benchmarks/benchmark-luna-generation-stages-2026-09-06.md diff --git a/docs/benchmark-luna-grain-context-2026-09-06.json b/docs/archive/benchmarks/benchmark-luna-grain-context-2026-09-06.json similarity index 100% rename from docs/benchmark-luna-grain-context-2026-09-06.json rename to docs/archive/benchmarks/benchmark-luna-grain-context-2026-09-06.json diff --git a/docs/benchmark-luna-grain-context-2026-09-06.md b/docs/archive/benchmarks/benchmark-luna-grain-context-2026-09-06.md similarity index 100% rename from docs/benchmark-luna-grain-context-2026-09-06.md rename to docs/archive/benchmarks/benchmark-luna-grain-context-2026-09-06.md diff --git a/docs/benchmark-luna-grain-context-preparation-2026-09-06.json b/docs/archive/benchmarks/benchmark-luna-grain-context-preparation-2026-09-06.json similarity index 100% rename from docs/benchmark-luna-grain-context-preparation-2026-09-06.json rename to docs/archive/benchmarks/benchmark-luna-grain-context-preparation-2026-09-06.json diff --git a/docs/benchmark-luna-grain-maintenance-2026-09-06.json b/docs/archive/benchmarks/benchmark-luna-grain-maintenance-2026-09-06.json similarity index 100% rename from docs/benchmark-luna-grain-maintenance-2026-09-06.json rename to docs/archive/benchmarks/benchmark-luna-grain-maintenance-2026-09-06.json diff --git a/docs/benchmark-luna-mixed-d20-2026-09-05.json b/docs/archive/benchmarks/benchmark-luna-mixed-d20-2026-09-05.json similarity index 100% rename from docs/benchmark-luna-mixed-d20-2026-09-05.json rename to docs/archive/benchmarks/benchmark-luna-mixed-d20-2026-09-05.json diff --git a/docs/benchmark-luna-mixed-d20-2026-09-05.md b/docs/archive/benchmarks/benchmark-luna-mixed-d20-2026-09-05.md similarity index 100% rename from docs/benchmark-luna-mixed-d20-2026-09-05.md rename to docs/archive/benchmarks/benchmark-luna-mixed-d20-2026-09-05.md diff --git a/docs/benchmark-luna-mixed-d20-seed44-2026-09-05.json b/docs/archive/benchmarks/benchmark-luna-mixed-d20-seed44-2026-09-05.json similarity index 100% rename from docs/benchmark-luna-mixed-d20-seed44-2026-09-05.json rename to docs/archive/benchmarks/benchmark-luna-mixed-d20-seed44-2026-09-05.json diff --git a/docs/benchmark-luna-mixed-d20-seed44-2026-09-05.md b/docs/archive/benchmarks/benchmark-luna-mixed-d20-seed44-2026-09-05.md similarity index 100% rename from docs/benchmark-luna-mixed-d20-seed44-2026-09-05.md rename to docs/archive/benchmarks/benchmark-luna-mixed-d20-seed44-2026-09-05.md diff --git a/docs/benchmark-luna-mixed-d20-seed45-2026-09-05.json b/docs/archive/benchmarks/benchmark-luna-mixed-d20-seed45-2026-09-05.json similarity index 100% rename from docs/benchmark-luna-mixed-d20-seed45-2026-09-05.json rename to docs/archive/benchmarks/benchmark-luna-mixed-d20-seed45-2026-09-05.json diff --git a/docs/benchmark-luna-mixed-d20-seed45-2026-09-05.md b/docs/archive/benchmarks/benchmark-luna-mixed-d20-seed45-2026-09-05.md similarity index 100% rename from docs/benchmark-luna-mixed-d20-seed45-2026-09-05.md rename to docs/archive/benchmarks/benchmark-luna-mixed-d20-seed45-2026-09-05.md diff --git a/docs/benchmark-luna-mixed-d20-seed46-2026-09-06.json b/docs/archive/benchmarks/benchmark-luna-mixed-d20-seed46-2026-09-06.json similarity index 100% rename from docs/benchmark-luna-mixed-d20-seed46-2026-09-06.json rename to docs/archive/benchmarks/benchmark-luna-mixed-d20-seed46-2026-09-06.json diff --git a/docs/benchmark-luna-mixed-d20-seed46-2026-09-06.md b/docs/archive/benchmarks/benchmark-luna-mixed-d20-seed46-2026-09-06.md similarity index 100% rename from docs/benchmark-luna-mixed-d20-seed46-2026-09-06.md rename to docs/archive/benchmarks/benchmark-luna-mixed-d20-seed46-2026-09-06.md diff --git a/docs/benchmark-luna-mixed-d20-seed48-2026-09-06.json b/docs/archive/benchmarks/benchmark-luna-mixed-d20-seed48-2026-09-06.json similarity index 100% rename from docs/benchmark-luna-mixed-d20-seed48-2026-09-06.json rename to docs/archive/benchmarks/benchmark-luna-mixed-d20-seed48-2026-09-06.json diff --git a/docs/benchmark-luna-mixed-d20-seed48-2026-09-06.md b/docs/archive/benchmarks/benchmark-luna-mixed-d20-seed48-2026-09-06.md similarity index 100% rename from docs/benchmark-luna-mixed-d20-seed48-2026-09-06.md rename to docs/archive/benchmarks/benchmark-luna-mixed-d20-seed48-2026-09-06.md diff --git a/docs/benchmark-luna-offline-triage-2026-09-05.json b/docs/archive/benchmarks/benchmark-luna-offline-triage-2026-09-05.json similarity index 100% rename from docs/benchmark-luna-offline-triage-2026-09-05.json rename to docs/archive/benchmarks/benchmark-luna-offline-triage-2026-09-05.json diff --git a/docs/benchmark-luna-offline-triage-2026-09-05.md b/docs/archive/benchmarks/benchmark-luna-offline-triage-2026-09-05.md similarity index 100% rename from docs/benchmark-luna-offline-triage-2026-09-05.md rename to docs/archive/benchmarks/benchmark-luna-offline-triage-2026-09-05.md diff --git a/docs/benchmark-luna-output-contract-review-2026-09-06.json b/docs/archive/benchmarks/benchmark-luna-output-contract-review-2026-09-06.json similarity index 100% rename from docs/benchmark-luna-output-contract-review-2026-09-06.json rename to docs/archive/benchmarks/benchmark-luna-output-contract-review-2026-09-06.json diff --git a/docs/benchmark-luna-output-contract-review-2026-09-06.md b/docs/archive/benchmarks/benchmark-luna-output-contract-review-2026-09-06.md similarity index 100% rename from docs/benchmark-luna-output-contract-review-2026-09-06.md rename to docs/archive/benchmarks/benchmark-luna-output-contract-review-2026-09-06.md diff --git a/docs/benchmark-luna-projection-instructions-2026-09-05.json b/docs/archive/benchmarks/benchmark-luna-projection-instructions-2026-09-05.json similarity index 100% rename from docs/benchmark-luna-projection-instructions-2026-09-05.json rename to docs/archive/benchmarks/benchmark-luna-projection-instructions-2026-09-05.json diff --git a/docs/benchmark-luna-scalar-cte-fix-2026-09-06.json b/docs/archive/benchmarks/benchmark-luna-scalar-cte-fix-2026-09-06.json similarity index 100% rename from docs/benchmark-luna-scalar-cte-fix-2026-09-06.json rename to docs/archive/benchmarks/benchmark-luna-scalar-cte-fix-2026-09-06.json diff --git a/docs/archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.json b/docs/archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.json new file mode 100644 index 0000000..0c41eab --- /dev/null +++ b/docs/archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.json @@ -0,0 +1,841 @@ +{ + "schema_version": "benchmark-luna-schema-descriptions-result-v1", + "task_id": "Forge-20260908-02", + "requirement": "REQ-2026-09-08-065", + "at": "2026-09-08T02:14:37.395314+00:00", + "summaries": { + "A1": { + "forge": { + "official_ea": { + "correct": 5, + "failed": 3, + "unknown": 0, + "observed_denominator": 8 + }, + "contract_accuracy": { + "correct": 5, + "failed": 3, + "unknown": 0, + "observed_denominator": 8 + }, + "total_tokens": 35236, + "unknown_usage": 0, + "generation_p95_ms": 14027.8, + "execution_passed": 7, + "tokens_per_ex_correct": 7047.2 + }, + "direct": { + "official_ea": { + "correct": 5, + "failed": 3, + "unknown": 0, + "observed_denominator": 8 + }, + "contract_accuracy": { + "correct": 5, + "failed": 3, + "unknown": 0, + "observed_denominator": 8 + }, + "total_tokens": 19074, + "unknown_usage": 0, + "generation_p95_ms": 12737.2, + "execution_passed": 8, + "tokens_per_ex_correct": 3814.8 + } + }, + "B1": { + "forge": { + "official_ea": { + "correct": 6, + "failed": 2, + "unknown": 0, + "observed_denominator": 8 + }, + "contract_accuracy": { + "correct": 6, + "failed": 2, + "unknown": 0, + "observed_denominator": 8 + }, + "total_tokens": 37853, + "unknown_usage": 0, + "generation_p95_ms": 19614.3, + "execution_passed": 8, + "tokens_per_ex_correct": 6308.833333333333 + }, + "direct": { + "official_ea": { + "correct": 5, + "failed": 3, + "unknown": 0, + "observed_denominator": 8 + }, + "contract_accuracy": { + "correct": 5, + "failed": 3, + "unknown": 0, + "observed_denominator": 8 + }, + "total_tokens": 18925, + "unknown_usage": 0, + "generation_p95_ms": 14857.5, + "execution_passed": 8, + "tokens_per_ex_correct": 3785.0 + } + }, + "B2": { + "forge": { + "official_ea": { + "correct": 6, + "failed": 2, + "unknown": 0, + "observed_denominator": 8 + }, + "contract_accuracy": { + "correct": 6, + "failed": 2, + "unknown": 0, + "observed_denominator": 8 + }, + "total_tokens": 37398, + "unknown_usage": 0, + "generation_p95_ms": 17137.7, + "execution_passed": 8, + "tokens_per_ex_correct": 6233.0 + }, + "direct": { + "official_ea": { + "correct": 5, + "failed": 3, + "unknown": 0, + "observed_denominator": 8 + }, + "contract_accuracy": { + "correct": 5, + "failed": 3, + "unknown": 0, + "observed_denominator": 8 + }, + "total_tokens": 18684, + "unknown_usage": 0, + "generation_p95_ms": 12778, + "execution_passed": 8, + "tokens_per_ex_correct": 3736.8 + } + }, + "A2": { + "forge": { + "official_ea": { + "correct": 5, + "failed": 3, + "unknown": 0, + "observed_denominator": 8 + }, + "contract_accuracy": { + "correct": 5, + "failed": 3, + "unknown": 0, + "observed_denominator": 8 + }, + "total_tokens": 35808, + "unknown_usage": 0, + "generation_p95_ms": 20737.9, + "execution_passed": 6, + "tokens_per_ex_correct": 7161.6 + }, + "direct": { + "official_ea": { + "correct": 5, + "failed": 3, + "unknown": 0, + "observed_denominator": 8 + }, + "contract_accuracy": { + "correct": 5, + "failed": 3, + "unknown": 0, + "observed_denominator": 8 + }, + "total_tokens": 19037, + "unknown_usage": 0, + "generation_p95_ms": 11284.5, + "execution_passed": 8, + "tokens_per_ex_correct": 3807.4 + } + } + }, + "combined": { + "A": { + "forge": { + "official_ea": { + "correct": 10, + "failed": 6, + "unknown": 0, + "observed_denominator": 16 + }, + "contract_accuracy": { + "correct": 10, + "failed": 6, + "unknown": 0, + "observed_denominator": 16 + }, + "total_tokens": 71044, + "unknown_usage": 0, + "generation_p95_ms": 20737.9, + "execution_passed": 13, + "tokens_per_ex_correct": 7104.4 + }, + "direct": { + "official_ea": { + "correct": 10, + "failed": 6, + "unknown": 0, + "observed_denominator": 16 + }, + "contract_accuracy": { + "correct": 10, + "failed": 6, + "unknown": 0, + "observed_denominator": 16 + }, + "total_tokens": 38111, + "unknown_usage": 0, + "generation_p95_ms": 12737.2, + "execution_passed": 16, + "tokens_per_ex_correct": 3811.1 + } + }, + "B": { + "forge": { + "official_ea": { + "correct": 12, + "failed": 4, + "unknown": 0, + "observed_denominator": 16 + }, + "contract_accuracy": { + "correct": 12, + "failed": 4, + "unknown": 0, + "observed_denominator": 16 + }, + "total_tokens": 75251, + "unknown_usage": 0, + "generation_p95_ms": 19614.3, + "execution_passed": 16, + "tokens_per_ex_correct": 6270.916666666667 + }, + "direct": { + "official_ea": { + "correct": 10, + "failed": 6, + "unknown": 0, + "observed_denominator": 16 + }, + "contract_accuracy": { + "correct": 10, + "failed": 6, + "unknown": 0, + "observed_denominator": 16 + }, + "total_tokens": 37609, + "unknown_usage": 0, + "generation_p95_ms": 14857.5, + "execution_passed": 16, + "tokens_per_ex_correct": 3760.9 + } + } + }, + "paired_transitions": [ + { + "repeat": 1, + "case_id": "md-009", + "arm": "forge", + "ex_A": false, + "ex_B": false, + "contract_A": false, + "contract_B": false + }, + { + "repeat": 1, + "case_id": "md-009", + "arm": "direct", + "ex_A": false, + "ex_B": false, + "contract_A": false, + "contract_B": false + }, + { + "repeat": 1, + "case_id": "md-079", + "arm": "forge", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 1, + "case_id": "md-079", + "arm": "direct", + "ex_A": false, + "ex_B": false, + "contract_A": false, + "contract_B": false + }, + { + "repeat": 1, + "case_id": "md-199", + "arm": "forge", + "ex_A": false, + "ex_B": false, + "contract_A": false, + "contract_B": false + }, + { + "repeat": 1, + "case_id": "md-199", + "arm": "direct", + "ex_A": false, + "ex_B": false, + "contract_A": false, + "contract_B": false + }, + { + "repeat": 1, + "case_id": "md-289", + "arm": "forge", + "ex_A": false, + "ex_B": true, + "contract_A": false, + "contract_B": true + }, + { + "repeat": 1, + "case_id": "md-289", + "arm": "direct", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 1, + "case_id": "md-002", + "arm": "forge", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 1, + "case_id": "md-002", + "arm": "direct", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 1, + "case_id": "md-052", + "arm": "forge", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 1, + "case_id": "md-052", + "arm": "direct", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 1, + "case_id": "md-312", + "arm": "forge", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 1, + "case_id": "md-312", + "arm": "direct", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 1, + "case_id": "md-386", + "arm": "forge", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 1, + "case_id": "md-386", + "arm": "direct", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 2, + "case_id": "md-009", + "arm": "forge", + "ex_A": false, + "ex_B": false, + "contract_A": false, + "contract_B": false + }, + { + "repeat": 2, + "case_id": "md-009", + "arm": "direct", + "ex_A": false, + "ex_B": false, + "contract_A": false, + "contract_B": false + }, + { + "repeat": 2, + "case_id": "md-079", + "arm": "forge", + "ex_A": false, + "ex_B": true, + "contract_A": false, + "contract_B": true + }, + { + "repeat": 2, + "case_id": "md-079", + "arm": "direct", + "ex_A": false, + "ex_B": false, + "contract_A": false, + "contract_B": false + }, + { + "repeat": 2, + "case_id": "md-199", + "arm": "forge", + "ex_A": false, + "ex_B": true, + "contract_A": false, + "contract_B": true + }, + { + "repeat": 2, + "case_id": "md-199", + "arm": "direct", + "ex_A": false, + "ex_B": false, + "contract_A": false, + "contract_B": false + }, + { + "repeat": 2, + "case_id": "md-289", + "arm": "forge", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 2, + "case_id": "md-289", + "arm": "direct", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 2, + "case_id": "md-002", + "arm": "forge", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 2, + "case_id": "md-002", + "arm": "direct", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 2, + "case_id": "md-052", + "arm": "forge", + "ex_A": true, + "ex_B": false, + "contract_A": true, + "contract_B": false + }, + { + "repeat": 2, + "case_id": "md-052", + "arm": "direct", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 2, + "case_id": "md-312", + "arm": "forge", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 2, + "case_id": "md-312", + "arm": "direct", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 2, + "case_id": "md-386", + "arm": "forge", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + }, + { + "repeat": 2, + "case_id": "md-386", + "arm": "direct", + "ex_A": true, + "ex_B": true, + "contract_A": true, + "contract_B": true + } + ], + "stable_target_gains": [], + "forge_regressions": [ + { + "repeat": 2, + "case_id": "md-052", + "arm": "forge", + "ex_A": true, + "ex_B": false, + "contract_A": true, + "contract_B": false + } + ], + "control_B_ex_correct": 7, + "delta_forge": 2, + "delta_direct": 0, + "total_tokens_ratio": 1.0339425587467364, + "forge_tokens_per_correct_ratio": 0.8826806861475518, + "forge_generation_p95_ratio": 0.9458190077105203, + "gates": { + "complete_64_scored_known_usage": true, + "original_response_and_replay_consistent": true, + "both_repeats_comparable": true, + "forge_gain_at_least_2": true, + "repeat_stable_target_gain": false, + "zero_forge_ex_contract_regressions": false, + "control_B_ex_8_of_8": false, + "forge_gain_minus_absolute_direct_gain_at_least_2": true, + "total_tokens_ratio_at_most_1_2": true, + "forge_tokens_per_correct_not_increased": true, + "forge_generation_p95_ratio_at_most_1_25": true + }, + "all_gates_passed": false, + "decision": "Keep default off. Mechanism-screening only; no broad accuracy superiority or automatic rollout.", + "cny_cost": null, + "cny_cap_revoked": true, + "historical_scores_unchanged": true, + "new_model_calls_during_analysis": 0, + "evidence_root": ".forge/benchmarks/schema-descriptions-run-20260908", + "execution": { + "task": "Forge-20260908-02", + "at": "2026-09-08T02:14:24.098Z", + "status": "completed", + "failure": null, + "actual_http_requests": 64, + "runs": [ + { + "label": "A1", + "run_id": "pbr_c76dc1f4030041bcb423eed340268e36", + "status": "completed", + "dispatched_calls": 16, + "completed_calls": 16 + }, + { + "label": "B1", + "run_id": "pbr_0631628fcb774ba19d254e30ea44b22e", + "status": "completed", + "dispatched_calls": 16, + "completed_calls": 16 + }, + { + "label": "B2", + "run_id": "pbr_7bd01d7fe8404e8c9fa4719c3c3845e1", + "status": "completed", + "dispatched_calls": 16, + "completed_calls": 16 + }, + { + "label": "A2", + "run_id": "pbr_9ab15c21a9ec4dd7b4975795d1071749", + "status": "completed", + "dispatched_calls": 16, + "completed_calls": 16 + } + ], + "planned_calls": 64, + "cny_cost": null, + "cny_cost_note": "Not computable from subscription OAuth; no free-use guarantee", + "no_retries_or_replacements": true + }, + "authorization_history": [ + { + "at": "2026-09-08T07:10:29+08:00", + "instruction": "64次且最多¥20;无法证明费用硬上界则停止", + "actual_calls": 0, + "evidence": ".forge/benchmarks/schema-descriptions-ready-20260908/budget-preflight-Forge-20260908-02.json" + }, + { + "at": "2026-09-08T10:07:48+08:00", + "instruction": "用户明确说费用先不用管,当前GPT订阅制不用担心费用,继续推进;撤销¥20及人民币结算证明门禁,保留订阅OAuth、原64次ABBA、零重试/扩样;不切付费API或购买额度" + } + ], + "verification": { + "actual_http_requests": 64, + "http_200": 64, + "original_sse_captures": 64, + "raw_candidate_and_provider_usage_matches": 64, + "candidate_replays": 64, + "sql_status_ex_contract_replay_differences": 0, + "protocol_comparisons": 2, + "provider_retries": 0, + "extra_canary_or_replacement_calls": 0, + "all_usage_known": true, + "tests_rerun": false, + "source_changes": false, + "loopback_scoring_service_stopped": true, + "generation_and_replay_processes_exited": true + }, + "interpretation_zh": "Forge EX/Contract由10/16增至12/16,Direct维持10/16;三次单重复恢复、一控制题回退,没有同一目标题在两重复稳定恢复,控制7/8,预注册门槛失败。保留默认off,不宣称超过Direct SQL总体准确率,不补跑追分。", + "cost_summary": { + "total_tokens": 222015, + "A_total_tokens": 109155, + "B_total_tokens": 112860, + "B_vs_A_percent": 3.394255874673635, + "forge_tokens_per_correct_percent": -11.73193138524482, + "forge_generation_p95_percent": -5.41809922894797, + "cny": null, + "note": "订阅OAuth人民币费用不可核算;不宣称免费。原tokens及P95相对验收门槛保留,已通过。" + }, + "prepared_card_sha256": "sha256:2229da5b5a68ac941663c6de3c4fed8ef82f18087e5bf124565e333223e2164b", + "generation_contracts": { + "A1": { + "forge_output_mode": "pi_tool_schema", + "forge_prompt_revision": "forge-structured-benchmark-v1", + "forge_schema_revision": "sha256:e9b56c6f98d08c8b866bd4f49ab0076ff55510711429025d397a5acd9188e723", + "provider_json_schema_request": "required", + "forge_wire_schema_revision": "sha256:01f2abbe6608b33610f4106f1acf8705ffca38a4aa3c8d990bc7b6f7fe739b8d", + "schema_descriptions": { + "mode": "off", + "catalog_revision": "sha256:796f6d6c15779b537cf3692ea315bd0d8fc6b8cd012e894e5833381d1c44ab18", + "wire_schema_revision": "sha256:01f2abbe6608b33610f4106f1acf8705ffca38a4aa3c8d990bc7b6f7fe739b8d" + }, + "direct_output_mode": "text_sql", + "sampling": "provider_default", + "transport": "sse", + "max_output_tokens": null, + "timeout_seconds": 120, + "provider_retries": 0, + "max_agent_turns_per_arm": 1, + "isolation_revision": "pi-benchmark-isolation-v1", + "pi_runtime_revision": "sha256:f6612f91028af494784d8ecc982513b47ba4ff2086df444ae19231b8c2f22d0d", + "pi_sdk_lock_revision": "sha256:cd26acc8f80885074afc9042709d0337a4732637d185e5b0b13be99e961c80b6" + }, + "B1": { + "forge_output_mode": "pi_tool_schema", + "forge_prompt_revision": "forge-structured-benchmark-v1", + "forge_schema_revision": "sha256:e9b56c6f98d08c8b866bd4f49ab0076ff55510711429025d397a5acd9188e723", + "provider_json_schema_request": "required", + "forge_wire_schema_revision": "sha256:d3d56c36a2a8fd0322e61474a1ae8602d40244bdba5d6a00a50095f0c254848f", + "schema_descriptions": { + "mode": "interfaces-v1", + "catalog_revision": "sha256:796f6d6c15779b537cf3692ea315bd0d8fc6b8cd012e894e5833381d1c44ab18", + "wire_schema_revision": "sha256:d3d56c36a2a8fd0322e61474a1ae8602d40244bdba5d6a00a50095f0c254848f" + }, + "direct_output_mode": "text_sql", + "sampling": "provider_default", + "transport": "sse", + "max_output_tokens": null, + "timeout_seconds": 120, + "provider_retries": 0, + "max_agent_turns_per_arm": 1, + "isolation_revision": "pi-benchmark-isolation-v1", + "pi_runtime_revision": "sha256:f6612f91028af494784d8ecc982513b47ba4ff2086df444ae19231b8c2f22d0d", + "pi_sdk_lock_revision": "sha256:cd26acc8f80885074afc9042709d0337a4732637d185e5b0b13be99e961c80b6" + }, + "B2": { + "forge_output_mode": "pi_tool_schema", + "forge_prompt_revision": "forge-structured-benchmark-v1", + "forge_schema_revision": "sha256:e9b56c6f98d08c8b866bd4f49ab0076ff55510711429025d397a5acd9188e723", + "provider_json_schema_request": "required", + "forge_wire_schema_revision": "sha256:d3d56c36a2a8fd0322e61474a1ae8602d40244bdba5d6a00a50095f0c254848f", + "schema_descriptions": { + "mode": "interfaces-v1", + "catalog_revision": "sha256:796f6d6c15779b537cf3692ea315bd0d8fc6b8cd012e894e5833381d1c44ab18", + "wire_schema_revision": "sha256:d3d56c36a2a8fd0322e61474a1ae8602d40244bdba5d6a00a50095f0c254848f" + }, + "direct_output_mode": "text_sql", + "sampling": "provider_default", + "transport": "sse", + "max_output_tokens": null, + "timeout_seconds": 120, + "provider_retries": 0, + "max_agent_turns_per_arm": 1, + "isolation_revision": "pi-benchmark-isolation-v1", + "pi_runtime_revision": "sha256:f6612f91028af494784d8ecc982513b47ba4ff2086df444ae19231b8c2f22d0d", + "pi_sdk_lock_revision": "sha256:cd26acc8f80885074afc9042709d0337a4732637d185e5b0b13be99e961c80b6" + }, + "A2": { + "forge_output_mode": "pi_tool_schema", + "forge_prompt_revision": "forge-structured-benchmark-v1", + "forge_schema_revision": "sha256:e9b56c6f98d08c8b866bd4f49ab0076ff55510711429025d397a5acd9188e723", + "provider_json_schema_request": "required", + "forge_wire_schema_revision": "sha256:01f2abbe6608b33610f4106f1acf8705ffca38a4aa3c8d990bc7b6f7fe739b8d", + "schema_descriptions": { + "mode": "off", + "catalog_revision": "sha256:796f6d6c15779b537cf3692ea315bd0d8fc6b8cd012e894e5833381d1c44ab18", + "wire_schema_revision": "sha256:01f2abbe6608b33610f4106f1acf8705ffca38a4aa3c8d990bc7b6f7fe739b8d" + }, + "direct_output_mode": "text_sql", + "sampling": "provider_default", + "transport": "sse", + "max_output_tokens": null, + "timeout_seconds": 120, + "provider_retries": 0, + "max_agent_turns_per_arm": 1, + "isolation_revision": "pi-benchmark-isolation-v1", + "pi_runtime_revision": "sha256:f6612f91028af494784d8ecc982513b47ba4ff2086df444ae19231b8c2f22d0d", + "pi_sdk_lock_revision": "sha256:cd26acc8f80885074afc9042709d0337a4732637d185e5b0b13be99e961c80b6" + } + }, + "local_evidence_fingerprints": { + ".forge/benchmarks/schema-descriptions-run-20260908/execution-start.json": "sha256:16ab39b2b10bc5a1e5af69f579d1e059c2bbb474bda53773cb9d39357ac3a2e8", + ".forge/benchmarks/schema-descriptions-run-20260908/execution-result.json": "sha256:52a3eb09a56abde51345c8ad4d5cdf63977be8f88f66ef8b681638c0cae3b19a", + ".forge/benchmarks/schema-descriptions-run-20260908/result.json": "sha256:de927ab6a505b04d042ab2913d51b6eed9ff88563d37885ab63eca50ca8529c8", + ".forge/benchmarks/schema-descriptions-run-20260908/original-response-and-replay-checks.json": "sha256:13db79dbbae7cd54a348baaa353be9719ff1761cd5b110767201252c2160c94c", + ".forge/benchmarks/schema-descriptions-run-20260908/paired-comparisons.json": "sha256:092fc8aa595be80be3c0d3ab035917864fbfd26fb632f8581bf84f06339e9a8e", + ".forge/benchmarks/schema-descriptions-run-20260908/A1-run.json": "sha256:d76749dfd7b773e63161cf76ba02577b8b9ae823ad219f01af0a4877e5bd3aeb", + ".forge/benchmarks/schema-descriptions-run-20260908/A1-replay.json": "sha256:d825db27426a3e72ad0ccb0814072cc63db8e7ed4b1ab326e31cadf9a64341ed", + ".forge/benchmarks/schema-descriptions-run-20260908/A1-logs.json": "sha256:75e4b6599b7568dac4f82a200c3e6433987e597180d04b0bc08153349054115e", + ".forge/benchmarks/schema-descriptions-run-20260908/B1-run.json": "sha256:eeac03e27ea4bb13cc681f2e358752d99eefc81ace91ee17ddf2a6069bae8048", + ".forge/benchmarks/schema-descriptions-run-20260908/B1-replay.json": "sha256:8d356999b5cd55065c1741f4b06c24b4e44ac53ee9e368784f4e532b4b699ab4", + ".forge/benchmarks/schema-descriptions-run-20260908/B1-logs.json": "sha256:70f72265af7c72e7beba91e46d0e31fa10843ab1168f425316939af3c09c421d", + ".forge/benchmarks/schema-descriptions-run-20260908/B2-run.json": "sha256:9009da1ca01b73e907416facf9e550befb38173413fd14079de82934133f93be", + ".forge/benchmarks/schema-descriptions-run-20260908/B2-replay.json": "sha256:5557ddadb7e1d2843836527b914fb2b9f258d7624303f7b3ea5e903b55c3a8af", + ".forge/benchmarks/schema-descriptions-run-20260908/B2-logs.json": "sha256:de4308c4f721e70b9672c9aff97f36fba68109ee17095b73e344ddba8fca7bc9", + ".forge/benchmarks/schema-descriptions-run-20260908/A2-run.json": "sha256:4be4471619a5ac28507339401bba4ef6cc667b20637eb44ddcd5f584a0265c19", + ".forge/benchmarks/schema-descriptions-run-20260908/A2-replay.json": "sha256:b29dca12c42449160d4d7914e31c7fb7ff9f7d599dd30ca282bd91ceb9e19e3f", + ".forge/benchmarks/schema-descriptions-run-20260908/A2-logs.json": "sha256:9e29a16d5e831166fc6ba4607b7727270c861c013cd5bad8c4afc3b5db6fbce6", + ".forge/benchmarks/schema-descriptions-run-20260908/response-01.sse": "sha256:3270b06f727c9ec988964a12c225ca29c44683b1c228b577de59609bc39cf7d3", + ".forge/benchmarks/schema-descriptions-run-20260908/response-02.sse": "sha256:fb37e2fa846130e07599e1eab10d1ffd39a7a82a843e631930fd57e31905accf", + ".forge/benchmarks/schema-descriptions-run-20260908/response-03.sse": "sha256:91b96915c9eef5029cce2aea9d17b46be42198ca94b32e5e78b47d5cba387ea4", + ".forge/benchmarks/schema-descriptions-run-20260908/response-04.sse": "sha256:69f43590e0ea0648935984acdb2752f6c20415f6c6d0169bd0a218ef9860f14a", + ".forge/benchmarks/schema-descriptions-run-20260908/response-05.sse": "sha256:b683faf85d91ed5fd8be9de3a674894582468f658695ba537f5fa99acacb6583", + ".forge/benchmarks/schema-descriptions-run-20260908/response-06.sse": "sha256:404492bf334e434bef20e811fb1fab0806a78b21492f9c5bd527768ffeacb2ee", + ".forge/benchmarks/schema-descriptions-run-20260908/response-07.sse": "sha256:20ad2ea1edd60e2ebd6d8c813b80f97c758defb7a87c7a84315e4fc2a068f5fa", + ".forge/benchmarks/schema-descriptions-run-20260908/response-08.sse": "sha256:94408ee9d24df7d379e53c1403ba84acda95c8a5399106f16623c7b2cc838ed8", + ".forge/benchmarks/schema-descriptions-run-20260908/response-09.sse": "sha256:57f508a016172bfbd88ebfedd34a6bc7bb1bcf608a4f21d0eef4ce5111c56e70", + ".forge/benchmarks/schema-descriptions-run-20260908/response-10.sse": "sha256:b754b71a7936d4b5ed79bc2d7b08e53a649866756f6aa1a339ee52a0ef335e01", + ".forge/benchmarks/schema-descriptions-run-20260908/response-11.sse": "sha256:9ae6268b5ba407e868fc9fc1d3b3a5f38c468d617da5d5908017f5a3aef1902a", + ".forge/benchmarks/schema-descriptions-run-20260908/response-12.sse": "sha256:53014e571ee15d44d0d35e3d5d3f27ad5053b09c18a615735d890fb5c73507e5", + ".forge/benchmarks/schema-descriptions-run-20260908/response-13.sse": "sha256:6b1096172bd9afc3cd56a7ea84f4c3e0409510da443acd1a0849d5c3e02abc38", + ".forge/benchmarks/schema-descriptions-run-20260908/response-14.sse": "sha256:bde79f8ad95ee96205c4697cc602b154d6c8697c66b4dd65be8be9f545a76916", + ".forge/benchmarks/schema-descriptions-run-20260908/response-15.sse": "sha256:fa13eb153922eab6eabf1121bbecd09dd4a4f24f453c507ebebdc00fdb19a9ed", + ".forge/benchmarks/schema-descriptions-run-20260908/response-16.sse": "sha256:e368dbe88c80e78f05304cae2ae957bc80ad04effe52ce32d129df3bf2f22295", + ".forge/benchmarks/schema-descriptions-run-20260908/response-17.sse": "sha256:156ca729d7ecf8672a359e5b217d218ed7d8dc5243e174b964fa12dc4c4dc83a", + ".forge/benchmarks/schema-descriptions-run-20260908/response-18.sse": "sha256:28d2501c22cb44dd4250ddc371b6be2d4402e85bf51f57841fa403cb6e4d4a6d", + ".forge/benchmarks/schema-descriptions-run-20260908/response-19.sse": "sha256:761d695d0e7903ac79e3a5a29b7c4831b272d7098a8976c6d3cc8cede7ba9251", + ".forge/benchmarks/schema-descriptions-run-20260908/response-20.sse": "sha256:46416bb0c7263993ecb68a4d22f3a1cf338c8bd2c7ab44484d7994b82f669776", + ".forge/benchmarks/schema-descriptions-run-20260908/response-21.sse": "sha256:1845df18fd32b781e00313d2c0c8670b1911c15cc62bdc69be33a34540fde7b0", + ".forge/benchmarks/schema-descriptions-run-20260908/response-22.sse": "sha256:af611283d242b86e039b7bc0966ace916b116a141826b13f45ef33e57ddc73df", + ".forge/benchmarks/schema-descriptions-run-20260908/response-23.sse": "sha256:3017ceb09ba32d69467c06bba9b26eca51e3fc36eebd9eb85d40cd9a38e4514b", + ".forge/benchmarks/schema-descriptions-run-20260908/response-24.sse": "sha256:671fb624cd5a2617917839488970c8477409a9bd15e429cb4d961a4eba3c6cd2", + ".forge/benchmarks/schema-descriptions-run-20260908/response-25.sse": "sha256:ab1ac74e37ee631d76bb17bbd0ad54bffc633dfa977122d21f90550c62909da5", + ".forge/benchmarks/schema-descriptions-run-20260908/response-26.sse": "sha256:1ac11bc86d3befb3f8a1e3e1e96804345599acf8e75646e9db62bd94014d9b72", + ".forge/benchmarks/schema-descriptions-run-20260908/response-27.sse": "sha256:107d1718a6a456bd200038b803a9037e3562538ec9665145ea948f91293d6b97", + ".forge/benchmarks/schema-descriptions-run-20260908/response-28.sse": "sha256:eb5fd0fcf7c1e43df4c27e69ec03e8de416ee2d3bd4922f9e3a27ca12b309171", + ".forge/benchmarks/schema-descriptions-run-20260908/response-29.sse": "sha256:fa7e1bf97e1364b219627355a0c148bec8aa7fed18af5e887efc866461e0aef0", + ".forge/benchmarks/schema-descriptions-run-20260908/response-30.sse": "sha256:5a1c1976c7216affc6c5e137289762fc70c0ad955498694242eb8e11f2cb2ed8", + ".forge/benchmarks/schema-descriptions-run-20260908/response-31.sse": "sha256:a3eb44fc006a08a45843eacf974e97755d91797db6a8efaedb8247d2882a793a", + ".forge/benchmarks/schema-descriptions-run-20260908/response-32.sse": "sha256:cd568747851fce8365869dcba15fcd901f11dbff7c6555bad96ac78db7f0122d", + ".forge/benchmarks/schema-descriptions-run-20260908/response-33.sse": "sha256:bfcb6735c3eb4c3a66cf03f49d14ef6c0c1c1ecadf3e3f6254cbac1e5e416389", + ".forge/benchmarks/schema-descriptions-run-20260908/response-34.sse": "sha256:622a3bf21c67639419a60469e06149f766addbbe15c8efeae0e1660e0e4f1c29", + ".forge/benchmarks/schema-descriptions-run-20260908/response-35.sse": "sha256:a518931944ea0df56c3faf87b5ff36f1263fc9cefb2e02040ae1c89a3def0e3f", + ".forge/benchmarks/schema-descriptions-run-20260908/response-36.sse": "sha256:5cba98725d17850f5b11aaddb6a815214604c414d0d26662d0884967deed6f88", + ".forge/benchmarks/schema-descriptions-run-20260908/response-37.sse": "sha256:43d1cdcdd7143ae81c29db4a554466604f0402f1494b2ae512d5b2de8e8fab0f", + ".forge/benchmarks/schema-descriptions-run-20260908/response-38.sse": "sha256:612d0f83fea671f65c3e850ff792ffca708a7c2e13f03235a9b69b4abfd4c163", + ".forge/benchmarks/schema-descriptions-run-20260908/response-39.sse": "sha256:9f198a5a4f40a7ad93257cc6821f551abfbae2b85441e68f6c748e8746b90447", + ".forge/benchmarks/schema-descriptions-run-20260908/response-40.sse": "sha256:8672a7bfdc710e419f99c9c1275e502123e12f2c8711286df6be25ce40609c94", + ".forge/benchmarks/schema-descriptions-run-20260908/response-41.sse": "sha256:0c9d6822ed99617a4d078815f2bb951945efa359ae08ba9101e4b1bff17cc5e3", + ".forge/benchmarks/schema-descriptions-run-20260908/response-42.sse": "sha256:ba811df7a130784ce24729d910bbca902a8d96dc02b055626c36d806210e10ba", + ".forge/benchmarks/schema-descriptions-run-20260908/response-43.sse": "sha256:53647400cb4a908a76741f32f0235220112b565582fe6a1a9bb35a7356eb416b", + ".forge/benchmarks/schema-descriptions-run-20260908/response-44.sse": "sha256:2b2caf1677f487dbc91b7d40b5856cd285aa2df99e018a2a39b6bd31d7ef1b16", + ".forge/benchmarks/schema-descriptions-run-20260908/response-45.sse": "sha256:2deaa3700a3296af94681be9594556b4481292efa511183ce650992446714554", + ".forge/benchmarks/schema-descriptions-run-20260908/response-46.sse": "sha256:56b39c46bfb48bf63176942209d64931182894261ac7263bcb7fcf3c49a43315", + ".forge/benchmarks/schema-descriptions-run-20260908/response-47.sse": "sha256:87b1af8d0939456fe225f55564b37f93abed91f1e34ed50e216d369fabd5e175", + ".forge/benchmarks/schema-descriptions-run-20260908/response-48.sse": "sha256:ca6c5e1ec3a400fb367f3cf1c13f8bb5851c9a1c7852b3da185d2b0e670888fa", + ".forge/benchmarks/schema-descriptions-run-20260908/response-49.sse": "sha256:7a4e65ffa5c4899a702a0c4585c16a34ed03c7922c62cafcd11ccc49dbd7fef8", + ".forge/benchmarks/schema-descriptions-run-20260908/response-50.sse": "sha256:4159a2239e0a5fe5c3051e003cf9dd2d42fbd87aee77e102508606f857d540f8", + ".forge/benchmarks/schema-descriptions-run-20260908/response-51.sse": "sha256:95d6bfb53d86bf317ca484bc33f87cfe791a741964ac700c8711702b25b2c043", + ".forge/benchmarks/schema-descriptions-run-20260908/response-52.sse": "sha256:a5999ada634d1a4e7352a4bfbb6389584ca932122884f07b32e72790330e2fe4", + ".forge/benchmarks/schema-descriptions-run-20260908/response-53.sse": "sha256:50c718ad6f0167dfbe99214e81f67c0e2af818cf35b1aef5d3c7ee6677827e8a", + ".forge/benchmarks/schema-descriptions-run-20260908/response-54.sse": "sha256:59ffb403c8cd4e9178637821119ac938db7a1198dd76cbf90df3d3c8ddbd6945", + ".forge/benchmarks/schema-descriptions-run-20260908/response-55.sse": "sha256:6dd4e380dfeb8dce4c1c31e9b794650931d455c63d1899e4215992265083e50d", + ".forge/benchmarks/schema-descriptions-run-20260908/response-56.sse": "sha256:30058a5f69af0f931535808ca7c6034f4283f50db7b0f4f2c0a7ca3e4b947c42", + ".forge/benchmarks/schema-descriptions-run-20260908/response-57.sse": "sha256:2318bab0f94b1a0de7a035b36eacfbaa29dbee55766279854f587ba5fad44652", + ".forge/benchmarks/schema-descriptions-run-20260908/response-58.sse": "sha256:b06e59d12ad930bbde70b0e67cbf8b3b00e7d4a5dfbbb66a5b78a0e518f0ea32", + ".forge/benchmarks/schema-descriptions-run-20260908/response-59.sse": "sha256:e6c41f06209030d7cacefa060b953f6dc3f4b718d80170556dc1826060e4e4b1", + ".forge/benchmarks/schema-descriptions-run-20260908/response-60.sse": "sha256:87491ee078bd2862e4837b4aa3f1f58b75e75e14ad978d024734931bb44a7bb0", + ".forge/benchmarks/schema-descriptions-run-20260908/response-61.sse": "sha256:daade27f5cb39448beb20c5744bc7ecdc7f5c5ee339891ebce3593501c51059b", + ".forge/benchmarks/schema-descriptions-run-20260908/response-62.sse": "sha256:e7bd4880f9ed3a27427ffc126af016e9329cd9fe6ff099806ea41498ec6e39fc", + ".forge/benchmarks/schema-descriptions-run-20260908/response-63.sse": "sha256:ab48a875f4013c2eb9a94bea3fddad1489fdb899280234448dfdaaac8089d363", + ".forge/benchmarks/schema-descriptions-run-20260908/response-64.sse": "sha256:06e50175958e147af07169a873111e170e0d88bfb22b474878681b227bcd40ae" + }, + "captured_execution_sources": { + "serve.py": "import os\nimport sys\nimport types\nfrom pathlib import Path\n\nos.environ['FORGE_DISABLE_DOTENV'] = 'true'\nsys.path.insert(0, str(Path.cwd()))\nmodule = types.ModuleType('config')\nmodule.cfg = types.SimpleNamespace(PI_SERVICE_API_KEYS=['req065-loopback-only'])\nsys.modules['config'] = module\nfrom fastapi import FastAPI\nimport uvicorn\nfrom web.routes.benchmark_v2 import router\n\napp = FastAPI()\napp.include_router(router)\nuvicorn.run(app, host='127.0.0.1', port=19043, log_level='warning')\n", + "run.mts": "import assert from 'node:assert/strict';\nimport { readFile, writeFile, open } from 'node:fs/promises';\nimport { resolve, join } from 'node:path';\nimport { setTimeout as pause } from 'node:timers/promises';\nimport { loadConfig } from '../../../services/pi-orchestrator/src/config.ts';\nimport { SqliteOrchestratorState } from '../../../services/pi-orchestrator/src/sqlite-store.ts';\nimport { OrchestratorApplication } from '../../../services/pi-orchestrator/src/application.ts';\nimport { PiBenchmarkRuntime } from '../../../services/pi-orchestrator/src/benchmark-runtime.ts';\n\nconst root = process.cwd();\nconst dir = resolve('.forge/benchmarks/schema-descriptions-run-20260908');\nconst preparation = resolve('.forge/benchmarks/schema-descriptions-ready-20260908');\nconst card = JSON.parse(await readFile('docs/archive/benchmarks/benchmark-luna-schema-descriptions-ready-2026-09-08.json', 'utf8')).experiment_card;\nconst schedule = ['A1', 'B1', 'B2', 'A2'];\nconst receipts: any[] = [];\nconst captures: Promise[] = [];\nconst runs: any[] = [];\nconst nativeFetch = globalThis.fetch;\nlet dispatched = 0;\nlet currentLabel = 'none';\nlet captureFailure: string | null = null;\nconst save = (name: string, value: unknown) => writeFile(join(dir, name), JSON.stringify(value, null, 2), { flag: 'wx' });\nawait save('execution-start.json', { task: 'Forge-20260908-02', at: new Date().toISOString(), max_requests: 64, cny_cap_revoked: true, cny_cost: null, subscription_oauth: true, schedule, card_sha256: card.card_sha256 });\n\nglobalThis.fetch = async (input: any, init?: any) => {\n const url = new URL(typeof input === 'string' || input instanceof URL ? input : input.url);\n const isGeneration = url.hostname === 'chatgpt.com' && /\\/responses$/.test(url.pathname);\n if (!isGeneration) return nativeFetch(input, init);\n assert.ok(dispatched < 64, 'Authorized 64-request ceiling reached');\n const index = ++dispatched;\n const receipt: any = { index, label: currentLabel, started_at: new Date().toISOString(), host: url.hostname, path: url.pathname };\n receipts.push(receipt);\n await save(`request-${String(index).padStart(2, '0')}-admitted.json`, receipt);\n try {\n const response = await nativeFetch(input, init);\n receipt.http_status = response.status;\n const clone = response.clone();\n captures.push((async () => {\n const file = await open(join(dir, `response-${String(index).padStart(2, '0')}.sse`), 'wx');\n try {\n if (clone.body) {\n const reader = clone.body.getReader();\n for (;;) {\n const item = await reader.read();\n if (item.done) break;\n await file.write(item.value);\n }\n }\n receipt.capture_complete = true;\n } catch (error) {\n receipt.capture_error = error instanceof Error ? error.message : String(error);\n captureFailure = receipt.capture_error;\n } finally {\n await file.close();\n receipt.ended_at = new Date().toISOString();\n await save(`request-${String(index).padStart(2, '0')}-receipt.json`, receipt);\n }\n })());\n return response;\n } catch (error) {\n receipt.transport_error = error instanceof Error ? error.message : String(error);\n receipt.ended_at = new Date().toISOString();\n await save(`request-${String(index).padStart(2, '0')}-receipt.json`, receipt);\n throw error;\n }\n};\n\nconst config = loadConfig({\n PI_ORCHESTRATOR_AGENT_DIR: '/.pi/agent',\n PI_ORCHESTRATOR_STATE_DB: join(dir, 'orchestrator.sqlite3'),\n SHISUI_DATA_SKILLS_DIR: root,\n PI_BENCHMARK_CONCURRENCY: '2',\n FORGE_BASE_URL: 'http://127.0.0.1:19043',\n FORGE_PI_SERVICE_KEY: 'req065-loopback-only',\n});\nconst state = new SqliteOrchestratorState(config.stateDbPath);\nconst application = new OrchestratorApplication({ config, state });\nconst runtime = new PiBenchmarkRuntime(config, application);\nlet failure: string | null = null;\ntry {\n for (const label of schedule) {\n currentLabel = label;\n const frozen = JSON.parse(await readFile(join(preparation, label.startsWith('A') ? 'control.frozen.json' : 'treatment.frozen.json'), 'utf8'));\n const started = await runtime.start({ provider: 'openai-codex', model: 'gpt-5.6-luna', caseIds: card.case_ids, confirmModelCalls: 16, protocolManifest: frozen.manifest });\n assert.equal(started.model.revision, card.model.expected_revision);\n await save(`${label}-started.json`, started);\n console.log(JSON.stringify({ label, run_id: started.run_id, status: started.status }));\n let run: any;\n let prior = '';\n for (;;) {\n run = runtime.get(started.run_id);\n const progress = JSON.stringify({ label, run_id: run.run_id, status: run.status, dispatched_calls: run.dispatched_calls, completed_calls: run.completed_calls, actual_http_requests: dispatched });\n if (progress !== prior) { console.log(progress); prior = progress; }\n if (['completed', 'failed', 'stopped', 'interrupted'].includes(run.status)) break;\n await pause(1000);\n }\n await Promise.all(captures);\n await save(`${label}-run.json`, run);\n await save(`${label}-logs.json`, runtime.logs(started.run_id));\n runs.push({ label, run_id: run.run_id, status: run.status, dispatched_calls: run.dispatched_calls, completed_calls: run.completed_calls });\n if (run.status !== 'completed' || run.dispatched_calls !== 16 || captureFailure || run.cases.some((c: any) => ['forge', 'direct'].some(a => c[a]?.usage_observed !== true))) {\n failure = `Stop after ${label}: terminal=${run.status}, capture=${captureFailure}, incomplete generation/usage possible`;\n break;\n }\n }\n} catch (error) {\n failure = error instanceof Error ? error.message : String(error);\n console.error(failure);\n} finally {\n await runtime.close();\n await Promise.all(captures);\n state.close();\n globalThis.fetch = nativeFetch;\n const result = { task: 'Forge-20260908-02', at: new Date().toISOString(), status: failure ? 'stopped_fail_closed' : 'completed', failure, actual_http_requests: dispatched, receipts, runs, planned_calls: 64, cny_cost: null, cny_cost_note: 'Not computable from subscription OAuth; no free-use guarantee', no_retries_or_replacements: true };\n await save('execution-result.json', result);\n console.log(JSON.stringify(result));\n}\n", + "analyze.py": "import os, sys, types, json, hashlib, math\nfrom pathlib import Path\nfrom datetime import datetime, timezone\nfrom collections import Counter\nos.environ['FORGE_DISABLE_DOTENV'] = 'true'\nsys.path.insert(0, str(Path.cwd()))\ncfg_module = types.ModuleType('config')\ncfg_module.cfg = types.SimpleNamespace(PI_SERVICE_API_KEYS=['req065-loopback-only'])\nsys.modules['config'] = cfg_module\nfrom forge import bird_benchmark as bird\n\nroot = Path('.forge/benchmarks/schema-descriptions-run-20260908')\nready = json.loads(Path('docs/archive/benchmarks/benchmark-luna-schema-descriptions-ready-2026-09-08.json').read_text())\nexecution = json.loads((root/'execution-result.json').read_text())\ndef save(name, value):\n with (root/name).open('x') as out: json.dump(value, out, ensure_ascii=False, indent=2)\ndef key(value):\n return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(',', ':'))\ndef raw_key(arm, raw):\n if arm == 'forge': return key(raw['tool_arguments'])\n return ''.join(b.get('text', '') for m in raw['assistant'] for b in m['content'] if b['type']=='text')\n\nruns, replays, indexes, response_checks = {}, {}, {}, []\nfor item in execution['runs']:\n label = item['label']\n run = json.loads((root/f'{label}-run.json').read_text())\n runs[label] = run\n replay = bird.replay(run)\n replays[label] = replay\n save(f'{label}-replay.json', replay)\n indexes[label] = {(r['case_id'],r['arm']):r for r in replay['candidates']}\n original = {(c['case_id'],a):c[a] for c in run['cases'] for a in ('forge','direct')}\n fields = ('scored','compile_status','execution_status','official_ea','contract_accuracy','sql')\n for ident, r in indexes[label].items():\n different = [f for f in fields if r['evaluation'].get(f)!=original[ident].get(f)]\n response_checks.append({'label':label,'case_id':ident[0],'arm':ident[1],'replay_differences':different})\n # Link captured original SSE to the Pi raw candidate without printing private reasoning.\n available = [(cid,arm,metric) for (cid,arm),metric in original.items() if metric.get('raw_output') and metric.get('output') is not None]\n for receipt in [r for r in execution['receipts'] if r['label']==label]:\n p = root/f\"response-{receipt['index']:02d}.sse\"\n events = [json.loads(line[6:]) for line in p.read_text().splitlines() if line.startswith('data: ') and line[6:]!='[DONE]']\n done = [e['item'] for e in events if e.get('type')=='response.output_item.done']\n calls = [i for i in done if i['type']=='function_call']\n if calls:\n arm='forge'; raw=key(json.loads(calls[0]['arguments']))\n else:\n arm='direct'; raw=''.join(b.get('text','') for i in done if i['type']=='message' for b in i.get('content',[]) if b.get('type')=='output_text')\n matched = [(cid,a,m) for cid,a,m in available if a==arm and raw_key(a,m['raw_output'])==raw]\n finals = [e['response'] for e in events if e.get('type')=='response.completed']\n check = {'label':label,'request_index':receipt['index'],'http_status':receipt.get('http_status'),'sse_sha256':'sha256:'+hashlib.sha256(p.read_bytes()).hexdigest(),'raw_candidate_matched':bool(matched),'provider_completed':bool(finals)}\n if matched:\n cid,a,m=matched[0]; available.remove(matched[0]); check.update(case_id=cid,arm=a)\n if finals:\n usage=finals[-1].get('usage',{})\n check['total_tokens_match']=usage.get('total_tokens')==m['total_tokens']\n check['completion_tokens_match']=usage.get('output_tokens')==m['completion_tokens']\n response_checks.append(check)\n if available:\n response_checks.append({'label':label,'unmatched_pi_candidates':[(c,a) for c,a,_ in available]})\nsave('original-response-and-replay-checks.json',response_checks)\n\ncomparisons = {}\nfor repeat in (1,2):\n a,b=f'A{repeat}',f'B{repeat}'\n if a in replays and b in replays:\n comparisons[str(repeat)] = bird.compare(replays[a],replays[b])\nsave('paired-comparisons.json',comparisons)\n\ndef summary(labels, arm):\n metrics=[c[arm] for label in labels if label in runs for c in runs[label]['cases']]\n scores=[indexes[label][c['case_id'],arm]['evaluation'] for label in labels if label in indexes for c in runs[label]['cases']]\n times=sorted(m['generation_ms'] for m in metrics if isinstance(m.get('generation_ms'),(int,float)))\n result={k:{'correct':sum(e.get(k) is True for e in scores),'failed':sum(e.get(k) is False for e in scores),'unknown':sum(e.get(k) is None for e in scores),'observed_denominator':len(scores)} for k in ('official_ea','contract_accuracy')}\n result.update(total_tokens=sum(m['total_tokens'] for m in metrics if m.get('usage_observed')),unknown_usage=sum(m.get('usage_observed') is not True for m in metrics),generation_p95_ms=times[math.ceil(.95*len(times))-1] if times else None,execution_passed=sum(e.get('execution_status')=='passed' for e in scores))\n correct=result['official_ea']['correct']\n result['tokens_per_ex_correct']=result['total_tokens']/correct if correct else None\n return result\nsummaries={l:{a:summary([l],a) for a in ('forge','direct')} for l in runs}\ncombined={c:{a:summary([c+'1',c+'2'],a) for a in ('forge','direct')} for c in ('A','B')}\ncomplete=execution['actual_http_requests']==64 and set(runs)=={'A1','B1','B2','A2'} and all(r['status']=='completed' for r in runs.values()) and all(r['complete'] for r in replays.values()) and all(s['unknown_usage']==0 for s in summaries.values() for s in s.values())\nfg=combined['B']['forge']['official_ea']['correct']-combined['A']['forge']['official_ea']['correct']\ndg=combined['B']['direct']['official_ea']['correct']-combined['A']['direct']['official_ea']['correct']\ntransitions=[]\nfor rep in (1,2):\n a,b=f'A{rep}',f'B{rep}'\n if a in indexes and b in indexes:\n for cid in ready['experiment_card']['case_ids']:\n for arm in ('forge','direct'):\n ae,be=indexes[a][cid,arm]['evaluation'],indexes[b][cid,arm]['evaluation']\n transitions.append({'repeat':rep,'case_id':cid,'arm':arm,'ex_A':ae['official_ea'],'ex_B':be['official_ea'],'contract_A':ae['contract_accuracy'],'contract_B':be['contract_accuracy']})\nstable=[t['case_id'] for t in ready['experiment_card']['targets'] if sum(x['case_id']==t['case_id'] and x['arm']=='forge' and x['ex_A'] is False and x['ex_B'] is True and x['contract_B'] is True for x in transitions)==2]\nregressions=[t for t in transitions if t['arm']=='forge' and ((t['ex_A'] is True and t['ex_B'] is not True) or (t['contract_A'] is True and t['contract_B'] is not True))]\ncontrols={t['case_id'] for t in ready['experiment_card']['controls']}\ncontrol_correct=sum(t['arm']=='forge' and t['case_id'] in controls and t['ex_B'] is True for t in transitions)\ndef ratio(b,a): return b/a if a and b is not None else None\ntoken_ratio=ratio(sum(v['total_tokens'] for v in combined['B'].values()),sum(v['total_tokens'] for v in combined['A'].values()))\nper_correct_ratio=ratio(combined['B']['forge']['tokens_per_ex_correct'],combined['A']['forge']['tokens_per_ex_correct'])\np95_ratio=ratio(combined['B']['forge']['generation_p95_ms'],combined['A']['forge']['generation_p95_ms'])\noriginals_ok=all(not c.get('replay_differences') and not c.get('unmatched_pi_candidates') and ('request_index' not in c or all(c.get(k) is True for k in ('raw_candidate_matched','provider_completed','total_tokens_match','completion_tokens_match'))) for c in response_checks)\ngates={'complete_64_scored_known_usage':complete,'original_response_and_replay_consistent':originals_ok,'both_repeats_comparable':len(comparisons)==2 and all(v.get('comparable') for v in comparisons.values()),'forge_gain_at_least_2':complete and fg>=2,'repeat_stable_target_gain':complete and bool(stable),'zero_forge_ex_contract_regressions':complete and not regressions,'control_B_ex_8_of_8':complete and control_correct==8,'forge_gain_minus_absolute_direct_gain_at_least_2':complete and fg-abs(dg)>=2,'total_tokens_ratio_at_most_1_2':complete and token_ratio is not None and token_ratio<=1.2,'forge_tokens_per_correct_not_increased':complete and per_correct_ratio is not None and per_correct_ratio<=1,'forge_generation_p95_ratio_at_most_1_25':complete and p95_ratio is not None and p95_ratio<=1.25}\nreport={'schema_version':'benchmark-luna-schema-descriptions-result-v1','task_id':'Forge-20260908-02','requirement':'REQ-2026-09-08-065','at':datetime.now(timezone.utc).isoformat(),'execution':execution,'summaries':summaries,'combined':combined,'paired_transitions':transitions,'stable_target_gains':stable,'forge_regressions':regressions,'control_B_ex_correct':control_correct,'delta_forge':fg,'delta_direct':dg,'total_tokens_ratio':token_ratio,'forge_tokens_per_correct_ratio':per_correct_ratio,'forge_generation_p95_ratio':p95_ratio,'gates':gates,'all_gates_passed':all(gates.values()),'decision':'Keep default off. Mechanism-screening only; no broad accuracy superiority or automatic rollout.','cny_cost':None,'cny_cap_revoked':True,'historical_scores_unchanged':True,'new_model_calls_during_analysis':0,'evidence_root':str(root)}\nsave('result.json',report)\nprint(json.dumps({k:report[k] for k in ['combined','delta_forge','delta_direct','stable_target_gains','forge_regressions','control_B_ex_correct','total_tokens_ratio','forge_tokens_per_correct_ratio','forge_generation_p95_ratio','gates','all_gates_passed']},ensure_ascii=False,indent=2))\n" + }, + "integrity": { + "algorithm": "SHA-256 of sorted compact UTF-8 JSON excluding report_sha256, ensure_ascii=false" + }, + "report_sha256": "sha256:9544445c1ccf4db94cb825d8722839fe1b7173f7ea0db4191bc1eba9e2bd8596" +} diff --git a/docs/archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.md b/docs/archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.md new file mode 100644 index 0000000..dfc95fd --- /dev/null +++ b/docs/archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.md @@ -0,0 +1,114 @@ +# Forge 里程碑:本轮 Schema 说明增强实验得分超过 Direct SQL + +> 日期:2026-09-08 · 实验:REQ-065 / Forge-20260908-02 · 归档:REQ-066 / Forge-20260908-03 +> 状态:实验完成、局部得分领先;预注册采用门槛未通过,候选保持默认 `off`。本记录不是版本发布。 + +## 1. 突破是什么 + +在本轮固定的 **8 道开发题、两次重复**中,启用 `interfaces-v1` 的 Forge EX 与 Contract 均为 **12/16(75%)**,同期 Direct SQL 为 **10/16(62.5%)**。两个重复分别都是 **6/8 vs 5/8**。 + +因此,可以记录:**在这轮限定样本实验中,增强后的 Forge 得分超过了 Direct SQL,高 12.5 个百分点。** + +不能记录为“16 道独立题”“首次超过 Direct SQL”“全面领先”或“统计显著优势”。历史定向实验已有局部领先;本次价值是:把关键 DSL 说明作为独立变量,观察到两个重复均有总分领先,并留下完整的真实调用与原响应重放证据。总分重复领先不等于同一题的改善稳定复现。 + +事实源:[实跑 JSON](benchmark-luna-schema-descriptions-2026-09-08.json);前置证据:[准备卡](benchmark-luna-schema-descriptions-ready-2026-09-08.json)、[生成优化研究](forge-json-generation-research-2026-09-08.json)。本简报不另行评分、不覆盖原报告。 + +## 2. 到底做了哪些优化 + +### 2.1 本轮唯一生成变量:补全五个接口的模型可见语义 + +REQ-064 的代码审计发现:当前 Benchmark 加载静态 `forge/schema.json`,既有 strict 转换会去掉原 Schema 的 72 条 `description`。合法 JSON 约束仍然存在,但“定义了什么、绑定了什么、导出了什么”不能仅靠结构合法性表达。这是当前链路的已知说明缺口;它是否导致某道错题,仍不能仅凭审计判定。 + +没有恢复全部旧说明,也没有继续堆题目范例。新增共享目录 [`forge-output-descriptions-v1.json`](../../../agent/contracts/forge-output-descriptions-v1.json),只审核并加入以下五个根字段说明: + +| 字段 | 增加的语义说明 | 防止混淆的边界 | +|---|---|---| +| `scan` | 本查询块的 FROM 来源;引用本地列前先通过 scan/joins 绑定表、CTE 或派生查询;合法祖先作用域相关引用仍可用。 | 声明 CTE 不等于将它加入 FROM。 | +| `cte` | 每个子查询的 `select` 定义对下游导出的列;下游只能引用导出名。 | CTE 内部字段不自动对外可见。 | +| `agg` | 聚合定义属于当前块,用精确 `as` 别名引用。 | 定义聚合不等于选入结果,也不等于导出给下一层。 | +| `window` | 窗口定义属于当前块,使用精确别名;同层用 `qualify` 过滤;下游需要 `select` 导出。 | 隐藏的窗口辅助值不能被下一层直接引用。 | +| `select` | 当前块的输出接口;CTE 显式导出下游所需列,最终块只返回问题要求的答案列。 | 中间计数、辅助值不应无要求地进入最终答案。 | + +[`createStrictForgeOutput`](../../../services/pi-orchestrator/src/strict-forge-output.ts) 复用既有转换器,构造 strict Schema 后附加经审核的说明。模型可见 Schema 从 **8,034 增至 9,171 字节(+1,137)**;字节增量不是 token 用量。 + +**没有改变**:canonical DSL、字段顺序、Prompt、Direct 输入、两臂上下文、模型/SDK、Compiler、Assurance、Gold、评分规则。没有自动补列、补 JOIN、重排键序、答案规划、追加返修、多候选选优或模型更换。不能把未实施的研究建议列作本轮优化动作。 + +### 2.2 配套工程:让单变量实验可信、可拒绝、可重放 + +这些是实验完整性改进,不应另算准确率收益: + +- **显式 opt-in**:`--schema-descriptions` 默认 `off`;`interfaces-v1` 必须同时声明 `--variable schema_descriptions`,不偷改默认路径。 +- **同一版本化来源**:共享目录同时绑定 canonical Schema 与实际 wire Schema 的 hash;Python 与 Pi 消费同一来源,wire 指纹由真实 TypeScript 转换复算,不再维护另一份转换器。 +- **冻结与比较**:`bird-protocol-v5` 将说明模式、目录与 wire 修订纳入冻结。新因素只允许已声明的 mode/wire 差异,不能夹带 Prompt、上下文、Compiler、SDK 或模型漂移;旧 `schema` 因素仍要求相同候选。 +- **运行时隔离**:每个 Run 使用自己的已验证 profile,启动、派发与重开都绑定原合同。未知模式、目录/Schema 漂移、未声明因素、旧冻结续跑均失败关闭。 +- **真实调用留证**:沿既有 Pi Runtime 执行,限制原 64 次,捕获原始 SSE、HTTP 回执、候选、用量与状态;再用既有 Python replay/compare 重放,不靠手工挑选成功响应。 + +源码入口:[`bird_benchmark.py`](../../../forge/bird_benchmark.py)、[`cli.py`](../../../forge/cli.py)、[`benchmark-contracts.ts`](../../../services/pi-orchestrator/src/benchmark-contracts.ts)、[`benchmark-runtime.ts`](../../../services/pi-orchestrator/src/benchmark-runtime.ts)。 + +### 2.3 历史基础,不是本轮新增变量 + +此前已分别完成 Structured Tool/Prompt 与舍入规则优化(REQ-029)、qualified identifier/HAVING alias 等确定性 Compiler 修复(REQ-030/031)、原生 `strict:true` 工具输出及传输 null 归一化(REQ-038)、省略 AS 别名解析维护(REQ-039)。这些为本轮提供既有基础,**不能把历史收益累加到这次 12/16 上**,也不能把本轮差值归因于全部历史动作。 + +同样,先前分母/CTE 范例出现的回退和失败结论不改写。本轮没有叠加这些候选。历史逐轮边界见[报告导航](../../README.md#accuracy--benchmark-逐轮报告)。 + +## 3. 实验设计与完整结果 + +- 模型:`openai-codex/gpt-5.6-luna`,既有订阅 OAuth;模型/SDK 修订由原卡与实际生成合同固定。 +- 目标题:`md-009`、`md-079`、`md-199`、`md-289`;跨库控制题:`md-002`、`md-052`、`md-312`、`md-386`。这是已曝光的开发筛查集,不是独立 H。 +- A:`off`;B:`interfaces-v1`。执行顺序 **A1 → B1 → B2 → A2**,比较 A1/B1 与 A2/B2。 +- 8 题 × 2 条件 × 2 臂 × 2 重复 = **64 次真实请求**。每臂单回合、默认采样、`max_output_tokens=null`、timeout 120 秒;零重试、换题、补跑或额外 canary。 +- 真实生成时间:2026-09-08 10:10–10:14(+08:00)。全部 HTTP 200、64 个候选、4 个 Run 均 completed;评分与用量未知均为 0。 + +| 条件 / 重复 | Forge EX | Forge Contract | Direct EX | Direct Contract | +|---|---:|---:|---:|---:| +| A1(off) | 5/8 | 5/8 | 5/8 | 5/8 | +| B1(interfaces-v1) | 6/8 | 6/8 | 5/8 | 5/8 | +| B2(interfaces-v1) | 6/8 | 6/8 | 5/8 | 5/8 | +| A2(off) | 5/8 | 5/8 | 5/8 | 5/8 | +| A 合计 | 10/16 | 10/16 | 10/16 | 10/16 | +| **B 合计** | **12/16** | **12/16** | **10/16** | **10/16** | + +EX 是原实验的执行结果匹配口径,不是“SQL 能运行”的比例;JSON 中沿用 `official_ea` 字段。Contract 单独记录,本轮恰好与 EX 一致,不能据此将两指标合并。 + +## 4. 收益、回退与成本一起保留 + +| 对照 → 处理的 Forge 变化 | EX / Contract | +|---|---| +| 第一重复 `md-289` | 错 → 对 | +| 第二重复 `md-079`、`md-199` | 错 → 对 | +| 第二重复控制题 `md-052` | **对 → 错** | + +没有同一目标题在两个重复中都实现错→对。处理组控制题合计 **7/8**,未达到 **8/8**。因此,稳定目标题收益、零回退、控制全对三项预注册门槛未通过;不因合计分数增加而事后放宽。 + +| 成本 / 执行指标 | A | B | B 相对 A | +|---|---:|---:|---:| +| 双臂总 tokens | 109,155 | 112,860 | +3.39% | +| Forge tokens | 71,044 | 75,251 | 原始量均保留 | +| Forge 每个 EX 正确答案 tokens | 7,104.40 | 6,270.92 | −11.73% | +| Forge 生成 P95 | 20,737.9 ms | 19,614.3 ms | −5.42% | +| Forge 执行成功 | 13/16 | 16/16 | 不替代 EX | + +总计 **222,015 tokens**,用量未知 0。以上相对成本门槛通过,但不能抵消正确性门槛失败;成本改善是 B 相对 A 的 Forge 效率,不是声称比 Direct 更省。P95 是本轮小样本实测,不代表生产性能。订阅人民币费用不可核算,不承诺免费。 + +## 5. 验证证据与公开边界 + +**生成前准备(历史验证,本次文档整理不复跑)**:45/45 独立 SQLite 正反行为检查;500 题默认 context/schema/instructions 不变;16 个保存候选在两条件下 SQL、结果、EX/Contract 不变;真实 Pi SDK 本地合成 SSE 验证。合成回放不是新模型生成。 + +**本轮真实生成与重放**:64 份原 SSE 的候选及 provider 用量逐一匹配 Pi 保存记录;64 臂 SQL、编译执行状态、EX、Contract 重放无差异;两个重复协议比较可比。没有在分析阶段新增模型调用。 + +**本次提交前维护验证(2026-09-08,11:04 +08:00 前完成)**: + +- `.venv/bin/python -m pytest tests/test_bird_benchmark.py -q`:81 passed;1 个第三方弃用 warning。 +- 在 `services/pi-orchestrator/` 执行 `npm run typecheck`:通过。 +- 同目录 `node --import tsx --test tests/benchmark-runtime.test.ts tests/strict-forge-output.test.ts`:53 passed;Node SQLite experimental warning。 +- 此次不是全套回归或新真实模型实验;测试数不与准备期全套记录混算。 + +公开报告中的本地证据路径不是公网下载地址。原始 SSE、SQLite、订阅凭据与第三方数据集不入 Git;保存的脚本仅是审计方法,不是可自动消费当前调用授权的入口。实跑报告内个人主目录作最小脱敏,原件与公开字节 hash 对照见[公开处理记录](../engineering/schema-descriptions-publication-2026-09-08.json)。嵌入的 `report_sha256` 仍描述原件,不冒充公开副本 hash。 + +## 6. 决定与可复用表达 + +**记为一个限定样本内的工程里程碑;记录领先,也保留失败门槛。候选继续默认 off。** + +不合并 main、不打 tag、不发布版本、不部署安装、不新增模型调用;本次授权仅包含文案/文档归档及当前分支 commit/push。H、R0.6 与历史 500 题结论不变。 + +可复用文案见[Devlog 草稿](../../devlog/2026-09-08-forge-schema-descriptions-milestone.md)。这份草稿可用于后续沟通,但本次不执行平台分发。 diff --git a/docs/archive/benchmarks/benchmark-luna-schema-descriptions-ready-2026-09-08.json b/docs/archive/benchmarks/benchmark-luna-schema-descriptions-ready-2026-09-08.json new file mode 100644 index 0000000..b020a5c --- /dev/null +++ b/docs/archive/benchmarks/benchmark-luna-schema-descriptions-ready-2026-09-08.json @@ -0,0 +1,3957 @@ +{ + "schema_version": "benchmark-schema-descriptions-ready-v1", + "date": "2026-09-08", + "requirement": "REQ-2026-09-08-065", + "status": "zero_model_call_preparation_complete_candidate_default_off", + "conclusion": { + "candidate_ready": true, + "default_enabled": false, + "new_generation_evidence": false, + "new_model_calls": 0, + "decision": "准备完成;保持默认off,等待固定64次Luna开发预算的单独明确授权。未证明任何EX提升或超过Direct SQL。" + }, + "implementation": { + "shared_catalog": "agent/contracts/forge-output-descriptions-v1.json", + "protocol_version": "bird-protocol-v5", + "factor": "schema_descriptions", + "default": "off", + "candidate": "interfaces-v1", + "description_fields": [ + "scan", + "cte", + "agg", + "window", + "select" + ], + "off_schema_bytes": 8034, + "candidate_schema_bytes": 9171, + "additional_schema_bytes": 1137, + "catalog_revision": "sha256:796f6d6c15779b537cf3692ea315bd0d8fc6b8cd012e894e5833381d1c44ab18", + "wire_revisions": { + "off": "sha256:01f2abbe6608b33610f4106f1acf8705ffca38a4aa3c8d990bc7b6f7fe739b8d", + "interfaces-v1": "sha256:d3d56c36a2a8fd0322e61474a1ae8602d40244bdba5d6a00a50095f0c254848f" + }, + "strict_structure_order_unchanged": true, + "canonical_prompt_compiler_assurance_unchanged": true, + "cutover": "仅v5新冻结;缺说明metadata、v4/旧冻结、伪mode/catalog/canonical/wire、未声明因素失败关闭;旧记录保留并仅可显式诊断。", + "actual_binding": "Python freeze/preflight/validate/verify_case及Pi start/resume/runArm/onPayload/decode/log使用同一说明来源与所属Run缓存profile;真实wire复算,不复制转换器。", + "compare": "schema_descriptions必须完整且各自与manifest绑定的Pi generation_contract/model provenance;只放行mode及wire,拒绝Prompt/context/canonical/catalog/source/runtime/SDK/model漂移;原schema确定性因素继续要求同候选。", + "packaging": "沿用pyproject.toml agent.contracts = [*.json];无额外打包约定。" + }, + "semantic_review": { + "method": "独立内存SQLite,非调用compile的回显;手工预定正确结果和拒绝边界,普通/空/NULL+并列三类fixture。", + "passed": 45, + "total": 45, + "positive_per_fixture": 11, + "negative_per_fixture": 4, + "results": { + "fixtures": { + "ordinary": [ + [ + 1, + "A", + 10.0 + ], + [ + 2, + "A", + 20.0 + ], + [ + 3, + "B", + 5.0 + ] + ], + "empty": [], + "null_and_ties": [ + [ + 1, + "A", + null + ], + [ + 2, + "A", + null + ], + [ + 3, + "B", + 5.0 + ], + [ + 4, + "B", + 5.0 + ] + ] + }, + "cases": [ + { + "name": "local_source", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ] + }, + "expected": { + "ordinary": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ], + "empty": [], + "null_and_ties": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ] + ] + }, + "reject": false + }, + { + "name": "local_aggregate_alias", + "query": { + "scan": "facts", + "group": [ + "grp" + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "grp", + "total" + ], + "sort": [ + { + "col": "grp", + "dir": "asc" + } + ] + }, + "expected": { + "ordinary": [ + [ + "A", + 30.0 + ], + [ + "B", + 5.0 + ] + ], + "empty": [], + "null_and_ties": [ + [ + "A", + null + ], + [ + "B", + 10.0 + ] + ] + }, + "reject": false + }, + { + "name": "declared_aggregate_is_not_an_output", + "query": { + "scan": "facts", + "group": [ + "grp" + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "grp" + ], + "sort": [ + { + "col": "grp", + "dir": "asc" + } + ] + }, + "expected": { + "ordinary": [ + [ + "A" + ], + [ + "B" + ] + ], + "empty": [], + "null_and_ties": [ + [ + "A" + ], + [ + "B" + ] + ] + }, + "reject": false + }, + { + "name": "hidden_aggregate_in_having", + "query": { + "scan": "facts", + "group": [ + "grp" + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "grp" + ], + "sort": [ + { + "col": "grp", + "dir": "asc" + } + ], + "having": [ + { + "col": "total", + "op": "gt", + "val": 15 + } + ] + }, + "expected": { + "ordinary": [ + [ + "A" + ] + ], + "empty": [], + "null_and_ties": [] + }, + "reject": false + }, + { + "name": "aggregate_alias_must_match", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "missing" + ] + }, + "expected": null, + "reject": true + }, + { + "name": "renamed_cte_output", + "query": { + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + { + "expr": "total", + "as": "exported_total" + } + ] + } + } + ], + "scan": "totals", + "select": [ + "exported_total" + ] + }, + "expected": { + "ordinary": [ + [ + 35.0 + ] + ], + "empty": [ + [ + null + ] + ], + "null_and_ties": [ + [ + 10.0 + ] + ] + }, + "reject": false + }, + { + "name": "cte_cannot_export_undeclared_alias", + "query": { + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ] + } + } + ], + "scan": "totals", + "select": [ + "total" + ] + }, + "expected": null, + "reject": true + }, + { + "name": "declared_cte_requires_from_binding", + "query": { + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "count_all", + "as": "n" + } + ], + "select": [ + "n" + ] + } + } + ], + "scan": "facts", + "select": [ + "totals.n" + ] + }, + "expected": null, + "reject": true + }, + { + "name": "unused_cte_does_not_change_source", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ], + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "count_all", + "as": "n" + } + ], + "select": [ + "n" + ] + } + } + ] + }, + "expected": { + "ordinary": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ], + "empty": [], + "null_and_ties": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ] + ] + }, + "reject": false + }, + { + "name": "local_hidden_window_qualify", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ], + "window": [ + { + "fn": "row_number", + "partition": [ + "grp" + ], + "order": [ + { + "col": "amount", + "dir": "desc" + }, + { + "col": "id", + "dir": "asc" + } + ], + "as": "r" + } + ], + "qualify": [ + { + "col": "r", + "op": "eq", + "val": 1 + } + ] + }, + "expected": { + "ordinary": [ + [ + 2 + ], + [ + 3 + ] + ], + "empty": [], + "null_and_ties": [ + [ + 1 + ], + [ + 3 + ] + ] + }, + "reject": false + }, + { + "name": "export_window_then_filter_downstream", + "query": { + "cte": [ + { + "name": "ranked", + "query": { + "scan": "facts", + "window": [ + { + "fn": "row_number", + "partition": [ + "grp" + ], + "order": [ + { + "col": "amount", + "dir": "desc" + }, + { + "col": "id", + "dir": "asc" + } + ], + "as": "r" + } + ], + "select": [ + "id", + "r" + ] + } + } + ], + "scan": "ranked", + "filter": [ + { + "col": "r", + "op": "eq", + "val": 1 + } + ], + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ] + }, + "expected": { + "ordinary": [ + [ + 2 + ], + [ + 3 + ] + ], + "empty": [], + "null_and_ties": [ + [ + 1 + ], + [ + 3 + ] + ] + }, + "reject": false + }, + { + "name": "hidden_window_is_not_exported", + "query": { + "cte": [ + { + "name": "ranked", + "query": { + "scan": "facts", + "window": [ + { + "fn": "row_number", + "partition": [ + "grp" + ], + "order": [ + { + "col": "amount", + "dir": "desc" + }, + { + "col": "id", + "dir": "asc" + } + ], + "as": "r" + } + ], + "select": [ + "id" + ] + } + } + ], + "scan": "ranked", + "filter": [ + { + "col": "r", + "op": "eq", + "val": 1 + } + ], + "select": [ + "id" + ] + }, + "expected": null, + "reject": true + }, + { + "name": "derived_source_remains_legal", + "query": { + "scan": "(SELECT id, amount FROM facts) AS source", + "select": [ + "source.id" + ], + "sort": [ + { + "col": "source.id", + "dir": "asc" + } + ] + }, + "expected": { + "ordinary": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ], + "empty": [], + "null_and_ties": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ] + ] + }, + "reject": false + }, + { + "name": "correlated_reference_remains_legal", + "query": { + "scan": "facts", + "select": [ + "facts.id", + { + "expr": "(SELECT MAX(inner_facts.amount) FROM facts AS inner_facts WHERE inner_facts.grp = facts.grp)", + "as": "group_max" + } + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ] + }, + "expected": { + "ordinary": [ + [ + 1, + 20.0 + ], + [ + 2, + 20.0 + ], + [ + 3, + 5.0 + ] + ], + "empty": [], + "null_and_ties": [ + [ + 1, + null + ], + [ + 2, + null + ], + [ + 3, + 5.0 + ], + [ + 4, + 5.0 + ] + ] + }, + "reject": false + }, + { + "name": "final_expression_not_intermediate_counts", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "count_all", + "as": "all_count" + }, + { + "fn": "count", + "col": "id", + "as": "part", + "filter": [ + { + "col": "grp", + "op": "eq", + "val": "A" + } + ] + } + ], + "select": [ + { + "expr": "100.0 * part / NULLIF(all_count,0)", + "as": "percentage" + } + ] + }, + "expected": { + "ordinary": [ + [ + 66.66666666666667 + ] + ], + "empty": [ + [ + null + ] + ], + "null_and_ties": [ + [ + 50.0 + ] + ] + }, + "reject": false + } + ], + "results": [ + { + "case": "local_source", + "fixture": "ordinary", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ] + }, + "sql": "SELECT id\nFROM facts\nORDER BY id ASC", + "expected": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ], + "actual": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "local_aggregate_alias", + "fixture": "ordinary", + "query": { + "scan": "facts", + "group": [ + "grp" + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "grp", + "total" + ], + "sort": [ + { + "col": "grp", + "dir": "asc" + } + ] + }, + "sql": "SELECT grp, SUM(amount) AS total\nFROM facts\nGROUP BY grp\nORDER BY grp ASC", + "expected": [ + [ + "A", + 30.0 + ], + [ + "B", + 5.0 + ] + ], + "actual": [ + [ + "A", + 30.0 + ], + [ + "B", + 5.0 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "declared_aggregate_is_not_an_output", + "fixture": "ordinary", + "query": { + "scan": "facts", + "group": [ + "grp" + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "grp" + ], + "sort": [ + { + "col": "grp", + "dir": "asc" + } + ] + }, + "sql": "SELECT grp\nFROM facts\nGROUP BY grp\nORDER BY grp ASC", + "expected": [ + [ + "A" + ], + [ + "B" + ] + ], + "actual": [ + [ + "A" + ], + [ + "B" + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "hidden_aggregate_in_having", + "fixture": "ordinary", + "query": { + "scan": "facts", + "group": [ + "grp" + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "grp" + ], + "sort": [ + { + "col": "grp", + "dir": "asc" + } + ], + "having": [ + { + "col": "total", + "op": "gt", + "val": 15 + } + ] + }, + "sql": "SELECT grp\nFROM facts\nGROUP BY grp\nHAVING SUM(amount) > 15\nORDER BY grp ASC", + "expected": [ + [ + "A" + ] + ], + "actual": [ + [ + "A" + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "aggregate_alias_must_match", + "fixture": "ordinary", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "missing" + ] + }, + "sql": "SELECT missing\nFROM facts", + "expected": null, + "actual": null, + "rejected": true, + "stage": "assurance", + "passed": true, + "error": "Registry/权限校验失败:SQL 使用了未授权或不存在的表/字段。" + }, + { + "case": "renamed_cte_output", + "fixture": "ordinary", + "query": { + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + { + "expr": "total", + "as": "exported_total" + } + ] + } + } + ], + "scan": "totals", + "select": [ + "exported_total" + ] + }, + "sql": "WITH totals AS (\n SELECT SUM(amount) AS exported_total\n FROM facts\n)\nSELECT exported_total\nFROM totals", + "expected": [ + [ + 35.0 + ] + ], + "actual": [ + [ + 35.0 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "cte_cannot_export_undeclared_alias", + "fixture": "ordinary", + "query": { + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ] + } + } + ], + "scan": "totals", + "select": [ + "total" + ] + }, + "sql": "WITH totals AS (\n SELECT id\n FROM facts\n ORDER BY id ASC\n)\nSELECT total\nFROM totals", + "expected": null, + "actual": null, + "rejected": true, + "stage": "assurance", + "passed": true, + "error": "Registry/权限校验失败:SQL 使用了未授权或不存在的表/字段。" + }, + { + "case": "declared_cte_requires_from_binding", + "fixture": "ordinary", + "query": { + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "count_all", + "as": "n" + } + ], + "select": [ + "n" + ] + } + } + ], + "scan": "facts", + "select": [ + "totals.n" + ] + }, + "sql": null, + "expected": null, + "actual": null, + "rejected": true, + "stage": "compile", + "passed": true, + "error": "字段引用了未加入 FROM/JOIN 的表:totals。请先声明正确的 JOIN。" + }, + { + "case": "unused_cte_does_not_change_source", + "fixture": "ordinary", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ], + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "count_all", + "as": "n" + } + ], + "select": [ + "n" + ] + } + } + ] + }, + "sql": "WITH totals AS (\n SELECT COUNT(*) AS n\n FROM facts\n)\nSELECT id\nFROM facts\nORDER BY id ASC", + "expected": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ], + "actual": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "local_hidden_window_qualify", + "fixture": "ordinary", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ], + "window": [ + { + "fn": "row_number", + "partition": [ + "grp" + ], + "order": [ + { + "col": "amount", + "dir": "desc" + }, + { + "col": "id", + "dir": "asc" + } + ], + "as": "r" + } + ], + "qualify": [ + { + "col": "r", + "op": "eq", + "val": 1 + } + ] + }, + "sql": "SELECT id FROM (\n SELECT id, ROW_NUMBER() OVER (PARTITION BY grp ORDER BY amount DESC, id ASC) AS r\n FROM facts\n ORDER BY id ASC\n) AS _q\nWHERE r = 1", + "expected": [ + [ + 2 + ], + [ + 3 + ] + ], + "actual": [ + [ + 2 + ], + [ + 3 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "export_window_then_filter_downstream", + "fixture": "ordinary", + "query": { + "cte": [ + { + "name": "ranked", + "query": { + "scan": "facts", + "window": [ + { + "fn": "row_number", + "partition": [ + "grp" + ], + "order": [ + { + "col": "amount", + "dir": "desc" + }, + { + "col": "id", + "dir": "asc" + } + ], + "as": "r" + } + ], + "select": [ + "id", + "r" + ] + } + } + ], + "scan": "ranked", + "filter": [ + { + "col": "r", + "op": "eq", + "val": 1 + } + ], + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ] + }, + "sql": "WITH ranked AS (\n SELECT id, ROW_NUMBER() OVER (PARTITION BY grp ORDER BY amount DESC, id ASC) AS r\n FROM facts\n)\nSELECT id\nFROM ranked\nWHERE r = 1\nORDER BY id ASC", + "expected": [ + [ + 2 + ], + [ + 3 + ] + ], + "actual": [ + [ + 2 + ], + [ + 3 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "hidden_window_is_not_exported", + "fixture": "ordinary", + "query": { + "cte": [ + { + "name": "ranked", + "query": { + "scan": "facts", + "window": [ + { + "fn": "row_number", + "partition": [ + "grp" + ], + "order": [ + { + "col": "amount", + "dir": "desc" + }, + { + "col": "id", + "dir": "asc" + } + ], + "as": "r" + } + ], + "select": [ + "id" + ] + } + } + ], + "scan": "ranked", + "filter": [ + { + "col": "r", + "op": "eq", + "val": 1 + } + ], + "select": [ + "id" + ] + }, + "sql": "WITH ranked AS (\n SELECT id\n FROM facts\n)\nSELECT id\nFROM ranked\nWHERE r = 1", + "expected": null, + "actual": null, + "rejected": true, + "stage": "assurance", + "passed": true, + "error": "Registry/权限校验失败:SQL 使用了未授权或不存在的表/字段。" + }, + { + "case": "derived_source_remains_legal", + "fixture": "ordinary", + "query": { + "scan": "(SELECT id, amount FROM facts) AS source", + "select": [ + "source.id" + ], + "sort": [ + { + "col": "source.id", + "dir": "asc" + } + ] + }, + "sql": "SELECT source.id\nFROM (SELECT id, amount FROM facts) AS source\nORDER BY source.id ASC", + "expected": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ], + "actual": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "correlated_reference_remains_legal", + "fixture": "ordinary", + "query": { + "scan": "facts", + "select": [ + "facts.id", + { + "expr": "(SELECT MAX(inner_facts.amount) FROM facts AS inner_facts WHERE inner_facts.grp = facts.grp)", + "as": "group_max" + } + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ] + }, + "sql": "SELECT facts.id, (SELECT MAX(inner_facts.amount) FROM facts AS inner_facts WHERE inner_facts.grp = facts.grp) AS group_max\nFROM facts\nORDER BY id ASC", + "expected": [ + [ + 1, + 20.0 + ], + [ + 2, + 20.0 + ], + [ + 3, + 5.0 + ] + ], + "actual": [ + [ + 1, + 20.0 + ], + [ + 2, + 20.0 + ], + [ + 3, + 5.0 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "final_expression_not_intermediate_counts", + "fixture": "ordinary", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "count_all", + "as": "all_count" + }, + { + "fn": "count", + "col": "id", + "as": "part", + "filter": [ + { + "col": "grp", + "op": "eq", + "val": "A" + } + ] + } + ], + "select": [ + { + "expr": "100.0 * part / NULLIF(all_count,0)", + "as": "percentage" + } + ] + }, + "sql": "SELECT 100.0 * COUNT(id) FILTER (WHERE grp = 'A') / NULLIF(COUNT(*),0) AS percentage\nFROM facts", + "expected": [ + [ + 66.66666666666667 + ] + ], + "actual": [ + [ + 66.66666666666667 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "local_source", + "fixture": "empty", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ] + }, + "sql": "SELECT id\nFROM facts\nORDER BY id ASC", + "expected": [], + "actual": [], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "local_aggregate_alias", + "fixture": "empty", + "query": { + "scan": "facts", + "group": [ + "grp" + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "grp", + "total" + ], + "sort": [ + { + "col": "grp", + "dir": "asc" + } + ] + }, + "sql": "SELECT grp, SUM(amount) AS total\nFROM facts\nGROUP BY grp\nORDER BY grp ASC", + "expected": [], + "actual": [], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "declared_aggregate_is_not_an_output", + "fixture": "empty", + "query": { + "scan": "facts", + "group": [ + "grp" + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "grp" + ], + "sort": [ + { + "col": "grp", + "dir": "asc" + } + ] + }, + "sql": "SELECT grp\nFROM facts\nGROUP BY grp\nORDER BY grp ASC", + "expected": [], + "actual": [], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "hidden_aggregate_in_having", + "fixture": "empty", + "query": { + "scan": "facts", + "group": [ + "grp" + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "grp" + ], + "sort": [ + { + "col": "grp", + "dir": "asc" + } + ], + "having": [ + { + "col": "total", + "op": "gt", + "val": 15 + } + ] + }, + "sql": "SELECT grp\nFROM facts\nGROUP BY grp\nHAVING SUM(amount) > 15\nORDER BY grp ASC", + "expected": [], + "actual": [], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "aggregate_alias_must_match", + "fixture": "empty", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "missing" + ] + }, + "sql": "SELECT missing\nFROM facts", + "expected": null, + "actual": null, + "rejected": true, + "stage": "assurance", + "passed": true, + "error": "Registry/权限校验失败:SQL 使用了未授权或不存在的表/字段。" + }, + { + "case": "renamed_cte_output", + "fixture": "empty", + "query": { + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + { + "expr": "total", + "as": "exported_total" + } + ] + } + } + ], + "scan": "totals", + "select": [ + "exported_total" + ] + }, + "sql": "WITH totals AS (\n SELECT SUM(amount) AS exported_total\n FROM facts\n)\nSELECT exported_total\nFROM totals", + "expected": [ + [ + null + ] + ], + "actual": [ + [ + null + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "cte_cannot_export_undeclared_alias", + "fixture": "empty", + "query": { + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ] + } + } + ], + "scan": "totals", + "select": [ + "total" + ] + }, + "sql": "WITH totals AS (\n SELECT id\n FROM facts\n ORDER BY id ASC\n)\nSELECT total\nFROM totals", + "expected": null, + "actual": null, + "rejected": true, + "stage": "assurance", + "passed": true, + "error": "Registry/权限校验失败:SQL 使用了未授权或不存在的表/字段。" + }, + { + "case": "declared_cte_requires_from_binding", + "fixture": "empty", + "query": { + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "count_all", + "as": "n" + } + ], + "select": [ + "n" + ] + } + } + ], + "scan": "facts", + "select": [ + "totals.n" + ] + }, + "sql": null, + "expected": null, + "actual": null, + "rejected": true, + "stage": "compile", + "passed": true, + "error": "字段引用了未加入 FROM/JOIN 的表:totals。请先声明正确的 JOIN。" + }, + { + "case": "unused_cte_does_not_change_source", + "fixture": "empty", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ], + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "count_all", + "as": "n" + } + ], + "select": [ + "n" + ] + } + } + ] + }, + "sql": "WITH totals AS (\n SELECT COUNT(*) AS n\n FROM facts\n)\nSELECT id\nFROM facts\nORDER BY id ASC", + "expected": [], + "actual": [], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "local_hidden_window_qualify", + "fixture": "empty", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ], + "window": [ + { + "fn": "row_number", + "partition": [ + "grp" + ], + "order": [ + { + "col": "amount", + "dir": "desc" + }, + { + "col": "id", + "dir": "asc" + } + ], + "as": "r" + } + ], + "qualify": [ + { + "col": "r", + "op": "eq", + "val": 1 + } + ] + }, + "sql": "SELECT id FROM (\n SELECT id, ROW_NUMBER() OVER (PARTITION BY grp ORDER BY amount DESC, id ASC) AS r\n FROM facts\n ORDER BY id ASC\n) AS _q\nWHERE r = 1", + "expected": [], + "actual": [], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "export_window_then_filter_downstream", + "fixture": "empty", + "query": { + "cte": [ + { + "name": "ranked", + "query": { + "scan": "facts", + "window": [ + { + "fn": "row_number", + "partition": [ + "grp" + ], + "order": [ + { + "col": "amount", + "dir": "desc" + }, + { + "col": "id", + "dir": "asc" + } + ], + "as": "r" + } + ], + "select": [ + "id", + "r" + ] + } + } + ], + "scan": "ranked", + "filter": [ + { + "col": "r", + "op": "eq", + "val": 1 + } + ], + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ] + }, + "sql": "WITH ranked AS (\n SELECT id, ROW_NUMBER() OVER (PARTITION BY grp ORDER BY amount DESC, id ASC) AS r\n FROM facts\n)\nSELECT id\nFROM ranked\nWHERE r = 1\nORDER BY id ASC", + "expected": [], + "actual": [], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "hidden_window_is_not_exported", + "fixture": "empty", + "query": { + "cte": [ + { + "name": "ranked", + "query": { + "scan": "facts", + "window": [ + { + "fn": "row_number", + "partition": [ + "grp" + ], + "order": [ + { + "col": "amount", + "dir": "desc" + }, + { + "col": "id", + "dir": "asc" + } + ], + "as": "r" + } + ], + "select": [ + "id" + ] + } + } + ], + "scan": "ranked", + "filter": [ + { + "col": "r", + "op": "eq", + "val": 1 + } + ], + "select": [ + "id" + ] + }, + "sql": "WITH ranked AS (\n SELECT id\n FROM facts\n)\nSELECT id\nFROM ranked\nWHERE r = 1", + "expected": null, + "actual": null, + "rejected": true, + "stage": "assurance", + "passed": true, + "error": "Registry/权限校验失败:SQL 使用了未授权或不存在的表/字段。" + }, + { + "case": "derived_source_remains_legal", + "fixture": "empty", + "query": { + "scan": "(SELECT id, amount FROM facts) AS source", + "select": [ + "source.id" + ], + "sort": [ + { + "col": "source.id", + "dir": "asc" + } + ] + }, + "sql": "SELECT source.id\nFROM (SELECT id, amount FROM facts) AS source\nORDER BY source.id ASC", + "expected": [], + "actual": [], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "correlated_reference_remains_legal", + "fixture": "empty", + "query": { + "scan": "facts", + "select": [ + "facts.id", + { + "expr": "(SELECT MAX(inner_facts.amount) FROM facts AS inner_facts WHERE inner_facts.grp = facts.grp)", + "as": "group_max" + } + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ] + }, + "sql": "SELECT facts.id, (SELECT MAX(inner_facts.amount) FROM facts AS inner_facts WHERE inner_facts.grp = facts.grp) AS group_max\nFROM facts\nORDER BY id ASC", + "expected": [], + "actual": [], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "final_expression_not_intermediate_counts", + "fixture": "empty", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "count_all", + "as": "all_count" + }, + { + "fn": "count", + "col": "id", + "as": "part", + "filter": [ + { + "col": "grp", + "op": "eq", + "val": "A" + } + ] + } + ], + "select": [ + { + "expr": "100.0 * part / NULLIF(all_count,0)", + "as": "percentage" + } + ] + }, + "sql": "SELECT 100.0 * COUNT(id) FILTER (WHERE grp = 'A') / NULLIF(COUNT(*),0) AS percentage\nFROM facts", + "expected": [ + [ + null + ] + ], + "actual": [ + [ + null + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "local_source", + "fixture": "null_and_ties", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ] + }, + "sql": "SELECT id\nFROM facts\nORDER BY id ASC", + "expected": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ] + ], + "actual": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "local_aggregate_alias", + "fixture": "null_and_ties", + "query": { + "scan": "facts", + "group": [ + "grp" + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "grp", + "total" + ], + "sort": [ + { + "col": "grp", + "dir": "asc" + } + ] + }, + "sql": "SELECT grp, SUM(amount) AS total\nFROM facts\nGROUP BY grp\nORDER BY grp ASC", + "expected": [ + [ + "A", + null + ], + [ + "B", + 10.0 + ] + ], + "actual": [ + [ + "A", + null + ], + [ + "B", + 10.0 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "declared_aggregate_is_not_an_output", + "fixture": "null_and_ties", + "query": { + "scan": "facts", + "group": [ + "grp" + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "grp" + ], + "sort": [ + { + "col": "grp", + "dir": "asc" + } + ] + }, + "sql": "SELECT grp\nFROM facts\nGROUP BY grp\nORDER BY grp ASC", + "expected": [ + [ + "A" + ], + [ + "B" + ] + ], + "actual": [ + [ + "A" + ], + [ + "B" + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "hidden_aggregate_in_having", + "fixture": "null_and_ties", + "query": { + "scan": "facts", + "group": [ + "grp" + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "grp" + ], + "sort": [ + { + "col": "grp", + "dir": "asc" + } + ], + "having": [ + { + "col": "total", + "op": "gt", + "val": 15 + } + ] + }, + "sql": "SELECT grp\nFROM facts\nGROUP BY grp\nHAVING SUM(amount) > 15\nORDER BY grp ASC", + "expected": [], + "actual": [], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "aggregate_alias_must_match", + "fixture": "null_and_ties", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + "missing" + ] + }, + "sql": "SELECT missing\nFROM facts", + "expected": null, + "actual": null, + "rejected": true, + "stage": "assurance", + "passed": true, + "error": "Registry/权限校验失败:SQL 使用了未授权或不存在的表/字段。" + }, + { + "case": "renamed_cte_output", + "fixture": "null_and_ties", + "query": { + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ], + "select": [ + { + "expr": "total", + "as": "exported_total" + } + ] + } + } + ], + "scan": "totals", + "select": [ + "exported_total" + ] + }, + "sql": "WITH totals AS (\n SELECT SUM(amount) AS exported_total\n FROM facts\n)\nSELECT exported_total\nFROM totals", + "expected": [ + [ + 10.0 + ] + ], + "actual": [ + [ + 10.0 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "cte_cannot_export_undeclared_alias", + "fixture": "null_and_ties", + "query": { + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ], + "agg": [ + { + "fn": "sum", + "col": "amount", + "as": "total" + } + ] + } + } + ], + "scan": "totals", + "select": [ + "total" + ] + }, + "sql": "WITH totals AS (\n SELECT id\n FROM facts\n ORDER BY id ASC\n)\nSELECT total\nFROM totals", + "expected": null, + "actual": null, + "rejected": true, + "stage": "assurance", + "passed": true, + "error": "Registry/权限校验失败:SQL 使用了未授权或不存在的表/字段。" + }, + { + "case": "declared_cte_requires_from_binding", + "fixture": "null_and_ties", + "query": { + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "count_all", + "as": "n" + } + ], + "select": [ + "n" + ] + } + } + ], + "scan": "facts", + "select": [ + "totals.n" + ] + }, + "sql": null, + "expected": null, + "actual": null, + "rejected": true, + "stage": "compile", + "passed": true, + "error": "字段引用了未加入 FROM/JOIN 的表:totals。请先声明正确的 JOIN。" + }, + { + "case": "unused_cte_does_not_change_source", + "fixture": "null_and_ties", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ], + "cte": [ + { + "name": "totals", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "count_all", + "as": "n" + } + ], + "select": [ + "n" + ] + } + } + ] + }, + "sql": "WITH totals AS (\n SELECT COUNT(*) AS n\n FROM facts\n)\nSELECT id\nFROM facts\nORDER BY id ASC", + "expected": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ] + ], + "actual": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "local_hidden_window_qualify", + "fixture": "null_and_ties", + "query": { + "scan": "facts", + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ], + "window": [ + { + "fn": "row_number", + "partition": [ + "grp" + ], + "order": [ + { + "col": "amount", + "dir": "desc" + }, + { + "col": "id", + "dir": "asc" + } + ], + "as": "r" + } + ], + "qualify": [ + { + "col": "r", + "op": "eq", + "val": 1 + } + ] + }, + "sql": "SELECT id FROM (\n SELECT id, ROW_NUMBER() OVER (PARTITION BY grp ORDER BY amount DESC, id ASC) AS r\n FROM facts\n ORDER BY id ASC\n) AS _q\nWHERE r = 1", + "expected": [ + [ + 1 + ], + [ + 3 + ] + ], + "actual": [ + [ + 1 + ], + [ + 3 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "export_window_then_filter_downstream", + "fixture": "null_and_ties", + "query": { + "cte": [ + { + "name": "ranked", + "query": { + "scan": "facts", + "window": [ + { + "fn": "row_number", + "partition": [ + "grp" + ], + "order": [ + { + "col": "amount", + "dir": "desc" + }, + { + "col": "id", + "dir": "asc" + } + ], + "as": "r" + } + ], + "select": [ + "id", + "r" + ] + } + } + ], + "scan": "ranked", + "filter": [ + { + "col": "r", + "op": "eq", + "val": 1 + } + ], + "select": [ + "id" + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ] + }, + "sql": "WITH ranked AS (\n SELECT id, ROW_NUMBER() OVER (PARTITION BY grp ORDER BY amount DESC, id ASC) AS r\n FROM facts\n)\nSELECT id\nFROM ranked\nWHERE r = 1\nORDER BY id ASC", + "expected": [ + [ + 1 + ], + [ + 3 + ] + ], + "actual": [ + [ + 1 + ], + [ + 3 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "hidden_window_is_not_exported", + "fixture": "null_and_ties", + "query": { + "cte": [ + { + "name": "ranked", + "query": { + "scan": "facts", + "window": [ + { + "fn": "row_number", + "partition": [ + "grp" + ], + "order": [ + { + "col": "amount", + "dir": "desc" + }, + { + "col": "id", + "dir": "asc" + } + ], + "as": "r" + } + ], + "select": [ + "id" + ] + } + } + ], + "scan": "ranked", + "filter": [ + { + "col": "r", + "op": "eq", + "val": 1 + } + ], + "select": [ + "id" + ] + }, + "sql": "WITH ranked AS (\n SELECT id\n FROM facts\n)\nSELECT id\nFROM ranked\nWHERE r = 1", + "expected": null, + "actual": null, + "rejected": true, + "stage": "assurance", + "passed": true, + "error": "Registry/权限校验失败:SQL 使用了未授权或不存在的表/字段。" + }, + { + "case": "derived_source_remains_legal", + "fixture": "null_and_ties", + "query": { + "scan": "(SELECT id, amount FROM facts) AS source", + "select": [ + "source.id" + ], + "sort": [ + { + "col": "source.id", + "dir": "asc" + } + ] + }, + "sql": "SELECT source.id\nFROM (SELECT id, amount FROM facts) AS source\nORDER BY source.id ASC", + "expected": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ] + ], + "actual": [ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "correlated_reference_remains_legal", + "fixture": "null_and_ties", + "query": { + "scan": "facts", + "select": [ + "facts.id", + { + "expr": "(SELECT MAX(inner_facts.amount) FROM facts AS inner_facts WHERE inner_facts.grp = facts.grp)", + "as": "group_max" + } + ], + "sort": [ + { + "col": "id", + "dir": "asc" + } + ] + }, + "sql": "SELECT facts.id, (SELECT MAX(inner_facts.amount) FROM facts AS inner_facts WHERE inner_facts.grp = facts.grp) AS group_max\nFROM facts\nORDER BY id ASC", + "expected": [ + [ + 1, + null + ], + [ + 2, + null + ], + [ + 3, + 5.0 + ], + [ + 4, + 5.0 + ] + ], + "actual": [ + [ + 1, + null + ], + [ + 2, + null + ], + [ + 3, + 5.0 + ], + [ + 4, + 5.0 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + }, + { + "case": "final_expression_not_intermediate_counts", + "fixture": "null_and_ties", + "query": { + "scan": "facts", + "agg": [ + { + "fn": "count_all", + "as": "all_count" + }, + { + "fn": "count", + "col": "id", + "as": "part", + "filter": [ + { + "col": "grp", + "op": "eq", + "val": "A" + } + ] + } + ], + "select": [ + { + "expr": "100.0 * part / NULLIF(all_count,0)", + "as": "percentage" + } + ] + }, + "sql": "SELECT 100.0 * COUNT(id) FILTER (WHERE grp = 'A') / NULLIF(COUNT(*),0) AS percentage\nFROM facts", + "expected": [ + [ + 50.0 + ] + ], + "actual": [ + [ + 50.0 + ] + ], + "rejected": false, + "stage": "execute", + "passed": true + } + ], + "new_model_calls": 0 + }, + "description_corrections": "scan明确保留derived及合法祖先相关引用;window说明允许同层qualify隐藏内部列,但下游需要select导出。", + "fixture_corrections": "初版烟测误用count_all.filter(改为已有count(id).filter)及把所有静态拒绝限定为Assurance(改为编译或Assurance拒绝);生产Compiler/Schema无改动。" + }, + "default_input_invariance": { + "public_cases": 500, + "checked_fields": [ + "context_snapshot", + "schema_context", + "forge_instructions", + "direct_instructions" + ], + "unchanged": 500, + "new_model_calls": 0, + "gold_executions": 0 + }, + "actual_cli_http": { + "freeze_command_base": ".venv/bin/python -m forge.cli benchmark bird freeze --cohort D --provider openai-codex --model gpt-5.6-luna --case-ids md-009 md-079 md-199 md-289 md-002 md-052 md-312 md-386 --variable schema_descriptions", + "control_flag": "--schema-descriptions off", + "treatment_flag": "--schema-descriptions interfaces-v1", + "only_manifest_differences": [ + "/schema_descriptions/mode", + "/schema_descriptions/wire_schema_revision" + ], + "gold_readiness": { + "policy": "require_all", + "selected": 8, + "blocked": 0, + "control_http_status": 200, + "treatment_http_status": 200 + }, + "runtime": "真实FastAPI路由/认证、真实冻结/上下文/评分;隔离cfg,仅合成服务key,没有加载真实.env/forge.yaml/凭据。", + "known_timeout_cases_not_executed": [ + "md-340", + "md-393" + ] + }, + "native_pi_sdk_smoke": { + "status": "passed", + "boundary": "real Pi SDK and real authenticated Python HTTP routes; only provider responses are deterministic loopback replay", + "new_model_calls": 0, + "synthetic_sse_dispatches": 4, + "external_network_requests": 0, + "unauthorized_http_status": 401, + "direct_payload_identical": true, + "forge_payload_identical_except_descriptions": true, + "candidate_outputs_identical": true, + "forged_mode_rejected_before_dispatch": true, + "runs": [ + { + "protocol_revision": "sha256:f9f11322f2f7e35ebd6615e097bdc8cde2cc6d0be685935bc091088b485262c5", + "generation_contract": { + "forge_output_mode": "pi_tool_schema", + "forge_prompt_revision": "forge-structured-benchmark-v1", + "forge_schema_revision": "sha256:e9b56c6f98d08c8b866bd4f49ab0076ff55510711429025d397a5acd9188e723", + "provider_json_schema_request": "required", + "forge_wire_schema_revision": "sha256:01f2abbe6608b33610f4106f1acf8705ffca38a4aa3c8d990bc7b6f7fe739b8d", + "schema_descriptions": { + "mode": "off", + "catalog_revision": "sha256:796f6d6c15779b537cf3692ea315bd0d8fc6b8cd012e894e5833381d1c44ab18", + "wire_schema_revision": "sha256:01f2abbe6608b33610f4106f1acf8705ffca38a4aa3c8d990bc7b6f7fe739b8d" + }, + "direct_output_mode": "text_sql", + "sampling": "provider_default", + "transport": "sse", + "max_output_tokens": null, + "timeout_seconds": 120, + "provider_retries": 0, + "max_agent_turns_per_arm": 1, + "isolation_revision": "pi-benchmark-isolation-v1", + "pi_runtime_revision": "sha256:f6612f91028af494784d8ecc982513b47ba4ff2086df444ae19231b8c2f22d0d", + "pi_sdk_lock_revision": "sha256:cd26acc8f80885074afc9042709d0337a4732637d185e5b0b13be99e961c80b6" + }, + "status": "completed", + "completed_synthetic_dispatches": 2, + "candidate_hashes": { + "forge": "sha256:eb54a3d6314be71e0de235500c981383c203716769e8352555a5ef20718cf3f1", + "direct": "sha256:a003db1086a1e223084f68747070f9d1f8c6f44d15a4613a9540d24701e4156c" + } + }, + { + "protocol_revision": "sha256:af97ed0bcf94e414aa07483c826457c7c782fc00e4e1c1ea8a457eb1b53727df", + "generation_contract": { + "forge_output_mode": "pi_tool_schema", + "forge_prompt_revision": "forge-structured-benchmark-v1", + "forge_schema_revision": "sha256:e9b56c6f98d08c8b866bd4f49ab0076ff55510711429025d397a5acd9188e723", + "provider_json_schema_request": "required", + "forge_wire_schema_revision": "sha256:d3d56c36a2a8fd0322e61474a1ae8602d40244bdba5d6a00a50095f0c254848f", + "schema_descriptions": { + "mode": "interfaces-v1", + "catalog_revision": "sha256:796f6d6c15779b537cf3692ea315bd0d8fc6b8cd012e894e5833381d1c44ab18", + "wire_schema_revision": "sha256:d3d56c36a2a8fd0322e61474a1ae8602d40244bdba5d6a00a50095f0c254848f" + }, + "direct_output_mode": "text_sql", + "sampling": "provider_default", + "transport": "sse", + "max_output_tokens": null, + "timeout_seconds": 120, + "provider_retries": 0, + "max_agent_turns_per_arm": 1, + "isolation_revision": "pi-benchmark-isolation-v1", + "pi_runtime_revision": "sha256:f6612f91028af494784d8ecc982513b47ba4ff2086df444ae19231b8c2f22d0d", + "pi_sdk_lock_revision": "sha256:cd26acc8f80885074afc9042709d0337a4732637d185e5b0b13be99e961c80b6" + }, + "status": "completed", + "completed_synthetic_dispatches": 2, + "candidate_hashes": { + "forge": "sha256:eb54a3d6314be71e0de235500c981383c203716769e8352555a5ef20718cf3f1", + "direct": "sha256:a003db1086a1e223084f68747070f9d1f8c6f44d15a4613a9540d24701e4156c" + } + } + ], + "network_paths": [ + "/api/internal/benchmark-v2/suite", + "/api/internal/benchmark-v2/suite", + "/api/internal/benchmark-v2/protocol", + "/api/internal/benchmark-v2/context", + "/v1/chat/completions", + "/v1/chat/completions", + "/api/internal/benchmark-v2/evaluate", + "/api/internal/benchmark-v2/evaluate", + "/api/internal/benchmark-v2/suite", + "/api/internal/benchmark-v2/protocol", + "/api/internal/benchmark-v2/context", + "/v1/chat/completions", + "/v1/chat/completions", + "/api/internal/benchmark-v2/evaluate", + "/api/internal/benchmark-v2/evaluate", + "/api/internal/benchmark-v2/suite", + "/api/internal/benchmark-v2/protocol" + ] + }, + "fixed_historical_candidates": { + "new_model_calls": 0, + "diagnostic_only": true, + "candidate_count": 16, + "authenticated_http_evaluations": 32, + "all_candidate_sql_results_ex_contract_identical": true, + "checked_fields": [ + "sql", + "official_ea", + "contract_accuracy", + "scored", + "compile_status", + "execution_status", + "error_code", + "semantic_verdict", + "column_mapping", + "result" + ], + "cases": [ + { + "case_id": "md-009", + "arm": "forge", + "source_candidate_sha256": "7a200ebd6e606ac5d03f6ea8d9d444f0426a83a210ff31acf9f0b9157456df2a", + "sql_sha256": "sha256:04dc3b849258f656d07035ccbc9bfb63418f6a82a9412847bfaa24984cebf3c2", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-009", + "arm": "direct", + "source_candidate_sha256": "4df139f77261375201e49469e41e424aa5b0277f6e5e431a4dcdc1a3fa4aab3f", + "sql_sha256": "sha256:2d89a9da793aee274d5915f2bb14f9105f59ffe4b6394d3e5858007ff0a713d8", + "official_ea": false, + "contract_accuracy": false, + "scored": true, + "execution_status": "passed", + "error_code": "result_value_mismatch", + "identical_in_both_conditions": true + }, + { + "case_id": "md-079", + "arm": "forge", + "source_candidate_sha256": "3feb6376f8ef7ba2e2394273ae1d9f16cdb71dec8bc74ebbd3f29f6c0777251e", + "sql_sha256": "sha256:9f74f3ce2e7303569f788580958c1cd6a90e2318d4ed36cbadfd6a9d93e3eb9f", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-079", + "arm": "direct", + "source_candidate_sha256": "341fd41f7d126be42c5b7606230108da2517ec952c4f9c756239da89a2f40133", + "sql_sha256": "sha256:b46838189dec7de2b430681399bd7ee8af47e06e6342fa51fd1079fdbd6ab550", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-199", + "arm": "forge", + "source_candidate_sha256": "555de2c3ad4a58e41aaddf1f882f335e593d14ff5b3009577dd302134c32db7a", + "sql_sha256": "sha256:7be0318a2d7986be512e14591feab44f0e5626eb15c0926a0fbd6bd2cf92cea4", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-199", + "arm": "direct", + "source_candidate_sha256": "7ccdeef8b21501e3fe038e757fecbe7b7f9339fbb25813bad7875d4b49fc7234", + "sql_sha256": "sha256:86db0af5453871a3fdf776783a427a51beeef927ae414ee14de637c0d3500b29", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-289", + "arm": "forge", + "source_candidate_sha256": "229ac25b0b0282f202c9c19e0da66deca6186d546ffb91466854c7ecd352d42e", + "sql_sha256": "sha256:b2eccf19a9fb73f04654ab6bbcad4785634c949f06cbba1078b1f9c7f9e2f883", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-289", + "arm": "direct", + "source_candidate_sha256": "4c100533ab3036bc2afc50e496ba5fc7a71257ef9cf5ba2a3240a3c6dd181253", + "sql_sha256": "sha256:d5c5026d2ac97c6e9a31a2f73bcef0c1b695a4ae7e58fbd9d2dba1bb85a2775b", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-002", + "arm": "forge", + "source_candidate_sha256": "466f527f9a340534fdbffb394a12611cf443694676cf727a58d79df6cc5fd502", + "sql_sha256": "sha256:fc7d3ac6cf6569c8a022bd09102aba40626000a32408273f64f5137bae7e98dc", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-002", + "arm": "direct", + "source_candidate_sha256": "93ccd6d06cc0dac612c0b138b1232a00fd7643b0f53ee1564fe1ec8516a5fc69", + "sql_sha256": "sha256:550cf0b350eb024e3dca08146f71a5f78a29c39c71a59b8c1ddd71a5f21e106d", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-052", + "arm": "forge", + "source_candidate_sha256": "2b5e1e9a50f6487b0f1c810287ce66fae69909c85d7c43841654069d5d66751c", + "sql_sha256": "sha256:45d806332d3c76813cf790a0d9c18b108e3a1eb3ca726b50c26360d991743a68", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-052", + "arm": "direct", + "source_candidate_sha256": "a003db1086a1e223084f68747070f9d1f8c6f44d15a4613a9540d24701e4156c", + "sql_sha256": "sha256:cd6c2e6d5fed721e2710b2d142d06922d9cc57db5be17777dab22d46e1dbeda3", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-312", + "arm": "forge", + "source_candidate_sha256": "1de49f917c865bc0fdc4bb28c9d7c585cdaab940b002826a207d7299abd7e8fc", + "sql_sha256": "sha256:a2e80be2dbb2981196b44cce495a3b94c45636fe4b3777916e7274d48f4d420e", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-312", + "arm": "direct", + "source_candidate_sha256": "86754a14a0358e2f4ad764e08a46f0d91e994c651b2d511ab3175c40d35a1297", + "sql_sha256": "sha256:fc48952c2fe78f65653f22ad9c534b6c18cc29461ae822d60383b8d8913247fc", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-386", + "arm": "forge", + "source_candidate_sha256": "4ad1e7672a76414859a6cc8acf741e5f00a07019a4654e0472acf30770274724", + "sql_sha256": "sha256:4328a5326fc1345545d21b5ca0975ab40fcd47e8ee52de66b497fbd1270caa6c", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + }, + { + "case_id": "md-386", + "arm": "direct", + "source_candidate_sha256": "5751e80fadcd8bd6f0820391686bd71318d27b9545b4bf4fe7e57220b9578c52", + "sql_sha256": "sha256:5f043c0cfe8bcb54138b0c178d34365dd35f19879d37f137361f7f41f071cf7c", + "official_ea": true, + "contract_accuracy": true, + "scored": true, + "execution_status": "passed", + "error_code": null, + "identical_in_both_conditions": true + } + ], + "explanation": "未修改的Sol原候选在当前两条件下诊断评分;无Pi新生成provenance,不作为生成收益或正式比较基线。" + }, + "regression_verification": { + "python": { + "command": "FORGE_DISABLE_DOTENV=true .venv/bin/python -m pytest tests -q", + "passed": 1012, + "skipped": 26, + "warnings": 1, + "warning": "lark_oapi dependency utcfromtimestamp DeprecationWarning" + }, + "pi": { + "command": "npm --prefix services/pi-orchestrator run typecheck && npm --prefix services/pi-orchestrator test", + "typecheck": "passed", + "passed": 226, + "failed": 0, + "warning": "Node experimental SQLite warning" + }, + "critical_behavior_coverage": [ + "候选实际payload与off/处理并发Run隔离", + "递归查询、SQL NULL、额外字段拒绝", + "候选pause/resume、重开及旧合同禁止续跑", + "未知/伪造mode/wire/catalog/canonical、缺对象、旧v4、未声明因素派发前拒绝", + "冻结后context及schema_context漂移、catalog/raw source漂移拒绝", + "无真实生成合同不可声明Schema说明可比收益;旧schema因素不可更换候选" + ] + }, + "experiment_card": { + "status": "frozen_proposal_pending_explicit_64_call_authorization", + "requirement": "REQ-2026-09-08-065", + "hypothesis": "仅在strict工具Schema五字段增加准确说明,可减少定义/导出/引用错误并改善完整答案EX;键序、Prompt及其他输入不变。", + "model": { + "provider": "openai-codex", + "model": "gpt-5.6-luna", + "expected_revision": "sha256:b18e69afb680689956ba8399d31d67e3f695b07da8aaf5ff44c5148bfc367693", + "revision_source": "REQ-058真实Luna回执;本轮未读取实际模型目录或凭据,启动前必须复核;不一致则派发前停止。" + }, + "cohort": "D; previously exposed mechanism probes, not representative, not H, not seed49", + "case_ids": [ + "md-009", + "md-079", + "md-199", + "md-289", + "md-002", + "md-052", + "md-312", + "md-386" + ], + "targets": [ + { + "case_id": "md-009", + "basis": "REQ-054出现已定义CTE未进入FROM/JOIN的完整答案失败;固定value_context=off,不叠加取值补充。" + }, + { + "case_id": "md-079", + "basis": "REQ-056/058正确百分比对照在别名、聚合/CTE投影上回退;检验无需CTE的最终答案接口。" + }, + { + "case_id": "md-199", + "basis": "REQ-052/058暴露CTE导出与外层引用问题;不追加旧CTE Prompt范例。" + }, + { + "case_id": "md-289", + "basis": "REQ-047同输入Forge从CTE引用失败变为成功,适合观察结构错误及重复稳定性,不把旧随机改善归因新处理。" + } + ], + "controls": [ + { + "case_id": "md-002", + "db_id": "debit_card_specializing", + "basis": "既有Sol双臂EX与Contract均正确;本次必须与新Luna控制配对,历史成绩不替代新控制。" + }, + { + "case_id": "md-052", + "db_id": "student_club", + "basis": "既有Sol双臂EX与Contract均正确;本次必须与新Luna控制配对,历史成绩不替代新控制。" + }, + { + "case_id": "md-312", + "db_id": "codebase_community", + "basis": "既有Sol双臂EX与Contract均正确;本次必须与新Luna控制配对,历史成绩不替代新控制。" + }, + { + "case_id": "md-386", + "db_id": "card_games", + "basis": "既有Sol双臂EX与Contract均正确;本次必须与新Luna控制配对,历史成绩不替代新控制。" + } + ], + "selection_audit": { + "excluded_before_freeze": "md-119虽有CTE导出错误,但旧triage标注Gold IGM边界争议;未进入正式冻结,改用已有CTE开发目标题md-199。此时零新生成,非事后换题。", + "no_replacement_after_freeze": true, + "gold_policy": "require_all", + "gold_ready": 8, + "blocked_cases": [] + }, + "conditions": { + "A": { + "schema_descriptions": "off", + "file": ".forge/benchmarks/schema-descriptions-ready-20260908/control.frozen.json", + "protocol_revision": "sha256:abece786f68ce4700ce2c95490f2ab04f5a7a6b959c2c95d82ba240501549866" + }, + "B": { + "schema_descriptions": "interfaces-v1", + "file": ".forge/benchmarks/schema-descriptions-ready-20260908/treatment.frozen.json", + "protocol_revision": "sha256:7af14fb4447304214c28474626cb8ed82e5e93ce21ebf052706ccef2df7709c5" + } + }, + "schedule": [ + { + "position": 1, + "repeat": 1, + "condition": "A", + "logical_calls": 16 + }, + { + "position": 2, + "repeat": 1, + "condition": "B", + "logical_calls": 16 + }, + { + "position": 3, + "repeat": 2, + "condition": "B", + "logical_calls": 16 + }, + { + "position": 4, + "repeat": 2, + "condition": "A", + "logical_calls": 16 + } + ], + "schedule_method": "ABBA运行级平衡分块;同一八题顺序、Pi现有固定并发2。一个Run终止后才启动下一个,重复1配A1/B1,重复2配A2/B2;不是逐次随机化,也不宣称完全消除时变噪声。无第二套调度。", + "authorization": { + "requested_logical_calls": 64, + "currently_authorized_model_calls": 0, + "actual_model_calls": 0, + "provider_retries": 0, + "replacement_calls": 0, + "extra_canary_calls": 0, + "new_r500_or_h_calls": 0, + "no_historical_budget_reuse": true + }, + "fixed_contract": { + "sole_factor": "schema_descriptions", + "prompt": "forge-structured-benchmark-v1", + "date_context": "off", + "grain_context": "off", + "value_context": "off", + "sampling": "provider_default", + "max_output_tokens": null, + "timeout_seconds": 120, + "provider_retries": 0, + "max_agent_turns_per_arm": 1, + "freeze_and_provenance": "同模型revision、数据/Gold/上下文、canonical/Compiler/Assurance/评价器、SDK/runtime/catalog;仅mode与对应wire revision可变。" + }, + "development_screen": { + "complete_denominator": "64次/64臂结果完整,EX均实际评分、usage全已知;失败、取消与未知不补零、不剔除、不补跑。", + "minimum_forge_ex_gain": 2, + "gain_denominator": "每条件16个Forge观测(8题×2重复);DeltaF=EX_B-EX_A。", + "repeat_stable_target_gain": "至少一个预定目标题在两重复均A-EX错误→B-EX正确,且B两次Contract均正确;只修复编译不能算成功。", + "regression_guard": "两重复逐题均不得出现Forge EX或Contract已确认正确→错误/未知;四个正确控制的B-EX须8/8。", + "direct_noise_guard": "DeltaF-abs(DeltaD)>=2;DeltaD为同样16观测的Direct EX_B-EX_A。Direct变化全列配对表,下降不算Forge改动收益。", + "cost_guards": { + "treatment_total_tokens_max_control_ratio": 1.2, + "forge_tokens_per_ex_correct_max_control_ratio": 1.0, + "forge_generation_p95_max_control_ratio": 1.25, + "basis": "沿用REQ-058成本阈值,不重评或放宽旧实验结论。", + "tokens": "合并同条件两个Run的全部观测input/output/cache用量,含错误答案;分别单报两臂及两重复。", + "p95": "沿用forge.accuracy_benchmark._p95的nearest-rank:每条件16个Forge generation_ms观测,在此恰为最大值;不含SQL执行,不是生产P95估计。", + "undefined_metrics": "not_passed" + }, + "metrics": "Official EX主指标,Contract独立;每重复/合并的wrong→correct、correct→wrong、执行/拒绝/静默错误代理、first-pass(本实验即final)、tokens/正确任务、时延/未知费用全部披露。", + "failure_action": "输入/模型漂移、Provider错误或未知用量立即停止后续Run,保留已发生调用与完整分母;任一最终门槛失败则默认继续off,不重试/换题/扩样追分。", + "promotion": "只筛查值得进一步验证的开发信号;即使通过也不宣称超过Direct或自动默认开启。另行获批R500与未参与调参的H;预定业务增益/功效,H配对差值95%区间下界>0才称统计优势。现有已曝光500题不得改称H。" + }, + "cost_disclosure": { + "billing_amount": null, + "hard_currency_or_token_cap": false, + "explanation": "64是逻辑调用上限,不是结算费用/Token硬上限;沿用max_output_tokens=null及120秒,新增1137 Schema字节不等于实测Token数。相对成本/P95阈值是结果验收门槛,不能保证事前费用。若需要硬Token预算,须另定协议而非暗改本单因素。" + }, + "user_decision_required": "是否接受上述固定设计、成本边界与门槛,并单独授权最多64次Luna真实生成。", + "card_sha256": "sha256:2229da5b5a68ac941663c6de3c4fed8ef82f18087e5bf124565e333223e2164b" + }, + "frozen_manifests": { + "control": { + "schema_version": "bird-protocol-v5", + "source": { + "dataset": "BIRD-SQL Mini-Dev", + "repository": "https://github.com/bird-bench/mini_dev", + "license": "CC BY-SA 4.0", + "exposed": true, + "gold_use": "scoring_only" + }, + "cohort": "D", + "purpose": "development", + "case_ids": [ + "md-009", + "md-079", + "md-199", + "md-289", + "md-002", + "md-052", + "md-312", + "md-386" + ], + "selection": { + "method": "explicit" + }, + "denominator": 8, + "official_denominator": 500, + "dataset_files": { + "dev_databases/california_schools/california_schools.sqlite": "sha256:c0903eec662e63068fd1d14403d3d6c1d473287fc10c4356333ea58f878db983", + "dev_databases/california_schools/database_description/frpm.csv": "sha256:f2c3fa53a02c5d711866a192f580c6a545389192a096441767f40d72ffa41334", + "dev_databases/california_schools/database_description/satscores.csv": "sha256:a44145158100894387d05a96987c487e3c83742892b13127b486de309bb8f138", + "dev_databases/california_schools/database_description/schools.csv": "sha256:f18d96abf47892e4bd8094dd47d6978ea6bbc11821eccdf91f3f54dd1685979f", + "dev_databases/card_games/card_games.sqlite": "sha256:c98bdb57fe7474da798b407785544b9af0daaad5d61fd21e2a73309493bc1227", + "dev_databases/card_games/database_description/cards.csv": "sha256:41bc566e91e165f43f7484a1d3d3f17e66094e2c0cc3092829366f6e2f019d23", + "dev_databases/card_games/database_description/foreign_data.csv": "sha256:ac254726eeb2d0fd574ec64bac31617ac233842623f692469b7569febe9f3310", + "dev_databases/card_games/database_description/legalities.csv": "sha256:223def1785f0f6f277db07a7881e8938e4314382697da47c080d14b52f1253e9", + "dev_databases/card_games/database_description/rulings.csv": "sha256:c50c64dd4d882a17d1a8478cd48b889103a39464c78f3da5dd904fde966bd3d4", + "dev_databases/card_games/database_description/set_translations.csv": "sha256:d6f172ff2add8a399176cdb9ef32a5d60c8cf11186363e6142bb48a09debb2ff", + "dev_databases/card_games/database_description/sets.csv": "sha256:3679c8051713f1574d40ff6793eaebf590705915d20f086ffe3ee930a4ddbb0e", + "dev_databases/codebase_community/codebase_community.sqlite": "sha256:92101be6d2a9f6adceea59d38f6d1c556087f9eea1432432a21268cb1348036d", + "dev_databases/codebase_community/database_description/badges.csv": "sha256:a1a7fc9783f11107c6b80adc54d0404a31d7bc162a1f5ae5e246e4852dc41a09", + "dev_databases/codebase_community/database_description/comments.csv": "sha256:bd8de09b3eab2b4a1f69d9298460b0f39d919504d5dfb34d00de302b77e520eb", + "dev_databases/codebase_community/database_description/postHistory.csv": "sha256:053779c106b3bc61da71744e918b321a2436180e5c57ad2a706e9c29fef11e94", + "dev_databases/codebase_community/database_description/postLinks.csv": "sha256:789fefbd5b9b8db2653f8079c78325d6e3fd23a2ceff69ed7ee8959674ff014c", + "dev_databases/codebase_community/database_description/posts.csv": "sha256:33e6883bbadc4fe77b5f4f593f7f23d74c2bc2bc45c8f2086c328beeefeb28e2", + "dev_databases/codebase_community/database_description/tags.csv": "sha256:27bc5022eeb20e18dc588a1f3cb63ac2c23720670f003fdd776ae9a5aad0a0d7", + "dev_databases/codebase_community/database_description/users.csv": "sha256:69d3297922932d9b39eb56e673606ba56fb3474a650fe417ea32d4d627160014", + "dev_databases/codebase_community/database_description/votes.csv": "sha256:9c3856469bc9fd563d86f7062bfb9d632c6e98ae42fd7c52117e0be15e9e7ccf", + "dev_databases/debit_card_specializing/database_description/customers.csv": "sha256:fd1ff06796da13f6331801dba2a24536fd0aed887cde2a8d08cd03530de88f2d", + "dev_databases/debit_card_specializing/database_description/gasstations.csv": "sha256:4e44804b860c9fe412dd8872a4f53fc0e1094035ecc027fac4d9477d05766199", + "dev_databases/debit_card_specializing/database_description/products.csv": "sha256:b61419d9b6481b170230a302c313fd787b5f0291f9a1a15fb3a55eb6d4f5f538", + "dev_databases/debit_card_specializing/database_description/transactions_1k.csv": "sha256:08bed279bc784952f1e17c97b290cf869ede6f9ea0914641052546408626b0af", + "dev_databases/debit_card_specializing/database_description/yearmonth.csv": "sha256:7faf48ff08295935610dc07b33596028483f8270dd1ace0c6a512ae65f8a2e16", + "dev_databases/debit_card_specializing/debit_card_specializing.sqlite": "sha256:b3d149ad05746dbbe5116e229e17e18f09c39db43cf117d9ef3441753608b691", + "dev_databases/european_football_2/database_description/Country.csv": "sha256:e74aa65527321782a69ec5fdc68c3993aa6e1e5684426724776b81d12bcbe437", + "dev_databases/european_football_2/database_description/League.csv": "sha256:d44bbef373f44c16dee4729012375c1bf901664f1097e3af4bb3dfc973067437", + "dev_databases/european_football_2/database_description/Match.csv": "sha256:2facc86ec5e869e7bb61b67fa660591c0a4f6291da79125dc2777a2bdafdd4dd", + "dev_databases/european_football_2/database_description/Player.csv": "sha256:a7a3cdc5c995227bbfcddf88d789f9244ffcfe0f6aed8aa69fcbef084149b92c", + "dev_databases/european_football_2/database_description/Player_Attributes.csv": "sha256:d01a00206b4ec6e94435f3af7e5153abca01931c4e93a519bb86ca5bbd42b46c", + "dev_databases/european_football_2/database_description/Team.csv": "sha256:104e03607f09cb41deddcb24a96add08aa2e9d8fc169454c3091a792df9f81ef", + "dev_databases/european_football_2/database_description/Team_Attributes.csv": "sha256:3fbad7950903c65a467c291282ab90d773a9e517802e0fffad5c5abfa7390840", + "dev_databases/european_football_2/european_football_2.sqlite": "sha256:f72f5c9b990371417288a67b27a02e601ef904d45525c2c9f7931fb01001c536", + "dev_databases/financial/database_description/account.csv": "sha256:98f9b72619c30593fadc013efc668d081193f34f2bda1353214c48c8013f03b3", + "dev_databases/financial/database_description/card.csv": "sha256:1dd79bf48c7696a5e6c3fc4835c9994b129f58307ad75c2f874f9cd1078fe300", + "dev_databases/financial/database_description/client.csv": "sha256:d1ef6f74b4730737517307c2f3b219496af264d83fe3e34f435c078b368dd800", + "dev_databases/financial/database_description/disp.csv": "sha256:3b7ade14650a78e7122fdf4f423c4dae241e923d73039c65e5e85b7ac7919ffe", + "dev_databases/financial/database_description/district.csv": "sha256:6da804294fe9e7f9f8285759b842e39e0c5c8cb10390a93d5e292c2cb28fdc48", + "dev_databases/financial/database_description/loan.csv": "sha256:e6f4c7393d3973c9647913206ec4da2b9480bca4a8fb1ed45f4d42c433112756", + "dev_databases/financial/database_description/order.csv": "sha256:d01db89f3121b96a8c5876108d835ad0ab8d8bd5e132d9d823d384ae12706476", + "dev_databases/financial/database_description/trans.csv": "sha256:59efafabbb4347853f29ebfc14fdd18633f724a669e7e26cb7b2ecd628d6c4a2", + "dev_databases/financial/financial.sqlite": "sha256:d15d89cdb068a202b6f2b99342af44dffc1d52545b39ceaf62efdc0ba570101e", + "dev_databases/formula_1/database_description/circuits.csv": "sha256:fd69591f97ae0cb3b36b2d35524f03e5ec250c52358a71b2e41d435f3b2b658d", + "dev_databases/formula_1/database_description/constructorResults.csv": "sha256:b446078a76a422e9fbbb3246acf18a36bc75a441fac5f907555ac7031834f7d5", + "dev_databases/formula_1/database_description/constructorStandings.csv": "sha256:d7df8f78744b244375278bb092f8b6d05c9cf4964bdc9cd41eb60261678db861", + "dev_databases/formula_1/database_description/constructors.csv": "sha256:79eb5ffde214702c1465ffa8584d59d3fc2e6a43fd8c41db91c02402af239dd4", + "dev_databases/formula_1/database_description/driverStandings.csv": "sha256:3cc467154abbf10dfc7f8ea5fdec512b5674f0683d36b893085a04de5d9aca5e", + "dev_databases/formula_1/database_description/drivers.csv": "sha256:0444a1610c97dcc1cb1af25a8aed4dc3ca585a0b27f8326d1bb9ffaa6f4e8635", + "dev_databases/formula_1/database_description/lapTimes.csv": "sha256:6fc86f0867ca9fc350b8583c18a74784d7a2e78afb1bc6462f83e3b7cddf5573", + "dev_databases/formula_1/database_description/pitStops.csv": "sha256:6c1c7eb14a445b617710ac286e1f5a303e8b808062fa760c2054c276b2b79fab", + "dev_databases/formula_1/database_description/qualifying.csv": "sha256:35b7e1ce9def76a653407a54f2b18901768392d92d1ef2484d24c20077c77e0e", + "dev_databases/formula_1/database_description/races.csv": "sha256:a8e61de0c7e966c5198c701475d80276065f3a1cf96c3b79051c3541d8fd60d3", + "dev_databases/formula_1/database_description/results.csv": "sha256:7f7cde75b468b8ea135c6ed0872ef30ff715fda691786ca58e70d783b0a23b5d", + "dev_databases/formula_1/database_description/seasons.csv": "sha256:6a87681dcc94db3f6c81879c8569ec29a966eccc7277aa1d9ad59b16e314e5c9", + "dev_databases/formula_1/database_description/status.csv": "sha256:78725236cee342600f862cea296e87a4ea2e047d64d365f594526363f8acde57", + "dev_databases/formula_1/formula_1.sqlite": "sha256:79770caf966707e35516fa566e24b40ae515c74ec1ec4631235245645b87b24d", + "dev_databases/student_club/database_description/Attendance.csv": "sha256:33a5d912e8fea231ecd73d1ee3847433ced7d1768b91866bd1403fb7fd88ea22", + "dev_databases/student_club/database_description/Budget.csv": "sha256:b9000d8f18b4a1613ea3c1877a41823375c2405647756a694591722ba86e60cd", + "dev_databases/student_club/database_description/Event.csv": "sha256:1bf99aa2ce4ae79886eb0d4204e3edd1f0c8c0e44ed427c166f3a1a1af0aec04", + "dev_databases/student_club/database_description/Expense.csv": "sha256:b323e60df3ebfa3ec64686a1d76bece0bb94d81cfe5b642a54b6763b67be302d", + "dev_databases/student_club/database_description/Income.csv": "sha256:573755cd0f41a5dce3a053eb877a52f101bf21af745aaf83170093aa5a4d0579", + "dev_databases/student_club/database_description/Major.csv": "sha256:baca5c68fa1b1c9a427445bd60a1c8702cbdab9d27d5eb0a4304fb7f2ef32e0d", + "dev_databases/student_club/database_description/Member.csv": "sha256:1b9dda90d5fdccc4f70f057bf594a6935975e55a9f81d333714d74d1f4d9674a", + "dev_databases/student_club/database_description/Zip_Code.csv": "sha256:1c903324ec3ff9decd6abb10ac96e3746e1c1b776a26d3a8d4bf5244c8620ecb", + "dev_databases/student_club/student_club.sqlite": "sha256:eb89bcfe97eefa386a27904ec5aa15159811a7eac894ec659a36e48fa9f76b77", + "dev_databases/superhero/database_description/alignment.csv": "sha256:ebff59e5832b2870c298d2bbc85607e0f6b93c4921ff4d3265803d02a8796dce", + "dev_databases/superhero/database_description/attribute.csv": "sha256:3c6bac9176d61e05ba059e8be6a3d5c5aa6eb743f526f07a1570f172cdbf6c72", + "dev_databases/superhero/database_description/colour.csv": "sha256:ba732eddb938dc077cbc3f038057f566f9f12ccb53cc131168a5da538514b9cf", + "dev_databases/superhero/database_description/gender.csv": "sha256:7311f964c77b6319184bbfc9ce8cc0ef87a103106bb1d6967461a5c681a3fe08", + "dev_databases/superhero/database_description/hero_attribute.csv": "sha256:65af1dfdb96e4ddaba6262f3dffe9f61ea240c31d0ea2122e974d769827f039b", + "dev_databases/superhero/database_description/hero_power.csv": "sha256:54eb40baa6b5b726bff28c872478caa8da8500f195239f8c6c3c552797c3794f", + "dev_databases/superhero/database_description/publisher.csv": "sha256:232e8656107f426beb3c7a25f1833afb295dbfa2ae3981b2a200f08ed4f1f000", + "dev_databases/superhero/database_description/race.csv": "sha256:8eb79fe0d1fc7d5641eff43d34e0e10b89fa726360d913bbee31dd55191064c7", + "dev_databases/superhero/database_description/superhero.csv": "sha256:503f0a71acd1766923c571865277f81accbf79b2c9d8df4a18439dfe01ec6f44", + "dev_databases/superhero/database_description/superpower.csv": "sha256:4edef8900f158238382843e348ff9842991c83f1d384c53bef5dd8cb1e613ee2", + "dev_databases/superhero/superhero.sqlite": "sha256:75e94a2c3236ee3bb2c01fb97a1c4b4c1c269bcefd4eab1d04be323d2d0825b1", + "dev_databases/thrombosis_prediction/database_description/Examination.csv": "sha256:b563c9030159bf169236e4582b653386bd34706e309227bf5eceb63b91eb0a89", + "dev_databases/thrombosis_prediction/database_description/Laboratory.csv": "sha256:cf9704e56cf3aca75e38de09277c307a7f0f726301b472254ce66ff4a352ff9f", + "dev_databases/thrombosis_prediction/database_description/Patient.csv": "sha256:519838a9f2592760bb26d1fb4f074bc304eee4e7aeaf46d03f652c370230e175", + "dev_databases/thrombosis_prediction/thrombosis_prediction.sqlite": "sha256:87583183c3dc472fba04de702965560a9d7c0a548836613f242317e0eeb83f00", + "dev_databases/toxicology/database_description/atom.csv": "sha256:9de75492701c77c1229242e8c3b688ced9eb9095ac59d37361dfb0ec34300245", + "dev_databases/toxicology/database_description/bond.csv": "sha256:7d200d38b0dcc07e8fe22718bd6bdb1bdf4b6522b7a84a5d0c95340b6d8cb4bc", + "dev_databases/toxicology/database_description/connected.csv": "sha256:589b24206b9f884863ca57f3e339abcb2409a15feeaff0b08afcd955cd211036", + "dev_databases/toxicology/database_description/molecule.csv": "sha256:a6ff2966916d03b07fd3ce275823d9ec65abb0b55158e871b07c40972b292d70", + "dev_databases/toxicology/toxicology.sqlite": "sha256:35ef27ae6bdfda530e125ed369666ac0abb8bc8c0bcc0ad09407f547ecb61a93", + "dev_tables.json": "sha256:48aa9febe7282d1690f3ed1f222dc040c182df83812ba4e9bee956084d99c8ff", + "mini_dev_sqlite.json": "sha256:4ba5fa8de55856222f484d380d2ba872b380bf79d825de70478e2120cb0fc43b" + }, + "sources": { + "prompt": { + "agent/prompts.py": "sha256:eff191736809d2645248b467ccafa49245f1f93480334694fe4c5d3ae6354e0b" + }, + "schema": { + "agent/contracts/query-candidate-v1.schema.json": "sha256:2ff6c4447f8f516bdec9fb877c6deff696fae7a822efdbe27559d151b8ec652d", + "forge/schema.json": "sha256:e9b56c6f98d08c8b866bd4f49ab0076ff55510711429025d397a5acd9188e723" + }, + "schema_descriptions": { + "agent/contracts/forge-output-descriptions-v1.json": "sha256:796f6d6c15779b537cf3692ea315bd0d8fc6b8cd012e894e5833381d1c44ab18" + }, + "compiler": { + "forge/compiler.py": "sha256:05d5d6e4b38431aa8e2e1d34b6f38cffc43cd38482e6cfd127a650f017903284" + }, + "context": { + "forge/benchmark_metadata.py": "sha256:e8c7752faeed4d954e73b9763233e729979bd4cef0dcc82d44a16fe6b8f70bb5", + "forge/benchmark_v2.py": "sha256:74b689dd3de3fbf4c51dda6e23be1b4193cc377c3e1e6d1794b2b7867f1c967e" + }, + "safety": { + "forge/executor.py": "sha256:cc2e821ae8c7e48d0f5a956d943e4b6330343e02d169edb9a0780eb44cd658f1", + "forge/lint.py": "sha256:b78c85be53defb33c96f0507f67dae072c49447c0798fbfac79c05148ee27d94", + "registry/relationships.py": "sha256:d2d109af1e2b11fd661c6140a10c37d3e1e5619538088f9d4c6a65867191135a" + }, + "official_snapshot": { + "tests/datasets/bird_mini_dev_standard.json": "sha256:0886f203ad6f41412b66ef843d3e87f939f565bc5cddbe7232b1ebe24d11698f" + }, + "evaluator": { + "agent/contracts/__init__.py": "sha256:12146de2af766d894a2f78abfa6e40a2fd1469a8dabefd00bd6dd02192b6812c", + "agent/contracts/benchmark-failure-v1.schema.json": "sha256:0d57f63bdd06b29aa54006fd768a6addd174a1cccce72a699a09a0c4d85702c0", + "forge/assurance.py": "sha256:25232efe2311b536822783a7129c9d89536c194b3e13205d05a00502e94c62f0", + "forge/benchmark_methods.py": "sha256:22ec345d80b90db7a96d83f6b9cce2e4fe9493e25c709ef1bd831dbc3ee5f01d", + "forge/benchmark_service.py": "sha256:1f0398858e5e7fab387c860953249a01369de141a35948b856652910cabd1386", + "forge/bird_benchmark.py": "sha256:b4a1482b6f245c885347741ce691c898c6f00a3c954161faaa7e9afde2c5e40c", + "forge/hard_accuracy_benchmark.py": "sha256:32963cce5222a8f5d26a77374491445c61c45358a1ecaaf1d259d469eb2c6a0c", + "pyproject.toml": "sha256:088f3b0c5960661037ab6de0129ec6eec433eb3304eec7f66a82cdfbcfba1bcd" + } + }, + "model": { + "provider": "openai-codex", + "model": "gpt-5.6-luna" + }, + "generation": { + "max_model_calls": 16, + "provider_retries": 0, + "max_agent_turns_per_arm": 1, + "timeout_seconds": 120, + "sampling": "provider_default", + "max_output_tokens": null + }, + "gold_readiness": { + "policy": "require_all", + "blocked_cases": [] + }, + "variables": { + "allowed_changes": [ + "schema_descriptions" + ] + }, + "date_context": { + "mode": "off", + "max_rows": 100 + }, + "grain_context": { + "mode": "off" + }, + "value_context": { + "mode": "off", + "field": null, + "max_values": 16 + }, + "schema_descriptions": { + "mode": "off", + "catalog_revision": "sha256:796f6d6c15779b537cf3692ea315bd0d8fc6b8cd012e894e5833381d1c44ab18", + "wire_schema_revision": "sha256:01f2abbe6608b33610f4106f1acf8705ffca38a4aa3c8d990bc7b6f7fe739b8d" + }, + "metric_revision": "semantic-result-compare-v2", + "official_ex_revision": "bird_execution_accuracy_exact_set_v1", + "forge_prompt_revision": "forge-structured-benchmark-v1", + "forge_schema_revision": "sha256:e9b56c6f98d08c8b866bd4f49ab0076ff55510711429025d397a5acd9188e723", + "context_hashes": { + "md-009": { + "snapshot": "sha256:b0fe819ea69c7d9dcda31dff5b6073f1bded828078467e8fa8c42b5f4ca43d22", + "schema": "sha256:b915f6c4b8f985b6cf2e4d90e561f217c342c5b3e33ed8a01f51252ce18ed53c", + "forge": "sha256:6fa52964572271372c6c38f3c1875e4682e7709bcfc879dfa878ea2fc3f8ea93", + "direct": "sha256:93f2d51ab4b7fa40f6821f3ac6de8465044659e545057c8d0459bdfa031b52d8", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-079": { + "snapshot": "sha256:21ab8fd129d69e3e08563c59682deda787d2d932da61425ffa39422a06b0129a", + "schema": "sha256:4c0f1254efae5e9e57c43300f80151ee10e00bcd312ac648c41fbef399985b7b", + "forge": "sha256:0361cf4e9f7bc97d6b7d0f0825e85c7032504e461de1834a340c928b91b1b489", + "direct": "sha256:e5e64f9573e3687e69811f574beafb0ad428c662d3778bf6293249ea175efb79", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-199": { + "snapshot": "sha256:9e7ac9eae571e86e02fc4402fc46f432610ee7954f062bcb92e381c931604b55", + "schema": "sha256:8b3c67bb47b8fb49bc27d8d9ab8bb62d936a382b268eae99d55101d7b0d3adbc", + "forge": "sha256:4d494cfb100a4afd5786fb45d7b21b9c54428242ade9106ecaad4020ca7f74a4", + "direct": "sha256:baf37bd1577e965c54fa4ce62d0596d7d64c03c66fc6341fd7d7c82a1b03f015", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-289": { + "snapshot": "sha256:9d7ac490c3e9ea1cfd532d3879003b5555a36471ee2cc3ec3c8f9c149718ad31", + "schema": "sha256:092165277e5a0b0795c180332993df873996d7e66ff2c158657a1ec5103297fa", + "forge": "sha256:2ffe1082026016359e3d83f8995e5ef48714b1c16abc0c86a4d2da1334134f5f", + "direct": "sha256:13242726ff2e9c32fa4cb31be09eb91ac7a26b806bea4dc596081b4c4573438e", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-002": { + "snapshot": "sha256:0ecba77b6d59f89bd98e355d93c429c7f91dbdfca79f41b4b0eadf9bd39d483e", + "schema": "sha256:b915f6c4b8f985b6cf2e4d90e561f217c342c5b3e33ed8a01f51252ce18ed53c", + "forge": "sha256:593c0e9b5acb70f0904c269d91641ba93deccbc9a3f198c2e414c36c62fce80f", + "direct": "sha256:8adffd53d8ba1565f855208a2a38433c3b16a69311eba8ce043425118709baf5", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-052": { + "snapshot": "sha256:d63c1decac44459f9d672e6dfad4655b72e0da81a0426cb2ca253d141b49b781", + "schema": "sha256:7c0395d7270401bf6e5253c4604e33a18b4d7263bbb6466d19648006dc6ee5ff", + "forge": "sha256:0ca7b8ce2376366213cc8c7f0828148a2558990c4a555e38a1ce36e7a0281955", + "direct": "sha256:59d9180585309f09670abb2681c14400a4121e88e0ac1ff2a090606817aaf7de", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-312": { + "snapshot": "sha256:75437f836736f9e96b3260c36baa0e62493bc14f7186e78b5dc292db77e51426", + "schema": "sha256:161e5567a4dd24f75807d29c2034b5739b6b6347b3c65a1904e83d474774e92a", + "forge": "sha256:bd66bff745024e706025df05f06a05508ad12a419e72eac1e4eb0b44ce53f0e4", + "direct": "sha256:3c83ee0c8ea95f2c8bb01e7a44d1158a42a954bee00258ce1df45df42ef1d4ff", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-386": { + "snapshot": "sha256:620fc864784d339de7ca10a6322073b6cb4b900bc3205800ecb71652eb14ccda", + "schema": "sha256:3df9b560b244b44495961f169977414f063fdf08819b134982cbc62eb8fe2017", + "forge": "sha256:aad0642910ee0268d06fe2d0ba66fefc6c0dba7b4573ffea0e79b6aeb4569ccc", + "direct": "sha256:5ec2bf42875efed48f45aad16fc17ef98c706c6e02cde529cda018a954d352fd", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + } + }, + "runtime": { + "python": "3.14.7", + "sqlite": "3.53.4", + "sqlglot": "29.0.1", + "jsonschema": "4.26.0", + "numpy": "2.5.2", + "pydantic": "2.13.5" + } + }, + "treatment": { + "schema_version": "bird-protocol-v5", + "source": { + "dataset": "BIRD-SQL Mini-Dev", + "repository": "https://github.com/bird-bench/mini_dev", + "license": "CC BY-SA 4.0", + "exposed": true, + "gold_use": "scoring_only" + }, + "cohort": "D", + "purpose": "development", + "case_ids": [ + "md-009", + "md-079", + "md-199", + "md-289", + "md-002", + "md-052", + "md-312", + "md-386" + ], + "selection": { + "method": "explicit" + }, + "denominator": 8, + "official_denominator": 500, + "dataset_files": { + "dev_databases/california_schools/california_schools.sqlite": "sha256:c0903eec662e63068fd1d14403d3d6c1d473287fc10c4356333ea58f878db983", + "dev_databases/california_schools/database_description/frpm.csv": "sha256:f2c3fa53a02c5d711866a192f580c6a545389192a096441767f40d72ffa41334", + "dev_databases/california_schools/database_description/satscores.csv": "sha256:a44145158100894387d05a96987c487e3c83742892b13127b486de309bb8f138", + "dev_databases/california_schools/database_description/schools.csv": "sha256:f18d96abf47892e4bd8094dd47d6978ea6bbc11821eccdf91f3f54dd1685979f", + "dev_databases/card_games/card_games.sqlite": "sha256:c98bdb57fe7474da798b407785544b9af0daaad5d61fd21e2a73309493bc1227", + "dev_databases/card_games/database_description/cards.csv": "sha256:41bc566e91e165f43f7484a1d3d3f17e66094e2c0cc3092829366f6e2f019d23", + "dev_databases/card_games/database_description/foreign_data.csv": "sha256:ac254726eeb2d0fd574ec64bac31617ac233842623f692469b7569febe9f3310", + "dev_databases/card_games/database_description/legalities.csv": "sha256:223def1785f0f6f277db07a7881e8938e4314382697da47c080d14b52f1253e9", + "dev_databases/card_games/database_description/rulings.csv": "sha256:c50c64dd4d882a17d1a8478cd48b889103a39464c78f3da5dd904fde966bd3d4", + "dev_databases/card_games/database_description/set_translations.csv": "sha256:d6f172ff2add8a399176cdb9ef32a5d60c8cf11186363e6142bb48a09debb2ff", + "dev_databases/card_games/database_description/sets.csv": "sha256:3679c8051713f1574d40ff6793eaebf590705915d20f086ffe3ee930a4ddbb0e", + "dev_databases/codebase_community/codebase_community.sqlite": "sha256:92101be6d2a9f6adceea59d38f6d1c556087f9eea1432432a21268cb1348036d", + "dev_databases/codebase_community/database_description/badges.csv": "sha256:a1a7fc9783f11107c6b80adc54d0404a31d7bc162a1f5ae5e246e4852dc41a09", + "dev_databases/codebase_community/database_description/comments.csv": "sha256:bd8de09b3eab2b4a1f69d9298460b0f39d919504d5dfb34d00de302b77e520eb", + "dev_databases/codebase_community/database_description/postHistory.csv": "sha256:053779c106b3bc61da71744e918b321a2436180e5c57ad2a706e9c29fef11e94", + "dev_databases/codebase_community/database_description/postLinks.csv": "sha256:789fefbd5b9b8db2653f8079c78325d6e3fd23a2ceff69ed7ee8959674ff014c", + "dev_databases/codebase_community/database_description/posts.csv": "sha256:33e6883bbadc4fe77b5f4f593f7f23d74c2bc2bc45c8f2086c328beeefeb28e2", + "dev_databases/codebase_community/database_description/tags.csv": "sha256:27bc5022eeb20e18dc588a1f3cb63ac2c23720670f003fdd776ae9a5aad0a0d7", + "dev_databases/codebase_community/database_description/users.csv": "sha256:69d3297922932d9b39eb56e673606ba56fb3474a650fe417ea32d4d627160014", + "dev_databases/codebase_community/database_description/votes.csv": "sha256:9c3856469bc9fd563d86f7062bfb9d632c6e98ae42fd7c52117e0be15e9e7ccf", + "dev_databases/debit_card_specializing/database_description/customers.csv": "sha256:fd1ff06796da13f6331801dba2a24536fd0aed887cde2a8d08cd03530de88f2d", + "dev_databases/debit_card_specializing/database_description/gasstations.csv": "sha256:4e44804b860c9fe412dd8872a4f53fc0e1094035ecc027fac4d9477d05766199", + "dev_databases/debit_card_specializing/database_description/products.csv": "sha256:b61419d9b6481b170230a302c313fd787b5f0291f9a1a15fb3a55eb6d4f5f538", + "dev_databases/debit_card_specializing/database_description/transactions_1k.csv": "sha256:08bed279bc784952f1e17c97b290cf869ede6f9ea0914641052546408626b0af", + "dev_databases/debit_card_specializing/database_description/yearmonth.csv": "sha256:7faf48ff08295935610dc07b33596028483f8270dd1ace0c6a512ae65f8a2e16", + "dev_databases/debit_card_specializing/debit_card_specializing.sqlite": "sha256:b3d149ad05746dbbe5116e229e17e18f09c39db43cf117d9ef3441753608b691", + "dev_databases/european_football_2/database_description/Country.csv": "sha256:e74aa65527321782a69ec5fdc68c3993aa6e1e5684426724776b81d12bcbe437", + "dev_databases/european_football_2/database_description/League.csv": "sha256:d44bbef373f44c16dee4729012375c1bf901664f1097e3af4bb3dfc973067437", + "dev_databases/european_football_2/database_description/Match.csv": "sha256:2facc86ec5e869e7bb61b67fa660591c0a4f6291da79125dc2777a2bdafdd4dd", + "dev_databases/european_football_2/database_description/Player.csv": "sha256:a7a3cdc5c995227bbfcddf88d789f9244ffcfe0f6aed8aa69fcbef084149b92c", + "dev_databases/european_football_2/database_description/Player_Attributes.csv": "sha256:d01a00206b4ec6e94435f3af7e5153abca01931c4e93a519bb86ca5bbd42b46c", + "dev_databases/european_football_2/database_description/Team.csv": "sha256:104e03607f09cb41deddcb24a96add08aa2e9d8fc169454c3091a792df9f81ef", + "dev_databases/european_football_2/database_description/Team_Attributes.csv": "sha256:3fbad7950903c65a467c291282ab90d773a9e517802e0fffad5c5abfa7390840", + "dev_databases/european_football_2/european_football_2.sqlite": "sha256:f72f5c9b990371417288a67b27a02e601ef904d45525c2c9f7931fb01001c536", + "dev_databases/financial/database_description/account.csv": "sha256:98f9b72619c30593fadc013efc668d081193f34f2bda1353214c48c8013f03b3", + "dev_databases/financial/database_description/card.csv": "sha256:1dd79bf48c7696a5e6c3fc4835c9994b129f58307ad75c2f874f9cd1078fe300", + "dev_databases/financial/database_description/client.csv": "sha256:d1ef6f74b4730737517307c2f3b219496af264d83fe3e34f435c078b368dd800", + "dev_databases/financial/database_description/disp.csv": "sha256:3b7ade14650a78e7122fdf4f423c4dae241e923d73039c65e5e85b7ac7919ffe", + "dev_databases/financial/database_description/district.csv": "sha256:6da804294fe9e7f9f8285759b842e39e0c5c8cb10390a93d5e292c2cb28fdc48", + "dev_databases/financial/database_description/loan.csv": "sha256:e6f4c7393d3973c9647913206ec4da2b9480bca4a8fb1ed45f4d42c433112756", + "dev_databases/financial/database_description/order.csv": "sha256:d01db89f3121b96a8c5876108d835ad0ab8d8bd5e132d9d823d384ae12706476", + "dev_databases/financial/database_description/trans.csv": "sha256:59efafabbb4347853f29ebfc14fdd18633f724a669e7e26cb7b2ecd628d6c4a2", + "dev_databases/financial/financial.sqlite": "sha256:d15d89cdb068a202b6f2b99342af44dffc1d52545b39ceaf62efdc0ba570101e", + "dev_databases/formula_1/database_description/circuits.csv": "sha256:fd69591f97ae0cb3b36b2d35524f03e5ec250c52358a71b2e41d435f3b2b658d", + "dev_databases/formula_1/database_description/constructorResults.csv": "sha256:b446078a76a422e9fbbb3246acf18a36bc75a441fac5f907555ac7031834f7d5", + "dev_databases/formula_1/database_description/constructorStandings.csv": "sha256:d7df8f78744b244375278bb092f8b6d05c9cf4964bdc9cd41eb60261678db861", + "dev_databases/formula_1/database_description/constructors.csv": "sha256:79eb5ffde214702c1465ffa8584d59d3fc2e6a43fd8c41db91c02402af239dd4", + "dev_databases/formula_1/database_description/driverStandings.csv": "sha256:3cc467154abbf10dfc7f8ea5fdec512b5674f0683d36b893085a04de5d9aca5e", + "dev_databases/formula_1/database_description/drivers.csv": "sha256:0444a1610c97dcc1cb1af25a8aed4dc3ca585a0b27f8326d1bb9ffaa6f4e8635", + "dev_databases/formula_1/database_description/lapTimes.csv": "sha256:6fc86f0867ca9fc350b8583c18a74784d7a2e78afb1bc6462f83e3b7cddf5573", + "dev_databases/formula_1/database_description/pitStops.csv": "sha256:6c1c7eb14a445b617710ac286e1f5a303e8b808062fa760c2054c276b2b79fab", + "dev_databases/formula_1/database_description/qualifying.csv": "sha256:35b7e1ce9def76a653407a54f2b18901768392d92d1ef2484d24c20077c77e0e", + "dev_databases/formula_1/database_description/races.csv": "sha256:a8e61de0c7e966c5198c701475d80276065f3a1cf96c3b79051c3541d8fd60d3", + "dev_databases/formula_1/database_description/results.csv": "sha256:7f7cde75b468b8ea135c6ed0872ef30ff715fda691786ca58e70d783b0a23b5d", + "dev_databases/formula_1/database_description/seasons.csv": "sha256:6a87681dcc94db3f6c81879c8569ec29a966eccc7277aa1d9ad59b16e314e5c9", + "dev_databases/formula_1/database_description/status.csv": "sha256:78725236cee342600f862cea296e87a4ea2e047d64d365f594526363f8acde57", + "dev_databases/formula_1/formula_1.sqlite": "sha256:79770caf966707e35516fa566e24b40ae515c74ec1ec4631235245645b87b24d", + "dev_databases/student_club/database_description/Attendance.csv": "sha256:33a5d912e8fea231ecd73d1ee3847433ced7d1768b91866bd1403fb7fd88ea22", + "dev_databases/student_club/database_description/Budget.csv": "sha256:b9000d8f18b4a1613ea3c1877a41823375c2405647756a694591722ba86e60cd", + "dev_databases/student_club/database_description/Event.csv": "sha256:1bf99aa2ce4ae79886eb0d4204e3edd1f0c8c0e44ed427c166f3a1a1af0aec04", + "dev_databases/student_club/database_description/Expense.csv": "sha256:b323e60df3ebfa3ec64686a1d76bece0bb94d81cfe5b642a54b6763b67be302d", + "dev_databases/student_club/database_description/Income.csv": "sha256:573755cd0f41a5dce3a053eb877a52f101bf21af745aaf83170093aa5a4d0579", + "dev_databases/student_club/database_description/Major.csv": "sha256:baca5c68fa1b1c9a427445bd60a1c8702cbdab9d27d5eb0a4304fb7f2ef32e0d", + "dev_databases/student_club/database_description/Member.csv": "sha256:1b9dda90d5fdccc4f70f057bf594a6935975e55a9f81d333714d74d1f4d9674a", + "dev_databases/student_club/database_description/Zip_Code.csv": "sha256:1c903324ec3ff9decd6abb10ac96e3746e1c1b776a26d3a8d4bf5244c8620ecb", + "dev_databases/student_club/student_club.sqlite": "sha256:eb89bcfe97eefa386a27904ec5aa15159811a7eac894ec659a36e48fa9f76b77", + "dev_databases/superhero/database_description/alignment.csv": "sha256:ebff59e5832b2870c298d2bbc85607e0f6b93c4921ff4d3265803d02a8796dce", + "dev_databases/superhero/database_description/attribute.csv": "sha256:3c6bac9176d61e05ba059e8be6a3d5c5aa6eb743f526f07a1570f172cdbf6c72", + "dev_databases/superhero/database_description/colour.csv": "sha256:ba732eddb938dc077cbc3f038057f566f9f12ccb53cc131168a5da538514b9cf", + "dev_databases/superhero/database_description/gender.csv": "sha256:7311f964c77b6319184bbfc9ce8cc0ef87a103106bb1d6967461a5c681a3fe08", + "dev_databases/superhero/database_description/hero_attribute.csv": "sha256:65af1dfdb96e4ddaba6262f3dffe9f61ea240c31d0ea2122e974d769827f039b", + "dev_databases/superhero/database_description/hero_power.csv": "sha256:54eb40baa6b5b726bff28c872478caa8da8500f195239f8c6c3c552797c3794f", + "dev_databases/superhero/database_description/publisher.csv": "sha256:232e8656107f426beb3c7a25f1833afb295dbfa2ae3981b2a200f08ed4f1f000", + "dev_databases/superhero/database_description/race.csv": "sha256:8eb79fe0d1fc7d5641eff43d34e0e10b89fa726360d913bbee31dd55191064c7", + "dev_databases/superhero/database_description/superhero.csv": "sha256:503f0a71acd1766923c571865277f81accbf79b2c9d8df4a18439dfe01ec6f44", + "dev_databases/superhero/database_description/superpower.csv": "sha256:4edef8900f158238382843e348ff9842991c83f1d384c53bef5dd8cb1e613ee2", + "dev_databases/superhero/superhero.sqlite": "sha256:75e94a2c3236ee3bb2c01fb97a1c4b4c1c269bcefd4eab1d04be323d2d0825b1", + "dev_databases/thrombosis_prediction/database_description/Examination.csv": "sha256:b563c9030159bf169236e4582b653386bd34706e309227bf5eceb63b91eb0a89", + "dev_databases/thrombosis_prediction/database_description/Laboratory.csv": "sha256:cf9704e56cf3aca75e38de09277c307a7f0f726301b472254ce66ff4a352ff9f", + "dev_databases/thrombosis_prediction/database_description/Patient.csv": "sha256:519838a9f2592760bb26d1fb4f074bc304eee4e7aeaf46d03f652c370230e175", + "dev_databases/thrombosis_prediction/thrombosis_prediction.sqlite": "sha256:87583183c3dc472fba04de702965560a9d7c0a548836613f242317e0eeb83f00", + "dev_databases/toxicology/database_description/atom.csv": "sha256:9de75492701c77c1229242e8c3b688ced9eb9095ac59d37361dfb0ec34300245", + "dev_databases/toxicology/database_description/bond.csv": "sha256:7d200d38b0dcc07e8fe22718bd6bdb1bdf4b6522b7a84a5d0c95340b6d8cb4bc", + "dev_databases/toxicology/database_description/connected.csv": "sha256:589b24206b9f884863ca57f3e339abcb2409a15feeaff0b08afcd955cd211036", + "dev_databases/toxicology/database_description/molecule.csv": "sha256:a6ff2966916d03b07fd3ce275823d9ec65abb0b55158e871b07c40972b292d70", + "dev_databases/toxicology/toxicology.sqlite": "sha256:35ef27ae6bdfda530e125ed369666ac0abb8bc8c0bcc0ad09407f547ecb61a93", + "dev_tables.json": "sha256:48aa9febe7282d1690f3ed1f222dc040c182df83812ba4e9bee956084d99c8ff", + "mini_dev_sqlite.json": "sha256:4ba5fa8de55856222f484d380d2ba872b380bf79d825de70478e2120cb0fc43b" + }, + "sources": { + "prompt": { + "agent/prompts.py": "sha256:eff191736809d2645248b467ccafa49245f1f93480334694fe4c5d3ae6354e0b" + }, + "schema": { + "agent/contracts/query-candidate-v1.schema.json": "sha256:2ff6c4447f8f516bdec9fb877c6deff696fae7a822efdbe27559d151b8ec652d", + "forge/schema.json": "sha256:e9b56c6f98d08c8b866bd4f49ab0076ff55510711429025d397a5acd9188e723" + }, + "schema_descriptions": { + "agent/contracts/forge-output-descriptions-v1.json": "sha256:796f6d6c15779b537cf3692ea315bd0d8fc6b8cd012e894e5833381d1c44ab18" + }, + "compiler": { + "forge/compiler.py": "sha256:05d5d6e4b38431aa8e2e1d34b6f38cffc43cd38482e6cfd127a650f017903284" + }, + "context": { + "forge/benchmark_metadata.py": "sha256:e8c7752faeed4d954e73b9763233e729979bd4cef0dcc82d44a16fe6b8f70bb5", + "forge/benchmark_v2.py": "sha256:74b689dd3de3fbf4c51dda6e23be1b4193cc377c3e1e6d1794b2b7867f1c967e" + }, + "safety": { + "forge/executor.py": "sha256:cc2e821ae8c7e48d0f5a956d943e4b6330343e02d169edb9a0780eb44cd658f1", + "forge/lint.py": "sha256:b78c85be53defb33c96f0507f67dae072c49447c0798fbfac79c05148ee27d94", + "registry/relationships.py": "sha256:d2d109af1e2b11fd661c6140a10c37d3e1e5619538088f9d4c6a65867191135a" + }, + "official_snapshot": { + "tests/datasets/bird_mini_dev_standard.json": "sha256:0886f203ad6f41412b66ef843d3e87f939f565bc5cddbe7232b1ebe24d11698f" + }, + "evaluator": { + "agent/contracts/__init__.py": "sha256:12146de2af766d894a2f78abfa6e40a2fd1469a8dabefd00bd6dd02192b6812c", + "agent/contracts/benchmark-failure-v1.schema.json": "sha256:0d57f63bdd06b29aa54006fd768a6addd174a1cccce72a699a09a0c4d85702c0", + "forge/assurance.py": "sha256:25232efe2311b536822783a7129c9d89536c194b3e13205d05a00502e94c62f0", + "forge/benchmark_methods.py": "sha256:22ec345d80b90db7a96d83f6b9cce2e4fe9493e25c709ef1bd831dbc3ee5f01d", + "forge/benchmark_service.py": "sha256:1f0398858e5e7fab387c860953249a01369de141a35948b856652910cabd1386", + "forge/bird_benchmark.py": "sha256:b4a1482b6f245c885347741ce691c898c6f00a3c954161faaa7e9afde2c5e40c", + "forge/hard_accuracy_benchmark.py": "sha256:32963cce5222a8f5d26a77374491445c61c45358a1ecaaf1d259d469eb2c6a0c", + "pyproject.toml": "sha256:088f3b0c5960661037ab6de0129ec6eec433eb3304eec7f66a82cdfbcfba1bcd" + } + }, + "model": { + "provider": "openai-codex", + "model": "gpt-5.6-luna" + }, + "generation": { + "max_model_calls": 16, + "provider_retries": 0, + "max_agent_turns_per_arm": 1, + "timeout_seconds": 120, + "sampling": "provider_default", + "max_output_tokens": null + }, + "gold_readiness": { + "policy": "require_all", + "blocked_cases": [] + }, + "variables": { + "allowed_changes": [ + "schema_descriptions" + ] + }, + "date_context": { + "mode": "off", + "max_rows": 100 + }, + "grain_context": { + "mode": "off" + }, + "value_context": { + "mode": "off", + "field": null, + "max_values": 16 + }, + "schema_descriptions": { + "mode": "interfaces-v1", + "catalog_revision": "sha256:796f6d6c15779b537cf3692ea315bd0d8fc6b8cd012e894e5833381d1c44ab18", + "wire_schema_revision": "sha256:d3d56c36a2a8fd0322e61474a1ae8602d40244bdba5d6a00a50095f0c254848f" + }, + "metric_revision": "semantic-result-compare-v2", + "official_ex_revision": "bird_execution_accuracy_exact_set_v1", + "forge_prompt_revision": "forge-structured-benchmark-v1", + "forge_schema_revision": "sha256:e9b56c6f98d08c8b866bd4f49ab0076ff55510711429025d397a5acd9188e723", + "context_hashes": { + "md-009": { + "snapshot": "sha256:b0fe819ea69c7d9dcda31dff5b6073f1bded828078467e8fa8c42b5f4ca43d22", + "schema": "sha256:b915f6c4b8f985b6cf2e4d90e561f217c342c5b3e33ed8a01f51252ce18ed53c", + "forge": "sha256:6fa52964572271372c6c38f3c1875e4682e7709bcfc879dfa878ea2fc3f8ea93", + "direct": "sha256:93f2d51ab4b7fa40f6821f3ac6de8465044659e545057c8d0459bdfa031b52d8", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-079": { + "snapshot": "sha256:21ab8fd129d69e3e08563c59682deda787d2d932da61425ffa39422a06b0129a", + "schema": "sha256:4c0f1254efae5e9e57c43300f80151ee10e00bcd312ac648c41fbef399985b7b", + "forge": "sha256:0361cf4e9f7bc97d6b7d0f0825e85c7032504e461de1834a340c928b91b1b489", + "direct": "sha256:e5e64f9573e3687e69811f574beafb0ad428c662d3778bf6293249ea175efb79", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-199": { + "snapshot": "sha256:9e7ac9eae571e86e02fc4402fc46f432610ee7954f062bcb92e381c931604b55", + "schema": "sha256:8b3c67bb47b8fb49bc27d8d9ab8bb62d936a382b268eae99d55101d7b0d3adbc", + "forge": "sha256:4d494cfb100a4afd5786fb45d7b21b9c54428242ade9106ecaad4020ca7f74a4", + "direct": "sha256:baf37bd1577e965c54fa4ce62d0596d7d64c03c66fc6341fd7d7c82a1b03f015", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-289": { + "snapshot": "sha256:9d7ac490c3e9ea1cfd532d3879003b5555a36471ee2cc3ec3c8f9c149718ad31", + "schema": "sha256:092165277e5a0b0795c180332993df873996d7e66ff2c158657a1ec5103297fa", + "forge": "sha256:2ffe1082026016359e3d83f8995e5ef48714b1c16abc0c86a4d2da1334134f5f", + "direct": "sha256:13242726ff2e9c32fa4cb31be09eb91ac7a26b806bea4dc596081b4c4573438e", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-002": { + "snapshot": "sha256:0ecba77b6d59f89bd98e355d93c429c7f91dbdfca79f41b4b0eadf9bd39d483e", + "schema": "sha256:b915f6c4b8f985b6cf2e4d90e561f217c342c5b3e33ed8a01f51252ce18ed53c", + "forge": "sha256:593c0e9b5acb70f0904c269d91641ba93deccbc9a3f198c2e414c36c62fce80f", + "direct": "sha256:8adffd53d8ba1565f855208a2a38433c3b16a69311eba8ce043425118709baf5", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-052": { + "snapshot": "sha256:d63c1decac44459f9d672e6dfad4655b72e0da81a0426cb2ca253d141b49b781", + "schema": "sha256:7c0395d7270401bf6e5253c4604e33a18b4d7263bbb6466d19648006dc6ee5ff", + "forge": "sha256:0ca7b8ce2376366213cc8c7f0828148a2558990c4a555e38a1ce36e7a0281955", + "direct": "sha256:59d9180585309f09670abb2681c14400a4121e88e0ac1ff2a090606817aaf7de", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-312": { + "snapshot": "sha256:75437f836736f9e96b3260c36baa0e62493bc14f7186e78b5dc292db77e51426", + "schema": "sha256:161e5567a4dd24f75807d29c2034b5739b6b6347b3c65a1904e83d474774e92a", + "forge": "sha256:bd66bff745024e706025df05f06a05508ad12a419e72eac1e4eb0b44ce53f0e4", + "direct": "sha256:3c83ee0c8ea95f2c8bb01e7a44d1158a42a954bee00258ce1df45df42ef1d4ff", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + }, + "md-386": { + "snapshot": "sha256:620fc864784d339de7ca10a6322073b6cb4b900bc3205800ecb71652eb14ccda", + "schema": "sha256:3df9b560b244b44495961f169977414f063fdf08819b134982cbc62eb8fe2017", + "forge": "sha256:aad0642910ee0268d06fe2d0ba66fefc6c0dba7b4573ffea0e79b6aeb4569ccc", + "direct": "sha256:5ec2bf42875efed48f45aad16fc17ef98c706c6e02cde529cda018a954d352fd", + "date_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "grain_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b", + "value_evidence": "sha256:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b" + } + }, + "runtime": { + "python": "3.14.7", + "sqlite": "3.53.4", + "sqlglot": "29.0.1", + "jsonschema": "4.26.0", + "numpy": "2.5.2", + "pydantic": "2.13.5" + } + } + }, + "source_fingerprints": { + "agent/contracts/forge-output-descriptions-v1.json": "sha256:796f6d6c15779b537cf3692ea315bd0d8fc6b8cd012e894e5833381d1c44ab18", + "forge/bird_benchmark.py": "sha256:b4a1482b6f245c885347741ce691c898c6f00a3c954161faaa7e9afde2c5e40c", + "forge/cli.py": "sha256:6b952376848881ebf4b185c4c4550095b324c62789c108fb767843c508b1bffc", + "services/pi-orchestrator/src/strict-forge-output.ts": "sha256:3f98829caa719772f365b9f602215719144f825e13154d6317f6232cfa663f36", + "services/pi-orchestrator/src/benchmark-runtime.ts": "sha256:a8840390ac4cbb4e2e72b7ff29950ffbb1b3abd92db9a2d68694e7c881e593ba", + "services/pi-orchestrator/src/benchmark-contracts.ts": "sha256:48ed10cda019128a4f8ac5da273c192a3dc7cca9df370ab5185f3ca9b9d4566b", + "tests/test_bird_benchmark.py": "sha256:8ae4fef17403b9b2bd466e07493c89f92cc4ba7b795b7611bcdbf60308cd3931", + "services/pi-orchestrator/tests/strict-forge-output.test.ts": "sha256:c8c69cd1ae917c9f8c6d6f7a6abda596f516df8d0e9f4e475f56b0a8534ea1c9", + "services/pi-orchestrator/tests/benchmark-runtime.test.ts": "sha256:e37be3df13dbbb828014b8c73ef9deb5d8bb9868945fcff1c44bf0a5366b1a6c" + }, + "protected_source_fingerprints": { + "agent/prompts.py": "sha256:eff191736809d2645248b467ccafa49245f1f93480334694fe4c5d3ae6354e0b", + "forge/schema.json": "sha256:e9b56c6f98d08c8b866bd4f49ab0076ff55510711429025d397a5acd9188e723", + "forge/compiler.py": "sha256:05d5d6e4b38431aa8e2e1d34b6f38cffc43cd38482e6cfd127a650f017903284", + "forge/assurance.py": "sha256:25232efe2311b536822783a7129c9d89536c194b3e13205d05a00502e94c62f0", + "docs/archive/benchmarks/benchmark-sol-error-triage-2026-09-05.json": "sha256:39cdfcf83d51d2f4dbb2618d54021f326598b668bca08f25565473fde1335573", + "docs/archive/benchmarks/benchmark-sol-metric-replay-2026-09-05.json": "sha256:2eee5ba01fe2f20c01542c74a6131be625bcf9c13a5847b1e85dc733403af796", + "docs/archive/benchmarks/benchmark-luna-projection-instructions-2026-09-05.json": "sha256:b59dac931ff210af8ec4a38f75e6b92587758a2f1cadcbdfb951a0a8d604a602", + "docs/archive/benchmarks/benchmark-luna-date-context-2026-09-05.json": "sha256:97e7842a38a7bd3f3b0f27d9a63d9875ebf81da8e7cfd5c07a9bac21c11acd46", + "docs/archive/benchmarks/benchmark-luna-value-context-2026-09-06.json": "sha256:6077229f0efb9ef678eed4e14a37aa50c23575f89abb197b81c4592d16e739be", + "docs/archive/benchmarks/benchmark-luna-denominator-scope-2026-09-07.json": "sha256:69546731b83a6d0e25aa13c38084d56d45f9d6360e3ae0d17cd0f54aa7458506", + "docs/archive/benchmarks/benchmark-luna-cte-interface-2026-09-07.json": "sha256:dfcb5e6a3faba7d3c2dedb4cf76fedc23696a370cb39b1b0613fdda9e4bf98d2" + }, + "local_evidence_fingerprints": { + ".forge/benchmarks/schema-descriptions-ready-20260908/control.frozen.json": "sha256:9421620febf7e1465aff0cf9d66334165f48d811ed94ce4b17f6613569ff17c8", + ".forge/benchmarks/schema-descriptions-ready-20260908/treatment.frozen.json": "sha256:1ffcb7ac1d95f0758105b4d18e048272e10dca312274cb805116cac296268e4e", + ".forge/benchmarks/schema-descriptions-ready-20260908/control.preflight.json": "sha256:b6a9f4a814dac817e3ab652723334b873b67b1279491f151a27f22870cf79bd8", + ".forge/benchmarks/schema-descriptions-ready-20260908/treatment.preflight.json": "sha256:58753a6ac98c03a888b13582d395c0c287fa92260a0aee66f85efd273a15dcde", + ".forge/benchmarks/schema-descriptions-ready-20260908/semantic-audit-revised.json": "sha256:23ed4535767250605fe76d44db6dd6b7ec1b17cdb6851e52a2e9330f6ba9b661", + ".forge/benchmarks/schema-descriptions-ready-20260908/input-invariance.json": "sha256:4e83860309696cdf1a6b23eb971daea662e2414c31467532b8e595b5b4d1b8c2", + ".forge/benchmarks/schema-descriptions-ready-20260908/historical-replay.json": "sha256:94a27284f8e588cacc374cd22c1f20193ffe98ecadc9172e2e5f03b481acaa66", + ".forge/benchmarks/schema-descriptions-ready-20260908/real-sdk-http-smoke.json": "sha256:ac1c79c51be89c91dd5cf2c0e0ed58bab6d977da80187a2868e1b4b92fd4dad7" + }, + "captured_smoke_sources": { + "note": "仅为审计保留实际临时驱动源码;不是新增运行入口、测试框架或业务状态。重做须使用新证据目录,不覆盖本报告冻结。", + "native_pi_sdk": "import assert from \"node:assert/strict\";\nimport { createHash } from \"node:crypto\";\nimport { createServer } from \"node:http\";\nimport { mkdtemp, readFile, writeFile, rm } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { resolve, join } from \"node:path\";\nimport { setTimeout as pause } from \"node:timers/promises\";\nimport { loadConfig } from \"../src/config.js\";\nimport { SqliteOrchestratorState } from \"../src/sqlite-store.js\";\nimport { OrchestratorApplication } from \"../src/application.js\";\nimport { PiBenchmarkRuntime } from \"../src/benchmark-runtime.js\";\nimport { createStrictForgeOutput } from \"../src/strict-forge-output.js\";\nconst root=resolve(\"../..\");\nconst evidence=join(root,\".forge/benchmarks/schema-descriptions-ready-20260908\");\nconst fixture=JSON.parse(await readFile(join(evidence,\"sdk-smoke-fixture.json\"),\"utf8\"));\nconst catalog=JSON.parse(await readFile(join(root,\"agent/contracts/forge-output-descriptions-v1.json\"),\"utf8\"));\nconst canonical=JSON.parse(await readFile(join(root,\"forge/schema.json\"),\"utf8\"));\nconst hash=(v:unknown)=>\"sha256:\"+createHash(\"sha256\").update(JSON.stringify(v)).digest(\"hex\");\nfunction deref(s:any,whole:any):any { return s.$ref===\"#\"?whole:s.$ref?deref(s.$ref.slice(2).split(\"/\").reduce((n:any,k:string)=>n[k],whole),whole):s; }\nfunction fits(v:any,s:any,whole:any):boolean {\n s=deref(s,whole);\n if(s.anyOf) return s.anyOf.some((n:any)=>fits(v,n,whole));\n if(s.enum&&!s.enum.includes(v))return false;\n if(s.type===\"null\")return v===null;\n if(s.type===\"string\")return typeof v===\"string\";\n if(s.type===\"number\"||s.type===\"integer\")return typeof v===\"number\";\n if(s.type===\"boolean\")return typeof v===\"boolean\";\n if(s.type===\"array\")return Array.isArray(v)&&v.every((n:any)=>fits(n,s.items,whole));\n if(s.type===\"object\")return v!==null&&typeof v===\"object\"&&!Array.isArray(v)&&Object.entries(v).every(([k,n])=>s.properties[k]&&fits(n,s.properties[k],whole));\n return true;\n}\nfunction strict(v:any,s:any,whole:any):any {\n s=deref(s,whole);\n if(s.anyOf){const branch=s.anyOf.find((n:any)=>fits(v,n,whole));assert.ok(branch,\"No strict branch for historical candidate\");return strict(v,branch,whole);}\n if(v===null)return null;\n if(Array.isArray(v))return v.map(n=>strict(n,s.items,whole));\n if(s.type===\"object\")return Object.fromEntries(s.required.map((k:string)=>[k,k in v?strict(v[k],s.properties[k],whole):null]));\n return v;\n}\nfunction withoutDescriptions(v:any):any {if(Array.isArray(v))return v.map(withoutDescriptions);if(v&&typeof v===\"object\")return Object.fromEntries(Object.entries(v).filter(([k])=>k!==\"description\").map(([k,n])=>[k,withoutDescriptions(n)]));return v;}\nconst directory=await mkdtemp(join(tmpdir(),\"forge-schema-real-sdk-\"));\nconst requests:any[]=[];\nconst network:string[]=[];\nconst nativeFetch=globalThis.fetch;\nglobalThis.fetch=async(input:any,init?:any)=>{\n const url=new URL(typeof input===\"string\"||input instanceof URL?input:input.url);\n assert.equal(url.hostname,\"127.0.0.1\",\"External network is forbidden in this smoke\");network.push(url.pathname);\n return nativeFetch(input,init);\n};\nconst provider=createServer(async(req,res)=>{\n try{\n let raw=\"\";for await(const part of req)raw+=part;\n const body=JSON.parse(raw);requests.push(body);\n const tool=body.tools?.[0]?.function;\n let delta:any,finish:string;\n if(tool){\n assert.equal(tool.name,\"emit_forge_query\");assert.equal(tool.strict,true);\n const args=strict(fixture.forge,tool.parameters,tool.parameters);\n const mode=tool.parameters.properties.scan.description?\"interfaces-v1\":\"off\";\n assert.deepEqual(createStrictForgeOutput(canonical,catalog.profiles[mode].descriptions).decode(args),fixture.forge);\n delta={role:\"assistant\",tool_calls:[{index:0,id:\"synthetic-call\",type:\"function\",function:{name:tool.name,arguments:JSON.stringify(args)}}]};finish=\"tool_calls\";\n }else{delta={role:\"assistant\",content:fixture.direct};finish=\"stop\";}\n res.writeHead(200,{\"content-type\":\"text/event-stream\"});\n const chunk=(choices:any[],usage?:any)=>res.write(\"data: \"+JSON.stringify({id:\"synthetic-response\",object:\"chat.completion.chunk\",created:0,model:\"fixture\",choices,...(usage?{usage}:{})})+\"\\n\\n\");\n chunk([{index:0,delta,finish_reason:null}]);chunk([{index:0,delta:{},finish_reason:finish}]);\n chunk([],{prompt_tokens:100,completion_tokens:50,total_tokens:150});res.end(\"data: [DONE]\\n\\n\");\n }catch(error){console.error(error);res.writeHead(500);res.end(\"Synthetic fixture failed\");}\n});\nawait new Promise(r=>provider.listen(0,\"127.0.0.1\",r));\nconst port=(provider.address() as any).port;\nawait writeFile(join(directory,\"models.json\"),JSON.stringify({providers:{\"local-schema-smoke\":{baseUrl:`http://127.0.0.1:${port}/v1`,api:\"openai-completions\",apiKey:\"synthetic-not-a-real-key\",authHeader:true,models:[{id:\"fixture\",name:\"Deterministic historical replay — not a model\",reasoning:false,input:[\"text\"],contextWindow:128000,maxTokens:16384,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},compat:{supportsDeveloperRole:false,supportsReasoningEffort:false,supportsStrictMode:true}}]}}}));\nawait writeFile(join(directory,\"auth.json\"),\"{}\");\nconst config=loadConfig({PI_ORCHESTRATOR_AGENT_DIR:directory,PI_ORCHESTRATOR_STATE_DB:join(directory,\"state.sqlite\"),SHISUI_DATA_SKILLS_DIR:directory,PI_BENCHMARK_CONCURRENCY:\"1\",FORGE_BASE_URL:\"http://127.0.0.1:19043\",FORGE_PI_SERVICE_KEY:\"synthetic-schema-smoke\"});\nconst state=new SqliteOrchestratorState(config.stateDbPath);\nconst application=new OrchestratorApplication({config,state});\nconst runtime=new PiBenchmarkRuntime(config,application);\nconst runs:any[]=[];\ntry{\n const unauthorized=await fetch(config.forgeBaseUrl+\"/api/internal/benchmark-v2/suite\");assert.equal(unauthorized.status,401);\n for(const mode of [\"off\",\"interfaces-v1\"]){\n const frozen=JSON.parse(await readFile(join(evidence,`synthetic-${mode}.frozen.json`),\"utf8\"));\n const started=await runtime.start({provider:\"local-schema-smoke\",model:\"fixture\",caseIds:[fixture.case_id],confirmModelCalls:2,protocolManifest:frozen.manifest});\n let run:any;\n for(let i=0;i<600;i++){run=runtime.get(started.run_id);if([\"completed\",\"failed\",\"stopped\",\"interrupted\"].includes(run.status))break;await pause(50);}\n assert.equal(run.status,\"completed\",JSON.stringify({run,logs:runtime.logs(started.run_id)}));\n assert.equal(run.completed_calls,2);assert.equal(run.generation_contract.schema_descriptions.mode,mode);\n assert.equal(run.generation_contract.forge_wire_schema_revision,catalog.profiles[mode].wire_schema_revision);\n for(const arm of [\"forge\",\"direct\"]){assert.equal(run.cases[0][arm].evidence.dispatches,1);assert.equal(run.cases[0][arm].usage_observed,true);}\n runs.push(run);\n }\n assert.equal(requests.length,4);\n const forge=requests.filter(r=>r.tools?.length),direct=requests.filter(r=>!r.tools?.length);\n assert.deepEqual(direct[0],direct[1]);assert.deepEqual(withoutDescriptions(forge[0]),withoutDescriptions(forge[1]));\n assert.equal(hash(forge[0].tools[0].function.parameters),catalog.profiles.off.wire_schema_revision);\n assert.equal(hash(forge[1].tools[0].function.parameters),catalog.profiles[\"interfaces-v1\"].wire_schema_revision);\n assert.deepEqual(runs[0].cases[0].forge.output,runs[1].cases[0].forge.output);\n assert.equal(runs[0].cases[0].direct.output,runs[1].cases[0].direct.output);\n const forged=JSON.parse(await readFile(join(evidence,\"synthetic-interfaces-v1.frozen.json\"),\"utf8\"));forged.manifest.schema_descriptions.mode=\"unknown\";\n await assert.rejects(runtime.start({provider:\"local-schema-smoke\",model:\"fixture\",caseIds:[fixture.case_id],confirmModelCalls:2,protocolManifest:forged.manifest}));\n assert.equal(requests.length,4);\n const result={status:\"passed\",boundary:\"real Pi SDK and real authenticated Python HTTP routes; only provider responses are deterministic loopback replay\",new_model_calls:0,synthetic_sse_dispatches:requests.length,external_network_requests:0,unauthorized_http_status:unauthorized.status,direct_payload_identical:true,forge_payload_identical_except_descriptions:true,candidate_outputs_identical:true,forged_mode_rejected_before_dispatch:true,runs:runs.map(r=>({protocol_revision:r.protocol_revision,generation_contract:r.generation_contract,status:r.status,completed_synthetic_dispatches:r.completed_calls,candidate_hashes:{forge:hash(r.cases[0].forge.output),direct:hash(r.cases[0].direct.output)}})),network_paths:network};\n await writeFile(join(evidence,\"real-sdk-http-smoke.json\"),JSON.stringify(result,null,2),{flag:\"wx\"});\n console.log(JSON.stringify(result));\n}finally{await runtime.close();state.close();await new Promise(r=>provider.close(()=>r()));globalThis.fetch=nativeFetch;await rm(directory,{recursive:true,force:true});}\n", + "isolated_python_http": "import os, sys, types, json\nfrom pathlib import Path\nos.environ[\"FORGE_DISABLE_DOTENV\"]=\"true\"\n# Isolated test configuration; never import/read real forge.yaml, .env or credentials.\nmodule=types.ModuleType(\"config\")\nmodule.cfg=types.SimpleNamespace(PI_SERVICE_API_KEYS=[\"synthetic-schema-smoke\"])\nsys.modules[\"config\"]=module\nfrom fastapi import FastAPI\nimport uvicorn\nfrom forge import bird_benchmark as bird\nfrom web.routes.benchmark_v2 import router\nroot=Path(\".forge/benchmarks/schema-descriptions-ready-20260908\")\nbird.PROTOCOL_DIR=root/\"synthetic-protocols\"\nfor mode in (\"off\",\"interfaces-v1\"):\n frozen=bird.freeze(cohort=\"D\",provider=\"local-schema-smoke\",model=\"fixture\",case_ids=[\"md-052\"],variable=\"schema_descriptions\",schema_descriptions=mode)\n with (root/(\"synthetic-\"+mode+\".frozen.json\")).open(\"x\") as f: json.dump(frozen,f,ensure_ascii=False,indent=2)\napp=FastAPI()\napp.include_router(router)\nuvicorn.run(app,host=\"127.0.0.1\",port=19043,log_level=\"warning\")\n", + "all_500_default_inputs": "import hashlib, json, sys, types\nfrom pathlib import Path\nmodule=types.ModuleType(\"config\");module.cfg=types.SimpleNamespace();sys.modules[\"config\"]=module\nfrom forge import hard_accuracy_benchmark as hard\nfrom forge.benchmark_service import build_context_response\nroot=Path(\".forge/benchmarks/schema-descriptions-ready-20260908\")\nbaseline=json.loads((root/\"baseline-input-hashes.json\").read_text())[\"cases\"]\ndef digest(value):return \"sha256:\"+hashlib.sha256(json.dumps(value,ensure_ascii=False,sort_keys=True,separators=(\",\",\":\"),allow_nan=False).encode()).hexdigest()\ncurrent={}\nfor case in hard.load_suite(hard._FULL_SUITE_ID)[\"cases\"]:\n ctx=build_context_response(hard.load_suite(hard._FULL_SUITE_ID),case)\n current[case[\"case_id\"]]={\"snapshot\":digest(ctx[\"context_snapshot\"]),\"schema\":digest(ctx[\"schema_context\"]),\"forge\":digest(ctx[\"forge_instructions\"]),\"direct\":digest(ctx[\"direct_instructions\"])}\nassert current==baseline\nresult={\"public_cases\":len(current),\"checked_fields\":[\"context_snapshot\",\"schema_context\",\"forge_instructions\",\"direct_instructions\"],\"unchanged\":len(current),\"new_model_calls\":0,\"gold_executions\":0}\nwith (root/\"input-invariance.json\").open(\"x\") as f:json.dump(result,f,indent=2)\nprint(json.dumps(result))\n" + }, + "boundaries": { + "real_provider_calls": 0, + "synthetic_loopback_sse_responses": 4, + "real_model_readiness_checked": false, + "customer_data_accessed": false, + "production_configuration_modified": false, + "commit_push_deploy": false, + "default_changed": false, + "seed49_started": false, + "r500_or_h_generation_started": false, + "r06_promoted": false, + "historical_reports_rewritten": false, + "temporary_http_service_stopped": true + }, + "integrity": { + "algorithm": "SHA-256 of UTF-8 JSON with ensure_ascii=false, sort_keys=true, compact separators, excluding report_sha256; experiment card uses same rule excluding card_sha256." + }, + "report_sha256": "sha256:8a4d4a3b72622a642212a490975cfe251bb50d32698deb0aedbd52746e3a6440" +} diff --git a/docs/benchmark-luna-standard-d20-2026-09-05.json b/docs/archive/benchmarks/benchmark-luna-standard-d20-2026-09-05.json similarity index 100% rename from docs/benchmark-luna-standard-d20-2026-09-05.json rename to docs/archive/benchmarks/benchmark-luna-standard-d20-2026-09-05.json diff --git a/docs/benchmark-luna-strict-output-2026-09-05.json b/docs/archive/benchmarks/benchmark-luna-strict-output-2026-09-05.json similarity index 100% rename from docs/benchmark-luna-strict-output-2026-09-05.json rename to docs/archive/benchmarks/benchmark-luna-strict-output-2026-09-05.json diff --git a/docs/benchmark-luna-strict-paired-2026-09-05.json b/docs/archive/benchmarks/benchmark-luna-strict-paired-2026-09-05.json similarity index 100% rename from docs/benchmark-luna-strict-paired-2026-09-05.json rename to docs/archive/benchmarks/benchmark-luna-strict-paired-2026-09-05.json diff --git a/docs/benchmark-luna-value-context-2026-09-06.json b/docs/archive/benchmarks/benchmark-luna-value-context-2026-09-06.json similarity index 100% rename from docs/benchmark-luna-value-context-2026-09-06.json rename to docs/archive/benchmarks/benchmark-luna-value-context-2026-09-06.json diff --git a/docs/benchmark-luna-value-context-2026-09-06.md b/docs/archive/benchmarks/benchmark-luna-value-context-2026-09-06.md similarity index 100% rename from docs/benchmark-luna-value-context-2026-09-06.md rename to docs/archive/benchmarks/benchmark-luna-value-context-2026-09-06.md diff --git a/docs/benchmark-luna-value-context-ready-2026-09-06.json b/docs/archive/benchmarks/benchmark-luna-value-context-ready-2026-09-06.json similarity index 100% rename from docs/benchmark-luna-value-context-ready-2026-09-06.json rename to docs/archive/benchmarks/benchmark-luna-value-context-ready-2026-09-06.json diff --git a/docs/benchmark-luna-value-context-ready-2026-09-06.md b/docs/archive/benchmarks/benchmark-luna-value-context-ready-2026-09-06.md similarity index 100% rename from docs/benchmark-luna-value-context-ready-2026-09-06.md rename to docs/archive/benchmarks/benchmark-luna-value-context-ready-2026-09-06.md diff --git a/docs/benchmark-r500-v8-binding-audit-2026-09-06.json b/docs/archive/benchmarks/benchmark-r500-v8-binding-audit-2026-09-06.json similarity index 100% rename from docs/benchmark-r500-v8-binding-audit-2026-09-06.json rename to docs/archive/benchmarks/benchmark-r500-v8-binding-audit-2026-09-06.json diff --git a/docs/benchmark-r500-v8-binding-audit-2026-09-06.md b/docs/archive/benchmarks/benchmark-r500-v8-binding-audit-2026-09-06.md similarity index 100% rename from docs/benchmark-r500-v8-binding-audit-2026-09-06.md rename to docs/archive/benchmarks/benchmark-r500-v8-binding-audit-2026-09-06.md diff --git a/docs/benchmark-sol-error-triage-2026-09-05.json b/docs/archive/benchmarks/benchmark-sol-error-triage-2026-09-05.json similarity index 100% rename from docs/benchmark-sol-error-triage-2026-09-05.json rename to docs/archive/benchmarks/benchmark-sol-error-triage-2026-09-05.json diff --git a/docs/benchmark-sol-metric-replay-2026-09-05.json b/docs/archive/benchmarks/benchmark-sol-metric-replay-2026-09-05.json similarity index 100% rename from docs/benchmark-sol-metric-replay-2026-09-05.json rename to docs/archive/benchmarks/benchmark-sol-metric-replay-2026-09-05.json diff --git a/docs/benchmark-standards-engineering-2026-09-05.json b/docs/archive/benchmarks/benchmark-standards-engineering-2026-09-05.json similarity index 100% rename from docs/benchmark-standards-engineering-2026-09-05.json rename to docs/archive/benchmarks/benchmark-standards-engineering-2026-09-05.json diff --git a/docs/benchmark_failure_analysis_2026-03-18.md b/docs/archive/benchmarks/benchmark_failure_analysis_2026-03-18.md similarity index 100% rename from docs/benchmark_failure_analysis_2026-03-18.md rename to docs/archive/benchmarks/benchmark_failure_analysis_2026-03-18.md diff --git a/docs/archive/benchmarks/forge-json-generation-research-2026-09-08.json b/docs/archive/benchmarks/forge-json-generation-research-2026-09-08.json new file mode 100644 index 0000000..a173b91 --- /dev/null +++ b/docs/archive/benchmarks/forge-json-generation-research-2026-09-08.json @@ -0,0 +1,444 @@ +{ + "schema_version": "forge-json-generation-research-v1", + "date": "2026-09-08", + "requirement": "REQ-2026-09-08-064", + "status": "research_complete_implementation_not_authorized", + "scope": { + "new_model_calls": 0, + "sql_executions": 0, + "gold_executions": 0, + "runtime_source_edits": false, + "historical_reports_modified": false, + "new_accuracy_claim": false, + "active_plan_changed": false + }, + "conclusion": "先消除模型可见DSL语义/依赖呈现的可疑负担,再以有来源的答案规划作为准确率主攻;不继续叠加通用范例。超过同条件Direct SQL是待验证目标,不是JSON格式的天然保证。", + "paired_historical_analysis": { + "source": "docs/archive/benchmarks/benchmark-sol-metric-replay-2026-09-05.json", + "n": 500, + "forge_ex": 313, + "direct_ex": 314, + "both_correct": 291, + "both_wrong": 164, + "forge_only": 22, + "direct_only": 23, + "delta_percentage_points": -0.2, + "mcnemar_exact_two_sided_p": 1, + "oracle_union_correct": 336, + "oracle_union_is_not_a_method": true, + "nonexecuting_forge": 4, + "perfect_nonexecution_repair_ceiling_correct": 317, + "compile_reorder_smoke": { + "source": "docs/archive/benchmarks/benchmark-sol-error-triage-2026-09-05.json", + "source_sha256": "39cdfcf83d51d2f4dbb2618d54021f326598b668bca08f25565473fde1335573", + "cases": 500, + "compile_status": { + "compiled": 500 + }, + "serialization_changed": 49, + "compile_or_error_changed": [], + "candidate_values_changed": 0, + "gold_executions": 0, + "new_model_calls": 0, + "new_sql_executions": 0, + "invalid_shape_valid_query": { + "sql": "SELECT missing\nFROM facts", + "assurance": "QueryAssuranceError" + }, + "candidate_order": [ + "cte", + "scan", + "joins", + "filter", + "group", + "agg", + "window", + "having", + "qualify", + "select", + "distinct", + "sort", + "limit", + "offset", + "explain", + "union", + "intersect", + "except" + ] + }, + "complexity_by_forge_candidate": { + "no_cte": { + "n": 454, + "forge_ex": 293, + "direct_ex": 293, + "window": 5 + }, + "cte": { + "n": 46, + "forge_ex": 20, + "direct_ex": 21, + "window": 3 + } + }, + "limitations": [ + "历史固定候选统计,不是当前Luna/Assurance v11新EX;不执行或补算已知Gold超时。", + "按候选含CTE分组是事后描述,题难度和模型选择混杂,不能当CTE导致失分的因果。", + "317/500仅是四个旧非执行候选全部修成正确且其他候选完全不变的理想上界;不是收益预测。" + ] + }, + "latest_experiment_review": { + "scope": "只读解析了指定五轮实验及 Sol triage/metric replay 的归档 JSON;仅查看必要字段与失败题原候选,没有执行 SQL、调用模型、重判 Gold、读取凭证/客户数据或写文件。以下路径均相对 docs/archive/benchmarks/。", + "priority_judgment": { + "first": "[研究建议,尚未验证] 下一刀应优先研究生成表示本身的“单一定义→显式最终答案→确定性导出/引用”设计,而不是再次添加投影/分母/CTE自然语言范例。已有机制证据集中在 agg/window 声明与 select 导出分离、CTE 定义与根 scan/引用分离,以及计算完成但根查询返回中间量。可以离线用保存候选和合法反例研究如何减少需模型重复维护的字段/名称;不能预先认定自动补列、自动补 JOIN、拒绝未使用 CTE 就是正确解法,也不能宣称能提高 EX。核心验收必须是完整最终答案,不是编译通过/引用连通。", + "second": "[研究建议,尚未验证] 值/日期事实确实能修正局部绑定,但要与完整答案形状、粒度、分母总体、百分比量纲分开观察;它们不是 DSL 导出问题。下一步如研究业务语义,应冻结一个独立机制,不叠加上一轮失败 Prompt。先要求答案计划能区分全体/子集分母、标量/实体行、字段拆分与百分比/比值,再检验最终生成是否遵循;不是再堆‘请注意粒度’提示。", + "deprioritize": "重复 REQ-044 投影说明、REQ-056 分母范例、REQ-058 CTE接口范例,或仅增加 Assurance 拒绝:前者已有无净收益/回退证据;后者只提前拦截,不产生正确答案。结构改造也只能列为可证伪假设:Sol 原始非执行错误只有4题,不能把整个 EX 差距解释为声明/导出冗余。" + }, + "experiments": [ + { + "requirement": "REQ-044", + "source": "benchmark-luna-projection-instructions-2026-09-05.json", + "fields": [ + "decision", + "metrics", + "paired", + "outcomes[case_id=md-259,arm=forge].candidate", + "outcomes[case_id=md-259,arm=forge].evaluation" + ], + "scores": "5题×2条件×2臂,20次;Forge EX/Contract 4/5→4/5,零转正、零正确回退;md-085/312/386三个正确对照保持。Direct输入不变但4/5→5/5。", + "mechanism": "md-259 对照 select 已是百分比+Marvel坏人数量,但 INNER JOIN 缩小分母,结果[28.60998650472335,118];处理组 agg 声明 total_count/bad_count/marvel_bad_count,根 select 直接返回三中间量[741,212,118],同时重复声明一个同样计算的 stats CTE 却不消费它。这是业务分母错误与最终答案表达错误叠加;不是 Compiler 漏生成原 JSON 已要求的百分比。md-436 两条件均正确且 SQL 相同,旧失败恢复不能归因于处理。", + "cost": "总tokens 36,284→36,262;Forge自身23,660→23,719(+0.25%)。", + "limit": "一条件一采样,已曝光5题;Direct波动明确反对把旧失败恢复当Prompt因果收益。" + }, + { + "requirement": "REQ-047", + "source": "benchmark-luna-date-context-2026-09-05.json", + "fields": [ + "mechanism_observations", + "outcomes[case_id=md-483|md-077|md-289]", + "metrics", + "costs" + ], + "scores": "20次,Forge EX/Contract 2/5→3/5,执行4/5→5/5;Direct3/5→3/5。", + "suberror_only": [ + "md-483:两臂从 YYMMDD 边界改 ISO 日期;Forge off 的 loan.date gte='950101'/lte='971231' 变 observed between='1995-01-01'/'1997-12-31'。日期命中修好,但处理组新增 group=['account.account_id'],select=['account.account_id','loan_count'],返回65行账户计数,而要求一行总计65;EX/Contract仍0。不是声明/导出失配,而是最终粒度改变。", + "md-077 Forge:date_received '9/9/2019'→'2019-09-09',空结果变两名学生及金额;select 仍 first_name || ' ' || last_name 为一列,原Gold姓名分列,失败从result_row_count_mismatch变result_column_count_mismatch。日期子错误修好不等于完整答案修好。" + ], + "false_attribution_guard": "唯一 Forge 完整转正 md-289 没有日期补充,两条件输入完全相同:off 的 stats.agg 定义 total_count/blue_count,但 stats.select 只导出 superhero.superhero_name,外层百分比引用不存在别名,被Assurance拒绝;observed直接用单层聚合表达式通过。这是结构失配样本及同输入生成波动,不是日期上下文收益。", + "cost": "双臂tokens34,621→38,944,+12.49%,默认off。" + }, + { + "requirement": "REQ-054", + "source": "benchmark-luna-value-context-2026-09-06.json", + "fields": [ + "cases", + "acceptance", + "binding_observations", + "remaining_failure.output", + "remaining_failure.sql", + "remaining_failure.interpretation" + ], + "scores": "4题×2条件×2臂,16次;由cases聚合 Forge EX/Contract2/4→3/4,Direct3/4→4/4。目标处理4臂仅3/4正确,目标门槛失败;正确对照md-002/018均保持。", + "suberror_only": "目标均改用准确 Discount/Premium 字面量,md-026 Forge与md-009 Direct转正。但md-009 Forge原错误值候选虽能执行,处理组改对Discount后却执行失败:两CTE cze/svk均 agg count_distinct(GasStationID) as cnt 且 select=['cnt'],根 scan仍gasstations,根select=['cze.cnt - svk.cnt'],没有把cze/svk接入FROM/JOIN。编译SQL忠实为 WITH cze...,svk... SELECT cze.cnt-svk.cnt FROM gasstations;SQLite no such column:cze.cnt。这不是CTE漏导出,而是声明存在≠当前关系已绑定;更不是业务含义仍不清。", + "regression_precision": "md-009是执行通过但结果错→执行失败,不能说‘正确答案被改坏’;EX本来就是0。归档Assurance v8还曾放行它,后续提前拒绝不算准确率提升。", + "cost": "16,329→19,243 tokens,+17.85%;虽然低于1.25成本门槛,4/4目标未达,保持off。" + }, + { + "requirement": "REQ-056", + "source": "benchmark-luna-denominator-scope-2026-09-07.json", + "fields": [ + "summary", + "paired", + "changes_observed", + "predeclared_gates", + "cost_and_latency" + ], + "scores": "16次,Forge EX/Contract2/4→3/4:md-259、md-000转正,md-079真正确回退,md-312保持;Direct2/4→2/4。", + "complete_gain": "md-259 对照三计数[741,212,118]既没有百分比又被INNER JOIN缩小总体;处理独立 total CTE 保留750英雄,最终[28.266666666666666,118]。这轮确实修完整答案,但不能只称为分母单错误修复。md-000对照根select=['1']及未使用CTE,未返回比值;处理用EUR/CZK标量计数和1.0*eur.n/NULLIF(czk.n,0),完整通过。", + "correct_broken": "md-079 对照EX/Contract均true,处理均false,unknown_schema_reference。changes_observed.regression.alias_declared原样为'n_last_presence_placeholder_wrong? no',alias_selected='n',独立SQLite记录no such column:n。原始/持久候选hash一致。分母仍Patient.SEX='F',没有‘范例使它误用所有病人分母’证据;失败是同一中间结果的声明名和导出名不一致。", + "business_remaining": "Direct md-079两条件均漏×100;Direct md-259两条件仍INNER JOIN缩小分母。两者是纯语义/量纲问题,并非Forge特有冗余。", + "cost": "总tokens25,753→27,305(+6.03%);Forge tokens/正确EX8,724.5→6,333;P95 21,679.7→16,925.5ms。成本通过仍因正确回退不采纳。" + }, + { + "requirement": "REQ-058", + "source": "benchmark-luna-cte-interface-2026-09-07.json", + "fields": [ + "paired.rows", + "changes_observed", + "summary", + "predeclared_gates", + "limitations" + ], + "scores": "16次,Forge EX/Contract3/4→3/4,执行3/4→4/4;md-199转正但md-079回退;Direct3/4→2/4。", + "correct_broken": "md-079 Forge fresh默认对照正确;处理只返回962和1023两计数,而原Gold为单列94.03714565004887百分比。CTE定义未被外层消费,执行成功也不是完整答案。与REQ-044 md-259重复出现‘算出中间量但根查询未完成答案’形态,不能当作旧别名错误已经修复→目标成功。Direct md-079处理漏×100得0.9403714565004888;模型输入逐字相同,其回退是采样波动,不能归因Forge范例。", + "gain_limit": "md-199 Forge对照best_ms声明/导出/引用本来已一致;此轮实际失败是原生执行30秒超时,且投影合并姓名只3列。处理用MATERIALIZED CTE并返回[67411,'Lewis','Hamilton','Austrian Grand Prix']四列,完整通过。因此该转正不能证明CTE漏导出机制改善(与seed48旧失败不同)。Direct两条件仍缺milliseconds,EX/Contract均0。", + "cost": "总tokens32,300→35,067(+8.57%);Forge tokens/正确EX6,792.67→7,683(+13.11%,门槛失败);P95 14,351.6→20,312ms(+41.53%,门槛失败)。P95每条件仅4样本、nearest-rank,不外推尾延迟。" + } + ], + "sol_mechanism": { + "source": "benchmark-sol-error-triage-2026-09-05.json", + "fields": [ + "coverage", + "triage_summary.forge", + "candidate_error_categories", + "cases[case_id=md-006|md-119|md-339|md-405].arms.forge", + "bounds", + "limitations" + ], + "structural_cases": [ + "md-006:ranked_customers.window定义consumption_rank,显式select仅Segment/CustomerID/annual_consumption,下游filter consumption_rank=1;no such column。跨CTE导出失配,同时原triage保留Gold统计粒度争议。", + "md-119:disease_counts.agg定义patient_count,但select仅Diagnosis,外层order patient_count;no such column。跨CTE导出失配,同时Gold IGM边界另有争议。", + "md-339:window定义comment_rank但未投影,且同层filter comment_rank<=10(窗口前WHERE),不存在可用名;不只是补上select就保证合法,也有阶段依赖问题。原triage另保留Gold评论作者/时间口径冲突。", + "md-405:同一聚合层MAX(COUNT(*)),misuse of aggregate function COUNT();缺聚合分层,不是重复别名导致。" + ], + "quantitative_limit": "Sol187个Forge EX失败臂,初步主要标签candidate_error46,其中value_grounding13、relation_filter7、output_contract7、ordering_limit6、grain_aggregation5、arithmetic_precision4、sql_scope4;另外ambiguous_intent66、reference_conflict74、unresolved1。标签互斥仅为计数,其他标签候选仍可能有独立错误,不能说剩余183题全是业务语义。4个非执行错误即便理想全部修成EX正确,也最多+0.8个百分点,且前三题原记录另有语义/Gold争议,修可执行不保证转正。", + "classification": "机制上至少分三类:①声明/导出/引用与阶段依赖(006/119/339、近期289/009/079);②根结果形状/表达未完成(044-259、058-079;可能受冗余表示影响,但尚无因果证明);③值、日期、粒度、分母、百分比单位等可在Direct同样出现的业务语义。不能全部归成DSL复杂,也不能因Compiler忠实就否认生成接口有可研究负担。" + }, + "metric_guard": { + "source": "benchmark-sol-metric-replay-2026-09-05.json", + "fields": [ + "aggregate", + "protocol", + "limitations" + ], + "fact": "固定候选官方EX仍Forge313/500、Direct314/500;比较器v1→v2只让Contract Forge280→284(md-172/259/419/427),Direct291→294(md-172/419/427),无回退。这是评估器修正,不是模型或业务准确率收益。", + "cross_run_warning": "Sol的md-259官方EX原本true(LEFT JOIN保全总体),旧Contract因column fingerprint失败,metric replay修为true;这与Luna REQ-044/056的INNER JOIN和三计数失败是不同候选,不能合并成同一题固定病因。", + "definitions": "triage.metric_explanation:官方EX比较精确tuple-set,忽略行序和重复次数,保留列位置;Contract默认multiset、推断行序且做列映射。不能把Contract变化当官方EX增益,亦不能通过删除争议题或放宽列/重复/顺序规则声称超过Direct。", + "limits": "Sol诊断重放120秒只属于历史记录,非新生成/Assurance/延迟基准;本次未重跑。近期实验均Luna,4或5个已曝光D题、每条件每臂单采样,不能把子集机制证据合成为Sol全量效果预测。" + } + }, + "external_primary_research": [ + { + "来源": "PICARD,EMNLP 2021,§2.2–2.3、§3、Table 1", + "URL": "https://aclanthology.org/2021.emnlp-main.779.pdf", + "原文短引": [ + "“rejecting inadmissible tokens at each decoding step”", + "“Additional checks and guards are conceivable, for instance, checking that only expressions of the same type are compared ... We leave these additional checks to future work.”" + ], + "核实条件与结果": "在 Spider 7,000 训练样本上微调 T5;Table 1 使用 beam=4、对 top-2 token prediction 做 parsing with guards。同一 T5-3B(含 DB content 的表末两行)Spider dev EX 74.4→79.3,test EX 70.1→75.1。guards 处理列属于表、alias 与表/子查询绑定、FROM 引入作用域、裸列唯一解析;同一 select scope 禁重复 alias,允许嵌套遮蔽。论文明确把表达式比较类型及 UNION/EXCEPT/INTERSECT 两侧类型一致性留作未来工作。", + "可迁移机制": "不是“JSON 格式合法”而是有状态 scope checking:CTE 只引用已定义输出;alias 绑定正确作用域;裸列不歧义。可在现有 compiler/assurance 与结构化生成之间设计最小反馈,而非重新发明第二个 SQL 编译器。", + "边界反例": "这是可访问逐 token logits 的微调 T5 + beam decoding,不是闭源 API 的 tool schema,也不是 SQL→JSON 的表示对照。不能把它称为已验证完整类型系统;不能把 +4.9pp 搬成 Forge 增益预测。" + }, + { + "来源": "RESDSQL,AAAI 2023,Methodology / Experimental Setup、Tables 2、5", + "URL": "https://arxiv.org/html/2302.05965v3", + "原文短引": [ + "“we encourage the decoder to first decode the skeleton of the SQL query, and based on this, we continue to decode the SQL query.”", + "“selects the first executable SQL query in the beam as the final result.”" + ], + "核实条件与结果": "训练 cross-encoder 排序 schema,再微调 T5;Spider 7,000 training、1,034 dev;beam=8,execution-guided selector 选第一个可执行候选。关键同模型消融是 RESDSQL-Base:完整 EX 77.9;去 schema ranking 70.1;去 skeleton parsing 77.1。Table 2 的 RESDSQL-3B SQL vs +NatSQL:dev EX 81.8→84.1,属于同规模模型、不同训练目标/表示的系统比较。", + "可迁移机制": "把结构决策和表列/值填槽分开,并让后续输出依赖已确定骨架;最接近 Forge 的表示研究。但可优先借用“先确定聚合粒度/子查询边界再填表达式”,不必迁移 NatSQL。", + "边界反例": "不是零样本现代大模型的单次 JSON 优势。去 skeleton 只有 -0.8pp,论文的大部分消融损失来自 schema ranking;不能把整个 RESDSQL 增益归给中间表示。第一个可执行不等于语义正确。NatSQL 隐去/重写 JOIN、GROUP 等语言差距的效果依赖训练及转换器,不能直接要求 Forge 也隐藏这些语义。" + }, + { + "来源": "CHASE-SQL,ICLR 2025 对应 arXiv v1,§3.3–3.5、§4.4 Tables 4–5、Appendix A.2", + "URL": "https://arxiv.org/html/2410.01943v1", + "原文短引": [ + "“decomposes complex queries into manageable sub-queries in a single LLM call”", + "“single candidate generation performance ... original BIRD prompt + zero-shot CoT with Gemini 1.5 pro on the BIRD dev set”" + ], + "核实条件与结果": "有用的不是 73.01 dev /73.0 test 总榜,而是 Table 4 同 Gemini 1.5 Pro、BIRD dev、单候选且未加 fixer 的对照:baseline 57.75,Query Plan CoT 63.62(+5.87pp),Divide-and-Conquer CoT 63.92(+6.17pp)。Online Synthetic 67.09 也叫 single candidate,但其输入示例在测试时额外生成,不能当成等调用的单次规划证据。Query Fixer 最多 3 次,使用 syntax error/empty-result feedback;QP 63.62→65.51,DC 63.92→65.77。最终系统每种 generator 7 候选,共21;跨执行结果候选成对比较且交换顺序。选择器是 Gemini 1.5 Flash,在 BIRD train 生成的 3.8K 样本上 LoRA 微调10 epoch/rank16;Claude 配置也复用该 Gemini 选择器。Table 5 的 binary accuracy 仅统计一对中恰好一正一误的样本:普通 Gemini 1.5 Pro 63.98%,微调 Flash 71.01%,不是端到端 EX。", + "可迁移机制": "最值得先借的是单候选的逻辑计划:哪些表扫描、哪些过滤在聚合前、怎样匹配、最终输出什么;DC 特别适合分子/分母及独立 CTE 的作用域分解。可形成很短、可检查的决策记录而不是长篇通用 CoT。", + "边界反例": "QP 的对象仍是 Direct SQL,说明 Direct 同样能享受规划增益;要证明 Forge 表示更好,Direct 必须给相同规划机会。21候选+最多3次修正+专门训练选择器明显属于 test-time scaling/多模型系统。不能直接搬到已失败的成本/P95门禁。原文 §3.5 的未微调选择器 58.01 与 Table 5 的63.98设置关系未充分解释,建议仅引用明确标表的63.98/71.01并说明条件,不混用。" + }, + { + "来源": "CHESS,arXiv v3(2024-11-25),§3.1、§4.1–4.3 Tables 1、2、4、5", + "URL": "https://arxiv.org/html/2405.16755v3", + "原文短引": [ + "“return the most relevant matches, along with their corresponding columns”", + "“we only call GPT-4-turbo model 6 times”", + "“restrict the number of candidate generations and revisions ... to only one and three times, respectively.”" + ], + "核实条件与结果": "低预算配置是微调 DeepSeek Coder 生成 + GPT-3.5-turbo 列筛选 + GPT-4-turbo 其他步骤,并非单次单模型;BIRD dev65.00/test66.69。Table4消融在 SDS147题(每个dev数据库取10%;81 simple/54 moderate/12 challenging):完整64.62;去 entity+context retrieval59.86(-4.76pp);去 revise57.82(-6.80pp);只1次 revise61.22(比无修正+3.40pp,但低于完整)。高预算版本 Gemini1.5 Pro生成20候选+10个自然语言unit tests,去SS,dev68.31/test71.10。检索结合 LSH、编辑距离与 embedding,相似值必须带所属列返回;catalog提供列/值描述。Table5最终列召回降至0.94,说明裁剪确有漏列代价。", + "可迁移机制": "给生成器的应是可追溯的“问题片段→候选列→规范化值→证据/来源”关联,而不是更多散装示例。结合已有 ContextSnapshot,先审计 evidence 被选错/没用到,或 literal encoding/值格式误配;官方 evidence 已覆盖的内容不应再新增一个 LLM 检索代理重复解释。", + "边界反例": "文中的约+2pp、大幅 token节省来自合并数据库构造的最大4,337列 schema 实验;不是普通 BIRD 单库默认收益。v1常被引用的65/66.69和v3高预算68.31/71.10不能混成一个设置。“低预算”仍有多模型、6次GPT-4及其他调用。1次修正有局部依据,但不是当前模型/Forge的已证收益;也不能把空结果自动标错。" + }, + { + "来源": "DIN-SQL,NeurIPS 2023,§4.3–4.4、§5.2/5.6 Tables4–5、§7", + "URL": "https://arxiv.org/html/2304.11015v3", + "原文短引": [ + "“The gentle prompt ... does not assume the SQL query is buggy”", + "“incurs a cost of approximately $0.5 and exhibits a latency of approximately 60 seconds ... using GPT-4.”" + ], + "核实条件与结果": "四模块:schema linking、难度/分解分类、SQL生成、self-correction;部分非嵌套任务使用 NatSQL 中间表示。GPT-4/CodeX;temperature0,self-correction max350 tokens,其他模块600。Spider dev同GPT-4 few-shot67.4→DIN-SQL74.2是整条多调用链收益,不是单次表示优势。Table5极有价值:GPT-4无修正73.3,gentle修正74.2,generic“BUGGY SQL”修正70.0;CodeX则generic69.9优于gentle68.7与无修正67.3。", + "可迁移机制": "修正必须保留原候选,依据具体编译/执行错误或可核查语义矛盾,最多一次,允许回答无需修改。记录 correct→wrong 与 wrong→correct,而不是只数被救回的失败。", + "边界反例": "DIN-SQL修正本身是自审提示,不是以数据库执行反馈证明正确;模型越强未必越值得强制修正。GPT-4 generic自审反而比不修正低3.3pp,与REQ-056/058救回目标题却伤md-079的局部优化风险高度相关。" + }, + { + "来源": "The Death of Schema Linking?,arXiv v2(2024-08-18),§3、§4、Table2", + "URL": "https://arxiv.org/html/2408.07702v2", + "原文短引": [ + "“imperfect schema linking can often exclude essential columns needed for accurate query generation.”", + "“all the required columns and vary the amount of irrelevant columns”" + ], + "核实条件与结果": "评价取BIRD dev各数据库10%;微调GPT-4o使用500条训练样本。Exp1用Gold SQL构造oracle linker,保证所需列全保留,仅变化噪声列,并单次生成;因此是机制实验/idealized EX,不是可部署系统成绩。12模型显示更强模型对无关schema列更耐受。Table2完整pipeline的ftGPT-4o67.35;加table-to-column裁剪62.58(-4.77pp),逐列裁剪55.78(-11.57pp);Gemini1.5Pro60.54→55.78/55.10。温度0,尽量structured output;不能可靠结构化的输出还经过GPT-4o-Mini identity JSON调用。", + "可迁移机制": "把 linking 理解为高召回证据定位与排序,而非一律删除schema。对join bridge、CTE依赖列、分母总体列不能因词面不相似就剪掉。", + "边界反例": "不是“schema linking已死”的普遍结论,也不能用含Gold oracle的IEX当EX。schema是否全给应依据当前snapshot大小及召回损失;CHESS在4,337列得到裁剪收益与本研究小schema反例并不矛盾。" + } + ], + "active_code_findings": { + "schema_source": "services/pi-orchestrator/src/benchmark-runtime.ts:34-39 静态加载forge/schema.json;本报告不把schema_builder.py的动态Schema当作当前Benchmark payload。", + "semantic_annotations": { + "canonical_description_count": 72, + "strict_wire_description_count": 0, + "canonical_examples_count": 0, + "wire_examples_count": 0, + "canonical_compact_utf8_bytes": 14787, + "strict_wire_compact_utf8_bytes": 8034, + "source": "services/pi-orchestrator/src/strict-forge-output.ts:annotationKeys/build", + "observation": "createStrictForgeOutput真实运行确认72条description被删除;build_structured_benchmark_system保留8条紧凑语义约束,但没有补回完整DSL字段说明。", + "interpretation": "[INFERENCE] 可能增大模型理解声明、导出和作用域的负担;是待测的信息/成本取舍,不是已证明的准确率Bug。Sol完整基线为旧prefer,不把当前strict的说明删除追溯成Sol失分原因。" + }, + "field_order": { + "current_root_order": [ + "scan", + "joins", + "filter", + "group", + "agg", + "having", + "select", + "window", + "qualify", + "sort", + "limit", + "offset", + "explain", + "cte", + "distinct", + "union", + "intersect", + "except" + ], + "observed_positions_one_based": { + "select": 7, + "window": 8, + "cte": 14 + }, + "interpretation": "[INFERENCE] 当前依赖定义后于消费,可能增加长查询生成不一致;JSON输出顺序不等于模型思考顺序,收益未知。候选只能单独改变生成端Schema序列化顺序,不改JSON字段集合、DSL能力、Compiler或隐式补列。" + }, + "strict_is_not_scope_validation": { + "shape_valid_candidate": { + "scan": "facts", + "agg": [ + { + "fn": "sum", + "col": "facts.amount", + "as": "total" + } + ], + "select": [ + "missing" + ] + }, + "strict_decode": "accepted", + "normalized_chars": 92, + "wire_chars": 314, + "unused_root_null_fields": 15, + "compiled_sql": "SELECT missing\nFROM facts", + "actual_assurance_result": "QueryAssuranceError", + "interpretation": "真实strict decode允许语义未绑定引用;共享Assurance正确拒绝。314/92是合成例的字符数,不是token比例或全量成本。" + }, + "cost_reference": "历史Structured Sol比Direct多59.57% tokens、51.69%平均生成时间;最新CTE范例每EX正确答案tokens +13.11%,不能靠额外调用掩盖成本。", + "provider_contract": { + "url": "https://developers.openai.com/api/docs/guides/structured-outputs", + "verified_sections": [ + "Step 1 recommends clear titles and descriptions for important keys", + "Key ordering: outputs follow schema key order", + "Handling mistakes: Structured Outputs can still contain mistakes" + ], + "interpretation": "官方文档支持description,且声明键顺序;未用新Provider请求验证本轮候选。" + } + }, + "prioritized_hypotheses": [ + { + "priority": "P0 narrow first experiment", + "name": "工具Schema语义说明完整性", + "change": "仅为scan/cte/agg/window/select等关键接口保留经过当前Compiler核对的简短description;不直接恢复全部旧说明,不加入Gold、范例或额外生成。", + "reason": "实际payload丢失72条说明,而当前Prompt依赖工具解释DSL;改动局部、可独立否证。", + "risk": "额外input tokens、旧说明过时、未必改善;描述不是动态约束。默认保持不变。" + }, + { + "priority": "P0 independent alternative", + "name": "定义先于引用的Schema键顺序", + "change": "单独测试cte先于scan、window先于select;所有字段和null语义不变,不与description同轮叠加。", + "reason": "500旧候选真实SQLite编译对照0 SQL变化、49份序列化改变;可先研究纯呈现变量。", + "risk": "未验证闭源模型收益;可能改变生成习惯但不能约束任意字符串作用域。" + }, + { + "priority": "P1 principal accuracy direction", + "name": "有来源的答案规划与证据绑定", + "change": "复用ContextSnapshot/Registry/ResultContract,区分事实与推断,明确计量实体、全集/子集分母、连接用途、时间、分组、单位和最终列。优先单次生成内规划,不恢复each/per强制grain,不新建Intent主状态或第二DSL。", + "reason": "CHASE-SQL单候选QP/DC消融提供机制证据;值/日期实验只修子错误而完整EX仍失败。", + "risk": "Direct也会受益,不能承诺表示优势;显式持久化计划若改变Contract,须另立协议而非偷加当前工具字段。" + }, + { + "priority": "P2 conditional", + "name": "确定性诊断最多一次修正", + "change": "仅对具体结构/作用域/类型错误向Pi原Task返回有界反馈;保留初稿、终稿和全部成本,不按Gold选优。两臂同样的调用上限,SQL改变重新走审批。", + "reason": "PICARD表明动态合法性约束不同于JSON形状;DIN-SQL表明强制修正能反伤正确候选。", + "risk": "闭源API无token hook;历史4个非执行候选理想修复最多+0.8pp,相对旧Direct仅+0.6pp;空结果不是错误,业务歧义不是重猜理由。" + }, + { + "priority": "P3 only with remaining structural evidence", + "name": "减少需模型重复维护的生成表示", + "change": "若前两项无效,再研究单一定义和明确最终答案接口能否减少agg/window/select/CTE重复绑定;先离线语义等价与表示负担审计,任何正式DSL迁移独立立项。", + "reason": "近期存在声明/导出断裂和返回中间量;单靠修提示已遇到回退。", + "risk": "新IR/NatSQL或SQL→JSON会新增编译器负担,不能用自动补列/补JOIN篡改显式输入,也不能把SQL先生成包装成JSON原生优势。" + } + ], + "not_recommended_now": [ + "继续追加投影/分母/CTE通用范例并靠重复四题挑最好一次", + "直接启用之前未过门槛的date/value上下文", + "盲目裁剪当前小库Schema、建设全量GraphRAG", + "多Agent投票、21候选选择器、微调或无限重试作为下一步默认", + "更换Gold/EX、删争议题、拒绝换分、把执行通过冒充答案正确", + "为满足目标把Direct SQL输出装进JSON而宣称Forge JSON胜出" + ], + "next_experiment_proposal": { + "status": "proposal_only_no_dispatch_authorization", + "first_variable": "经过审核的关键DSL description;键順序和答案规划另做单因素", + "development_design": "预先冻结8道开发题(结构失配/最终输出目标与跨库正确控制各4)、两条件、两臂、2个独立重复;8×2×2×2=64次逻辑调用提案,尚未选题/冻结或授权。两重复用于估计波动,不按最好一次选优。", + "canary_accounting": "canary如另做须计入总上限或另行批准,不能隐去;Provider失败/未知用量保留,不补跑。", + "fairness": "同模型revision/SDK/数据/Gold/证据/评价器/Compiler/Assurance;当前Schema试验只允许已声明的wire revision差异。后续语义规划或反馈同时给Direct相同信息与最大调用机会;报告原Direct和同增强Direct。", + "order_and_stability": "预注册交错/分块次序;现行机制只支持顺序时,先评估最小协议变更,不能直接声称已支持。输入不变Direct的变化是噪声对照,不归因为Forge改动;不追溯放宽REQ-056/058门槛。", + "protocol_gap": "现有显式variable prompt是注册Prompt实验,不等于已支持wire_schema单因素;须最小扩展冻结/可比性Contract,仅放行预声明Schema差异,不关闭revision校验。", + "metrics": [ + "完整预注册分母Official EX", + "Contract单报", + "wrong→correct / correct→wrong逐题配对", + "first-pass与final分开", + "执行/误拒/静默错误代理", + "tokens每题及每正确任务、实际调用、时延/P95与未知成本" + ], + "promotion": "开发信号只决定是否值得验证;同输入生成波动不当因果。候选冻结后R500回归与未参与本项目调参的H配对验证,预先确定最小业务增益/功效与成本阈值;95%配对差值区间下界>0才称统计优势。H开发污染后不得重复调参称独立。", + "gold_readiness": "已知md-340/md-393超时不为本研究复跑;后续事先解决/声明评分就绪,不能事后剔除或发布未知臂的完整准确率。", + "cost_authority": "64次只是待确认设计,token/成本/P95阈值须看结果前由用户确认;当前sampling=provider_default、max_output_tokens=null,不能把历史8192当实际预算硬上限。" + }, + "verification": { + "compiler_smoke_source": "import json, hashlib\nfrom collections import Counter\nfrom pathlib import Path\nfrom forge.compiler import compile_query\nfrom forge.assurance import assure_compiled_sql, QueryAssuranceError\np=Path(\"docs/archive/benchmarks/benchmark-sol-error-triage-2026-09-05.json\")\nb=p.read_bytes(); data=json.loads(b)\norder=[\"cte\",\"scan\",\"joins\",\"filter\",\"group\",\"agg\",\"window\",\"having\",\"qualify\",\"select\",\"distinct\",\"sort\",\"limit\",\"offset\",\"explain\",\"union\",\"intersect\",\"except\"]\ndef reorder(x):\n if isinstance(x,list): return [reorder(v) for v in x]\n if not isinstance(x,dict): return x\n keys=[k for k in order if k in x]+[k for k in x if k not in order] if \"scan\" in x and \"select\" in x else x.keys()\n return {k:reorder(x[k]) for k in keys}\ndef outcome(q):\n try: return {\"sql\":compile_query(q,dialect=\"sqlite\")}\n except ValueError as e: return {\"error\":str(e)}\nchanges=[]; statuses=Counter(); ordered=0\nfor c in data[\"cases\"]:\n q=c[\"arms\"][\"forge\"][\"candidate\"]; r=reorder(q)\n assert q==r\n ordered+=json.dumps(q)!=json.dumps(r)\n a,z=outcome(q),outcome(r)\n statuses[\"compiled\" if \"sql\" in a else \"rejected\"]+=1\n if a!=z: changes.append(c[\"case_id\"])\nassert not changes\nbad={\"scan\":\"facts\",\"agg\":[{\"fn\":\"sum\",\"col\":\"facts.amount\",\"as\":\"total\"}],\"select\":[\"missing\"]}\nlocal=outcome(bad)\ntry:\n assure_compiled_sql(local[\"sql\"],dialect=\"sqlite\",input_kind=\"forge_json\",allowed_tables=[\"facts\"],registry_snapshot={\"tables\":{\"facts\":{\"columns\":{\"amount\":{}}}}})\n gate=\"allowed\"\nexcept QueryAssuranceError as e:\n gate=type(e).__name__\nprint(json.dumps({\"source\":str(p),\"source_sha256\":hashlib.sha256(b).hexdigest(),\"cases\":len(data[\"cases\"]),\"compile_status\":dict(statuses),\"serialization_changed\":ordered,\"compile_or_error_changed\":changes,\"candidate_values_changed\":0,\"gold_executions\":0,\"new_model_calls\":0,\"new_sql_executions\":0,\"invalid_shape_valid_query\":{\"sql\":local.get(\"sql\"),\"assurance\":gate},\"candidate_order\":order},indent=2))\n", + "strict_schema_command": "bun -e: import createStrictForgeOutput and forge/schema.json; count canonical/wire descriptions; decode shape-valid missing reference. See active_code_findings for observed output.", + "result": "研究实际运行完成;无新增永久测试、临时脚本或服务。500×2次SQLite方言编译及合成Assurance检查,不是500题SQL执行/新准确率评测。" + }, + "source_fingerprints": { + "agent/prompts.py": "eff191736809d2645248b467ccafa49245f1f93480334694fe4c5d3ae6354e0b", + "forge/schema.json": "e9b56c6f98d08c8b866bd4f49ab0076ff55510711429025d397a5acd9188e723", + "forge/compiler.py": "05d5d6e4b38431aa8e2e1d34b6f38cffc43cd38482e6cfd127a650f017903284", + "forge/assurance.py": "25232efe2311b536822783a7129c9d89536c194b3e13205d05a00502e94c62f0", + "services/pi-orchestrator/src/benchmark-runtime.ts": "905f6b91d0865d8860a41a0f44aebd52fdc5e3320d762e38c09f708b9b7e5a4b", + "services/pi-orchestrator/src/strict-forge-output.ts": "33f42cb95d71eb723428ac5de5f210af70c4464dc45b8c05da6ebf2deeb4bac3", + "docs/archive/benchmarks/benchmark-sol-error-triage-2026-09-05.json": "39cdfcf83d51d2f4dbb2618d54021f326598b668bca08f25565473fde1335573", + "docs/archive/benchmarks/benchmark-sol-metric-replay-2026-09-05.json": "2eee5ba01fe2f20c01542c74a6131be625bcf9c13a5847b1e85dc733403af796", + "docs/archive/benchmarks/benchmark-luna-projection-instructions-2026-09-05.json": "b59dac931ff210af8ec4a38f75e6b92587758a2f1cadcbdfb951a0a8d604a602", + "docs/archive/benchmarks/benchmark-luna-date-context-2026-09-05.json": "97e7842a38a7bd3f3b0f27d9a63d9875ebf81da8e7cfd5c07a9bac21c11acd46", + "docs/archive/benchmarks/benchmark-luna-value-context-2026-09-06.json": "6077229f0efb9ef678eed4e14a37aa50c23575f89abb197b81c4592d16e739be", + "docs/archive/benchmarks/benchmark-luna-denominator-scope-2026-09-07.json": "69546731b83a6d0e25aa13c38084d56d45f9d6360e3ae0d17cd0f54aa7458506", + "docs/archive/benchmarks/benchmark-luna-cte-interface-2026-09-07.json": "dfcb5e6a3faba7d3c2dedb4cf76fedc23696a370cb39b1b0613fdda9e4bf98d2" + }, + "limitations": [ + "调研不保证超过Direct,不叠加跨论文不同模型/数据/调用条件的百分点。", + "旧Sol归因是Agent初判,后续更正优先;不能按参考冲突标签改官方分。", + "公开报告SHA256是当前公开字节,不冒充脱敏前原件hash。", + "未批准主动计划/架构迁移、部署、commit或push;R0.6外部采用与H均未完成。" + ], + "report_sha256": "4faa99d1520a2a0ecbde8c7e425de2c4b9d42077faaff5124d19cab82d7e2a24" +} diff --git a/tests/accuracy/results/method_k/report_2026-03-15_185406.md b/docs/archive/benchmarks/report_2026-03-15_185406.md similarity index 100% rename from tests/accuracy/results/method_k/report_2026-03-15_185406.md rename to docs/archive/benchmarks/report_2026-03-15_185406.md diff --git a/docs/archive/engineering/architecture-quality-implementation-2026-09-07.json b/docs/archive/engineering/architecture-quality-implementation-2026-09-07.json new file mode 100644 index 0000000..de0da0f --- /dev/null +++ b/docs/archive/engineering/architecture-quality-implementation-2026-09-07.json @@ -0,0 +1,527 @@ +{ + "schema_version": "architecture-quality-implementation-v1", + "date": "2026-09-07", + "requirement": "REQ-2026-09-07-060", + "baseline_commit": "018317d89edfa0f56c48c865f35c9a45204d9d11", + "status": "implemented_and_locally_verified", + "implementation_commit": null, + "authorization": { + "quote": "好的,那就按照你的调研结果执行吧", + "packages": [ + "OP-1", + "OP-2", + "OP-3", + "OP-4", + "OP-5", + "OP-6" + ], + "model_calls_authorized": 0, + "commit_push_release_deploy_authorized": false + }, + "boundary": { + "pi": "唯一主 Orchestrator 与 Task 真相源", + "forge": "受控准备、校验、审批、执行与 Evidence", + "skills": "专业方法层,不获得数据库执行权", + "channels": "投影与投递回执,不拥有第二套 Task 状态", + "product_gate_change": false, + "historical_accuracy_rewritten": false, + "real_configuration_or_runtime_accessed": false, + "model_calls": 0 + }, + "findings": [ + { + "id": "AQ-01", + "optimization_package": "OP-2", + "title": "阶段重试先改变Task,再复用已终止Attempt,产生无法正常回收的状态", + "acceptance": "timeout/interrupted后新attempt可成功;同成功key不再调用Skill;同失败key处理一致;不得留下running Task+terminal Attempt。", + "status": "implemented_and_verified", + "change": "默认重试使用新 Attempt/下游 command;成功显式 key 回放,失败或跨阶段 key 在 Task 迁移前拒绝。", + "files": [ + "services/pi-orchestrator/src/application.ts", + "services/pi-orchestrator/tests/stage-lifecycle.test.ts", + "services/pi-orchestrator/tests/application.test.ts" + ], + "evidence": [ + "dual_state_adapters" + ] + }, + { + "id": "AQ-02", + "optimization_package": "OP-2", + "title": "用户取消与真实阶段执行、Attempt收口没有形成同一协议", + "acceptance": "取消触发真实abort;迟到成功/错误不落Artifact、不改变cancelled、不留下running Attempt;覆盖timeout/cancel竞争。", + "status": "implemented_and_verified", + "change": "取消传播活跃 abort;超时及调用方中断有界返回;迟到成功/错误不写 Artifact、不改终态。", + "files": [ + "services/pi-orchestrator/src/application.ts", + "services/pi-orchestrator/tests/stage-lifecycle.test.ts" + ], + "evidence": [ + "dual_state_adapters" + ] + }, + { + "id": "AQ-03", + "optimization_package": "OP-2", + "title": "内存Store和SQLite没有同等事务语义,测试模型可能掩盖生产失败", + "acceptance": "相同失败、取消、重试、错误Artifact语料在两个适配器观察一致;不允许持久Store配no-op事务。", + "status": "implemented_and_verified", + "change": "不可拆分 OrchestratorState 包含全部 Store 与事务;内存 checkpoint、SQLite SAVEPOINT 使用同一失败语料。", + "files": [ + "services/pi-orchestrator/src/orchestrator-state.ts", + "services/pi-orchestrator/src/sqlite-store.ts", + "services/pi-orchestrator/tests/stage-lifecycle.test.ts" + ], + "evidence": [ + "dual_state_adapters" + ] + }, + { + "id": "AQ-04", + "optimization_package": "OP-3", + "title": "数据集专用字段规则进入通用Assurance,污染Registry接入边界", + "acceptance": "自定义合法Registry通过;原large profile仍拒绝自己的错误字段;未选择profile不运行数据集规则;保留历史基线与policy/approval drift。", + "status": "implemented_and_verified", + "change": "数据集规则须显式 assurance_profile;默认 not_applicable,未知 Profile 拒绝;Profile/版本进入审批漂移边界。", + "files": [ + "forge/assurance.py", + "forge/lint.py", + "forge/benchmark_methods.py", + "tests/test_assurance.py", + "tests/test_query_runs.py" + ], + "evidence": [ + "python_regression" + ] + }, + { + "id": "AQ-05", + "optimization_package": "OP-1", + "title": "公开Evaluate默认auto与Compiler契约冲突", + "acceptance": "两输入覆盖省略/auto/具体方言/不支持方言;默认不能落内部compile_failed;评估不能偷偷依赖生产数据库URL。", + "status": "implemented_and_verified", + "change": "纯 requested/resolved/provenance 方言解析:Direct 可 generic,Forge 缺绑定返回 dialect_required,未知值返回 dialect_unsupported。", + "files": [ + "forge/dialects.py", + "forge/evaluate.py", + "web/routes/evaluate.py", + "tests/test_evaluate.py" + ], + "evidence": [ + "python_regression", + "installed_distributions" + ] + }, + { + "id": "AQ-06", + "optimization_package": "OP-3", + "title": "执行领域状态依赖展示文本前缀,而非结构化结果", + "acceptance": "警告列名、空结果、截断成功;权限、超时、语法失败具有稳定code;更换展示语言不改变QueryRun状态;统一迁移所有caller。", + "status": "implemented_and_verified", + "change": "execute 仅返回 ExecutionResult;所有 caller 按 success/error_code 判定,删除旧 tuple/dict API 和文案前缀推断。", + "files": [ + "forge/executor.py", + "forge/query_runs.py", + "web/feishu.py", + "web/router.py", + "tests/test_executor.py" + ], + "evidence": [ + "python_regression", + "installed_distributions" + ] + }, + { + "id": "AQ-07", + "optimization_package": "OP-1", + "title": "非editable分发缺少必需资源,构建成功不等于可使用", + "acceptance": "wheel/sdist包含核心Schema及所声明Web资源;非源码cwd中import、compile与公开Quickstart可用;不靠editable路径补资源。", + "status": "implemented_and_verified", + "change": "使用 importlib.resources 并声明 Schema/Web 资源;新增 wheel/sdist 非 editable CI 门禁和实测 Python 3.11 约束。", + "files": [ + "pyproject.toml", + ".github/workflows/ci.yml", + "constraints/ci-python311.txt", + "scripts/package_smoke.py" + ], + "evidence": [ + "installed_distributions" + ] + }, + { + "id": "AQ-08", + "optimization_package": "OP-4", + "title": "上游故障被映射成资源不存在,已有领域code在HTTP边界丢失", + "acceptance": "200/404/不可见403/500/503/invalid JSON矩阵正确;不泄露scope或raw异常。", + "status": "implemented_and_verified", + "change": "HTTP 边界保留安全稳定 code:不可见403隐藏为404,500转502,503保留,非法协议为502;不泄露 raw 异常。", + "files": [ + "web/diagnostics.py", + "web/pi_client.py", + "web/router.py", + "tests/test_diagnostics_delivery.py" + ], + "evidence": [ + "python_regression" + ] + }, + { + "id": "AQ-09", + "optimization_package": "OP-4", + "title": "业务证据强,运维诊断和用户可见审计未串联当前主链", + "acceptance": "按任一业务ID关联Web→Pi→Forge;失败区分not_started/known/unknown花费;存储失联显示partial而非0;默认不记录SQL rows/凭证。", + "status": "implemented_and_verified", + "change": "X-Request-ID、Task/QueryRun/Attempt、模型及策略版本贯通;未知用量不补零;审计只读联查、不可用为 partial。", + "files": [ + "diagnostics.py", + "agent/audit.py", + "agent/llm.py", + "services/pi-orchestrator/src/request-context.ts", + "services/pi-orchestrator/src/product-projection-builder.ts" + ], + "evidence": [ + "python_regression", + "real_web_pi_replay", + "delivery_stale_completion" + ] + }, + { + "id": "AQ-10", + "optimization_package": "OP-4", + "title": "浏览器把未知投递结果当未发送,重试生成新命令身份", + "acceptance": "接受后丢响应再重试只产生一个ChannelEvent/Task;更改内容才新建ID;可以回查原命令结果。", + "status": "implemented_and_verified", + "change": "待确认 Command 按内容匹配保留身份;未知响应显示回查入口,同内容重送复用 ID,成功确认才清理。", + "files": [ + "web/static/product/product-pages.js", + "web/static/product/product-shell.js" + ], + "evidence": [ + "real_web_pi_replay" + ] + }, + { + "id": "AQ-11", + "optimization_package": "OP-6", + "title": "Benchmark拥有专用运行引擎,但关联Task生命周期及多owner边界未收口", + "acceptance": "零模型运行的Task/run终态一致;并发create只有一个admitted;第二owner不干扰活动run;挂起端口能停止。", + "status": "implemented_and_verified", + "change": "Benchmark 与 Task 同 SQLite 事务;并发准入只有一个 owner;第二进程只读;context/evaluate 请求支持 stop/timeout/shutdown。", + "files": [ + "services/pi-orchestrator/src/benchmark-runtime.ts", + "services/pi-orchestrator/src/server.ts", + "services/pi-orchestrator/tests/benchmark-runtime.test.ts" + ], + "evidence": [ + "benchmark_http_process" + ] + }, + { + "id": "AQ-12", + "optimization_package": "OP-6", + "title": "ExecutionPlan是手工同步的影子进度,失败和取消可能留下running步骤", + "acceptance": "失败、取消、超时、恢复后计划不保留与Task终态冲突的running步骤。", + "status": "implemented_and_verified", + "change": "ExecutionPlan 为显示进度,失败/取消/超时/恢复随 Task 同事务收口;不完整分析不遗留 running,失败补查不消费 child。", + "files": [ + "services/pi-orchestrator/src/application.ts", + "services/pi-orchestrator/src/planning.ts", + "services/pi-orchestrator/tests/stage-lifecycle.test.ts" + ], + "evidence": [ + "dual_state_adapters" + ] + }, + { + "id": "AQ-13", + "optimization_package": "OP-5", + "title": "依赖方向与导入生命周期混杂,单纯拆大文件不能降低耦合", + "acceptance": "核心不依赖Web适配;禁用legacy的纯校验不初始化旧Memory;不丢tenant ACL交集;临时阻断非必需模块仍能跑核心。", + "status": "implemented_and_verified", + "change": "Benchmark 服务下沉 Forge;方言/校验脱离旧 Agent;Memory/cache/BIRD 资源首次使用初始化;共享模板 loader。", + "files": [ + "forge/benchmark_service.py", + "forge/hard_accuracy_benchmark.py", + "agent/memory/__init__.py", + "agent/agent.py", + "web/templates.py", + "main.py" + ], + "evidence": [ + "installed_distributions", + "python_regression" + ] + }, + { + "id": "AQ-14", + "optimization_package": "OP-6", + "title": "新增一等Stage的契约和模型scope仍依赖多处手工同步", + "acceptance": "新增Advisory与新Stage各做一次变更面演练;Python/TS消费同语料并一致接受/拒绝;model scope不靠字符串猜测。", + "status": "implemented_and_verified", + "change": "Stage descriptor 明确身份、输出与证据策略;TypeBox 为六种 Structured Artifact Schema 来源;Python/TS 共用语义语料。", + "files": [ + "services/pi-orchestrator/src/stage-descriptors.ts", + "services/pi-orchestrator/src/contracts.ts", + "services/pi-orchestrator/scripts/export-structured-artifact-schemas.ts", + "agent/contracts/artifact_semantics.py", + "agent/contracts/structured-artifact-fixtures.v1.json" + ], + "evidence": [ + "structured_contracts", + "extension_drill" + ] + }, + { + "id": "AQ-15", + "optimization_package": "OP-5", + "title": "稳定架构入口仍描述旧产品主链,误导未来维护者的边界判断", + "acceptance": "文档能准确指出Evaluate/Enforce/Explain、Pi主Task及legacy开关;不存在第二份自称当前主架构的矛盾说明。", + "status": "implemented_and_verified", + "change": "当前架构说明明确 Evaluate/Enforce/Explain、Pi Task 权威、Forge QueryRun 执行权和 Legacy 开关;不引入第二调度器。", + "files": [ + "docs/architecture.md", + "docs/platform-architecture.md", + "services/pi-orchestrator/README.md" + ], + "evidence": [ + "documentation_links" + ] + }, + { + "id": "AQ-16", + "optimization_package": "OP-4", + "title": "渠道投递与Conversation视图缺少独立的恢复边界", + "acceptance": "任务完成而投递失败可定位原Task并仅重送;乱序A/B响应只呈现当前对话;进程存活与渠道连接状态可区分。", + "status": "implemented_and_verified", + "change": "飞书 receipt 独立于 Task,授权后仅重读并重送 presentation;Conversation epoch 防乱序,进程存活不等于已连接。", + "files": [ + "web/channel_delivery.py", + "web/routes/deliveries.py", + "web/feishu_pi.py", + "web/feishu_runtime.py", + "web/static/product/product-pages.js", + "tests/test_diagnostics_delivery.py" + ], + "evidence": [ + "python_regression", + "conversation_browser", + "delivery_stale_completion" + ] + } + ], + "verification": { + "python_regression": { + "command": "python -m pytest tests -q -rs", + "environment": "隔离源码副本;移除私有配置、运行库及凭证;sandbox 仅允许本地网络", + "python_314": { + "version": "3.14.7", + "passed": 983, + "skipped": 28, + "skip_details": ["24项浏览器E2E未启动其默认localhost:8000服务", "2项指标CRUD E2E要求显式隔离Registry", "2项依赖完整Mini-Dev runtime assets"], + "warnings": [ + "第三方 lark protobuf utcfromtimestamp 弃用警告" + ] + }, + "python_311": { + "version": "3.11.14", + "passed": 983, + "skipped": 3, + "skip_details": [ + "Playwright 未安装:整份 test_e2e.py 在 collection 跳过", + "2项依赖完整 Mini-Dev runtime assets 的测试跳过" + ] + }, + "note": "跳过项不计为通过;Web 行为另外由真实 Chromium 验证。" + }, + "pi_regression": { + "commands": [ + "npm --prefix services/pi-orchestrator test", + "npm --prefix services/pi-orchestrator run typecheck" + ], + "node": "24.4.1", + "passed": 215, + "failed": 0, + "skipped": 0, + "typecheck": "passed", + "isolation": "临时 HOME;阻断真实运行库/凭证和外部网络,允许 localhost", + "warning": "node:sqlite experimental warning;未改变 ES2022 target" + }, + "dual_state_adapters": { + "adapters": [ + "InMemoryOrchestratorState", + "SqliteOrchestratorState" + ], + "status": "passed", + "cases": [ + "timeout/interrupted 新 Attempt", + "成功 key 回放、失败 key 拒绝", + "cancel 与 timeout 竞争", + "迟到成功/错误不得写 Artifact", + "非法 Artifact 与嵌套事务全 Store 回滚", + "派发前中断 not_started", + "过期恢复与 Plan 收口", + "补查失败不消费 child", + "下游失败 command cache 不困住新重试" + ] + }, + "benchmark_http_process": { + "status": "passed", + "transport": "实际本地 Pi HTTP Server → 挂起的合成 Forge HTTP Server;独立子进程共用临时 SQLite", + "pre_fix": [ + "并发 start 产生两个 admitted Run", + "第二 Runtime 把活跃 Run 标成 interrupted" + ], + "post_fix": { + "single_owner": true, + "independent_process_cannot_interrupt": true, + "stopped_task": "cancelled", + "deadline_task": "failed", + "request_correlation": "passed", + "disconnected_contexts": 2, + "model_calls": 0 + }, + "additional_regression": [ + "准入失败 Task/Run/case 全回滚", + "context 与 evaluate 可停止", + "shutdown 后 Task interrupted,重开不重放" + ] + }, + "installed_distributions": { + "status": "passed", + "python": "3.11.14", + "artifacts": [ + "wheel", + "sdist" + ], + "build": "已安装的实测 build/setuptools,离线构建 sdist 再构建 wheel", + "install": "分别非 editable 安装到临时环境,复用 constraints/ci-python311.txt 对应依赖;不是源码目录导入", + "cwd": "临时目录,不在源码 checkout", + "checks": [ + "Schema/HTML/CSS/JS 打入包;无 charts、数据库或私有配置", + "实际 import/compile/CLI/公开合成 Quickstart", + "main import 阻断 SQLite/SQLAlchemy 连接并禁止私有 runtime open", + "阻断 web/legacy Agent/Memory 后仍可使用核心方言与 Evaluate" + ], + "quickstart": { + "status": "passed", + "enforce": "completed", + "rows": [ + [ + 1 + ], + [ + 2 + ] + ], + "truncated": true, + "explain_integrity": "verified", + "evidence_types": [ + "candidate", + "policy", + "query", + "assurance", + "source", + "approval", + "result" + ] + }, + "remote_ci_executed": false + }, + "real_web_pi_replay": { + "status": "passed", + "surface": "真实 Chromium → 隔离 Python main:app → 真实 Pi Server → 临时 SQLite", + "fault": "POST chat message 已返回 HTTP 200 后,在 Chromium CDP response 阶段注入网络失败", + "observed": [ + "UI 显示消息投递结果未知及原 Command ID", + "相同内容重送复用同一 message_id", + "原 Conversation 仅一个真实 Task,状态 completed", + "最新 pages v7/CSS v6 reload 后仍能回查原结果", + "两侧日志相同 request_id,Web 日志包含 task_run_id" + ], + "models": "问候语走确定性无模型通道", + "model_calls": 0, + "visual_confirmation": true + }, + "conversation_browser": { + "status": "passed", + "surface": "真实 Product 模板/JS/CSS + 本地合成 API", + "observed": [ + "A 延迟700ms/B延迟30ms,只呈现当前 B", + "safe_error、model revision、policy version、request ID、未知用量可见", + "长 ID 和未知提示按钮完整可见" + ], + "external_channel_delivery_exercised": false + }, + "delivery_stale_completion": { + "status": "passed", + "scenario": "旧 sending lease 过期,新 attempt 已失败后,旧 attempt 迟到成功", + "before": { + "persisted": "failed", + "logged": "delivered" + }, + "after": { + "persisted": "failed", + "logged": "failed", + "current_attempt": 2 + }, + "note": "诊断以 CAS 后的持久状态为准,不伪报迟到 worker 的期望状态。" + }, + "structured_contracts": { + "status": "passed", + "shared_fixture_cases": 42, + "consumers": [ + "TypeBox/TypeScript", + "generated JSON Schema + Python semantics" + ], + "boundaries": [ + "row_count/rows 与行宽", + "重复列", + "RFC3339 日历/时区/闰秒", + "证据 lineage", + "不完整输出所需问题", + "因果与私密内容边界" + ] + }, + "extension_drill": { + "status": "passed", + "environment": "隔离源码复制,扩展脚本已删除", + "scope": [ + "新增 Advisory", + "新增一等 Stage" + ], + "notes": [ + "实际执行类型化输出及 Python 生成契约验证", + "模型 scope 来自 descriptor 而非名字子串", + "保留显式 Application stage/审批边界,不引入任意 DAG 权限" + ] + }, + "documentation_links": { + "status": "passed", + "command": "python -m pytest tests/test_docs_links.py -q" + } + }, + "migration_notes": [ + "Assurance query-assurance-v11 / scoped-policy-v1;旧 QueryRun 审批不得直接沿用,按既有漂移门禁重新 prepare/审批。", + "基准专用 Registry 显式使用 assurance_profile={id:large-benchmark,revision:large-benchmark-v1};自定义 Registry 默认不运行该规则。", + "execute 统一为 ExecutionResult(success,text,columns,rows,truncated,error_code);旧执行结果 API 已移除,不留 shim。", + "Application 构造仅传 coherent State bundle;已有 caller 已迁移。", + "缺方言绑定的 Forge Evaluate 返回 dialect_required;Pi disabled 为 HTTP503/code=disabled。" + ], + "limitations": [ + "本地实现/验收,不是远端 CI 结果或已发布版本。", + "未调用模型、真实数据库、飞书/钉钉网络或真实 WebSocket。", + "单机 SQLite 单 owner 不是 HA;PID/主机不确定时失败关闭。", + "Abort 不保证撤销已经发生的远端 SQL/发布副作用。", + "Provider 缺少 usage 保持 unknown;已知 Token 不等于已知结算成本。", + "未做生产规模压测、PostgreSQL/MySQL 实库复验或模型准确率实验。", + "历史成绩、可选 Prompt 开关与 R0.6/H 外部采用门禁不变。" + ], + "cleanup": { + "throwaway_scripts_removed": true, + "synthetic_services_stopped": true, + "managed_browser_closed": true, + "temporary_distribution_cleanup": "临时构建包、验证环境及合成运行库已删除;永久保留 package_smoke CI 门禁和必要行为回归", + "user_preexisting_work_preserved": true, + "commit_push_release_deploy": false + } +} diff --git a/docs/archive/engineering/architecture-quality-review-2026-09-07.json b/docs/archive/engineering/architecture-quality-review-2026-09-07.json new file mode 100644 index 0000000..6ba56bb --- /dev/null +++ b/docs/archive/engineering/architecture-quality-review-2026-09-07.json @@ -0,0 +1,3140 @@ +{ + "schema_version": "architecture-quality-review-v1", + "date": "2026-09-07", + "requirement": "REQ-2026-09-07-060", + "baseline_commit": "018317d89edfa0f56c48c865f35c9a45204d9d11", + "status": "assessment_complete_implementation_proposals_not_yet_accepted", + "scope": { + "runtime_source_files": 116, + "python_files": 82, + "typescript_source_files": 31, + "javascript_source_files": 3, + "source_lines": 46529, + "method": "All selected runtime files structurally parsed; deep review of product boundaries, representative critical paths and high-change modules. Not a line-by-line review of every repository asset.", + "excluded": "Third-party dependencies, generated/static vendor assets, full historical reports, private configuration, actual runtime databases/customer data; templates/deployment/contracts reviewed selectively.", + "production_source_modified": false, + "model_calls": 0, + "commit_push_or_deployment": false + }, + "summary": { + "product": "定位清晰:Evaluate→Enforce→Explain;工程边界尚未收敛,不建议重写。", + "maintainability": "主要风险是生命周期/业务规则的多处实现和适配层承担领域语义,已产生可复现缺陷;大文件只作为导航信号。", + "observability": "业务Evidence与hash绑定较强,运维诊断、花费未知性、投递结果及用户可见审计未贯通。", + "extensibility": "同类Advisory方法扩展已有复用;新Stage、数据源/方言、policy和多实例运行需要跨多个手工契约演进。", + "model_quality": "本次评价领域/状态/Contract建模。LLM统计准确率与确定性正确性独立:既有500题固定候选回评62.6%对62.8%不能证明模型优势,代码重构不承诺提高生成准确率。" + }, + "strengths": [ + "Pi保持Task权威,Web主链是投影而非另一份持久Task。", + "QueryRun审批绑定实际SQL/Assurance/Policy/Registry/hash,CAS/lease恢复不自动重放SQL。", + "Evaluate不授予执行权,Explain历史完整性与Enforce当前权限分别验证。", + "Pi SDK承担隔离Session/工具/模型交互,应用显式持有业务Task/Attempt,边界本身合理。", + "已有immutable domain records、JSON Schema缓存、TypeBox导出与跨语言共享fixture,可逐步复用。" + ], + "measurements": { + "python": { + "method": "Python AST static scan; imports include function-local imports. SCC does not imply an import-time crash; line span is a navigation signal, not a quality score. Exact duplicate bodies keep parameter/local names; no semantic clone claim.", + "file_count": 82, + "lines": 33378, + "files": [ + { + "path": "web/router.py", + "lines": 3003, + "functions": 115 + }, + { + "path": "forge/compiler.py", + "lines": 1764, + "functions": 51 + }, + { + "path": "forge/lint.py", + "lines": 1711, + "functions": 73 + }, + { + "path": "forge/hard_accuracy_benchmark.py", + "lines": 1468, + "functions": 57 + }, + { + "path": "web/feishu.py", + "lines": 1259, + "functions": 44 + }, + { + "path": "forge/query_runs.py", + "lines": 940, + "functions": 19 + }, + { + "path": "forge/cli.py", + "lines": 878, + "functions": 13 + }, + { + "path": "agent/llm.py", + "lines": 849, + "functions": 11 + }, + { + "path": "agent/agent.py", + "lines": 834, + "functions": 18 + }, + { + "path": "forge/retriever.py", + "lines": 799, + "functions": 21 + }, + { + "path": "forge/accuracy_benchmark.py", + "lines": 707, + "functions": 33 + }, + { + "path": "forge/bird_benchmark.py", + "lines": 703, + "functions": 29 + }, + { + "path": "forge/reporting.py", + "lines": 698, + "functions": 36 + }, + { + "path": "web/routes/settings.py", + "lines": 694, + "functions": 26 + }, + { + "path": "forge/assurance.py", + "lines": 689, + "functions": 21 + }, + { + "path": "web/routes/product.py", + "lines": 653, + "functions": 25 + }, + { + "path": "agent/model_control.py", + "lines": 587, + "functions": 23 + }, + { + "path": "agent/pipeline.py", + "lines": 569, + "functions": 16 + }, + { + "path": "forge/enforce.py", + "lines": 550, + "functions": 13 + }, + { + "path": "forge/explain.py", + "lines": 498, + "functions": 12 + }, + { + "path": "forge/quickstart.py", + "lines": 478, + "functions": 15 + }, + { + "path": "forge/schema_builder.py", + "lines": 462, + "functions": 2 + }, + { + "path": "agent/knowledge.py", + "lines": 459, + "functions": 17 + }, + { + "path": "forge/chart.py", + "lines": 455, + "functions": 13 + }, + { + "path": "registry/studio.py", + "lines": 444, + "functions": 25 + }, + { + "path": "agent/prompts.py", + "lines": 430, + "functions": 4 + }, + { + "path": "forge/benchmark_metadata.py", + "lines": 423, + "functions": 10 + }, + { + "path": "web/routes/benchmark_v2.py", + "lines": 422, + "functions": 14 + }, + { + "path": "agent/memory/ems.py", + "lines": 377, + "functions": 16 + }, + { + "path": "forge/evaluation_runs.py", + "lines": 363, + "functions": 16 + }, + { + "path": "forge/benchmark_v2.py", + "lines": 361, + "functions": 13 + }, + { + "path": "registry/validator.py", + "lines": 338, + "functions": 6 + }, + { + "path": "registry/sync.py", + "lines": 322, + "functions": 7 + }, + { + "path": "forge/evaluate.py", + "lines": 313, + "functions": 7 + }, + { + "path": "web/routes/evaluate.py", + "lines": 302, + "functions": 9 + }, + { + "path": "web/routes/accuracy_benchmark.py", + "lines": 300, + "functions": 29 + }, + { + "path": "web/feishu_pi.py", + "lines": 293, + "functions": 11 + }, + { + "path": "agent/model_quality.py", + "lines": 292, + "functions": 11 + }, + { + "path": "forge/executor.py", + "lines": 285, + "functions": 15 + }, + { + "path": "agent/audit.py", + "lines": 283, + "functions": 8 + }, + { + "path": "forge/benchmark_methods.py", + "lines": 277, + "functions": 9 + }, + { + "path": "agent/model_config.py", + "lines": 277, + "functions": 9 + }, + { + "path": "agent/memory/extractor.py", + "lines": 274, + "functions": 9 + }, + { + "path": "config.py", + "lines": 270, + "functions": 3 + }, + { + "path": "web/pi_channel.py", + "lines": 267, + "functions": 11 + }, + { + "path": "forge/cache.py", + "lines": 248, + "functions": 11 + }, + { + "path": "agent/memory/smp.py", + "lines": 239, + "functions": 9 + }, + { + "path": "agent/contracts/governance_semantics.py", + "lines": 236, + "functions": 6 + }, + { + "path": "forge/poc.py", + "lines": 226, + "functions": 12 + }, + { + "path": "agent/db.py", + "lines": 225, + "functions": 17 + }, + { + "path": "web/auth.py", + "lines": 220, + "functions": 16 + }, + { + "path": "web/routes/enforce.py", + "lines": 211, + "functions": 5 + }, + { + "path": "web/routes/query_runs.py", + "lines": 195, + "functions": 9 + }, + { + "path": "agent/memory/wmb.py", + "lines": 182, + "functions": 4 + }, + { + "path": "web/routes/registry_studio.py", + "lines": 182, + "functions": 10 + }, + { + "path": "main.py", + "lines": 181, + "functions": 7 + }, + { + "path": "web/routes/reports.py", + "lines": 177, + "functions": 14 + }, + { + "path": "agent/feishu.py", + "lines": 174, + "functions": 5 + }, + { + "path": "agent/contracts/product_projection_semantics.py", + "lines": 170, + "functions": 5 + }, + { + "path": "forge/context.py", + "lines": 168, + "functions": 7 + }, + { + "path": "registry/staging_sync.py", + "lines": 168, + "functions": 2 + }, + { + "path": "forge/benchmark_quality.py", + "lines": 165, + "functions": 4 + }, + { + "path": "agent/tenant.py", + "lines": 165, + "functions": 12 + }, + { + "path": "forge/readiness.py", + "lines": 158, + "functions": 6 + }, + { + "path": "agent/memory/__init__.py", + "lines": 120, + "functions": 8 + }, + { + "path": "web/feishu_runtime.py", + "lines": 119, + "functions": 6 + }, + { + "path": "registry/business_context.py", + "lines": 109, + "functions": 2 + }, + { + "path": "forge/normalization.py", + "lines": 103, + "functions": 2 + }, + { + "path": "registry/relationships.py", + "lines": 98, + "functions": 4 + }, + { + "path": "agent/feedback.py", + "lines": 95, + "functions": 4 + }, + { + "path": "agent/contracts/__init__.py", + "lines": 86, + "functions": 4 + }, + { + "path": "web/dingtalk_pi.py", + "lines": 86, + "functions": 5 + }, + { + "path": "web/routes/memory.py", + "lines": 62, + "functions": 2 + }, + { + "path": "forge/adapters.py", + "lines": 56, + "functions": 5 + }, + { + "path": "web/routes/explain.py", + "lines": 47, + "functions": 2 + }, + { + "path": "web/routes/context.py", + "lines": 42, + "functions": 1 + }, + { + "path": "web/pi_client.py", + "lines": 38, + "functions": 1 + }, + { + "path": "forge/__init__.py", + "lines": 3, + "functions": 0 + }, + { + "path": "registry/__init__.py", + "lines": 2, + "functions": 0 + }, + { + "path": "web/routes/__init__.py", + "lines": 1, + "functions": 0 + }, + { + "path": "web/__init__.py", + "lines": 1, + "functions": 0 + }, + { + "path": "agent/__init__.py", + "lines": 0, + "functions": 0 + } + ], + "largest_functions": [ + { + "path": "forge/schema_builder.py", + "symbol": "build_tool_schema", + "line": 60, + "span": 403, + "arguments": 1 + }, + { + "path": "forge/cli.py", + "symbol": "main", + "line": 496, + "span": 379, + "arguments": 0 + }, + { + "path": "forge/query_runs.py", + "symbol": "create_query_run", + "line": 315, + "span": 281, + "arguments": 10 + }, + { + "path": "forge/compiler.py", + "symbol": "_compile", + "line": 899, + "span": 211, + "arguments": 3 + }, + { + "path": "agent/agent.py", + "symbol": "_prepare_query", + "line": 110, + "span": 202, + "arguments": 4 + }, + { + "path": "forge/enforce.py", + "symbol": "prepare_governance_context", + "line": 66, + "span": 197, + "arguments": 7 + }, + { + "path": "forge/reporting.py", + "symbol": "_build_pptx", + "line": 395, + "span": 190, + "arguments": 3 + }, + { + "path": "forge/query_runs.py", + "symbol": "claim_query_run_for_execution", + "line": 597, + "span": 184, + "arguments": 6 + }, + { + "path": "forge/hard_accuracy_benchmark.py", + "symbol": "run_hard_benchmark", + "line": 1197, + "span": 182, + "arguments": 4 + }, + { + "path": "agent/contracts/governance_semantics.py", + "symbol": "validate_governance_review_trace", + "line": 57, + "span": 180, + "arguments": 1 + }, + { + "path": "agent/agent.py", + "symbol": "process", + "line": 344, + "span": 176, + "arguments": 2 + }, + { + "path": "agent/llm.py", + "symbol": "_registry_context", + "line": 123, + "span": 166, + "arguments": 2 + }, + { + "path": "web/routes/benchmark_v2.py", + "symbol": "evaluate_candidate", + "line": 261, + "span": 162, + "arguments": 2 + }, + { + "path": "forge/benchmark_metadata.py", + "symbol": "audit_value_domain", + "line": 235, + "span": 160, + "arguments": 3 + }, + { + "path": "forge/accuracy_benchmark.py", + "symbol": "_project_snapshot", + "line": 332, + "span": 154, + "arguments": 2 + }, + { + "path": "forge/hard_accuracy_benchmark.py", + "symbol": "project_snapshot", + "line": 1032, + "span": 140, + "arguments": 4 + }, + { + "path": "forge/lint.py", + "symbol": "lint_conventions", + "line": 17, + "span": 138, + "arguments": 2 + }, + { + "path": "agent/llm.py", + "symbol": "call", + "line": 665, + "span": 137, + "arguments": 8 + }, + { + "path": "forge/compiler.py", + "symbol": "_join", + "line": 1427, + "span": 130, + "arguments": 3 + }, + { + "path": "forge/explain.py", + "symbol": "project_explain_query_run", + "line": 370, + "span": 129, + "arguments": 1 + } + ], + "import_edges": [ + [ + "agent.agent", + "agent" + ], + [ + "agent.agent", + "agent.llm" + ], + [ + "agent.agent", + "agent.memory" + ], + [ + "agent.agent", + "agent.model_config" + ], + [ + "agent.agent", + "agent.tenant" + ], + [ + "agent.agent", + "config" + ], + [ + "agent.agent", + "forge.assurance" + ], + [ + "agent.agent", + "forge.cache" + ], + [ + "agent.agent", + "forge.normalization" + ], + [ + "agent.agent", + "registry.staging_sync" + ], + [ + "agent.agent", + "registry.validator" + ], + [ + "agent.audit", + "config" + ], + [ + "agent.contracts.governance_semantics", + "agent.contracts" + ], + [ + "agent.contracts.product_projection_semantics", + "agent.contracts" + ], + [ + "agent.db", + "config" + ], + [ + "agent.feedback", + "agent" + ], + [ + "agent.feedback", + "agent.audit" + ], + [ + "agent.feishu", + "agent" + ], + [ + "agent.feishu", + "agent.agent" + ], + [ + "agent.feishu", + "config" + ], + [ + "agent.knowledge", + "agent" + ], + [ + "agent.knowledge", + "agent.db" + ], + [ + "agent.knowledge", + "agent.llm" + ], + [ + "agent.knowledge", + "agent.memory" + ], + [ + "agent.llm", + "agent.model_config" + ], + [ + "agent.llm", + "agent.prompts" + ], + [ + "agent.llm", + "config" + ], + [ + "agent.llm", + "forge.retriever" + ], + [ + "agent.llm", + "forge.schema_builder" + ], + [ + "agent.memory", + "agent.memory.ems" + ], + [ + "agent.memory", + "agent.memory.extractor" + ], + [ + "agent.memory", + "agent.memory.smp" + ], + [ + "agent.memory", + "agent.memory.wmb" + ], + [ + "agent.memory", + "agent.tenant" + ], + [ + "agent.memory.ems", + "agent.db" + ], + [ + "agent.memory.ems", + "config" + ], + [ + "agent.memory.extractor", + "agent" + ], + [ + "agent.memory.extractor", + "agent.llm" + ], + [ + "agent.memory.smp", + "agent.db" + ], + [ + "agent.memory.wmb", + "registry.business_context" + ], + [ + "agent.model_config", + "agent.model_control" + ], + [ + "agent.model_quality", + "agent.agent" + ], + [ + "agent.model_quality", + "agent.llm" + ], + [ + "agent.model_quality", + "agent.model_config" + ], + [ + "agent.model_quality", + "agent.model_control" + ], + [ + "agent.model_quality", + "config" + ], + [ + "agent.model_quality", + "forge.assurance" + ], + [ + "agent.model_quality", + "forge.executor" + ], + [ + "agent.pipeline", + "agent" + ], + [ + "agent.pipeline", + "agent.agent" + ], + [ + "agent.pipeline", + "agent.llm" + ], + [ + "agent.pipeline", + "agent.memory" + ], + [ + "agent.pipeline", + "agent.tenant" + ], + [ + "agent.pipeline", + "forge.chart" + ], + [ + "agent.tenant", + "agent.db" + ], + [ + "forge", + "forge.compiler" + ], + [ + "forge.accuracy_benchmark", + "agent.model_config" + ], + [ + "forge.accuracy_benchmark", + "agent.prompts" + ], + [ + "forge.accuracy_benchmark", + "forge.benchmark_methods" + ], + [ + "forge.assurance", + "config" + ], + [ + "forge.assurance", + "forge.compiler" + ], + [ + "forge.assurance", + "forge.executor" + ], + [ + "forge.assurance", + "forge.lint" + ], + [ + "forge.assurance", + "registry.relationships" + ], + [ + "forge.benchmark_metadata", + "forge" + ], + [ + "forge.benchmark_metadata", + "forge.hard_accuracy_benchmark" + ], + [ + "forge.benchmark_methods", + "forge.compiler" + ], + [ + "forge.benchmark_methods", + "forge.lint" + ], + [ + "forge.bird_benchmark", + "agent.prompts" + ], + [ + "forge.bird_benchmark", + "forge" + ], + [ + "forge.bird_benchmark", + "forge.benchmark_metadata" + ], + [ + "forge.bird_benchmark", + "forge.benchmark_v2" + ], + [ + "forge.bird_benchmark", + "forge.hard_accuracy_benchmark" + ], + [ + "forge.bird_benchmark", + "web.routes.benchmark_v2" + ], + [ + "forge.cache", + "config" + ], + [ + "forge.cli", + "agent.prompts" + ], + [ + "forge.cli", + "config" + ], + [ + "forge.cli", + "forge" + ], + [ + "forge.cli", + "forge.benchmark_metadata" + ], + [ + "forge.cli", + "forge.benchmark_quality" + ], + [ + "forge.cli", + "forge.bird_benchmark" + ], + [ + "forge.cli", + "forge.compiler" + ], + [ + "forge.cli", + "forge.poc" + ], + [ + "forge.cli", + "forge.quickstart" + ], + [ + "forge.cli", + "forge.readiness" + ], + [ + "forge.cli", + "registry.staging_sync" + ], + [ + "forge.cli", + "registry.sync" + ], + [ + "forge.context", + "agent.memory.smp" + ], + [ + "forge.context", + "config" + ], + [ + "forge.enforce", + "agent.contracts" + ], + [ + "forge.enforce", + "config" + ], + [ + "forge.enforce", + "forge.assurance" + ], + [ + "forge.enforce", + "forge.evaluate" + ], + [ + "forge.evaluate", + "agent.contracts" + ], + [ + "forge.evaluate", + "forge" + ], + [ + "forge.evaluate", + "forge.assurance" + ], + [ + "forge.evaluate", + "forge.benchmark_v2" + ], + [ + "forge.evaluation_runs", + "agent.contracts" + ], + [ + "forge.evaluation_runs", + "forge" + ], + [ + "forge.evaluation_runs", + "forge.assurance" + ], + [ + "forge.evaluation_runs", + "forge.benchmark_v2" + ], + [ + "forge.evaluation_runs", + "forge.evaluate" + ], + [ + "forge.executor", + "config" + ], + [ + "forge.explain", + "agent.contracts" + ], + [ + "forge.explain", + "config" + ], + [ + "forge.explain", + "forge.enforce" + ], + [ + "forge.hard_accuracy_benchmark", + "agent.model_config" + ], + [ + "forge.hard_accuracy_benchmark", + "agent.prompts" + ], + [ + "forge.hard_accuracy_benchmark", + "forge.accuracy_benchmark" + ], + [ + "forge.hard_accuracy_benchmark", + "forge.benchmark_methods" + ], + [ + "forge.hard_accuracy_benchmark", + "forge.executor" + ], + [ + "forge.query_runs", + "agent.agent" + ], + [ + "forge.query_runs", + "agent.contracts" + ], + [ + "forge.query_runs", + "agent.tenant" + ], + [ + "forge.query_runs", + "config" + ], + [ + "forge.query_runs", + "forge.assurance" + ], + [ + "forge.query_runs", + "forge.enforce" + ], + [ + "forge.query_runs", + "forge.evaluate" + ], + [ + "forge.query_runs", + "forge.executor" + ], + [ + "forge.query_runs", + "forge.explain" + ], + [ + "forge.readiness", + "config" + ], + [ + "forge.retriever", + "registry.relationships" + ], + [ + "main", + "agent.feishu" + ], + [ + "main", + "agent.model_config" + ], + [ + "main", + "agent.model_control" + ], + [ + "main", + "config" + ], + [ + "main", + "forge.query_runs" + ], + [ + "main", + "forge.readiness" + ], + [ + "main", + "web.auth" + ], + [ + "main", + "web.feishu_pi" + ], + [ + "main", + "web.feishu_runtime" + ], + [ + "main", + "web.router" + ], + [ + "registry", + "registry.sync" + ], + [ + "registry", + "registry.validator" + ], + [ + "registry.business_context", + "config" + ], + [ + "registry.sync", + "registry.studio" + ], + [ + "web.auth", + "config" + ], + [ + "web.dingtalk_pi", + "web.pi_channel" + ], + [ + "web.feishu", + "agent" + ], + [ + "web.feishu", + "agent.agent" + ], + [ + "web.feishu", + "agent.memory" + ], + [ + "web.feishu", + "config" + ], + [ + "web.feishu", + "forge.chart" + ], + [ + "web.feishu", + "forge.executor" + ], + [ + "web.feishu", + "web.feishu_pi" + ], + [ + "web.feishu", + "web.pi_channel" + ], + [ + "web.feishu_pi", + "config" + ], + [ + "web.feishu_pi", + "web.pi_channel" + ], + [ + "web.pi_channel", + "config" + ], + [ + "web.pi_client", + "config" + ], + [ + "web.router", + "agent" + ], + [ + "web.router", + "agent.agent" + ], + [ + "web.router", + "agent.audit" + ], + [ + "web.router", + "agent.db" + ], + [ + "web.router", + "agent.feedback" + ], + [ + "web.router", + "agent.knowledge" + ], + [ + "web.router", + "agent.llm" + ], + [ + "web.router", + "agent.memory" + ], + [ + "web.router", + "agent.pipeline" + ], + [ + "web.router", + "agent.tenant" + ], + [ + "web.router", + "config" + ], + [ + "web.router", + "forge.executor" + ], + [ + "web.router", + "forge.explain" + ], + [ + "web.router", + "forge.query_runs" + ], + [ + "web.router", + "registry.staging_sync" + ], + [ + "web.router", + "registry.validator" + ], + [ + "web.router", + "web.auth" + ], + [ + "web.router", + "web.pi_client" + ], + [ + "web.router", + "web.routes.accuracy_benchmark" + ], + [ + "web.router", + "web.routes.benchmark_v2" + ], + [ + "web.router", + "web.routes.context" + ], + [ + "web.router", + "web.routes.enforce" + ], + [ + "web.router", + "web.routes.evaluate" + ], + [ + "web.router", + "web.routes.explain" + ], + [ + "web.router", + "web.routes.memory" + ], + [ + "web.router", + "web.routes.product" + ], + [ + "web.router", + "web.routes.query_runs" + ], + [ + "web.router", + "web.routes.registry_studio" + ], + [ + "web.router", + "web.routes.reports" + ], + [ + "web.router", + "web.routes.settings" + ], + [ + "web.routes.accuracy_benchmark", + "agent.model_config" + ], + [ + "web.routes.accuracy_benchmark", + "forge.accuracy_benchmark" + ], + [ + "web.routes.accuracy_benchmark", + "forge.hard_accuracy_benchmark" + ], + [ + "web.routes.accuracy_benchmark", + "web.pi_client" + ], + [ + "web.routes.benchmark_v2", + "agent.contracts" + ], + [ + "web.routes.benchmark_v2", + "agent.prompts" + ], + [ + "web.routes.benchmark_v2", + "forge.assurance" + ], + [ + "web.routes.benchmark_v2", + "forge.benchmark_v2" + ], + [ + "web.routes.benchmark_v2", + "forge.bird_benchmark" + ], + [ + "web.routes.benchmark_v2", + "forge.compiler" + ], + [ + "web.routes.benchmark_v2", + "forge.hard_accuracy_benchmark" + ], + [ + "web.routes.benchmark_v2", + "web.auth" + ], + [ + "web.routes.context", + "forge.context" + ], + [ + "web.routes.context", + "web.auth" + ], + [ + "web.routes.enforce", + "agent.contracts" + ], + [ + "web.routes.enforce", + "forge.enforce" + ], + [ + "web.routes.enforce", + "forge.query_runs" + ], + [ + "web.routes.enforce", + "web.auth" + ], + [ + "web.routes.evaluate", + "forge.evaluate" + ], + [ + "web.routes.evaluate", + "forge.evaluation_runs" + ], + [ + "web.routes.evaluate", + "web.auth" + ], + [ + "web.routes.explain", + "forge.explain" + ], + [ + "web.routes.explain", + "forge.query_runs" + ], + [ + "web.routes.explain", + "web.auth" + ], + [ + "web.routes.memory", + "agent.memory.smp" + ], + [ + "web.routes.memory", + "web.auth" + ], + [ + "web.routes.product", + "agent.contracts.product_projection_semantics" + ], + [ + "web.routes.product", + "config" + ], + [ + "web.routes.product", + "web.auth" + ], + [ + "web.routes.product", + "web.pi_client" + ], + [ + "web.routes.product", + "web.routes.reports" + ], + [ + "web.routes.query_runs", + "forge.query_runs" + ], + [ + "web.routes.query_runs", + "web.auth" + ], + [ + "web.routes.registry_studio", + "config" + ], + [ + "web.routes.registry_studio", + "registry.studio" + ], + [ + "web.routes.registry_studio", + "web.router" + ], + [ + "web.routes.reports", + "config" + ], + [ + "web.routes.reports", + "forge.reporting" + ], + [ + "web.routes.reports", + "web.auth" + ], + [ + "web.routes.settings", + "agent.llm" + ], + [ + "web.routes.settings", + "agent.model_config" + ], + [ + "web.routes.settings", + "agent.model_control" + ], + [ + "web.routes.settings", + "agent.model_quality" + ], + [ + "web.routes.settings", + "config" + ], + [ + "web.routes.settings", + "web.feishu_runtime" + ] + ], + "static_scc": [ + [ + "forge.bird_benchmark", + "web.routes.benchmark_v2" + ], + [ + "web.router", + "web.routes.registry_studio" + ] + ], + "layer_edges": [ + { + "from": "agent", + "to": "agent", + "count": 37 + }, + { + "from": "agent", + "to": "config", + "count": 7 + }, + { + "from": "agent", + "to": "forge", + "count": 8 + }, + { + "from": "agent", + "to": "registry", + "count": 3 + }, + { + "from": "forge", + "to": "agent", + "count": 14 + }, + { + "from": "forge", + "to": "config", + "count": 9 + }, + { + "from": "forge", + "to": "forge", + "count": 39 + }, + { + "from": "forge", + "to": "registry", + "count": 4 + }, + { + "from": "forge", + "to": "web", + "count": 1 + }, + { + "from": "main", + "to": "agent", + "count": 3 + }, + { + "from": "main", + "to": "config", + "count": 1 + }, + { + "from": "main", + "to": "forge", + "count": 2 + }, + { + "from": "main", + "to": "web", + "count": 4 + }, + { + "from": "registry", + "to": "config", + "count": 1 + }, + { + "from": "registry", + "to": "registry", + "count": 3 + }, + { + "from": "web", + "to": "agent", + "count": 23 + }, + { + "from": "web", + "to": "config", + "count": 10 + }, + { + "from": "web", + "to": "forge", + "count": 21 + }, + { + "from": "web", + "to": "registry", + "count": 3 + }, + { + "from": "web", + "to": "web", + "count": 32 + } + ], + "exact_body_duplicates": [ + [ + { + "path": "agent/contracts/product_projection_semantics.py", + "symbol": "_expected_task_state", + "line": 64, + "span": 16 + }, + { + "path": "web/routes/product.py", + "symbol": "_task_state", + "line": 91, + "span": 16 + } + ], + [ + { + "path": "agent/memory/smp.py", + "symbol": "_ensure_conn", + "line": 76, + "span": 14 + }, + { + "path": "agent/knowledge.py", + "symbol": "_ensure_conn", + "line": 82, + "span": 14 + } + ], + [ + { + "path": "registry/studio.py", + "symbol": "_normalize_type", + "line": 410, + "span": 11 + }, + { + "path": "registry/sync.py", + "symbol": "_normalize_type", + "line": 283, + "span": 11 + } + ] + ] + }, + "typescript_javascript": { + "method": "TypeScript compiler AST parse only; nested callbacks included; spans are navigation signals, not complexity scores.", + "file_count": 34, + "lines": 13151, + "files": [ + { + "path": "services/pi-orchestrator/src/application.ts", + "lines": 2113, + "functions": 114 + }, + { + "path": "services/pi-orchestrator/src/benchmark-runtime.ts", + "lines": 1249, + "functions": 79 + }, + { + "path": "services/pi-orchestrator/src/sqlite-store.ts", + "lines": 1101, + "functions": 49 + }, + { + "path": "services/pi-orchestrator/src/server.ts", + "lines": 903, + "functions": 25 + }, + { + "path": "web/static/product/product-pages.js", + "lines": 746, + "functions": 92 + }, + { + "path": "services/pi-orchestrator/src/product-projections.ts", + "lines": 718, + "functions": 11 + }, + { + "path": "services/pi-orchestrator/src/product-projection-builder.ts", + "lines": 674, + "functions": 55 + }, + { + "path": "services/pi-orchestrator/src/governance-contracts.ts", + "lines": 580, + "functions": 16 + }, + { + "path": "services/pi-orchestrator/src/skill-executor.ts", + "lines": 571, + "functions": 47 + }, + { + "path": "services/pi-orchestrator/src/structured-artifact-tools.ts", + "lines": 547, + "functions": 37 + }, + { + "path": "services/pi-orchestrator/src/channels/renderer.ts", + "lines": 435, + "functions": 47 + }, + { + "path": "services/pi-orchestrator/src/forge/query-run-client.ts", + "lines": 395, + "functions": 14 + }, + { + "path": "services/pi-orchestrator/src/chart-artifacts-v2.ts", + "lines": 314, + "functions": 45 + }, + { + "path": "services/pi-orchestrator/src/task-store.ts", + "lines": 311, + "functions": 23 + }, + { + "path": "services/pi-orchestrator/src/planning.ts", + "lines": 211, + "functions": 19 + }, + { + "path": "services/pi-orchestrator/src/config.ts", + "lines": 201, + "functions": 11 + }, + { + "path": "services/pi-orchestrator/src/stage-attempts.ts", + "lines": 193, + "functions": 13 + }, + { + "path": "services/pi-orchestrator/src/benchmark-contracts.ts", + "lines": 183, + "functions": 0 + }, + { + "path": "services/pi-orchestrator/src/report-artifacts.ts", + "lines": 181, + "functions": 24 + }, + { + "path": "services/pi-orchestrator/src/skills.ts", + "lines": 172, + "functions": 15 + }, + { + "path": "services/pi-orchestrator/src/strict-forge-output.ts", + "lines": 162, + "functions": 21 + }, + { + "path": "services/pi-orchestrator/src/channels/identity.ts", + "lines": 149, + "functions": 6 + }, + { + "path": "services/pi-orchestrator/src/forge/client.ts", + "lines": 136, + "functions": 5 + }, + { + "path": "services/pi-orchestrator/src/artifacts.ts", + "lines": 116, + "functions": 6 + }, + { + "path": "services/pi-orchestrator/src/runtime.ts", + "lines": 112, + "functions": 4 + }, + { + "path": "services/pi-orchestrator/src/channels/intent.ts", + "lines": 109, + "functions": 2 + }, + { + "path": "services/pi-orchestrator/src/channels/contracts.ts", + "lines": 108, + "functions": 2 + }, + { + "path": "services/pi-orchestrator/src/model-bindings.ts", + "lines": 104, + "functions": 3 + }, + { + "path": "services/pi-orchestrator/src/tools/forge-prepare-query.ts", + "lines": 87, + "functions": 3 + }, + { + "path": "services/pi-orchestrator/src/task-events.ts", + "lines": 80, + "functions": 4 + }, + { + "path": "services/pi-orchestrator/src/skill-policy.ts", + "lines": 67, + "functions": 4 + }, + { + "path": "web/static/product/product-shell.js", + "lines": 64, + "functions": 8 + }, + { + "path": "web/static/accuracy-benchmark.js", + "lines": 37, + "functions": 73 + }, + { + "path": "services/pi-orchestrator/src/channels/event-store.ts", + "lines": 22, + "functions": 0 + } + ], + "largest_functions": [ + { + "path": "services/pi-orchestrator/src/server.ts", + "symbol": "createOrchestratorServer", + "line": 223, + "span": 670 + }, + { + "path": "services/pi-orchestrator/src/server.ts", + "symbol": "", + "line": 250, + "span": 635 + }, + { + "path": "services/pi-orchestrator/src/channels/renderer.ts", + "symbol": "renderChannelPresentation", + "line": 96, + "span": 340 + }, + { + "path": "services/pi-orchestrator/src/benchmark-runtime.ts", + "symbol": "#runArm", + "line": 733, + "span": 334 + }, + { + "path": "services/pi-orchestrator/src/application.ts", + "symbol": "renderReport", + "line": 1684, + "span": 250 + }, + { + "path": "services/pi-orchestrator/src/application.ts", + "symbol": "ingestChannelAction", + "line": 624, + "span": 209 + }, + { + "path": "services/pi-orchestrator/src/application.ts", + "symbol": "ingestChannelMessage", + "line": 416, + "span": 207 + }, + { + "path": "services/pi-orchestrator/src/benchmark-runtime.ts", + "symbol": "start", + "line": 278, + "span": 177 + }, + { + "path": "services/pi-orchestrator/src/application.ts", + "symbol": "approveQuery", + "line": 1159, + "span": 173 + }, + { + "path": "services/pi-orchestrator/src/application.ts", + "symbol": "resumeAnalysisWithSupplement", + "line": 1421, + "span": 155 + }, + { + "path": "services/pi-orchestrator/src/governance-contracts.ts", + "symbol": "validateGovernanceReviewTrace", + "line": 448, + "span": 133 + }, + { + "path": "services/pi-orchestrator/src/benchmark-runtime.ts", + "symbol": "#processCase", + "line": 605, + "span": 127 + }, + { + "path": "services/pi-orchestrator/src/application.ts", + "symbol": "prepareQuery", + "line": 1032, + "span": 126 + }, + { + "path": "services/pi-orchestrator/src/application.ts", + "symbol": "runAdvisory", + "line": 277, + "span": 117 + }, + { + "path": "services/pi-orchestrator/src/sqlite-store.ts", + "symbol": "SqliteOrchestratorState", + "line": 915, + "span": 117 + }, + { + "path": "services/pi-orchestrator/src/product-projection-builder.ts", + "symbol": "getTaskDetail", + "line": 510, + "span": 113 + }, + { + "path": "services/pi-orchestrator/src/strict-forge-output.ts", + "symbol": "createStrictForgeOutput", + "line": 26, + "span": 106 + }, + { + "path": "services/pi-orchestrator/src/application.ts", + "symbol": "analyzeTask", + "line": 1577, + "span": 106 + }, + { + "path": "services/pi-orchestrator/src/product-projections.ts", + "symbol": "validateProductProjection", + "line": 622, + "span": 97 + }, + { + "path": "services/pi-orchestrator/src/config.ts", + "symbol": "loadConfig", + "line": 109, + "span": 93 + } + ], + "imports": [ + { + "from": "services/pi-orchestrator/src/benchmark-runtime.ts", + "to": "node:crypto", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/benchmark-runtime.ts", + "to": "node:fs", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/benchmark-runtime.ts", + "to": "node:sqlite", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/benchmark-runtime.ts", + "to": "node:path", + "line": 4 + }, + { + "from": "services/pi-orchestrator/src/benchmark-runtime.ts", + "to": "node:url", + "line": 5 + }, + { + "from": "services/pi-orchestrator/src/benchmark-runtime.ts", + "to": "@earendil-works/pi-coding-agent", + "line": 6 + }, + { + "from": "services/pi-orchestrator/src/benchmark-runtime.ts", + "to": "typebox", + "line": 14 + }, + { + "from": "services/pi-orchestrator/src/benchmark-runtime.ts", + "to": "./application.js", + "line": 16 + }, + { + "from": "services/pi-orchestrator/src/benchmark-runtime.ts", + "to": "./config.js", + "line": 17 + }, + { + "from": "services/pi-orchestrator/src/benchmark-runtime.ts", + "to": "./benchmark-contracts.js", + "line": 18 + }, + { + "from": "services/pi-orchestrator/src/benchmark-runtime.ts", + "to": "./strict-forge-output.js", + "line": 29 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "node:crypto", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "node:http", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "node:url", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "./application.js", + "line": 5 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "./benchmark-runtime.js", + "line": 6 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "./channels/contracts.js", + "line": 7 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "./channels/identity.js", + "line": 8 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "./config.js", + "line": 9 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "./forge/client.js", + "line": 10 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "./forge/query-run-client.js", + "line": 11 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "./runtime.js", + "line": 12 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "./skills.js", + "line": 13 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "./skill-policy.js", + "line": 19 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "./sqlite-store.js", + "line": 20 + }, + { + "from": "services/pi-orchestrator/src/server.ts", + "to": "./task-store.js", + "line": 21 + }, + { + "from": "services/pi-orchestrator/src/strict-forge-output.ts", + "to": "node:crypto", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/strict-forge-output.ts", + "to": "typebox/compile", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/strict-forge-output.ts", + "to": "typebox", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "node:crypto", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./channels/event-store.js", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./channels/contracts.js", + "line": 4 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./channels/renderer.js", + "line": 5 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./channels/intent.js", + "line": 6 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./planning.js", + "line": 7 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./report-artifacts.js", + "line": 13 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./model-bindings.js", + "line": 14 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./artifacts.js", + "line": 15 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./config.js", + "line": 20 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./forge/client.js", + "line": 21 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./product-projection-builder.js", + "line": 22 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./product-projections.js", + "line": 27 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./forge/query-run-client.js", + "line": 28 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./skill-executor.js", + "line": 36 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./stage-attempts.js", + "line": 40 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./structured-artifact-tools.js", + "line": 41 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./skills.js", + "line": 46 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./skill-policy.js", + "line": 51 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./task-store.js", + "line": 52 + }, + { + "from": "services/pi-orchestrator/src/application.ts", + "to": "./task-events.js", + "line": 61 + }, + { + "from": "services/pi-orchestrator/src/forge/query-run-client.ts", + "to": "./client.js", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/forge/query-run-client.ts", + "to": "./client.js", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/config.ts", + "to": "node:crypto", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/config.ts", + "to": "node:fs", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/config.ts", + "to": "node:path", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/config.ts", + "to": "node:url", + "line": 4 + }, + { + "from": "services/pi-orchestrator/src/product-projection-builder.ts", + "to": "node:crypto", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/product-projection-builder.ts", + "to": "./artifacts.js", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/product-projection-builder.ts", + "to": "./channels/contracts.js", + "line": 4 + }, + { + "from": "services/pi-orchestrator/src/product-projection-builder.ts", + "to": "./channels/renderer.js", + "line": 5 + }, + { + "from": "services/pi-orchestrator/src/product-projection-builder.ts", + "to": "./product-projections.js", + "line": 6 + }, + { + "from": "services/pi-orchestrator/src/product-projection-builder.ts", + "to": "./stage-attempts.js", + "line": 14 + }, + { + "from": "services/pi-orchestrator/src/product-projection-builder.ts", + "to": "./task-store.js", + "line": 15 + }, + { + "from": "services/pi-orchestrator/src/product-projection-builder.ts", + "to": "./task-events.js", + "line": 24 + }, + { + "from": "services/pi-orchestrator/src/sqlite-store.ts", + "to": "node:crypto", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/sqlite-store.ts", + "to": "node:fs", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/sqlite-store.ts", + "to": "node:path", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/sqlite-store.ts", + "to": "node:sqlite", + "line": 4 + }, + { + "from": "services/pi-orchestrator/src/sqlite-store.ts", + "to": "./channels/event-store.js", + "line": 6 + }, + { + "from": "services/pi-orchestrator/src/sqlite-store.ts", + "to": "./channels/contracts.js", + "line": 10 + }, + { + "from": "services/pi-orchestrator/src/sqlite-store.ts", + "to": "./artifacts.js", + "line": 11 + }, + { + "from": "services/pi-orchestrator/src/sqlite-store.ts", + "to": "./skills.js", + "line": 18 + }, + { + "from": "services/pi-orchestrator/src/sqlite-store.ts", + "to": "./skill-policy.js", + "line": 19 + }, + { + "from": "services/pi-orchestrator/src/sqlite-store.ts", + "to": "./stage-attempts.js", + "line": 24 + }, + { + "from": "services/pi-orchestrator/src/sqlite-store.ts", + "to": "./task-store.js", + "line": 31 + }, + { + "from": "services/pi-orchestrator/src/sqlite-store.ts", + "to": "./task-events.js", + "line": 43 + }, + { + "from": "services/pi-orchestrator/src/stage-attempts.ts", + "to": "node:crypto", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/stage-attempts.ts", + "to": "./task-store.js", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/product-projections.ts", + "to": "typebox", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/product-projections.ts", + "to": "typebox/value", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/task-store.ts", + "to": "node:crypto", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/report-artifacts.ts", + "to": "node:crypto", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/report-artifacts.ts", + "to": "./artifacts.js", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/report-artifacts.ts", + "to": "./structured-artifact-tools.js", + "line": 4 + }, + { + "from": "services/pi-orchestrator/src/channels/renderer.ts", + "to": "../artifacts.js", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/channels/renderer.ts", + "to": "../task-events.js", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/channels/renderer.ts", + "to": "./contracts.js", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/skill-executor.ts", + "to": "node:path", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/skill-executor.ts", + "to": "@earendil-works/pi-coding-agent", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/skill-executor.ts", + "to": "./artifacts.js", + "line": 11 + }, + { + "from": "services/pi-orchestrator/src/skill-executor.ts", + "to": "./config.js", + "line": 12 + }, + { + "from": "services/pi-orchestrator/src/skill-executor.ts", + "to": "./model-bindings.js", + "line": 13 + }, + { + "from": "services/pi-orchestrator/src/skill-executor.ts", + "to": "./skills.js", + "line": 14 + }, + { + "from": "services/pi-orchestrator/src/skill-executor.ts", + "to": "./structured-artifact-tools.js", + "line": 20 + }, + { + "from": "services/pi-orchestrator/src/skill-executor.ts", + "to": "./task-store.js", + "line": 33 + }, + { + "from": "services/pi-orchestrator/src/governance-contracts.ts", + "to": "typebox", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/governance-contracts.ts", + "to": "typebox/value", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/channels/identity.ts", + "to": "node:fs", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/channels/identity.ts", + "to": "node:path", + "line": 10 + }, + { + "from": "services/pi-orchestrator/src/channels/identity.ts", + "to": "../task-store.js", + "line": 12 + }, + { + "from": "services/pi-orchestrator/src/channels/identity.ts", + "to": "./contracts.js", + "line": 13 + }, + { + "from": "services/pi-orchestrator/src/channels/contracts.ts", + "to": "../artifacts.js", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/channels/contracts.ts", + "to": "../task-events.js", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/channels/contracts.ts", + "to": "../task-store.js", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/model-bindings.ts", + "to": "node:fs", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/model-bindings.ts", + "to": "node:sqlite", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/model-bindings.ts", + "to": "./config.js", + "line": 4 + }, + { + "from": "services/pi-orchestrator/src/task-events.ts", + "to": "node:crypto", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/artifacts.ts", + "to": "node:crypto", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/artifacts.ts", + "to": "./structured-artifact-tools.js", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/artifacts.ts", + "to": "./planning.js", + "line": 11 + }, + { + "from": "services/pi-orchestrator/src/artifacts.ts", + "to": "./report-artifacts.js", + "line": 12 + }, + { + "from": "services/pi-orchestrator/src/structured-artifact-tools.ts", + "to": "@earendil-works/pi-coding-agent", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/structured-artifact-tools.ts", + "to": "typebox", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/structured-artifact-tools.ts", + "to": "typebox/format", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/structured-artifact-tools.ts", + "to": "typebox/value", + "line": 4 + }, + { + "from": "services/pi-orchestrator/src/planning.ts", + "to": "./artifacts.js", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/planning.ts", + "to": "./channels/intent.js", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/skills.ts", + "to": "node:fs/promises", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/skills.ts", + "to": "node:path", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/skills.ts", + "to": "@earendil-works/pi-coding-agent", + "line": 4 + }, + { + "from": "services/pi-orchestrator/src/skill-policy.ts", + "to": "./skills.js", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/runtime.ts", + "to": "node:path", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/runtime.ts", + "to": "@earendil-works/pi-coding-agent", + "line": 3 + }, + { + "from": "services/pi-orchestrator/src/runtime.ts", + "to": "./config.js", + "line": 10 + }, + { + "from": "services/pi-orchestrator/src/runtime.ts", + "to": "./forge/query-run-client.js", + "line": 11 + }, + { + "from": "services/pi-orchestrator/src/runtime.ts", + "to": "./skills.js", + "line": 12 + }, + { + "from": "services/pi-orchestrator/src/runtime.ts", + "to": "./tools/forge-prepare-query.js", + "line": 13 + }, + { + "from": "services/pi-orchestrator/src/channels/event-store.ts", + "to": "./contracts.js", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/tools/forge-prepare-query.ts", + "to": "@earendil-works/pi-coding-agent", + "line": 1 + }, + { + "from": "services/pi-orchestrator/src/tools/forge-prepare-query.ts", + "to": "typebox", + "line": 2 + }, + { + "from": "services/pi-orchestrator/src/tools/forge-prepare-query.ts", + "to": "../forge/client.js", + "line": 4 + }, + { + "from": "services/pi-orchestrator/src/tools/forge-prepare-query.ts", + "to": "../forge/query-run-client.js", + "line": 5 + }, + { + "from": "web/static/product/product-pages.js", + "to": "./product-shell.js?v=2", + "line": 1 + } + ], + "parse_diagnostics": [] + } + }, + "findings": [ + { + "id": "AQ-01", + "priority": "P1", + "confidence": "isolated_reproduction", + "title": "阶段重试先改变Task,再复用已终止Attempt,产生无法正常回收的状态", + "refs": [ + "services/pi-orchestrator/src/application.ts:889-946", + "services/pi-orchestrator/src/application.ts:1949-1984", + "services/pi-orchestrator/src/stage-attempts.ts:78-84", + "services/pi-orchestrator/src/sqlite-store.ts:610-614", + "services/pi-orchestrator/src/sqlite-store.ts:1033-1039" + ], + "observed": "clarify首轮timeout后默认重试,第二次Skill返回合法payload仍报旧attempt已timed_out;SQLite留下task=clarifying/attempt=timed_out/artifact=0,内存却留下needs_input/artifact=1。", + "impact": "可重试错误变成重复工作后卡死;仅扫描running attempt的reconcile无法回收该组合。", + "counter": "新key可绕开具体反例;runAdvisory已有成功key回放、失败key拒绝的局部正确模式,不是所有重试都坏。", + "change": "复用runAdvisory的幂等判定规则,区分同command回放与新attempt;在Task迁移和外部调用之前完成判定。", + "acceptance": "timeout/interrupted后新attempt可成功;同成功key不再调用Skill;同失败key处理一致;不得留下running Task+terminal Attempt。" + }, + { + "id": "AQ-02", + "priority": "P1", + "confidence": "isolated_reproduction", + "title": "用户取消与真实阶段执行、Attempt收口没有形成同一协议", + "refs": [ + "services/pi-orchestrator/src/application.ts:834-875", + "services/pi-orchestrator/src/application.ts:2016-2021", + "services/pi-orchestrator/src/skill-executor.ts:423-441", + "services/pi-orchestrator/src/sqlite-store.ts:1069-1090" + ], + "observed": "挂起clarify时cancelTask后Skill收到的signal.aborted仍false;迟到返回后SQLite task=cancelled、attempt仍running、artifact=0;内存则attempt=failed且残留artifact。", + "impact": "界面取消不代表底层停止;迟到结果与CAS/事务回滚竞争,掩盖原始错误并让状态解释矛盾。", + "counter": "Task终态保护有效;等待查询审批时已有远端取消分支;SQL/发布实际副作用仍持续仅是静态风险,未执行这些外部动作。", + "change": "active attempt持有取消句柄;以attempt身份和终态所有权收口late result;明确远端取消与仅停止等待的边界,不宣称所有操作可撤销。", + "acceptance": "取消触发真实abort;迟到成功/错误不落Artifact、不改变cancelled、不留下running Attempt;覆盖timeout/cancel竞争。" + }, + { + "id": "AQ-03", + "priority": "P1", + "confidence": "isolated_reproduction", + "title": "内存Store和SQLite没有同等事务语义,测试模型可能掩盖生产失败", + "refs": [ + "services/pi-orchestrator/src/application.ts:133-149", + "services/pi-orchestrator/src/task-store.ts:281-310", + "services/pi-orchestrator/src/sqlite-store.ts:377-432", + "services/pi-orchestrator/src/sqlite-store.ts:1017-1030" + ], + "observed": "AQ-01/AQ-02在相同Application调用下得到不同Task/Attempt/Artifact结果;默认transactions仅调用operation,没有回滚。", + "impact": "独立可选tasks/events/artifacts/attempts/transactions可被混搭;新增状态规则要复制到多个存储实现。", + "counter": "SQLite的事务、CAS和唯一索引是正确的防线,不能削弱生产语义来让内存测试通过。", + "change": "引入不可混搭的State port组合或让核心场景默认临时SQLite;共用纯领域规则,存储仅负责读写。", + "acceptance": "相同失败、取消、重试、错误Artifact语料在两个适配器观察一致;不允许持久Store配no-op事务。" + }, + { + "id": "AQ-04", + "priority": "P1", + "confidence": "isolated_reproduction", + "title": "数据集专用字段规则进入通用Assurance,污染Registry接入边界", + "refs": [ + "forge/assurance.py:117-123", + "forge/lint.py:1033-1050", + "forge/assurance.py:305-389" + ], + "observed": "合成Registry合法声明dim_user.id;等价Direct SQL通过,Forge JSON被large benchmark字段纠错规则拒绝,返回candidate_contract_invalid。", + "impact": "客户的权威Registry可能输给硬编码样例表名;改benchmark规则会改变通用产品接受条件。", + "counter": "两输入语义可见性本来不同,Direct不执行DSL lint不构成审批绕过;Evaluate仍不授予执行权限。", + "change": "分开通用结构规则与绑定dataset/Registry revision的业务policy;显式规则适用域、rule_id/revision及applied/not_applicable,不建立万能规则平台。", + "acceptance": "自定义合法Registry通过;原large profile仍拒绝自己的错误字段;未选择profile不运行数据集规则;保留历史基线与policy/approval drift。" + }, + { + "id": "AQ-05", + "priority": "P1", + "confidence": "isolated_reproduction", + "title": "公开Evaluate默认auto与Compiler契约冲突", + "refs": [ + "web/routes/evaluate.py:37", + "forge/evaluate.py:258-287", + "forge/compiler.py:57-90", + "forge/query_runs.py:262-266", + "agent/agent.py:83-102" + ], + "observed": "同一orders.id:默认Direct通过,默认Forge JSON为compile_failed;显式sqlite的Forge JSON通过。", + "impact": "合法默认请求因输入形态而失败;Evaluate与Enforce方言解析的归属和来源不一致。", + "counter": "具体支持方言可用;Direct auto解析与Forge目标方言选择语义不同,不能简单默认sqlite。", + "change": "纯方言解析脱离旧Agent;区分requested/resolved dialect并记录来源,依据显式请求或受信绑定选择。", + "acceptance": "两输入覆盖省略/auto/具体方言/不支持方言;默认不能落内部compile_failed;评估不能偷偷依赖生产数据库URL。" + }, + { + "id": "AQ-06", + "priority": "P1", + "confidence": "real_executor_with_extracted_finalizer", + "title": "执行领域状态依赖展示文本前缀,而非结构化结果", + "refs": [ + "forge/executor.py:185-243", + "forge/query_runs.py:856-888" + ], + "observed": "真实内存SQLite普通SELECT返回[[1]]并完成;仅将合法列别名改为警告标记开头,同样返回[[1]]却被实际收口函数判execution_failed;空结果仍完成。claim和持久化使用合成端口,未验证整条审批链。", + "impact": "本地化、格式化或列名可改变执行状态;错误类别和retryability被压成文案。", + "counter": "当前前缀确实拦住现有多数错误;不是所有异常都被误当成功。", + "change": "明确ExecutionSuccess/ExecutionFailure或领域异常,保留empty/truncated独立语义;展示层只渲染,不参与领域判定。", + "acceptance": "警告列名、空结果、截断成功;权限、超时、语法失败具有稳定code;更换展示语言不改变QueryRun状态;统一迁移所有caller。" + }, + { + "id": "AQ-07", + "priority": "P1", + "confidence": "clean_source_wheel_build_and_import", + "title": "非editable分发缺少必需资源,构建成功不等于可使用", + "refs": [ + "pyproject.toml:49-57", + "forge/compiler.py:32-34", + "forge/__init__.py:1", + "main.py:148-154" + ], + "observed": "从018317d已跟踪源码的干净副本构建wheel成功;包内forge/schema.json不存在、templates/static文件数均0;从wheel解包目录import forge即FileNotFoundError。agent/contracts的33个JSON存在。", + "impact": "作为可独立采用的开源Runtime,标准包分发首先不能导入;当前editable安装CI掩盖资源打包缺口。", + "counter": "已验证的fresh clone/editable Quickstart不因此失效;未执行正式PyPI发布,也未声称当前发布包已被用户使用。", + "change": "明确包资源与importlib.resources访问;CI增加构建后离开源码目录的安装/CLI smoke。保留库的依赖范围,增加可复现实测约束或范围端点门禁。", + "acceptance": "wheel/sdist包含核心Schema及所声明Web资源;非源码cwd中import、compile与公开Quickstart可用;不靠editable路径补资源。" + }, + { + "id": "AQ-08", + "priority": "P2", + "confidence": "isolated_function_reproduction", + "title": "上游故障被映射成资源不存在,已有领域code在HTTP边界丢失", + "refs": [ + "web/router.py:976-980", + "web/router.py:1016-1024", + "web/pi_client.py:28-37", + "web/routes/query_runs.py:49-53" + ], + "observed": "合成task GET状态200→Web200、404→404、500/503→404 not_found;QueryRun异常已有code,但旧适配只返回error文案。", + "impact": "用户和监控采取错误的恢复动作,无法区分Task不存在、服务失联与协议错误。", + "counter": "跨scope不可见保持404是正确的;新Product BFF已有更合理错误适配可复用。", + "change": "窄的统一错误适配,保留安全code与request_id;真实not-found/不可见和upstream unavailable分开。", + "acceptance": "200/404/不可见403/500/503/invalid JSON矩阵正确;不泄露scope或raw异常。" + }, + { + "id": "AQ-09", + "priority": "P2", + "confidence": "traced_paths_and_projection_probe", + "title": "业务证据强,运维诊断和用户可见审计未串联当前主链", + "refs": [ + "main.py:38-42", + "web/pi_client.py:17-25", + "web/router.py:878-915", + "web/router.py:2474-2485", + "web/router.py:2094-2148", + "agent/audit.py:35-48", + "services/pi-orchestrator/src/stage-attempts.ts:22-42", + "web/static/product/product-pages.js:566-629" + ], + "observed": "Attempt旧flow投影丢error/model_revision/skill_policy_version;主Product详情未渲染已有attempts.safe_error。Audit页/今日legacy查询指标只读旧audit,不是Pi QueryRun的完整视图。", + "impact": "失败在哪层、哪个build、是否已花费和可否重放不能沿一条可检索链回答;日志与审计易被误解为同一种证据。", + "counter": "已有Task correlation_id、QueryRun hashes/lineage和Attempt版本;Dashboard另有governed QueryRun块,不是完全无关联或无审计。", + "change": "复用现有task/query/attempt IDs传播request/trace;结构化安全error/build/stage/usage_status;Audit做标明来源的只读联合投影,UI展示已授权safe_error。", + "acceptance": "按任一业务ID关联Web→Pi→Forge;失败区分not_started/known/unknown花费;存储失联显示partial而非0;默认不记录SQL rows/凭证。" + }, + { + "id": "AQ-10", + "priority": "P2", + "confidence": "static_call_chain", + "title": "浏览器把未知投递结果当未发送,重试生成新命令身份", + "refs": [ + "web/static/product/product-pages.js:225-235", + "web/static/product/product-pages.js:512-524", + "web/static/product/product-pages.js:668-675", + "web/router.py:938-950", + "services/pi-orchestrator/src/application.ts:433-481" + ], + "observed": "每次submit生成新message_id,Pi以该ID去重;catch保留输入但显示未发送。未真实断网复现。", + "impact": "已被Pi接受但响应丢失时重发可能新建Task和重复模型工作;不能由此断言同一SQL一定重复执行。", + "counter": "Pi已实现同event去重,QueryRun审批另有hash和幂等保护。", + "change": "浏览器保留待确认command ID,transport failure表示结果未知;重试同命令沿用同ID,不复制Task真相源。", + "acceptance": "接受后丢响应再重试只产生一个ChannelEvent/Task;更改内容才新建ID;可以回查原命令结果。" + }, + { + "id": "AQ-11", + "priority": "P2", + "confidence": "static_call_chain", + "title": "Benchmark拥有专用运行引擎,但关联Task生命周期及多owner边界未收口", + "refs": [ + "services/pi-orchestrator/src/benchmark-runtime.ts:233-261", + "services/pi-orchestrator/src/benchmark-runtime.ts:360-442", + "services/pi-orchestrator/src/benchmark-runtime.ts:590-602", + "services/pi-orchestrator/src/benchmark-runtime.ts:1082-1097", + "services/pi-orchestrator/src/benchmark-runtime.ts:1159-1169" + ], + "observed": "application调用仅createTask,run完成/失败更新Benchmark表而不推进父Task;启动即中断所有活动run,无owner判别;context/evaluate fetch缺deadline/abort。并发后果未实测。", + "impact": "Task与Benchmark展示可能矛盾;不能直接靠增加worker横向扩容;停止模型arm不等于停止挂起的下游评分请求。", + "counter": "固定预算、单派发、禁止重放模型等专用语义必须保留;不是Python争夺Pi主状态。", + "change": "保留case/evaluation算法,收口aggregate生命周期、Task关联和单owner/lease;Forge端口统一deadline/abort,不套普通Skill自动重试。", + "acceptance": "零模型运行的Task/run终态一致;并发create只有一个admitted;第二owner不干扰活动run;挂起端口能停止。" + }, + { + "id": "AQ-12", + "priority": "P2", + "confidence": "static_call_chain", + "title": "ExecutionPlan是手工同步的影子进度,失败和取消可能留下running步骤", + "refs": [ + "services/pi-orchestrator/src/planning.ts:136-208", + "services/pi-orchestrator/src/application.ts:1601-1677", + "services/pi-orchestrator/src/application.ts:1913-1928", + "services/pi-orchestrator/src/product-projection-builder.ts:196-225" + ], + "observed": "实际执行由Application方法和TaskStatus驱动,不消费depends_on调度;开始/成功更新计划,但部分失败/取消/reconcile没有计划收口。", + "impact": "新增阶段需要多处补同步,否则Task/Attempt/Plan互相矛盾。", + "counter": "当前固定模板无需通用DAG调度器;未找到外部任意图执行入口,不把多节点环检查缺少夸大成漏洞。", + "change": "明确Plan为投影,从权威Task/Attempt事件派生,或在同一Stage完成事务更新全部状态。", + "acceptance": "失败、取消、超时、恢复后计划不保留与Task终态冲突的running步骤。" + }, + { + "id": "AQ-13", + "priority": "P2", + "confidence": "AST_and_traced_imports", + "title": "依赖方向与导入生命周期混杂,单纯拆大文件不能降低耦合", + "refs": [ + "forge/bird_benchmark.py:253", + "forge/bird_benchmark.py:366", + "forge/bird_benchmark.py:537", + "web/routes/benchmark_v2.py:64-70", + "web/routes/registry_studio.py:62-65", + "web/router.py:48-70", + "forge/query_runs.py:262-266", + "agent/memory/__init__.py:120" + ], + "observed": "存在bird_benchmark↔Web benchmark路由、web.router↔registry_studio两组静态强连通导入;含函数内导入,不代表import-time崩溃。仅解析dialect也导入旧Agent/Memory生命周期。", + "impact": "CLI/核心复用被HTTP DTO和旧Agent存储牵制;关闭legacy HTTP不等于不初始化legacy依赖。", + "counter": "纯agent.contracts包名不构成坏依赖;旧EMS功能可能仍被合法管理入口使用,不应整体删除。", + "change": "业务Benchmark服务下沉、HTTP路由变薄;纯方言解析与授权上下文明确;logging/依赖装配/迁移放composition root或lifespan。沿已有web/routes模式渐进切分。", + "acceptance": "核心不依赖Web适配;禁用legacy的纯校验不初始化旧Memory;不丢tenant ACL交集;临时阻断非必需模块仍能跑核心。" + }, + { + "id": "AQ-14", + "priority": "P2", + "confidence": "static_contract_comparison", + "title": "新增一等Stage的契约和模型scope仍依赖多处手工同步", + "refs": [ + "services/pi-orchestrator/src/skills.ts:10-50", + "services/pi-orchestrator/src/skill-executor.ts:137-165", + "services/pi-orchestrator/src/model-bindings.ts:31-45", + "services/pi-orchestrator/src/artifacts.ts:19-78", + "agent/contracts/__init__.py:17-46", + "services/pi-orchestrator/src/structured-artifact-tools.ts:303-306", + "services/pi-orchestrator/scripts/export-product-projection-schema.ts:1-6" + ], + "observed": "同Advisory输出的Skill可轻量复用;新Stage需改输出工具、Artifact、Application、HTTP、planning、model scope及Python Contract。结构schema与额外领域语义并非完全等同。", + "impact": "扩展代价集中在跨契约语义一致性,不是缺少一个万能Adapter接口;已有DatabaseAdapter/LLMProviderAdapter声明不证明运行主链可插拔。", + "counter": "已有Product Projection的TypeBox导出和Governance共享反例fixture,应复用;不要取消allowlist或退化为execute(any)。", + "change": "按契约族确定现有owner;可导出的结构继续生成,跨语言业务约束用共享正反例;小型Skill/Stage描述统一身份/输出/model scope/证据要求,业务步骤保持显式。", + "acceptance": "新增Advisory与新Stage各做一次变更面演练;Python/TS消费同语料并一致接受/拒绝;model scope不靠字符串猜测。" + }, + { + "id": "AQ-15", + "priority": "P2", + "confidence": "document_and_entrypoint_comparison", + "title": "稳定架构入口仍描述旧产品主链,误导未来维护者的边界判断", + "refs": [ + "docs/architecture.md:5-43", + "docs/current-project-state.md:9-34", + "docs/product-north-star.md:68-76", + "main.py:128-146", + "web/router.py:1635-1644" + ], + "observed": "当前北极星是Trust Runtime,architecture.md仍把NL→Forge JSON及agent.agent描述为主调度。旧HTTP主流程实际受回滚开关约束。", + "impact": "新功能容易继续堆到旧Agent/巨型router;文档上的稳定入口与真实权威顺序冲突。", + "counter": "保留Chat作为渠道不等于产品定位错误;不能仅因有legacy代码就删除仍受支持的回滚能力。", + "change": "校正现状图和路径地图,明确current/legacy/experimental;退休旧能力必须按真实调用者做完整cutover。", + "acceptance": "文档能准确指出Evaluate/Enforce/Explain、Pi主Task及legacy开关;不存在第二份自称当前主架构的矛盾说明。" + }, + { + "id": "AQ-16", + "priority": "P2", + "confidence": "static_call_chain", + "title": "渠道投递与Conversation视图缺少独立的恢复边界", + "refs": [ + "web/feishu_pi.py:58-131", + "web/feishu_runtime.py:31-79", + "web/static/product/product-pages.js:440-475", + "web/static/product/product-pages.js:262-267" + ], + "observed": "飞书送达失败主要为无receipt的日志;进程alive不等于channel connected。Conversation缺少Task面板已有的epoch防乱序;前端自行禁用服务端enabled action。未做真实外部投递/浏览器乱序测试。", + "impact": "任务执行、消息送达、页面呈现三种状态容易混淆;恢复操作可能误发新任务。", + "counter": "Task不应因渠道断开而自动取消;已存在重连日志、BFF安全投影和局部epoch模式。", + "change": "将投递receipt与业务Task分离,仅重送presentation;复用现有epoch/当前ID检查;渠道能力availability由投影明确给出。", + "acceptance": "任务完成而投递失败可定位原Task并仅重送;乱序A/B响应只呈现当前对话;进程存活与渠道连接状态可区分。" + } + ], + "experiments": { + "evaluate": { + "method": "Temporary synthetic Registry; config dependency isolated; no SQL/model/network execution.", + "cases": [ + { + "name": "default_direct", + "status": "passed" + }, + { + "name": "default_forge_json", + "status": "compile_failed" + }, + { + "name": "explicit_sqlite_forge_json", + "status": "passed" + }, + { + "name": "custom_dim_user_id_direct", + "status": "passed" + }, + { + "name": "custom_dim_user_id_forge_json", + "status": "candidate_contract_invalid" + } + ] + }, + "stage_lifecycle": { + "method": "Actual OrchestratorApplication; injected non-network Skill/Forge ports; temporary SQLite and in-memory stores; sandbox denied real config/runtime/network.", + "timeout_retry": { + "memory": { + "task": "needs_input", + "attempt": "timed_out", + "artifact_count": 1, + "skill_calls": 2 + }, + "sqlite": { + "task": "clarifying", + "attempt": "timed_out", + "artifact_count": 0, + "skill_calls": 2 + } + }, + "cancel_late_result": { + "signal_aborted": false, + "memory": { + "task": "cancelled", + "attempt": "failed", + "artifact_count": 1 + }, + "sqlite": { + "task": "cancelled", + "attempt": "running", + "artifact_count": 0 + } + } + }, + "http_projection": { + "method": "Extracted unmodified route/projection functions with synthetic upstream responses; not a live HTTP/UI experiment.", + "status_pairs": [ + [ + 200, + 200 + ], + [ + 404, + 404 + ], + [ + 500, + 404 + ], + [ + 503, + 404 + ] + ], + "dropped_attempt_fields": [ + "error", + "model_revision", + "skill_policy_version" + ] + }, + "wheel": { + "wheel": "forge-0.1.0-py3-none-any.whl", + "forge_schema_present": false, + "template_files": 0, + "static_files": 0, + "agent_contract_json_files": 33, + "cli_import": { + "status": "failed", + "exception": "FileNotFoundError", + "message": "[Errno 2] No such file or directory: '/forge/schema.json'" + } + }, + "execution_result": { + "method": "Real execute_with_metadata against in-memory SQLite plus extracted unmodified approval finalizer. Claim/persistence are synthetic ports; full approval/ACL protocol not exercised.", + "cases": [ + { + "case": "ordinary", + "actual_rows": [ + [ + 1 + ] + ], + "finalizer": { + "status": "completed" + } + }, + { + "case": "warning_column_alias", + "actual_rows": [ + [ + 1 + ] + ], + "finalizer": { + "status": "failed", + "code": "execution_failed", + "error_type": "QueryRunError" + } + }, + { + "case": "empty_success", + "actual_rows": [], + "finalizer": { + "status": "completed" + } + } + ], + "model_calls": 0 + }, + "investigation_notes": [ + "Initial source archive included uv.lock, but uv.lock is intentionally gitignored and not in HEAD; retried using tracked paths only. No repository lock drift finding is asserted.", + "Initial wheel probe failed at import forge before its error capture; corrected capture and obtained the same missing-schema result.", + "Execution probe first disposed its in-memory SQLite engine on the wrong thread; fixed probe cleanup and repeated identical business results without the cleanup warning.", + "Wheel build used uv 0.10.7 and a fresh isolated backend environment; this may fetch public build dependencies. No model/provider or production-service calls were made." + ] + }, + "target_dependency_direction": [ + "HTTP/CLI/channel adapters -> application use cases -> pure domain contracts/rules.", + "Storage/SQL engine/Pi SDK implementations satisfy explicit ports; core must not import HTTP routers.", + "Pi Task/Attempt remains business execution authority; Plan/UI/Audit are typed projections, not extra task stores.", + "Benchmark keeps dedicated datasets/scoring/budget semantics but shares explicit lifecycle/transport guarantees, not generic automatic retries." + ], + "optimization_packages": [ + { + "id": "OP-1", + "name": "外部入口与分发闭环", + "findings": [ + "AQ-05", + "AQ-07" + ], + "depends_on": [], + "gate": "默认请求契约明确;非editable包在非源码目录完成CLI/Quickstart;不依赖生产配置解析。" + }, + { + "id": "OP-2", + "name": "阶段生命周期与State一致性", + "findings": [ + "AQ-01", + "AQ-02", + "AQ-03" + ], + "depends_on": [], + "gate": "内存/SQLite同场景一致,重试不重复终止attempt,取消真实传播且late result无副作用。" + }, + { + "id": "OP-3", + "name": "通用规则边界与结构化执行结果", + "findings": [ + "AQ-04", + "AQ-06" + ], + "depends_on": [], + "gate": "自定义Registry不被样例规则否决;错误不靠文案;保留旧profile和版本漂移保护。" + }, + { + "id": "OP-4", + "name": "错误传播、诊断与投递恢复", + "findings": [ + "AQ-08", + "AQ-09", + "AQ-10", + "AQ-16" + ], + "depends_on": [], + "gate": "安全error code、业务ID和request关联贯通;未知投递/未知成本不冒充未开始;重送不重跑Task。" + }, + { + "id": "OP-5", + "name": "核心边界与文档收敛", + "findings": [ + "AQ-13", + "AQ-15" + ], + "depends_on": [], + "gate": "分离纯规则与导入副作用,移除核心对Web依赖,保留授权交集;文档准确标记current/legacy。" + }, + { + "id": "OP-6", + "name": "扩展与派生状态一致性", + "findings": [ + "AQ-11", + "AQ-12", + "AQ-14" + ], + "depends_on": [ + "OP-2" + ], + "gate": "Task/Benchmark/Plan终态一致;按契约族单一owner+共享语料;单实例边界或owner保证可验证。" + } + ], + "recommended_first_batch": [ + "OP-1", + "OP-2", + "OP-3" + ], + "not_recommended": [ + "全量重写或现在拆更多微服务。", + "为减少行数把Evaluate、Enforce、Explain折叠为万能处理器。", + "把所有Store改成万能Repository,或用no-op事务迁就测试。", + "取消Skill allowlist/审批/失败关闭,或将全部lint降为warning。", + "为了统一模块而重写既有历史成绩、偷偷继续付费实验或把旧协议改成新运行。" + ], + "verification_limits": [ + "No full suite was rerun for an assessment-only task. The previous green release CI does not refute the newly exercised edge cases.", + "No production load, multi-process ownership, real customer database, live provider/Feishu/Dingtalk or browser visual testing. Static concurrency/delivery/UI risks remain hypotheses, clearly separated from reproduced failures.", + "Every recommendation requires a scoped implementation decision; no architecture migration is authorized by this report alone." + ] +} diff --git a/docs/archive/engineering/candidate-documentation-publication-audit-2026-09-08.json b/docs/archive/engineering/candidate-documentation-publication-audit-2026-09-08.json new file mode 100644 index 0000000..1602682 --- /dev/null +++ b/docs/archive/engineering/candidate-documentation-publication-audit-2026-09-08.json @@ -0,0 +1,19 @@ +{ + "candidate_path_count": 556, + "excluded_paths": [], + "documentation_files_scanned": 107, + "findings": [ + { + "path": "docs/archive/engineering/golden-journey-acceptance-2026-08-24.md", + "line": 122, + "kind": "personal_absolute_path" + }, + { + "path": "docs/requirements-pool.md", + "line": 443, + "kind": "personal_absolute_path" + } + ], + "archive_files_hash_matched": 84, + "limitations": "Bounded pattern scan of changed/new public documentation; not an independent security certification. Private originals and existing excluded runtime assets were not inspected." +} diff --git a/docs/archive/engineering/candidate-pi-web-publication-audit-2026-09-08.json b/docs/archive/engineering/candidate-pi-web-publication-audit-2026-09-08.json new file mode 100644 index 0000000..3516475 --- /dev/null +++ b/docs/archive/engineering/candidate-pi-web-publication-audit-2026-09-08.json @@ -0,0 +1,662 @@ +{ + "baseline_head": "018317d89edfa0f56c48c865f35c9a45204d9d11", + "scope": "Publication-scope/sensitive-content review only: changed/new Pi orchestrator, web, demo, manual benchmark tooling, plus deleted public benchmark source predecessors.", + "status": "completed_with_inherited_low_severity_finding", + "reviewed_paths": [ + "demo/seed.py", + "demo/seed_mock_data.py", + "services/pi-orchestrator/README.md", + "services/pi-orchestrator/package.json", + "services/pi-orchestrator/scripts/export-structured-artifact-schemas.ts", + "services/pi-orchestrator/src/application.ts", + "services/pi-orchestrator/src/artifacts.ts", + "services/pi-orchestrator/src/benchmark-contracts.ts", + "services/pi-orchestrator/src/benchmark-runtime.ts", + "services/pi-orchestrator/src/channels/event-store.ts", + "services/pi-orchestrator/src/contracts.ts", + "services/pi-orchestrator/src/forge/client.ts", + "services/pi-orchestrator/src/forge/query-run-client.ts", + "services/pi-orchestrator/src/model-bindings.ts", + "services/pi-orchestrator/src/orchestrator-state.ts", + "services/pi-orchestrator/src/planning.ts", + "services/pi-orchestrator/src/product-projection-builder.ts", + "services/pi-orchestrator/src/product-projections.ts", + "services/pi-orchestrator/src/request-context.ts", + "services/pi-orchestrator/src/server.ts", + "services/pi-orchestrator/src/skill-executor.ts", + "services/pi-orchestrator/src/skill-policy.ts", + "services/pi-orchestrator/src/skills.ts", + "services/pi-orchestrator/src/sqlite-store.ts", + "services/pi-orchestrator/src/stage-attempts.ts", + "services/pi-orchestrator/src/stage-descriptors.ts", + "services/pi-orchestrator/src/structured-artifact-tools.ts", + "services/pi-orchestrator/src/task-events.ts", + "services/pi-orchestrator/src/task-store.ts", + "services/pi-orchestrator/tests/application.test.ts", + "services/pi-orchestrator/tests/benchmark-runtime.test.ts", + "services/pi-orchestrator/tests/channels.test.ts", + "services/pi-orchestrator/tests/model-bindings.test.ts", + "services/pi-orchestrator/tests/product-projections.test.ts", + "services/pi-orchestrator/tests/server.test.ts", + "services/pi-orchestrator/tests/sqlite-store.test.ts", + "services/pi-orchestrator/tests/stage-lifecycle.test.ts", + "services/pi-orchestrator/tests/structured-contracts.test.ts", + "services/pi-orchestrator/tests/structured-skills.test.ts", + "tests/accuracy/build_context.py", + "tests/accuracy/compare.py", + "tests/accuracy/evaluate_ea.py", + "tests/accuracy/generate_cases.py", + "tests/accuracy/generate_cases_large.py", + "tests/accuracy/grade.py", + "tests/accuracy/methods/__init__.py", + "tests/accuracy/methods/legacy/method_a.py", + "tests/accuracy/methods/legacy/method_d.py", + "tests/accuracy/methods/legacy/method_e.py", + "tests/accuracy/methods/legacy/method_f.py", + "tests/accuracy/methods/legacy/method_h.py", + "tests/accuracy/methods/legacy/method_i.py", + "tests/accuracy/methods/method_aa.py", + "tests/accuracy/methods/method_ab.py", + "tests/accuracy/methods/method_ac.py", + "tests/accuracy/methods/method_ad.py", + "tests/accuracy/methods/method_ae.py", + "tests/accuracy/methods/method_af.py", + "tests/accuracy/methods/method_ag.py", + "tests/accuracy/methods/method_ah.py", + "tests/accuracy/methods/method_ai.py", + "tests/accuracy/methods/method_b.py", + "tests/accuracy/methods/method_b_large.py", + "tests/accuracy/methods/method_b_large_sem.py", + "tests/accuracy/methods/method_b_qwen.py", + "tests/accuracy/methods/method_b_sem.py", + "tests/accuracy/methods/method_g.py", + "tests/accuracy/methods/method_j.py", + "tests/accuracy/methods/method_j_sem.py", + "tests/accuracy/methods/method_k.py", + "tests/accuracy/methods/method_l.py", + "tests/accuracy/methods/method_m.py", + "tests/accuracy/methods/method_n.py", + "tests/accuracy/methods/method_o.py", + "tests/accuracy/methods/method_p.py", + "tests/accuracy/methods/method_q.py", + "tests/accuracy/methods/method_r.py", + "tests/accuracy/methods/method_s.py", + "tests/accuracy/methods/method_t.py", + "tests/accuracy/methods/method_u.py", + "tests/accuracy/methods/method_v.py", + "tests/accuracy/methods/method_w.py", + "tests/accuracy/methods/method_x.py", + "tests/accuracy/methods/method_y.py", + "tests/accuracy/methods/method_z.py", + "tests/accuracy/results/cases_large.json", + "tests/accuracy/results/method_k/report_2026-03-15_185406.md", + "tests/accuracy/run_claude_direct.py", + "tests/accuracy/runner.py", + "tests/accuracy/semantic_lib.py", + "tests/accuracy/triage_failures.py", + "tests/benchmark/cases.json", + "tests/benchmark/create_db.py", + "tests/benchmark/demo_retrieval.py", + "tests/benchmark/gold/C01.csv", + "tests/benchmark/gold/C02.csv", + "tests/benchmark/gold/C03.csv", + "tests/benchmark/gold/C04.csv", + "tests/benchmark/gold/C05.csv", + "tests/benchmark/gold/C06.csv", + "tests/benchmark/gold/C07.csv", + "tests/benchmark/gold/C08.csv", + "tests/benchmark/gold/C09.csv", + "tests/benchmark/gold/C10.csv", + "tests/benchmark/gold/C11.csv", + "tests/benchmark/gold/C12.csv", + "tests/benchmark/gold/C13.csv", + "tests/benchmark/gold/C14.csv", + "tests/benchmark/gold/C15.csv", + "tests/benchmark/gold/C16.csv", + "tests/benchmark/gold/C17.csv", + "tests/benchmark/gold/C18.csv", + "tests/benchmark/gold/C19.csv", + "tests/benchmark/gold/C20.csv", + "tests/benchmark/gold/C21.csv", + "tests/benchmark/gold/C22.csv", + "tests/benchmark/gold/C23.csv", + "tests/benchmark/gold/C24.csv", + "tests/benchmark/gold/C25.csv", + "tests/benchmark/gold/C26.csv", + "tests/benchmark/gold/C27.csv", + "tests/benchmark/gold/C28.csv", + "tests/benchmark/gold/C29.csv", + "tests/benchmark/gold/C30.csv", + "tests/benchmark/gold/C31.csv", + "tests/benchmark/gold/C32.csv", + "tests/benchmark/gold/C33.csv", + "tests/benchmark/gold/C34.csv", + "tests/benchmark/gold/C35.csv", + "tests/benchmark/gold/C36.csv", + "tests/benchmark/gold/C37.csv", + "tests/benchmark/gold/C38.csv", + "tests/benchmark/gold/C39.csv", + "tests/benchmark/gold/C40.csv", + "tests/benchmark/report.py", + "tests/benchmark/runner.py", + "tests/spider2/__init__.py", + "tests/spider2/evaluate.py", + "tests/spider2/prompts.py", + "tests/spider2/run_siliconflow.sh", + "tests/spider2/runner.py", + "tests/spider2/setup.py", + "tests/text-to-sql-failures/A-join-traps.md", + "tests/text-to-sql-failures/B-aggregation-traps.md", + "tests/text-to-sql-failures/C-time-traps.md", + "tests/text-to-sql-failures/D-semantic-traps.md", + "tests/text-to-sql-failures/E-dialect-traps.md", + "tests/text-to-sql-failures/README.md", + "tests/text-to-sql-failures/create_db.py", + "tests/text-to-sql-failures/run_ea.py", + "tools/benchmarks/accuracy/build_context.py", + "tools/benchmarks/accuracy/cases_large.json", + "tools/benchmarks/accuracy/compare.py", + "tools/benchmarks/accuracy/evaluate_ea.py", + "tools/benchmarks/accuracy/generate_cases.py", + "tools/benchmarks/accuracy/generate_cases_large.py", + "tools/benchmarks/accuracy/grade.py", + "tools/benchmarks/accuracy/methods/__init__.py", + "tools/benchmarks/accuracy/methods/legacy/method_a.py", + "tools/benchmarks/accuracy/methods/legacy/method_d.py", + "tools/benchmarks/accuracy/methods/legacy/method_e.py", + "tools/benchmarks/accuracy/methods/legacy/method_f.py", + "tools/benchmarks/accuracy/methods/legacy/method_h.py", + "tools/benchmarks/accuracy/methods/legacy/method_i.py", + "tools/benchmarks/accuracy/methods/method_aa.py", + "tools/benchmarks/accuracy/methods/method_ab.py", + "tools/benchmarks/accuracy/methods/method_ac.py", + "tools/benchmarks/accuracy/methods/method_ad.py", + "tools/benchmarks/accuracy/methods/method_ae.py", + "tools/benchmarks/accuracy/methods/method_af.py", + "tools/benchmarks/accuracy/methods/method_ag.py", + "tools/benchmarks/accuracy/methods/method_ah.py", + "tools/benchmarks/accuracy/methods/method_ai.py", + "tools/benchmarks/accuracy/methods/method_b.py", + "tools/benchmarks/accuracy/methods/method_b_large.py", + "tools/benchmarks/accuracy/methods/method_b_large_sem.py", + "tools/benchmarks/accuracy/methods/method_b_qwen.py", + "tools/benchmarks/accuracy/methods/method_b_sem.py", + "tools/benchmarks/accuracy/methods/method_g.py", + "tools/benchmarks/accuracy/methods/method_j.py", + "tools/benchmarks/accuracy/methods/method_j_sem.py", + "tools/benchmarks/accuracy/methods/method_k.py", + "tools/benchmarks/accuracy/methods/method_l.py", + "tools/benchmarks/accuracy/methods/method_m.py", + "tools/benchmarks/accuracy/methods/method_n.py", + "tools/benchmarks/accuracy/methods/method_o.py", + "tools/benchmarks/accuracy/methods/method_p.py", + "tools/benchmarks/accuracy/methods/method_q.py", + "tools/benchmarks/accuracy/methods/method_r.py", + "tools/benchmarks/accuracy/methods/method_s.py", + "tools/benchmarks/accuracy/methods/method_t.py", + "tools/benchmarks/accuracy/methods/method_u.py", + "tools/benchmarks/accuracy/methods/method_v.py", + "tools/benchmarks/accuracy/methods/method_w.py", + "tools/benchmarks/accuracy/methods/method_x.py", + "tools/benchmarks/accuracy/methods/method_y.py", + "tools/benchmarks/accuracy/methods/method_z.py", + "tools/benchmarks/accuracy/run_claude_direct.py", + "tools/benchmarks/accuracy/runner.py", + "tools/benchmarks/accuracy/semantic_lib.py", + "tools/benchmarks/accuracy/triage_failures.py", + "tools/benchmarks/spider2/__init__.py", + "tools/benchmarks/spider2/evaluate.py", + "tools/benchmarks/spider2/prompts.py", + "tools/benchmarks/spider2/run_siliconflow.sh", + "tools/benchmarks/spider2/runner.py", + "tools/benchmarks/spider2/setup.py", + "tools/benchmarks/synthetic/cases.json", + "tools/benchmarks/synthetic/create_db.py", + "tools/benchmarks/synthetic/demo_retrieval.py", + "tools/benchmarks/synthetic/gold/C01.csv", + "tools/benchmarks/synthetic/gold/C02.csv", + "tools/benchmarks/synthetic/gold/C03.csv", + "tools/benchmarks/synthetic/gold/C04.csv", + "tools/benchmarks/synthetic/gold/C05.csv", + "tools/benchmarks/synthetic/gold/C06.csv", + "tools/benchmarks/synthetic/gold/C07.csv", + "tools/benchmarks/synthetic/gold/C08.csv", + "tools/benchmarks/synthetic/gold/C09.csv", + "tools/benchmarks/synthetic/gold/C10.csv", + "tools/benchmarks/synthetic/gold/C11.csv", + "tools/benchmarks/synthetic/gold/C12.csv", + "tools/benchmarks/synthetic/gold/C13.csv", + "tools/benchmarks/synthetic/gold/C14.csv", + "tools/benchmarks/synthetic/gold/C15.csv", + "tools/benchmarks/synthetic/gold/C16.csv", + "tools/benchmarks/synthetic/gold/C17.csv", + "tools/benchmarks/synthetic/gold/C18.csv", + "tools/benchmarks/synthetic/gold/C19.csv", + "tools/benchmarks/synthetic/gold/C20.csv", + "tools/benchmarks/synthetic/gold/C21.csv", + "tools/benchmarks/synthetic/gold/C22.csv", + "tools/benchmarks/synthetic/gold/C23.csv", + "tools/benchmarks/synthetic/gold/C24.csv", + "tools/benchmarks/synthetic/gold/C25.csv", + "tools/benchmarks/synthetic/gold/C26.csv", + "tools/benchmarks/synthetic/gold/C27.csv", + "tools/benchmarks/synthetic/gold/C28.csv", + "tools/benchmarks/synthetic/gold/C29.csv", + "tools/benchmarks/synthetic/gold/C30.csv", + "tools/benchmarks/synthetic/gold/C31.csv", + "tools/benchmarks/synthetic/gold/C32.csv", + "tools/benchmarks/synthetic/gold/C33.csv", + "tools/benchmarks/synthetic/gold/C34.csv", + "tools/benchmarks/synthetic/gold/C35.csv", + "tools/benchmarks/synthetic/gold/C36.csv", + "tools/benchmarks/synthetic/gold/C37.csv", + "tools/benchmarks/synthetic/gold/C38.csv", + "tools/benchmarks/synthetic/gold/C39.csv", + "tools/benchmarks/synthetic/gold/C40.csv", + "tools/benchmarks/synthetic/report.py", + "tools/benchmarks/synthetic/runner.py", + "tools/benchmarks/text_to_sql_failures/A-join-traps.md", + "tools/benchmarks/text_to_sql_failures/B-aggregation-traps.md", + "tools/benchmarks/text_to_sql_failures/C-time-traps.md", + "tools/benchmarks/text_to_sql_failures/D-semantic-traps.md", + "tools/benchmarks/text_to_sql_failures/E-dialect-traps.md", + "tools/benchmarks/text_to_sql_failures/README.md", + "tools/benchmarks/text_to_sql_failures/create_db.py", + "tools/benchmarks/text_to_sql_failures/run_ea.py", + "web/channel_delivery.py", + "web/diagnostics.py", + "web/feishu.py", + "web/feishu_pi.py", + "web/feishu_runtime.py", + "web/pi_channel.py", + "web/pi_client.py", + "web/router.py", + "web/routes/accuracy_benchmark.py", + "web/routes/benchmark_v2.py", + "web/routes/deliveries.py", + "web/routes/evaluate.py", + "web/routes/product.py", + "web/routes/query_runs.py", + "web/routes/registry_studio.py", + "web/routes/settings.py", + "web/static/product/product-pages.js", + "web/static/product/product-shell.js", + "web/static/product/product.css", + "web/templates.py", + "web/templates/audit.html", + "web/templates/dashboard.html", + "web/templates/product_base.html", + "web/templates/product_chat.html", + "web/templates/product_data.html", + "web/templates/product_reports.html", + "web/templates/product_task_detail.html", + "web/templates/product_tasks.html", + "web/templates/product_workspace.html", + "web/templates/settings.html" + ], + "checks": [ + { + "name": "candidate_path_scope", + "status": "pass", + "candidate_paths": 290, + "current_public_content_paths": 179, + "deleted_public_source_predecessors": 69, + "path_only_excluded_predecessors": 42, + "new_runtime_or_private_asset_paths": [], + "source_symlinks": [], + "detail": "No new .env, forge.yaml, .forge, .runtime, downloaded data, benchmark execution results, database, cache, build, dependency, or credential assets occur in this candidate slice. Paths naming results are deleted predecessors only and were not opened." + }, + { + "name": "full_public_source_and_artifact_scan", + "status": "pass", + "current_files": 179, + "current_lines": 36908, + "scan_manifest_sha256": "3cafac6138e832f745806a0e72abc2975c2cf6e8bdf7e46696967d9e696f0eac", + "detail": "Full text scanned for literal credentials, provider token shapes, private keys, JWTs, credential-bearing URLs, long opaque literals, absolute personal paths, private hosts and email addresses. No live-looking credential or private literal dataset identified; findings remain heuristic rather than a guarantee of absence." + }, + { + "name": "manual_tool_relocation_baseline", + "status": "pass", + "baseline_public_files": 71, + "detail": "Scanned 69 deleted public source/document predecessors at the baseline, plus baseline web/feishu.py and scripts/seed_mock_data.py for suspicious-literal provenance. All 69 deleted public source predecessors are absent from working-tree paths. Original results, data and database contents were never accessed." + }, + { + "name": "credential_and_endpoint_triage", + "status": "pass", + "detail": "Shell API-key assignments are environment-variable references, not embedded keys. Historical external API URLs in relocated tools have identical baseline source lines. New test URLs are reserved test/invalid/example hosts or local service names. Settings connection URLs use illustrative placeholders. No credential values are included in this report." + }, + { + "name": "synthetic_fixture_provenance", + "status": "pass", + "detail": "Demo/mock seed files explicitly define synthetic users and business data. The internal-wiki URL and token placeholder are an inherited, disabled mock fixture, not evidence of a live secret. Channel traceback absolute path is deliberately synthetic redaction-test input. Two 40-case JSON fixtures contain questions/reference SQL for synthetic demo schemas rather than private execution records." + }, + { + "name": "authorized_new_gold_artifacts", + "status": "pass", + "csv_files": 40, + "csv_lines": 549, + "case_ids_match_filenames": true, + "malformed_row_width_files": [], + "detail": "Only NEW tools/benchmarks/synthetic/gold CSV contents were scanned, per parent authorization. Their public synthetic provenance is documented by the accompanying create_db.py; all 40 CSVs parse with consistent row widths. No database or old gold/result content was read or executed." + }, + { + "name": "schema_exporter_publication_scope", + "status": "pass", + "detail": "The changed exporter writes schemas from the public structuredArtifactSchemas definition into agent/contracts. It does not embed local runtime state or credential/config values. Generated agent/contracts files are owned by the sibling publication review; exporter was inspected but not run." + } + ], + "findings": [ + { + "severity": "low", + "path": "web/feishu.py", + "line": 782, + "reason": "A hard-coded RFC1918 address remains in the chart URL fallback. The identical literal exists at baseline line 775; this is inherited internal-endpoint publication hygiene, not a newly introduced credential. Address is intentionally redacted. Do not infer a live secret or a newly introduced blocker from this finding." + } + ], + "limits": [ + "Read-only static publication review; no architecture re-audit, model calls, network validation, application execution, or full-suite rerun.", + "Did not open .env, forge.yaml, .forge, .runtime, credentials, any database, tests/accuracy/results content, any downloaded data directory, or original gold CSV files.", + "42 excluded predecessor paths received filename/scope review only: 2 original results paths and 40 old gold CSV paths. Current synthetic gold CSVs were separately authorized and scanned.", + "No changes to source/docs, staging, commits, push, merge, release/tag/deploy, config, database or original historical reports. Only the assigned temporary JSON report is written.", + "Static patterns and contextual source review cannot establish whether every arbitrary literal is sensitive or whether an endpoint remains live. Historical public API URLs and explicit synthetic values are not treated as live secrets.", + "The current-content digest is calculated from sorted path plus per-file SHA-256 entries for the 179 scanned working-tree files; baseline sources are not part of that digest." + ], + "content_reviewed_paths": [ + "demo/seed.py", + "demo/seed_mock_data.py", + "services/pi-orchestrator/README.md", + "services/pi-orchestrator/package.json", + "services/pi-orchestrator/scripts/export-structured-artifact-schemas.ts", + "services/pi-orchestrator/src/application.ts", + "services/pi-orchestrator/src/artifacts.ts", + "services/pi-orchestrator/src/benchmark-contracts.ts", + "services/pi-orchestrator/src/benchmark-runtime.ts", + "services/pi-orchestrator/src/channels/event-store.ts", + "services/pi-orchestrator/src/contracts.ts", + "services/pi-orchestrator/src/forge/client.ts", + "services/pi-orchestrator/src/forge/query-run-client.ts", + "services/pi-orchestrator/src/model-bindings.ts", + "services/pi-orchestrator/src/orchestrator-state.ts", + "services/pi-orchestrator/src/planning.ts", + "services/pi-orchestrator/src/product-projection-builder.ts", + "services/pi-orchestrator/src/product-projections.ts", + "services/pi-orchestrator/src/request-context.ts", + "services/pi-orchestrator/src/server.ts", + "services/pi-orchestrator/src/skill-executor.ts", + "services/pi-orchestrator/src/skill-policy.ts", + "services/pi-orchestrator/src/skills.ts", + "services/pi-orchestrator/src/sqlite-store.ts", + "services/pi-orchestrator/src/stage-attempts.ts", + "services/pi-orchestrator/src/stage-descriptors.ts", + "services/pi-orchestrator/src/structured-artifact-tools.ts", + "services/pi-orchestrator/src/task-events.ts", + "services/pi-orchestrator/src/task-store.ts", + "services/pi-orchestrator/tests/application.test.ts", + "services/pi-orchestrator/tests/benchmark-runtime.test.ts", + "services/pi-orchestrator/tests/channels.test.ts", + "services/pi-orchestrator/tests/model-bindings.test.ts", + "services/pi-orchestrator/tests/product-projections.test.ts", + "services/pi-orchestrator/tests/server.test.ts", + "services/pi-orchestrator/tests/sqlite-store.test.ts", + "services/pi-orchestrator/tests/stage-lifecycle.test.ts", + "services/pi-orchestrator/tests/structured-contracts.test.ts", + "services/pi-orchestrator/tests/structured-skills.test.ts", + "tools/benchmarks/accuracy/build_context.py", + "tools/benchmarks/accuracy/cases_large.json", + "tools/benchmarks/accuracy/compare.py", + "tools/benchmarks/accuracy/evaluate_ea.py", + "tools/benchmarks/accuracy/generate_cases.py", + "tools/benchmarks/accuracy/generate_cases_large.py", + "tools/benchmarks/accuracy/grade.py", + "tools/benchmarks/accuracy/methods/__init__.py", + "tools/benchmarks/accuracy/methods/legacy/method_a.py", + "tools/benchmarks/accuracy/methods/legacy/method_d.py", + "tools/benchmarks/accuracy/methods/legacy/method_e.py", + "tools/benchmarks/accuracy/methods/legacy/method_f.py", + "tools/benchmarks/accuracy/methods/legacy/method_h.py", + "tools/benchmarks/accuracy/methods/legacy/method_i.py", + "tools/benchmarks/accuracy/methods/method_aa.py", + "tools/benchmarks/accuracy/methods/method_ab.py", + "tools/benchmarks/accuracy/methods/method_ac.py", + "tools/benchmarks/accuracy/methods/method_ad.py", + "tools/benchmarks/accuracy/methods/method_ae.py", + "tools/benchmarks/accuracy/methods/method_af.py", + "tools/benchmarks/accuracy/methods/method_ag.py", + "tools/benchmarks/accuracy/methods/method_ah.py", + "tools/benchmarks/accuracy/methods/method_ai.py", + "tools/benchmarks/accuracy/methods/method_b.py", + "tools/benchmarks/accuracy/methods/method_b_large.py", + "tools/benchmarks/accuracy/methods/method_b_large_sem.py", + "tools/benchmarks/accuracy/methods/method_b_qwen.py", + "tools/benchmarks/accuracy/methods/method_b_sem.py", + "tools/benchmarks/accuracy/methods/method_g.py", + "tools/benchmarks/accuracy/methods/method_j.py", + "tools/benchmarks/accuracy/methods/method_j_sem.py", + "tools/benchmarks/accuracy/methods/method_k.py", + "tools/benchmarks/accuracy/methods/method_l.py", + "tools/benchmarks/accuracy/methods/method_m.py", + "tools/benchmarks/accuracy/methods/method_n.py", + "tools/benchmarks/accuracy/methods/method_o.py", + "tools/benchmarks/accuracy/methods/method_p.py", + "tools/benchmarks/accuracy/methods/method_q.py", + "tools/benchmarks/accuracy/methods/method_r.py", + "tools/benchmarks/accuracy/methods/method_s.py", + "tools/benchmarks/accuracy/methods/method_t.py", + "tools/benchmarks/accuracy/methods/method_u.py", + "tools/benchmarks/accuracy/methods/method_v.py", + "tools/benchmarks/accuracy/methods/method_w.py", + "tools/benchmarks/accuracy/methods/method_x.py", + "tools/benchmarks/accuracy/methods/method_y.py", + "tools/benchmarks/accuracy/methods/method_z.py", + "tools/benchmarks/accuracy/run_claude_direct.py", + "tools/benchmarks/accuracy/runner.py", + "tools/benchmarks/accuracy/semantic_lib.py", + "tools/benchmarks/accuracy/triage_failures.py", + "tools/benchmarks/spider2/__init__.py", + "tools/benchmarks/spider2/evaluate.py", + "tools/benchmarks/spider2/prompts.py", + "tools/benchmarks/spider2/run_siliconflow.sh", + "tools/benchmarks/spider2/runner.py", + "tools/benchmarks/spider2/setup.py", + "tools/benchmarks/synthetic/cases.json", + "tools/benchmarks/synthetic/create_db.py", + "tools/benchmarks/synthetic/demo_retrieval.py", + "tools/benchmarks/synthetic/gold/C01.csv", + "tools/benchmarks/synthetic/gold/C02.csv", + "tools/benchmarks/synthetic/gold/C03.csv", + "tools/benchmarks/synthetic/gold/C04.csv", + "tools/benchmarks/synthetic/gold/C05.csv", + "tools/benchmarks/synthetic/gold/C06.csv", + "tools/benchmarks/synthetic/gold/C07.csv", + "tools/benchmarks/synthetic/gold/C08.csv", + "tools/benchmarks/synthetic/gold/C09.csv", + "tools/benchmarks/synthetic/gold/C10.csv", + "tools/benchmarks/synthetic/gold/C11.csv", + "tools/benchmarks/synthetic/gold/C12.csv", + "tools/benchmarks/synthetic/gold/C13.csv", + "tools/benchmarks/synthetic/gold/C14.csv", + "tools/benchmarks/synthetic/gold/C15.csv", + "tools/benchmarks/synthetic/gold/C16.csv", + "tools/benchmarks/synthetic/gold/C17.csv", + "tools/benchmarks/synthetic/gold/C18.csv", + "tools/benchmarks/synthetic/gold/C19.csv", + "tools/benchmarks/synthetic/gold/C20.csv", + "tools/benchmarks/synthetic/gold/C21.csv", + "tools/benchmarks/synthetic/gold/C22.csv", + "tools/benchmarks/synthetic/gold/C23.csv", + "tools/benchmarks/synthetic/gold/C24.csv", + "tools/benchmarks/synthetic/gold/C25.csv", + "tools/benchmarks/synthetic/gold/C26.csv", + "tools/benchmarks/synthetic/gold/C27.csv", + "tools/benchmarks/synthetic/gold/C28.csv", + "tools/benchmarks/synthetic/gold/C29.csv", + "tools/benchmarks/synthetic/gold/C30.csv", + "tools/benchmarks/synthetic/gold/C31.csv", + "tools/benchmarks/synthetic/gold/C32.csv", + "tools/benchmarks/synthetic/gold/C33.csv", + "tools/benchmarks/synthetic/gold/C34.csv", + "tools/benchmarks/synthetic/gold/C35.csv", + "tools/benchmarks/synthetic/gold/C36.csv", + "tools/benchmarks/synthetic/gold/C37.csv", + "tools/benchmarks/synthetic/gold/C38.csv", + "tools/benchmarks/synthetic/gold/C39.csv", + "tools/benchmarks/synthetic/gold/C40.csv", + "tools/benchmarks/synthetic/report.py", + "tools/benchmarks/synthetic/runner.py", + "tools/benchmarks/text_to_sql_failures/A-join-traps.md", + "tools/benchmarks/text_to_sql_failures/B-aggregation-traps.md", + "tools/benchmarks/text_to_sql_failures/C-time-traps.md", + "tools/benchmarks/text_to_sql_failures/D-semantic-traps.md", + "tools/benchmarks/text_to_sql_failures/E-dialect-traps.md", + "tools/benchmarks/text_to_sql_failures/README.md", + "tools/benchmarks/text_to_sql_failures/create_db.py", + "tools/benchmarks/text_to_sql_failures/run_ea.py", + "web/channel_delivery.py", + "web/diagnostics.py", + "web/feishu.py", + "web/feishu_pi.py", + "web/feishu_runtime.py", + "web/pi_channel.py", + "web/pi_client.py", + "web/router.py", + "web/routes/accuracy_benchmark.py", + "web/routes/benchmark_v2.py", + "web/routes/deliveries.py", + "web/routes/evaluate.py", + "web/routes/product.py", + "web/routes/query_runs.py", + "web/routes/registry_studio.py", + "web/routes/settings.py", + "web/static/product/product-pages.js", + "web/static/product/product-shell.js", + "web/static/product/product.css", + "web/templates.py", + "web/templates/audit.html", + "web/templates/dashboard.html", + "web/templates/product_base.html", + "web/templates/product_chat.html", + "web/templates/product_data.html", + "web/templates/product_reports.html", + "web/templates/product_task_detail.html", + "web/templates/product_tasks.html", + "web/templates/product_workspace.html", + "web/templates/settings.html" + ], + "baseline_content_reviewed_paths": [ + "scripts/seed_mock_data.py", + "tests/accuracy/build_context.py", + "tests/accuracy/compare.py", + "tests/accuracy/evaluate_ea.py", + "tests/accuracy/generate_cases.py", + "tests/accuracy/generate_cases_large.py", + "tests/accuracy/grade.py", + "tests/accuracy/methods/__init__.py", + "tests/accuracy/methods/legacy/method_a.py", + "tests/accuracy/methods/legacy/method_d.py", + "tests/accuracy/methods/legacy/method_e.py", + "tests/accuracy/methods/legacy/method_f.py", + "tests/accuracy/methods/legacy/method_h.py", + "tests/accuracy/methods/legacy/method_i.py", + "tests/accuracy/methods/method_aa.py", + "tests/accuracy/methods/method_ab.py", + "tests/accuracy/methods/method_ac.py", + "tests/accuracy/methods/method_ad.py", + "tests/accuracy/methods/method_ae.py", + "tests/accuracy/methods/method_af.py", + "tests/accuracy/methods/method_ag.py", + "tests/accuracy/methods/method_ah.py", + "tests/accuracy/methods/method_ai.py", + "tests/accuracy/methods/method_b.py", + "tests/accuracy/methods/method_b_large.py", + "tests/accuracy/methods/method_b_large_sem.py", + "tests/accuracy/methods/method_b_qwen.py", + "tests/accuracy/methods/method_b_sem.py", + "tests/accuracy/methods/method_g.py", + "tests/accuracy/methods/method_j.py", + "tests/accuracy/methods/method_j_sem.py", + "tests/accuracy/methods/method_k.py", + "tests/accuracy/methods/method_l.py", + "tests/accuracy/methods/method_m.py", + "tests/accuracy/methods/method_n.py", + "tests/accuracy/methods/method_o.py", + "tests/accuracy/methods/method_p.py", + "tests/accuracy/methods/method_q.py", + "tests/accuracy/methods/method_r.py", + "tests/accuracy/methods/method_s.py", + "tests/accuracy/methods/method_t.py", + "tests/accuracy/methods/method_u.py", + "tests/accuracy/methods/method_v.py", + "tests/accuracy/methods/method_w.py", + "tests/accuracy/methods/method_x.py", + "tests/accuracy/methods/method_y.py", + "tests/accuracy/methods/method_z.py", + "tests/accuracy/run_claude_direct.py", + "tests/accuracy/runner.py", + "tests/accuracy/semantic_lib.py", + "tests/accuracy/triage_failures.py", + "tests/benchmark/cases.json", + "tests/benchmark/create_db.py", + "tests/benchmark/demo_retrieval.py", + "tests/benchmark/report.py", + "tests/benchmark/runner.py", + "tests/spider2/__init__.py", + "tests/spider2/evaluate.py", + "tests/spider2/prompts.py", + "tests/spider2/run_siliconflow.sh", + "tests/spider2/runner.py", + "tests/spider2/setup.py", + "tests/text-to-sql-failures/A-join-traps.md", + "tests/text-to-sql-failures/B-aggregation-traps.md", + "tests/text-to-sql-failures/C-time-traps.md", + "tests/text-to-sql-failures/D-semantic-traps.md", + "tests/text-to-sql-failures/E-dialect-traps.md", + "tests/text-to-sql-failures/README.md", + "tests/text-to-sql-failures/create_db.py", + "tests/text-to-sql-failures/run_ea.py", + "web/feishu.py" + ], + "path_only_excluded_paths": [ + "tests/accuracy/results/cases_large.json", + "tests/accuracy/results/method_k/report_2026-03-15_185406.md", + "tests/benchmark/gold/C01.csv", + "tests/benchmark/gold/C02.csv", + "tests/benchmark/gold/C03.csv", + "tests/benchmark/gold/C04.csv", + "tests/benchmark/gold/C05.csv", + "tests/benchmark/gold/C06.csv", + "tests/benchmark/gold/C07.csv", + "tests/benchmark/gold/C08.csv", + "tests/benchmark/gold/C09.csv", + "tests/benchmark/gold/C10.csv", + "tests/benchmark/gold/C11.csv", + "tests/benchmark/gold/C12.csv", + "tests/benchmark/gold/C13.csv", + "tests/benchmark/gold/C14.csv", + "tests/benchmark/gold/C15.csv", + "tests/benchmark/gold/C16.csv", + "tests/benchmark/gold/C17.csv", + "tests/benchmark/gold/C18.csv", + "tests/benchmark/gold/C19.csv", + "tests/benchmark/gold/C20.csv", + "tests/benchmark/gold/C21.csv", + "tests/benchmark/gold/C22.csv", + "tests/benchmark/gold/C23.csv", + "tests/benchmark/gold/C24.csv", + "tests/benchmark/gold/C25.csv", + "tests/benchmark/gold/C26.csv", + "tests/benchmark/gold/C27.csv", + "tests/benchmark/gold/C28.csv", + "tests/benchmark/gold/C29.csv", + "tests/benchmark/gold/C30.csv", + "tests/benchmark/gold/C31.csv", + "tests/benchmark/gold/C32.csv", + "tests/benchmark/gold/C33.csv", + "tests/benchmark/gold/C34.csv", + "tests/benchmark/gold/C35.csv", + "tests/benchmark/gold/C36.csv", + "tests/benchmark/gold/C37.csv", + "tests/benchmark/gold/C38.csv", + "tests/benchmark/gold/C39.csv", + "tests/benchmark/gold/C40.csv" + ] +} diff --git a/docs/archive/engineering/candidate-python-publication-audit-2026-09-08.json b/docs/archive/engineering/candidate-python-publication-audit-2026-09-08.json new file mode 100644 index 0000000..a54674c --- /dev/null +++ b/docs/archive/engineering/candidate-python-publication-audit-2026-09-08.json @@ -0,0 +1,118 @@ +{ + "scope": "Changed/new Python runtime, core, packaging, CI, and tests/test_*.py publication-scope review; not an architecture or release-readiness re-audit.", + "baseline_head": "018317d89edfa0f56c48c865f35c9a45204d9d11", + "result": "No confirmed publication blockers found within the reviewed scope.", + "reviewed_paths": [ + ".github/workflows/ci.yml", + "agent/agent.py", + "agent/audit.py", + "agent/contracts/__init__.py", + "agent/contracts/advisory-artifact.schema.json", + "agent/contracts/analysis-artifact.schema.json", + "agent/contracts/artifact_semantics.py", + "agent/contracts/benchmark-failure-v1.schema.json", + "agent/contracts/clarification-artifact.schema.json", + "agent/contracts/metric-definition-artifact.schema.json", + "agent/contracts/product-projection-fixtures.v1.json", + "agent/contracts/product-projection-v1.schema.json", + "agent/contracts/query-result-artifact.schema.json", + "agent/contracts/rendered-output-artifact.schema.json", + "agent/contracts/structured-artifact-fixtures.v1.json", + "agent/llm.py", + "agent/memory/__init__.py", + "config.py", + "constraints/ci-python311.txt", + "diagnostics.py", + "forge/accuracy_benchmark.py", + "forge/assurance.py", + "forge/benchmark_methods.py", + "forge/benchmark_service.py", + "forge/bird_benchmark.py", + "forge/compiler.py", + "forge/dialects.py", + "forge/evaluate.py", + "forge/executor.py", + "forge/hard_accuracy_benchmark.py", + "forge/lint.py", + "forge/poc.py", + "forge/query_runs.py", + "forge/templates/poc/README.md", + "forge/templates/poc/cases.example.json", + "forge/templates/poc/delivery_report.template.md", + "forge/templates/poc/failure_triage.template.md", + "forge/templates/poc/provider-smoke.example.json", + "forge/templates/poc/registry/disambiguations.registry.yaml", + "forge/templates/poc/registry/field_conventions.registry.yaml", + "forge/templates/poc/registry/metrics.registry.yaml", + "forge/templates/poc/registry/schema.registry.json", + "main.py", + "pyproject.toml", + "scripts/package_smoke.py", + "tests/test_accuracy_triage.py", + "tests/test_agent_runtime.py", + "tests/test_api.py", + "tests/test_architecture_course_docs.py", + "tests/test_artifact_contracts.py", + "tests/test_assurance.py", + "tests/test_benchmark_metric_revision_api.py", + "tests/test_bird_benchmark.py", + "tests/test_commercial_readiness.py", + "tests/test_compiler.py", + "tests/test_database_compatibility.py", + "tests/test_diagnostics_delivery.py", + "tests/test_dingtalk_pi.py", + "tests/test_evaluate.py", + "tests/test_executor.py", + "tests/test_feishu_runtime.py", + "tests/test_hard_accuracy_benchmark.py", + "tests/test_lint.py", + "tests/test_pi_channel.py", + "tests/test_pi_orchestrator_web.py", + "tests/test_product_shell.py", + "tests/test_query_runs.py" + ], + "removed_paths_accounted_for": ["scripts/seed_mock_data.py"], + "context_paths": ["config.py"], + "checks": [ + { + "name": "Candidate source inventory and full-text scanning", + "status": "passed", + "evidence": "Combined the supplied changed/new NUL path manifests and selected the assigned scope. Read 67 current public source files, including unchanged config.py for context, using raw reads after normal reads summarized long files. Credential/debug/path grep passes completed without truncated matches. No DB, credential file, runtime directory, or historical result content was read." + }, + { + "name": "Credential-shaped literals and private artifacts", + "status": "passed", + "evidence": "Scanned private-key headers, common cloud/GitHub/API token prefixes, credential assignments, authenticated URLs, workstation paths, private host indicators, and debug hooks. No confirmed live credential, private-key block, workstation path, private-host literal, or debug breakpoint was found in the current reviewed sources. Credential-shaped test values were classified using their fixture/monkeypatch/assertion context, not as live secrets." + }, + { + "name": "Fixture false-positive classification", + "status": "passed", + "evidence": "tests/test_commercial_readiness.py:109,120 contains an explicitly synthetic credential used to assert CLI non-disclosure. tests/test_pi_orchestrator_web.py:16 triggered a token-prefix substring scan inside a task-related HTML data attribute, not a credential. CI database passwords and authenticated loopback database URLs belong to ephemeral service fixtures. Other test credentials are synthetic fixture or redaction-test inputs. Values intentionally omitted." + }, + { + "name": "New diagnostic output and exposed fields", + "status": "passed", + "evidence": "Reviewed the changed diagnostic and runtime diff plus surrounding source. diagnostics.py limits accepted fields to identifiers and scalar measurements; agent/llm.py additions record bounded metadata rather than prompt/response bodies; forge/executor.py logs exception class rather than raw driver details. agent/audit.py's new projection selects identifiers, statuses, counts, timing and model revision, not SQL, result rows, model input, or raw exception text. No accidental payload debug output was identified in these additions." + }, + { + "name": "Dependency and package resource exposure", + "status": "passed_static_review", + "evidence": "Reviewed pyproject.toml, the Python 3.11 constraint file, resource consumers, and scripts/package_smoke.py. Dependency declarations contain package requirements, not private indexes, credential-bearing URLs, local paths, or direct private VCS references. diagnostics is listed as a distributable module. Contract JSON resources and PoC templates are explicitly included; the changed/new packaged files are schemas, synthetic fixtures and templates. Narrow resource inventories completed for agent/contracts/*.json and forge/templates/poc/**/*; no private artifact was identified in the changed resource set." + }, + { + "name": "CI and relocation references", + "status": "passed_static_review", + "evidence": "The CI workflow references the present constraints/ci-python311.txt and scripts/package_smoke.py, retains the existing tests/test_database_compatibility.py target, and exercises wheel/sdist installation from an external temporary working directory. The smoke script checks required resources and rejects chart directories, database files, forge.yaml and .env archive members. PoC loading uses importlib.resources instead of the removed top-level customer-poc-template path. No obsolete tests/accuracy, tests/text-to-sql-failures, scripts/seed_mock_data, or customer-poc-template references were found in the reviewed current Python/CI sources. Existing tests/datasets references were not mistaken for relocated manual benchmark paths." + } + ], + "findings": [], + "limits": [ + "This is a static publication-scope scan, not a guarantee that arbitrary opaque strings are harmless or a full application security audit.", + "No project test suite, package build/install, model call, dependency-index lookup, database query, or real runtime configuration access was performed. Previously reported local verification was accepted rather than repeated.", + "Built wheel/sdist contents were not independently regenerated or inspected; package resource and exclusion conclusions are limited to reviewed source declarations and the committed smoke-check logic. Parent owns final publication verification.", + "The first broad package glob unexpectedly applied a 200-result cap despite a larger requested limit and included nested same-name directories. It was reported to tool QA and was not used as proof of a complete inventory; narrow resource globs were used instead.", + "Manual benchmark trees, historical reports, original result runs, real datasets/configuration, and nonassigned Web/Pi/tooling files were excluded or left to their assigned reviewers.", + "Pre-existing logging outside the changed diagnostic additions was not re-audited as a general refactor/security project. The absence of accidental new payload logging does not certify every existing runtime log path.", + "No source or documentation edits, staging, commits, pushes, merges, tags, releases, or deployment actions were performed. The only requested deliverable written is this temporary audit report." + ] +} diff --git a/docs/chart-engine-bakeoff-2026-08-24.md b/docs/archive/engineering/chart-engine-bakeoff-2026-08-24.md similarity index 100% rename from docs/chart-engine-bakeoff-2026-08-24.md rename to docs/archive/engineering/chart-engine-bakeoff-2026-08-24.md diff --git a/docs/chart-storytelling-echarts-focused-evidence-2026-08-24.md b/docs/archive/engineering/chart-storytelling-echarts-focused-evidence-2026-08-24.md similarity index 100% rename from docs/chart-storytelling-echarts-focused-evidence-2026-08-24.md rename to docs/archive/engineering/chart-storytelling-echarts-focused-evidence-2026-08-24.md diff --git a/docs/chart-storytelling-r0-evidence-2026-08-24.md b/docs/archive/engineering/chart-storytelling-r0-evidence-2026-08-24.md similarity index 100% rename from docs/chart-storytelling-r0-evidence-2026-08-24.md rename to docs/archive/engineering/chart-storytelling-r0-evidence-2026-08-24.md diff --git a/docs/delivery-assessment-2026-05-07.md b/docs/archive/engineering/delivery-assessment-2026-05-07.md similarity index 100% rename from docs/delivery-assessment-2026-05-07.md rename to docs/archive/engineering/delivery-assessment-2026-05-07.md diff --git a/docs/forge-goal-gap-assessment-2026-08-24.md b/docs/archive/engineering/forge-goal-gap-assessment-2026-08-24.md similarity index 94% rename from docs/forge-goal-gap-assessment-2026-08-24.md rename to docs/archive/engineering/forge-goal-gap-assessment-2026-08-24.md index 2989db2..65130d5 100644 --- a/docs/forge-goal-gap-assessment-2026-08-24.md +++ b/docs/archive/engineering/forge-goal-gap-assessment-2026-08-24.md @@ -2,7 +2,7 @@ > 评估对象:当前本地 `929e8d4`、Atlas 生产基线 `d2b0fd9`、M0–M7 唯一主动计划。百分比只表示对已定义目标的阶段估计,不是准确度、可靠性或商业成功率。 > -> **后续优先级修订**:本评估最初建议 M1A,随后调整为 W3 Product Shell。第一版 W3A 用户门禁为 CHANGE;2026-08-25 已完成 [`product-north-star.md`](product-north-star.md) 并形成新的 [`product-design-roadmap-2026-08-25.md`](product-design-roadmap-2026-08-25.md) 提案。当前等待用户确认 Human Control Plane、Agent Data Runtime 和 Shared Trust/Data Foundation 的新阶段顺序;本文件的差距数据仍保留为历史估计,不再单独决定优先级。 +> **后续优先级修订**:本评估最初建议 M1A,随后调整为 W3 Product Shell。第一版 W3A 用户门禁为 CHANGE;2026-08-25 已完成 [`product-north-star.md`](../../product-north-star.md) 并形成新的 [`product-design-roadmap-2026-08-25.md`](../../product-design-roadmap-2026-08-25.md) 提案。当前等待用户确认 Human Control Plane、Agent Data Runtime 和 Shared Trust/Data Foundation 的新阶段顺序;本文件的差距数据仍保留为历史估计,不再单独决定优先级。 ## 1. 先区分两个目标 diff --git a/docs/golden-journey-acceptance-2026-08-24.md b/docs/archive/engineering/golden-journey-acceptance-2026-08-24.md similarity index 98% rename from docs/golden-journey-acceptance-2026-08-24.md rename to docs/archive/engineering/golden-journey-acceptance-2026-08-24.md index 3f1e32e..78837fd 100644 --- a/docs/golden-journey-acceptance-2026-08-24.md +++ b/docs/archive/engineering/golden-journey-acceptance-2026-08-24.md @@ -1,6 +1,6 @@ # Forge Golden Journey Acceptance Review — 2026-08-24 -> Requirement: [`REQ-2026-08-24-007`](requirements-pool.md#req-2026-08-24-007完整问数旅程的物理链路与逐阶段视觉验收) +> Requirement: [`REQ-2026-08-24-007`](../../requirements-pool.md#req-2026-08-24-007完整问数旅程的物理链路与逐阶段视觉验收) > Code under test: NAS `9fca1ea` > Verdict: **Physical chain PASS / Trusted product outcome FAIL** > Scope: desktop Web only. Mobile evidence is explicitly non-gating per the user's latest direction. diff --git a/docs/golden-journey-p0-closure-2026-08-24.md b/docs/archive/engineering/golden-journey-p0-closure-2026-08-24.md similarity index 94% rename from docs/golden-journey-p0-closure-2026-08-24.md rename to docs/archive/engineering/golden-journey-p0-closure-2026-08-24.md index 3cc264e..0d0d8e0 100644 --- a/docs/golden-journey-p0-closure-2026-08-24.md +++ b/docs/archive/engineering/golden-journey-p0-closure-2026-08-24.md @@ -1,6 +1,6 @@ # Golden Journey P0 Closure — 2026-08-24 -> Requirement: [`REQ-2026-08-24-008`](requirements-pool.md#req-2026-08-24-008关闭-golden-journey-的-p0-可信交付缺陷) +> Requirement: [`REQ-2026-08-24-008`](../../requirements-pool.md#req-2026-08-24-008关闭-golden-journey-的-p0-可信交付缺陷) > Implementation: `b5e4884` > Verdict: **H4 PASS — three declared P0 findings closed** > Scope: desktop only; P1 and mobile are not part of this verdict. @@ -13,7 +13,7 @@ | Same-page Report/Publication blank | Viewport-bounded Chat shell, independent feed/flow scrolling, explicit task-card reveal | Long Analysis action focus/click → Report running → Publication, no reload | PASS | | Misleading repeated-label Chart | Chart builder requires a unique visible string grain and exact 10-row evidence projection; Report Renderer independently suppresses unsafe legacy Chart input | 107 rows / repeated category labels creates 0 ChartArtifact and 0 report chart | PASS | -The chart result is intentionally fail-closed. It does not claim the current report has good visualization; it only proves the platform no longer publishes the known misleading chart. Rich, modern, annotated multi-chart storytelling is a separate product requirement, [`REQ-2026-08-24-009`](requirements-pool.md#req-2026-08-24-009专业报告的多图叙事现代图表与证据绑定交互). +The chart result is intentionally fail-closed. It does not claim the current report has good visualization; it only proves the platform no longer publishes the known misleading chart. Rich, modern, annotated multi-chart storytelling is a separate product requirement, [`REQ-2026-08-24-009`](../../requirements-pool.md#req-2026-08-24-009专业报告的多图叙事现代图表与证据绑定交互). ## 2. Automated verification diff --git a/docs/governance-contract-review-2026-08-24.md b/docs/archive/engineering/governance-contract-review-2026-08-24.md similarity index 100% rename from docs/governance-contract-review-2026-08-24.md rename to docs/archive/engineering/governance-contract-review-2026-08-24.md diff --git a/docs/product-direction-architecture-review-2026-08-24.md b/docs/archive/engineering/product-direction-architecture-review-2026-08-24.md similarity index 98% rename from docs/product-direction-architecture-review-2026-08-24.md rename to docs/archive/engineering/product-direction-architecture-review-2026-08-24.md index 2bcb10b..8589020 100644 --- a/docs/product-direction-architecture-review-2026-08-24.md +++ b/docs/archive/engineering/product-direction-architecture-review-2026-08-24.md @@ -1,8 +1,8 @@ # Forge 产品方向与架构复审(2026-08-24) -> 状态:评审完成,产品方向与四平面框架已确认 · Review basis: [`product-axioms.md`](product-axioms.md) +> 状态:评审完成,产品方向与四平面框架已确认 · Review basis: [`product-axioms.md`](../../product-axioms.md) > -> 本文以 Governance、Coordination、Economics、Assurance 四个问题平面和 32 条产品公理重新审核当前产品方向、目标架构与实际代码。评审结论已确认并纳入 [`platform-architecture.md`](platform-architecture.md);当前唯一主动实施计划是 [`forge-enterprise-evolution-plan.md`](forge-enterprise-evolution-plan.md)。本文保留评审依据,不再作为待确认计划。 +> 本文以 Governance、Coordination、Economics、Assurance 四个问题平面和 32 条产品公理重新审核当前产品方向、目标架构与实际代码。评审结论已确认并纳入 [`platform-architecture.md`](../../platform-architecture.md);当前唯一主动实施计划是 [`forge-enterprise-evolution-plan.md`](../../forge-enterprise-evolution-plan.md)。本文保留评审依据,不再作为待确认计划。 ## 1. 执行摘要 diff --git a/docs/product-spine-sp1-evidence-2026-08-25.md b/docs/archive/engineering/product-spine-sp1-evidence-2026-08-25.md similarity index 100% rename from docs/product-spine-sp1-evidence-2026-08-25.md rename to docs/archive/engineering/product-spine-sp1-evidence-2026-08-25.md diff --git a/docs/product-spine-sp2-evidence-2026-08-25.md b/docs/archive/engineering/product-spine-sp2-evidence-2026-08-25.md similarity index 100% rename from docs/product-spine-sp2-evidence-2026-08-25.md rename to docs/archive/engineering/product-spine-sp2-evidence-2026-08-25.md diff --git a/docs/product-spine-sp3-evidence-2026-08-25.md b/docs/archive/engineering/product-spine-sp3-evidence-2026-08-25.md similarity index 100% rename from docs/product-spine-sp3-evidence-2026-08-25.md rename to docs/archive/engineering/product-spine-sp3-evidence-2026-08-25.md diff --git a/docs/product-spine-sp4-evidence-2026-08-25.md b/docs/archive/engineering/product-spine-sp4-evidence-2026-08-25.md similarity index 100% rename from docs/product-spine-sp4-evidence-2026-08-25.md rename to docs/archive/engineering/product-spine-sp4-evidence-2026-08-25.md diff --git a/docs/product-spine-sp5-evidence-2026-08-25.md b/docs/archive/engineering/product-spine-sp5-evidence-2026-08-25.md similarity index 99% rename from docs/product-spine-sp5-evidence-2026-08-25.md rename to docs/archive/engineering/product-spine-sp5-evidence-2026-08-25.md index 10bb0ac..f38b03a 100644 --- a/docs/product-spine-sp5-evidence-2026-08-25.md +++ b/docs/archive/engineering/product-spine-sp5-evidence-2026-08-25.md @@ -1,6 +1,6 @@ # Product Spine SP5 集成门禁证据(2026-08-25) -> Requirement:[`REQ-2026-08-25-017`](requirements-pool.md#req-2026-08-25-017短期-product-spine-底层优先实施计划)
+> Requirement:[`REQ-2026-08-25-017`](../../requirements-pool.md#req-2026-08-25-017短期-product-spine-底层优先实施计划)
> 原始 Candidate:`product-spine-5dcd4715941a`;性能修复:`product-spine-d0aa8c9e3a0e`;Table 最终修复:`product-spine-6a23e71276e5` > URL:`http://preview.internal.invalid:18007/`
> 自动化/真实链路结论:**PASS**
diff --git a/docs/release-verification-2026-09-07.json b/docs/archive/engineering/release-verification-2026-09-07.json similarity index 100% rename from docs/release-verification-2026-09-07.json rename to docs/archive/engineering/release-verification-2026-09-07.json diff --git a/docs/report-publication-2026-09-07.json b/docs/archive/engineering/report-publication-2026-09-07.json similarity index 100% rename from docs/report-publication-2026-09-07.json rename to docs/archive/engineering/report-publication-2026-09-07.json diff --git a/docs/archive/engineering/schema-descriptions-publication-2026-09-08.json b/docs/archive/engineering/schema-descriptions-publication-2026-09-08.json new file mode 100644 index 0000000..92d925d --- /dev/null +++ b/docs/archive/engineering/schema-descriptions-publication-2026-09-08.json @@ -0,0 +1,83 @@ +{ + "schema_version": "report-publication-v1", + "date": "2026-09-08", + "requirement": "REQ-2026-09-08-066", + "task_id": "Forge-20260908-03", + "scope": "REQ-064 research, REQ-065 preparation and real 64-call ABBA reports; milestone documentation and related implementation/test commit, not a software release.", + "public_report_count": 3, + "changed_report_count": 1, + "original_archive": ".forge/benchmarks/schema-descriptions-publication-20260908/originals", + "original_archive_public": false, + "rules": [ + "Reuse the report-publication-v1 policy from 2026-09-07; replace the one personal home prefix in captured run.mts with .", + "Preserve metric values, case membership, model/SDK revisions, costs, failures, authorization history and original evidence hashes.", + "Do not add raw SSE, provider sessions, credentials, runtime databases, .maestri state or third-party datasets to Git." + ], + "limitations": [ + "Public copies are not original-byte artifacts. Embedded report_sha256 and captured source hashes still describe original evidence; whole-file source/published mappings are listed below.", + "The captured script now contains a redacted local path; it documents the executed method, not a ready-to-run public command or permission for new calls.", + "Pattern scanning and source review are not independent security or anonymization certification. Local evidence references are not public download links.", + "This task does not rerun the 64 model requests, recalculate historical scores, enable the candidate, merge main, create tags/releases, deploy or install a version." + ], + "reports": [ + { + "path": "docs/archive/benchmarks/forge-json-generation-research-2026-09-08.json", + "source_sha256": "sha256:29098c981cb5874ca6e5fe1f016554d578ed4bdd311bf2e2e7a5d8fe04b35a28", + "published_sha256": "sha256:29098c981cb5874ca6e5fe1f016554d578ed4bdd311bf2e2e7a5d8fe04b35a28", + "source_archive": ".forge/benchmarks/schema-descriptions-publication-20260908/originals/docs/archive/benchmarks/forge-json-generation-research-2026-09-08.json", + "redacted_or_reformatted": false, + "changed_lines": [], + "changed_json_fields": [] + }, + { + "path": "docs/archive/benchmarks/benchmark-luna-schema-descriptions-ready-2026-09-08.json", + "source_sha256": "sha256:93d12e540543e7ba94b3161ada1588b38fba9f9803bde992ab61213623a8922c", + "published_sha256": "sha256:93d12e540543e7ba94b3161ada1588b38fba9f9803bde992ab61213623a8922c", + "source_archive": ".forge/benchmarks/schema-descriptions-publication-20260908/originals/docs/archive/benchmarks/benchmark-luna-schema-descriptions-ready-2026-09-08.json", + "redacted_or_reformatted": false, + "changed_lines": [], + "changed_json_fields": [] + }, + { + "path": "docs/archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.json", + "source_sha256": "sha256:18f415c3d54b1ff7d63de25964cbda7072e6d650b2209233d7b3cb2b428fb823", + "published_sha256": "sha256:dacc6abf22865feb9e4451e9f73d49c39dec85409b0a4e1dd66e93d8075b318d", + "source_archive": ".forge/benchmarks/schema-descriptions-publication-20260908/originals/docs/archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.json", + "redacted_or_reformatted": true, + "changed_lines": [ + 834 + ], + "changed_json_fields": [ + "$.captured_execution_sources.run.mts" + ] + } + ], + "precommit_verification": { + "completed_by": "2026-09-08T11:04:04+08:00", + "python": { + "command": ".venv/bin/python -m pytest tests/test_bird_benchmark.py -q", + "passed": 81, + "warnings": 1, + "warning_category": "third-party DeprecationWarning" + }, + "pi": { + "cwd": "services/pi-orchestrator", + "typecheck": "npm run typecheck", + "typecheck_passed": true, + "test_command": "node --import tsx --test tests/benchmark-runtime.test.ts tests/strict-forge-output.test.ts", + "passed": 53, + "warnings": [ + "Node SQLite ExperimentalWarning" + ] + }, + "full_suite_rerun": false, + "new_model_calls": 0 + }, + "git_scope": { + "branch": "review/forge-engineering-evidence-2026-09-08", + "remote": "git@github.com:shisuidata/Forge.git", + "commit_and_push_authorized": true, + "release_authorized": false, + "remote_delivery_proof": "Actual commit SHA and remote head are reported after push; this pre-commit record does not claim delivery." + } +} diff --git a/docs/test-report-2026-05-05.md b/docs/archive/engineering/test-report-2026-05-05.md similarity index 100% rename from docs/test-report-2026-05-05.md rename to docs/archive/engineering/test-report-2026-05-05.md diff --git a/docs/test-report-2026-05-06.md b/docs/archive/engineering/test-report-2026-05-06.md similarity index 100% rename from docs/test-report-2026-05-06.md rename to docs/archive/engineering/test-report-2026-05-06.md diff --git a/docs/test-report-2026-07-13.md b/docs/archive/engineering/test-report-2026-07-13.md similarity index 100% rename from docs/test-report-2026-07-13.md rename to docs/archive/engineering/test-report-2026-07-13.md diff --git a/docs/web-product-content-audit-2026-08-24.md b/docs/archive/engineering/web-product-content-audit-2026-08-24.md similarity index 100% rename from docs/web-product-content-audit-2026-08-24.md rename to docs/archive/engineering/web-product-content-audit-2026-08-24.md diff --git a/docs/web-product-shell-w3a-evidence-2026-08-24.md b/docs/archive/engineering/web-product-shell-w3a-evidence-2026-08-24.md similarity index 100% rename from docs/web-product-shell-w3a-evidence-2026-08-24.md rename to docs/archive/engineering/web-product-shell-w3a-evidence-2026-08-24.md diff --git a/docs/optimization_plan_2026-03-19.md b/docs/archive/plans/optimization_plan_2026-03-19.md similarity index 100% rename from docs/optimization_plan_2026-03-19.md rename to docs/archive/plans/optimization_plan_2026-03-19.md diff --git a/docs/pi-forge-integration-plan.md b/docs/archive/plans/pi-forge-integration-plan.md similarity index 99% rename from docs/pi-forge-integration-plan.md rename to docs/archive/plans/pi-forge-integration-plan.md index af56843..877bf77 100644 --- a/docs/pi-forge-integration-plan.md +++ b/docs/archive/plans/pi-forge-integration-plan.md @@ -2,7 +2,7 @@ > 状态:历史实施快照(Phase 0–7 项目侧基线已完成;不再承载当前 TODO) · Snapshot updated: 2026-08-24 > -> 本文保留 Pi × Forge 集成的历史实施状态、当时决策与验收证据。文中的“当前”“进行中”“后续”均按所在段落日期理解,不代表 2026-08-24 之后的主动工作;新的唯一主动计划真相源是 [`forge-enterprise-evolution-plan.md`](forge-enterprise-evolution-plan.md)。总体架构仍以 [`platform-architecture.md`](platform-architecture.md) 为准,现有外部 Agent 安全边界见 [`agent-integration.md`](agent-integration.md)。任何后续实施必须同时遵守本文既有职责边界和新主动计划,不得借换计划恢复双 Orchestrator 或绕过 Forge 可信执行。 +> 本文保留 Pi × Forge 集成的历史实施状态、当时决策与验收证据。文中的“当前”“进行中”“后续”均按所在段落日期理解,不代表 2026-08-24 之后的主动工作;新的唯一主动计划真相源是 [`forge-enterprise-evolution-plan.md`](../../forge-enterprise-evolution-plan.md)。总体架构仍以 [`platform-architecture.md`](../../platform-architecture.md) 为准,现有外部 Agent 安全边界见 [`agent-integration.md`](../../agent-integration.md)。任何后续实施必须同时遵守本文既有职责边界和新主动计划,不得借换计划恢复双 Orchestrator 或绕过 Forge 可信执行。 ## 0. 计划治理 diff --git a/docs/short-term-product-spine-plan-2026-08-25.md b/docs/archive/plans/short-term-product-spine-plan-2026-08-25.md similarity index 97% rename from docs/short-term-product-spine-plan-2026-08-25.md rename to docs/archive/plans/short-term-product-spine-plan-2026-08-25.md index c37f12e..a70d924 100644 --- a/docs/short-term-product-spine-plan-2026-08-25.md +++ b/docs/archive/plans/short-term-product-spine-plan-2026-08-25.md @@ -2,13 +2,13 @@ > 状态:历史实施计划,SP0–SP5 已完成并保留为 Product Projection/BFF/Web Shell 基础;`REQ-2026-08-25-023` 已将当前短期目标重排为 S0–S4 真实用户闭环,本文件不再承载主动 TODO > -> Requirement:[`REQ-2026-08-25-017`](requirements-pool.md#req-2026-08-25-017短期-product-spine-底层优先实施计划) +> Requirement:[`REQ-2026-08-25-017`](../../requirements-pool.md#req-2026-08-25-017短期-product-spine-底层优先实施计划) > > 原则:**底层真实框架先行,前端真实投影随后,最后形成可持续人工测试抓手。** > > 本计划只覆盖近期单用户私有化产品闭环,不批准企业多用户、Agent Runtime 执行、Economics、通用 Decision Runtime、自动调度或第二场景。 -> **后续边界(2026-08-25)**:本文解决“如何获得真实、可恢复、可人工测试的产品骨架”,不证明目标用户愿意持续使用。当前唯一主动路线见 [`forge-enterprise-evolution-plan.md`](forge-enterprise-evolution-plan.md):先以 Design Partner 建立真实问题基线,再验证 Direct Trusted Answer、Semantic Learning Loop 和三环境证据;不继续在本文追加页面、Runtime 或企业治理工作包。 +> **后续边界(2026-08-25)**:本文解决“如何获得真实、可恢复、可人工测试的产品骨架”,不证明目标用户愿意持续使用。当前唯一主动路线见 [`forge-enterprise-evolution-plan.md`](../../forge-enterprise-evolution-plan.md):先以 Design Partner 建立真实问题基线,再验证 Direct Trusted Answer、Semantic Learning Loop 和三环境证据;不继续在本文追加页面、Runtime 或企业治理工作包。 ## 1. 短期目标 @@ -379,7 +379,7 @@ Contract 固定 - 重复消息返回原任务,过期重复批准返回 409 且不重放 SQL;等待审批与完成态均通过 Pi/API restart recovery;Pi offline 时 Workspace 明确降级为 partial,Report/Data 继续可读。 - 真实链路发现并修复 insecure-HTTP ID、瞬时 ready 轮询、同源 HTTP 报告链接、空 Attempt error、长 SQL Grid overflow 和完成态历史审核误标权限六个缺陷;复杂查询 Assurance 拒绝与数据质量 `incomplete` 作为反证保留,未通过放宽门禁掩盖。 - 最终验证:Python `583 passed / 24 skipped`、Pi `115 passed`、typecheck、npm audit、JS syntax、`git diff --check`、双桌面 12 routes/0 external request/0 error/0 overflow 全部通过。 -- 证据:[`product-spine-sp5-evidence-2026-08-25.md`](product-spine-sp5-evidence-2026-08-25.md)。自动门禁 PASS;用户 Atlas 门禁仍为 PENDING,不能把稳定 URL 冒充用户接受。 +- 证据:[`product-spine-sp5-evidence-2026-08-25.md`](../engineering/product-spine-sp5-evidence-2026-08-25.md)。自动门禁 PASS;用户 Atlas 门禁仍为 PENDING,不能把稳定 URL 冒充用户接受。 - 用户 Atlas 首轮返回 `CHANGE`:Workspace/Task 等页面性能严重不可接受。诊断确认 Pi 原始读取仅 `44.4–55.9 ms`,主瓶颈是 Product BFF 对每条 Task/Report 重复执行 JSON Schema `check_schema` 与 validator construction。 - `agent.contracts.validate_contract` 改为按 Contract name 缓存已检查 validator;不减少数据、Contract、Evidence、Assurance 或 scope gate。批量 100 Task + 50 Report 回归从 `12.83s` 失败降为 `0.18s` 测试完成。 - 性能候选 `product-spine-d0aa8c9e3a0e` 已在同一隔离状态、只读数据和稳定 URL 上发布。稳定 Product API 为 `54.5–258.8ms`;Workspace/Chat/Tasks/Task Detail/Reports/Data 严格等待 DOM 内容替换后的完成时间为 `83.7–586.9ms`,0 console/page error、0 横向溢出;定向回归 `41 passed`。 diff --git a/docs/web-product-shell-plan-2026-08-24.md b/docs/archive/plans/web-product-shell-plan-2026-08-24.md similarity index 96% rename from docs/web-product-shell-plan-2026-08-24.md rename to docs/archive/plans/web-product-shell-plan-2026-08-24.md index 561b517..8d2a793 100644 --- a/docs/web-product-shell-plan-2026-08-24.md +++ b/docs/archive/plans/web-product-shell-plan-2026-08-24.md @@ -2,7 +2,7 @@ > Status: historical first W3A plan · User gate: CHANGE · Requirement: REQ-2026-08-24-014 · Scope: desktop first > -> 本文保留 `821065f` 原型的第一版设计依据,不再作为当前已确认产品地图。“新建任务”中心和缺少连续 Conversation 的 IA 已被用户门禁退回。北极星见 [`product-north-star.md`](product-north-star.md),长期重建方向见 [`product-design-roadmap-2026-08-25.md`](product-design-roadmap-2026-08-25.md),当前底层优先实施提案见 [`short-term-product-spine-plan-2026-08-25.md`](short-term-product-spine-plan-2026-08-25.md)。 +> 本文保留 `821065f` 原型的第一版设计依据,不再作为当前已确认产品地图。“新建任务”中心和缺少连续 Conversation 的 IA 已被用户门禁退回。北极星见 [`product-north-star.md`](../../product-north-star.md),长期重建方向见 [`product-design-roadmap-2026-08-25.md`](../../product-design-roadmap-2026-08-25.md),当前底层优先实施提案见 [`short-term-product-spine-plan-2026-08-25.md`](short-term-product-spine-plan-2026-08-25.md)。 ## 1. 目的 diff --git a/docs/benchmarks.md b/docs/benchmarks.md index 732afca..9d5d27e 100644 --- a/docs/benchmarks.md +++ b/docs/benchmarks.md @@ -20,7 +20,7 @@ BIRD Official EX(历史亦称Official EA)使用官方核心规则:`set(gol md-454漏Top-5仍在原公开数据上EX通过;隔离构造同县6校即可暴露返回6行的错误。`tests/test_bird_semantic_boundaries.py`保留此性质:即使EX与Contract都在五校快照上通过,加入第六校仍可证伪逻辑等价。既有`test_bird_execution_accuracy_uses_exact_result_sets`固守官方核心;S不覆盖Gold或改写历史成绩。Gold SQL、结果与答案可以用于隔离评分、离线归因和开发/回归集上的规律总结,但不进入本次被测候选生成的Prompt、context或模型工具;清单可含Gold SQL哈希,不携带Gold内容。 -分析Gold找错、执行明确标记的人为反事实、据此改进通用Prompt/检索/Contract/Compiler属于正常开发,不是作弊。应先对照参考解的实体、JOIN、筛选、粒度、聚合、投影,再核对题意与元数据;不能拒绝分析Gold,也不能无依据地照抄其每个关联。禁止答案泄漏后冒充独立生成、人工改候选/Gold后冒充原始成绩、看Gold调参后仍称独立H或将按题号硬编码包装成通用能力。当前500题属于开发/回归,改进需如实披露曝光与调参;独立验证另用未参与调参的数据。冻结中的`gold_use=scoring_only`约束被测生成链路,不否定隔离离线诊断。见[输出契约与Gold使用复核](benchmark-luna-output-contract-review-2026-09-06.md)。 +分析Gold找错、执行明确标记的人为反事实、据此改进通用Prompt/检索/Contract/Compiler属于正常开发,不是作弊。应先对照参考解的实体、JOIN、筛选、粒度、聚合、投影,再核对题意与元数据;不能拒绝分析Gold,也不能无依据地照抄其每个关联。禁止答案泄漏后冒充独立生成、人工改候选/Gold后冒充原始成绩、看Gold调参后仍称独立H或将按题号硬编码包装成通用能力。当前500题属于开发/回归,改进需如实披露曝光与调参;独立验证另用未参与调参的数据。冻结中的`gold_use=scoring_only`约束被测生成链路,不否定隔离离线诊断。见[输出契约与Gold使用复核](archive/benchmarks/benchmark-luna-output-contract-review-2026-09-06.md)。 ### 冻结、公平性、预算与原始证据 @@ -77,7 +77,7 @@ REQ-048从正常Python/Pi ResultContract删除未经业务确认的expected_grai 参数型date_context/grain_context/value_context都不允许共享源码漂移或任意提示事实替换;每次重建验证全部hash,只在比较时排除已声明模式及其后缀hash。正常滚动实验仍须提供上一轮与全部同模型历史,两条件复用相同选择参数;总预算按两条件合并确认,未评分题留分母。 -REQ-048后续维护已修复未派发重放语义:output=null且显式scored=false的记录保留未评分及原执行/失败状态;不把它计为生成失败。未标明scored=false的旧空候选账本仍按既有生成失败语义处理,有实际候选则重新评价。新Pi raw_output.assistant保存content、stopReason和errorMessage,失败日志保留Provider错误详情;历史丢失信息不回填,未知用量不补零。80臂零调用重放及两侧回归证据见`benchmark-luna-grain-maintenance-2026-09-06.json`。源码指纹变化后的旧冻结不得续跑;diagnostic或未评分记录仍不能晋级正式比较。 +REQ-048后续维护已修复未派发重放语义:output=null且显式scored=false的记录保留未评分及原执行/失败状态;不把它计为生成失败。未标明scored=false的旧空候选账本仍按既有生成失败语义处理,有实际候选则重新评价。新Pi raw_output.assistant保存content、stopReason和errorMessage,失败日志保留Provider错误详情;历史丢失信息不回填,未知用量不补零。80臂零调用重放及两侧回归证据见`archive/benchmarks/benchmark-luna-grain-maintenance-2026-09-06.json`。源码指纹变化后的旧冻结不得续跑;diagnostic或未评分记录仍不能晋级正式比较。 ### SQLite 标量极值 CTE 性能修复(REQ-049) @@ -92,7 +92,7 @@ SQLite 编译目标对参与 INNER/CROSS JOIN 的简单非递归标量 MIN/MAX C - 24个旧Forge候选共120项五方言编译结果中,只有这一项SQLite SQL改变;13种排除边界与修复前源码输出一致。 - 固定VM预算的MIN/MAX两个反例修复前失败,修复后保留并列极值;另覆盖NULL、空输入、引用别名与未投影聚合不阻断下推。Python818 passed/26 skipped、Pi150 passed/typecheck通过。 -完整简报:[benchmark-luna-scalar-cte-fix-2026-09-06.json](benchmark-luna-scalar-cte-fix-2026-09-06.json)。原付费Run与旧证据不改写;新的diagnostic冻结有效,旧源码冻结拒绝,diagnostic/未评分仍不晋级。本结果只证明固定候选的Compiler修复,不是模型能力提升、完整配对结论或H/R0.6验收。 +完整简报:[benchmark-luna-scalar-cte-fix-2026-09-06.json](archive/benchmarks/benchmark-luna-scalar-cte-fix-2026-09-06.json)。原付费Run与旧证据不改写;新的diagnostic冻结有效,旧源码冻结拒绝,diagnostic/未评分仍不晋级。本结果只证明固定候选的Compiler修复,不是模型能力提升、完整配对结论或H/R0.6验收。 ### 滚动seed48与跨语言冻结维护(REQ-046) @@ -100,7 +100,7 @@ SQLite 编译目标对参与 INNER/CROSS JOIN 的简单非递归标量 MIN/MAX C seed48首次提交在创建Run前被拒绝、零调用;修复后真实HTTP协议往返成功。Python819 passed/26 skipped、Pi150 passed/typecheck通过。获批38次的Run实际32派发/30候选后停止:Forge md-234生成120秒超时,md-447被取消;3题6臂未派发,Gold md-340仍零调用保留。完整20题下两臂EX均4/12/4、Contract均1/15/4,观察107160 tokens及2臂未知usage;只有新md-313双臂全过。 -32份留存响应hash、40臂核心评分重放、28个可执行候选的独立官方EX一致;原失败元数据和Gold编译投影差异不抹平。未评分记录仍拒绝正式比较,未补跑或延长超时。原候选/Gold/数据不改写,服务已停止。逐题结果、跨轮限制与完整证据见[seed48简报](benchmark-luna-mixed-d20-seed48-2026-09-06.md)及[JSON](benchmark-luna-mixed-d20-seed48-2026-09-06.json)。 +32份留存响应hash、40臂核心评分重放、28个可执行候选的独立官方EX一致;原失败元数据和Gold编译投影差异不抹平。未评分记录仍拒绝正式比较,未补跑或延长超时。原候选/Gold/数据不改写,服务已停止。逐题结果、跨轮限制与完整证据见[seed48简报](archive/benchmarks/benchmark-luna-mixed-d20-seed48-2026-09-06.md)及[JSON](archive/benchmarks/benchmark-luna-mixed-d20-seed48-2026-09-06.json)。 ### 取消完成后封存失败证据(REQ-050) @@ -108,7 +108,7 @@ Pi Benchmark对同一会话复用abort Promise;超时/取消或其他失败时 修复前的确定性deadline反例保留assistant=[];修复后Run重开可见终止消息和最终用量,日志hash可复算。真实Pi SDK的合成流烟测确认提交顺序,未访问网络或真实模型。Pi151 passed/typecheck、Python819 passed/26 skipped;seed48原40臂诊断重放与历史工件hash均不变。旧缺失消息和usage不能回填,不宣称查询准确率收益。Pi runtime指纹变化仍禁止旧Run跨版本resume;Python协议校验与不完整比较门禁不变。 -简报和完整证据:[benchmark-luna-cancellation-evidence-fix-2026-09-06.json](benchmark-luna-cancellation-evidence-fix-2026-09-06.json)。 +简报和完整证据:[benchmark-luna-cancellation-evidence-fix-2026-09-06.json](archive/benchmarks/benchmark-luna-cancellation-evidence-fix-2026-09-06.json)。 ### 生成流阶段定向诊断(REQ-051) @@ -116,19 +116,19 @@ Pi Benchmark对同一会话复用abort Promise;超时/取消或其他失败时 四次生成/执行均成功,EX/Contract均0/4,19831 tokens且未知用量0。Forge耗时11.18/23.60秒,工具参数可见区间3.27/7.46秒;未复现超时,不能据此宣称可靠性或准确率提升。md-234存在次数请求与Gold列集合差异;md-447为DOCType标签与DOC编码差异,离线反事实换列可匹配Gold,但不修改原候选/评分,不做按题规则。 -4份Prompt与seed48对应臂hash一致,4份响应hash、4臂原候选重放及独立只读EX核验通过;完整57条日志和Pi快照已封存、服务已停。不追加调用、不改变生成策略;这是定向诊断而非seed49,滚动父Run不变。见[简报](benchmark-luna-generation-stages-2026-09-06.md)与[机器证据](benchmark-luna-generation-stages-2026-09-06.json)。 +4份Prompt与seed48对应臂hash一致,4份响应hash、4臂原候选重放及独立只读EX核验通过;完整57条日志和Pi快照已封存、服务已停。不追加调用、不改变生成策略;这是定向诊断而非seed49,滚动父Run不变。见[简报](archive/benchmarks/benchmark-luna-generation-stages-2026-09-06.md)与[机器证据](archive/benchmarks/benchmark-luna-generation-stages-2026-09-06.json)。 ### CTE绑定与公共SQL字段保障(REQ-052) Compiler不再剥离显式CTE限定名,也不把裸列/窗口别名强绑到主CTE;保留显式select,不机械补投影。五个合法查询的真实SQLite反例恢复结果。公共Forge JSON末尾复用现有`assure_compiled_sql`的只读、解析、Registry/字段作用域门禁,使用同一已限定Registry并保留先前证据;Assurance修订为`query-assurance-v8`,Policy仍为v9,不授予执行权。两个CTE未投影字段漏拒反例已拒绝,歧义拒绝边界保持。 -零模型调用;40个固定Forge候选的200项五方言编译结果与5份历史Run hash不变。md-032/md-199四臂在新v8 diagnostic冻结下评分/SQL不变,缺列仍拒绝。实际CLI/HTTP及返回SQL隔离执行通过;Python825 passed/26 skipped、Pi151 passed/typecheck。不是准确率提升或完整R500复评,旧冻结不跨版本复用,滚动父Run不变。公共既有关系/裸列前置限制未放宽;见[修复简报](benchmark-luna-cte-binding-fix-2026-09-06.md)与[机器证据](benchmark-luna-cte-binding-fix-2026-09-06.json)。 +零模型调用;40个固定Forge候选的200项五方言编译结果与5份历史Run hash不变。md-032/md-199四臂在新v8 diagnostic冻结下评分/SQL不变,缺列仍拒绝。实际CLI/HTTP及返回SQL隔离执行通过;Python825 passed/26 skipped、Pi151 passed/typecheck。不是准确率提升或完整R500复评,旧冻结不跨版本复用,滚动父Run不变。公共既有关系/裸列前置限制未放宽;见[修复简报](archive/benchmarks/benchmark-luna-cte-binding-fix-2026-09-06.md)与[机器证据](archive/benchmarks/benchmark-luna-cte-binding-fix-2026-09-06.json)。 ### 当前栈R500回归与取值证据审计(REQ-053) 零被测模型调用,1000份Structured Sol原候选完整进入当前Compiler/Assurance v8诊断。EX Forge311/187/2、Direct312/186/2;Contract282/216/2、292/206/2(正确/失败/未知)。md-340/md-393两臂Gold在30秒下超时,保留500分母及未知;无旧正确候选误拒、无已评分正确/错误转换。14变化臂已审查,候选/SQL/Gold hash及源码/数据完整性核对;Replay写完1000项但complete=false/exit1,不晋级正式成绩。历史120秒/缓存、Assurance未重跑及多次源码/上下文漂移使其不是v8单因素或模型比较;只覆盖Benchmark共享SQL门禁。 -取值审计确认当前两臂gasstations.Segment元数据缺少精确存储值;公开只读5716行5值及三个字面量反事实证明机制,原成绩仍1/4。带来源的限定列值证据仅作为下一处理候选,未进入Prompt;不自动lower/LIKE,不把历史离线重建视为原始Prompt。4题16次配对生成仅提案、另批预算。见[简报](benchmark-r500-v8-binding-audit-2026-09-06.md)及[完整机器证据](benchmark-r500-v8-binding-audit-2026-09-06.json)。 +取值审计确认当前两臂gasstations.Segment元数据缺少精确存储值;公开只读5716行5值及三个字面量反事实证明机制,原成绩仍1/4。带来源的限定列值证据仅作为下一处理候选,未进入Prompt;不自动lower/LIKE,不把历史离线重建视为原始Prompt。4题16次配对生成仅提案、另批预算。见[简报](archive/benchmarks/benchmark-r500-v8-binding-audit-2026-09-06.md)及[完整机器证据](archive/benchmarks/benchmark-r500-v8-binding-audit-2026-09-06.json)。 ### 限定列观察取值上下文(REQ-054) @@ -140,7 +140,7 @@ Compiler不再剥离显式CTE限定名,也不把裸列/窗口别名强绑到 四题真实冻结/HTTP验证:md-009、md-026和同表控制md-018每臂新增1642字节;同名异表控制md-002无证据、指令不变。off四题八份指令与修改前逐字一致。实际Pi消费八份合成输出完成,冻结后指令篡改在新派发前拒绝;不是SDK真实生成或准确率证据。原Sol八候选在两条件各重放,SQL与EX/Contract均不变。Python873 passed/26 skipped、Pi151 passed/typecheck通过;服务与临时脚本已清理。 -授权前实现与零调用准备见[准备简报](benchmark-luna-value-context-ready-2026-09-06.md)。随后用户单独批准16次Luna配对:16派发/16候选,Forge EX/Contract2/4→3/4、Direct3/4→4/4;目标四臂1/4→3/4,未达预声明4/4,控制无回退。总35572 tokens、未知用量0,处理组+17.85%;保持默认off,不补跑/扩样。md-009 Forge已用Discount,却漏接CTE FROM/JOIN;共享Assurance v8通过该样本,SQLite报unknown_column,不自动补JOIN。16原响应hash/回放/独立SQLite评分一致,216日志及Pi快照封存、服务已停。完整结果见[配对简报](benchmark-luna-value-context-2026-09-06.md)与[机器证据](benchmark-luna-value-context-2026-09-06.json)。父Run仍为seed48,不作为seed49或H/R0.6晋级。 +授权前实现与零调用准备见[准备简报](archive/benchmarks/benchmark-luna-value-context-ready-2026-09-06.md)。随后用户单独批准16次Luna配对:16派发/16候选,Forge EX/Contract2/4→3/4、Direct3/4→4/4;目标四臂1/4→3/4,未达预声明4/4,控制无回退。总35572 tokens、未知用量0,处理组+17.85%;保持默认off,不补跑/扩样。md-009 Forge已用Discount,却漏接CTE FROM/JOIN;共享Assurance v8通过该样本,SQLite报unknown_column,不自动补JOIN。16原响应hash/回放/独立SQLite评分一致,216日志及Pi快照封存、服务已停。完整结果见[配对简报](archive/benchmarks/benchmark-luna-value-context-2026-09-06.md)与[机器证据](archive/benchmarks/benchmark-luna-value-context-2026-09-06.json)。父Run仍为seed48,不作为seed49或H/R0.6晋级。 ### FROM作用域绑定保障(REQ-055) @@ -148,21 +148,40 @@ REQ-055当时将共享Assurance修订升为`query-assurance-v9`,Policy仍为v9 零模型调用;1016份固定历史SQL仅新增拒绝REQ-054处理组md-009 Forge,R500原997通过/3拒绝不变,旧正确新增误拒0。原16候选在当前诊断上下文下输出、SQL、EX/Contract保持一致,只把该臂的执行错误前移到Assurance拒绝。65个SQLite夹具中原qualify接受且可执行的查询无新增误拒;18项五方言/LATERAL/SEMI/ANTI检查仅证明静态解析和作用域,不代表外部数据库运行时已验证。 -真实CLI→鉴权HTTP验证原Forge JSON/Direct SQL均拒绝,合法CTE通过但不授权执行,其返回SQL另行只读执行一致。旧v4冻结因源码漂移HTTP409;即使显式diagnostic,旧版本化候选也不能越过预声明变量。保留原Run/协议及文件hash,将未修改输出提取到独立诊断账本后重评;compare仍拒绝晋级。Python887 passed/26 skipped、Pi151 passed/typecheck通过,服务关闭。不改原成绩或value_context默认off结论,滚动父Run仍seed48。见[修复简报](benchmark-luna-from-scope-fix-2026-09-07.md)与[机器证据](benchmark-luna-from-scope-fix-2026-09-07.json)。 +真实CLI→鉴权HTTP验证原Forge JSON/Direct SQL均拒绝,合法CTE通过但不授权执行,其返回SQL另行只读执行一致。旧v4冻结因源码漂移HTTP409;即使显式diagnostic,旧版本化候选也不能越过预声明变量。保留原Run/协议及文件hash,将未修改输出提取到独立诊断账本后重评;compare仍拒绝晋级。Python887 passed/26 skipped、Pi151 passed/typecheck通过,服务关闭。不改原成绩或value_context默认off结论,滚动父Run仍seed48。见[修复简报](archive/benchmarks/benchmark-luna-from-scope-fix-2026-09-07.md)与[机器证据](archive/benchmarks/benchmark-luna-from-scope-fix-2026-09-07.json)。 ### 发布前物理来源授权修复(2026-09-07) -现行共享Assurance为`query-assurance-v10`,Policy仍v9。发布审阅发现既有全局CTE名称集合可遮蔽未授权实体表;现改按SQLGlot各Scope的真实source校验物理表,CTE/派生Scope不冒充物理关系,并沿用MappingSchema的方言标识符归一化。扁平Registry没有schema/catalog授权语义,带此类限定的物理来源失败关闭,不借同名表获得授权。 +该次物理来源授权修复将共享Assurance升为`query-assurance-v10`,Policy仍v9。发布审阅发现既有全局CTE名称集合可遮蔽未授权实体表;现改按SQLGlot各Scope的真实source校验物理表,CTE/派生Scope不冒充物理关系,并沿用MappingSchema的方言标识符归一化。扁平Registry没有schema/catalog授权语义,带此类限定的物理来源失败关闭,不借同名表获得授权。 -合成越权复现先红后绿,合法CTE结果与双输入门禁保留;旧v9 QueryRun审批必须因assurance_revision_drift拒绝,重新prepare/审核,不自动迁移。此修复零模型调用;旧实验成绩和原始hash不重写,旧冻结协议遇新源码会拒绝。见[版本验证](release-verification-2026-09-07.json)。 +合成越权复现先红后绿,合法CTE结果与双输入门禁保留;旧v9 QueryRun审批必须因assurance_revision_drift拒绝,重新prepare/审核,不自动迁移。此修复零模型调用;旧实验成绩和原始hash不重写,旧冻结协议遇新源码会拒绝。见[版本验证](archive/engineering/release-verification-2026-09-07.json)。 + +### 显式数据集规则与结构化执行(REQ-060) + +当前Assurance为`query-assurance-v11`,通用Policy为`scoped-policy-v1`。Registry/ACL、关系粒度、类型、SQL只读与来源作用域校验始终执行。历史large字段约定和自然语言意图启发式不再成为通用数据源接入条件:Registry未选择profile时,报告中`convention_policy`和`intent_fulfillment`为`not_applicable`;合法自定义`dim_user.id`不会输给样例字段名。 + +若要启用历史规则,在受信Registry顶层显式声明`"assurance_profile": {"id": "large-benchmark", "revision": "large-benchmark-v1"}`。未知或残缺revision失败关闭;规则是否适用、规则gate与revision进入报告,整份Registry hash绑定选择。benchmark generation lint调用同样显式固定profile/revision,不自动从表名、题目或数据集路径推断。该profile是历史业务约定,不是可执行权限;Direct SQL仍只接受可验证的SQL保障,不声称校验自然语言意图。 + +执行层统一使用`forge.executor.execute`返回`ExecutionResult`(success/text/columns/rows/truncated/error_code),旧tuple与metadata入口已移除。QueryRun审批及legacy Web/飞书消费者依据success和稳定code判断,不解析展示文本;空结果和截断是成功,权限拒绝、超时、语法及表字段错误分别保留code。旧Assurance/Policy审核必须重新prepare和人工审核,profile变更触发Registry drift,不迁移旧证据、不修改历史成绩或冻结hash。 ### 已实现的离线CLI -以下命令不调用模型;PROVIDER/MODEL替换为真实配置名,输出使用新路径,不覆盖历史。D可用--case-ids显式列题,或seed/size按数据库×难度round-robin确定性抽样;R固定完整500题,不接受子集。变量只允许model/prompt/compiler/schema/date_context/grain_context/value_context之一。日期、粒度与取值提示变量只切换各自的窄参数;任意ContextSnapshot、Schema、采样上限或共享源码修改仍被拒绝,不能借此绕过评价器门禁。 +以下命令不调用模型;PROVIDER/MODEL替换为真实配置名,输出使用新路径,不覆盖历史。D可用--case-ids显式列题,或seed/size按数据库×难度round-robin确定性抽样;R固定完整500题,不接受子集。变量只允许model/prompt/compiler/schema/date_context/grain_context/value_context/schema_descriptions之一。日期、粒度、取值与Schema说明变量只切换各自的窄参数;任意ContextSnapshot、采样上限、未声明Schema或共享源码修改仍被拒绝,不能借此绕过评价器门禁。 + +`--schema-descriptions`默认`off`;`interfaces-v1`仅给strict工具Schema的scan/cte/agg/window/select增加审核说明,必须同时声明`--variable schema_descriptions`。不改字段顺序、完整DSL、Prompt、Direct输入、Compiler或评分。共享`agent/contracts/forge-output-descriptions-v1.json`绑定canonical与实际wire hash;v5冻结、实际Pi派发和重开均校验。该因素compare只允许已声明mode/wire差异,必须有两侧完整且各自绑定的Pi生成合同与模型来源;无合同旧候选只能诊断。原schema因素仍要求同候选,不能借新因素绕过目录、源码、上下文或SDK漂移。 + +REQ-065零调用实现验证与后续获批64次ABBA均已完成。8题各两重复,处理Forge EX/Contract12/16(75%)高于同期Direct10/16(62.5%),两重复各6/8 vs5/8;控制组两臂均10/16。此为限定样本里程碑,不是总体或统计优势;无同一目标题跨重复稳定恢复、控制题md-052回退,采用门槛失败,候选保持默认off。新增1137 Schema字节不是tokens;真实总用量222015 tokens。见[原准备卡](archive/benchmarks/benchmark-luna-schema-descriptions-ready-2026-09-08.json)、[实跑报告](archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.json)与[优化动作/完整简报](archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.md)。不补跑、不启用、不发布版本。 + +Schema说明候选的零调用冻结示例(控制组同清单、同变量,模式为off;真实生成另行授权): + +```bash +forge benchmark bird freeze --cohort D --provider "$PROVIDER" --model "$MODEL" --case-ids md-009 md-079 md-199 md-289 md-002 md-052 md-312 md-386 --variable schema_descriptions --schema-descriptions interfaces-v1 --out frozen-schema-descriptions.json +forge benchmark bird preflight frozen-schema-descriptions.json +``` -`--forge-prompt-revision`默认`forge-structured-benchmark-v1`,保持原指令;`forge-structured-benchmark-denominator-v1`只追加一条合成分母范围范例,必须同时声明`--variable prompt`。只接受注册的内置revision,不加载任意Prompt文件,不包含真实题目/Gold。冻结、HTTP上下文、Pi生成合同与重开均绑定同一revision;compare允许控制/处理各自绑定的Prompt revision不同,但不能顺带改变Direct、共享上下文、runtime或SDK。该范例已完成16次Luna开发对照:Forge EX/Contract2/4→3/4、Direct2/4不变,但正确对照md-079发生别名/投影错误回退,未过预声明门槛,不启用默认或补跑。见[完整机器证据](benchmark-luna-denominator-scope-2026-09-07.json)。 +`--forge-prompt-revision`默认`forge-structured-benchmark-v1`,保持原指令;`forge-structured-benchmark-denominator-v1`只追加一条合成分母范围范例,必须同时声明`--variable prompt`。只接受注册的内置revision,不加载任意Prompt文件,不包含真实题目/Gold。冻结、HTTP上下文、Pi生成合同与重开均绑定同一revision;compare允许控制/处理各自绑定的Prompt revision不同,但不能顺带改变Direct、共享上下文、runtime或SDK。该范例已完成16次Luna开发对照:Forge EX/Contract2/4→3/4、Direct2/4不变,但正确对照md-079发生别名/投影错误回退,未过预声明门槛,不启用默认或补跑。见[完整机器证据](archive/benchmarks/benchmark-luna-denominator-scope-2026-09-07.json)。 -`forge-structured-benchmark-cte-interface-v1`是另一个独立、默认不启用的候选:只追加一条合成CTE声明/导出/引用范例,不叠加分母范例,不强制简单查询使用CTE,不自动补列或增加返修。也必须显式`--variable prompt`。REQ-058已完成独立授权的16次Luna配对调用:Forge EX/Contract3/4→3/4(md-199新增正确、md-079回退),Direct3/4→2/4;目标全对与零回退门槛失败。总67367 tokens,处理总量+8.57%,但Forge每正确答案tokens+13.11%、生成P95+41.53%,后两项护栏亦失败。不启用默认、不补跑或扩样;四题单次开发结果不代表500题或生产表现。见[生成证据](benchmark-luna-cte-interface-2026-09-07.json);原[零调用准备证据](benchmark-cte-interface-ready-2026-09-07.json)保留,不能混作生成结果。 +`forge-structured-benchmark-cte-interface-v1`是另一个独立、默认不启用的候选:只追加一条合成CTE声明/导出/引用范例,不叠加分母范例,不强制简单查询使用CTE,不自动补列或增加返修。也必须显式`--variable prompt`。REQ-058已完成独立授权的16次Luna配对调用:Forge EX/Contract3/4→3/4(md-199新增正确、md-079回退),Direct3/4→2/4;目标全对与零回退门槛失败。总67367 tokens,处理总量+8.57%,但Forge每正确答案tokens+13.11%、生成P95+41.53%,后两项护栏亦失败。不启用默认、不补跑或扩样;四题单次开发结果不代表500题或生产表现。见[生成证据](archive/benchmarks/benchmark-luna-cte-interface-2026-09-07.json);原[零调用准备证据](archive/benchmarks/benchmark-cte-interface-ready-2026-09-07.json)保留,不能混作生成结果。 ```bash forge benchmark bird freeze --cohort D --provider "$PROVIDER" --model "$MODEL" --seed 42 --size 20 --variable prompt --out frozen-d.json @@ -190,7 +209,7 @@ forge benchmark bird freeze --cohort D --provider "$PROVIDER" --model "$MODEL" - forge benchmark bird preflight frozen-cte-interface.json ``` -候选账本为`{schema_version:"bird-candidates-v1",protocol_revision:"sha256:…",candidates:[{case_id,arm:"forge"|"direct",output}]}`;每个冻结case/arm恰好一项,生成失败保留output:null。也接受Pi导出的cases双臂output。历史无版本候选只能显式replay --diagnostic,不能参与可比较晋级;同一协议schema内跨源码版本重评需显式新--protocol并保留candidate_protocol_revision。已不支持的v1/v2/v3协议不得伪造升级;仅可保留原始Run/协议/文件hash,将原候选无修改提取到显式诊断账本,再用当前上下文重评,不能充当新生成或可比基线。quality-records.json形状为`{label_basis,records}`,遵守上面的质量契约;输入也可用`-`从stdin读取。日期审计可用--dataset-root指定官方数据根目录。 +候选账本为`{schema_version:"bird-candidates-v1",protocol_revision:"sha256:…",candidates:[{case_id,arm:"forge"|"direct",output}]}`;每个冻结case/arm恰好一项,生成失败保留output:null。也接受Pi导出的cases双臂output。历史无版本候选只能显式replay --diagnostic,不能参与可比较晋级;同一协议schema内跨源码版本重评需显式新--protocol并保留candidate_protocol_revision。当前只接受v5;不支持的v1/v2/v3/v4协议不得伪造升级,只能保留原始Run/协议/hash,将原候选无修改提取到显式诊断账本,用当前上下文重评,不能充当新生成或可比基线。quality-records.json形状为`{label_basis,records}`,遵守上面的质量契约;输入也可用`-`从stdin读取。 需要实际生成时,沿用Pi现有鉴权调用`POST /v1/benchmarks`,提交`{provider,model,case_ids,confirm_model_calls:frozen.generation.max_model_calls,protocol_manifest:frozen.manifest}`;这是会消耗模型额度的步骤,必须另行明确授权。默认require_all为2N预算;显式Gold跳过则减去2×阻塞题数,题目分母不变。case_ids保留冻结顺序,R阶段使用显式R清单,不因题目数碰巧为500就把D自动升级为R。Web默认启动按钮仍确认2N预算;未传清单的启动由协议API冻结为D。随后导出现有Pi Run供replay,不另建生成器。 @@ -198,15 +217,15 @@ forge benchmark bird preflight frozen-cte-interface.json ### 当前候选与历史保护 -REQ-044投影完整性候选Forge仍4/5、零新增通过,不采纳、不扩样追分;Direct未改指令却4/5→5/5属于生成波动。保留现行Prompt、[原始配对证据](benchmark-luna-projection-instructions-2026-09-05.json)及下文历史,不把日期审计、评价器纠错或标准落地写成新的模型收益。本标准落地不授权新增付费模型调用。 +REQ-044投影完整性候选Forge仍4/5、零新增通过,不采纳、不扩样追分;Direct未改指令却4/5→5/5属于生成波动。保留现行Prompt、[原始配对证据](archive/benchmarks/benchmark-luna-projection-instructions-2026-09-05.json)及下文历史,不把日期审计、评价器纠错或标准落地写成新的模型收益。本标准落地不授权新增付费模型调用。 -REQ-047日期观察实验已完成20次Luna配对生成:Forge EX/Contract2/5→3/5,Direct3/5→3/5;新增通过仅为未获日期补充、输入相同的md-289,不计日期收益。目标md-483双臂和md-077 Forge的日期绑定改善,但EX/Contract仍失败,预声明门槛未满足,默认off、不推广、不补样。总73565 tokens,处理组双臂+12.49%;20臂重放/hash与19个可执行候选独立官方EX核心复算一致,1个Assurance拒绝保留。见[简报](benchmark-luna-date-context-2026-09-05.md)与[逐题证据](benchmark-luna-date-context-2026-09-05.json)。 +REQ-047日期观察实验已完成20次Luna配对生成:Forge EX/Contract2/5→3/5,Direct3/5→3/5;新增通过仅为未获日期补充、输入相同的md-289,不计日期收益。目标md-483双臂和md-077 Forge的日期绑定改善,但EX/Contract仍失败,预声明门槛未满足,默认off、不推广、不补样。总73565 tokens,处理组双臂+12.49%;20臂重放/hash与19个可执行候选独立官方EX核心复算一致,1个Assurance拒绝保留。见[简报](archive/benchmarks/benchmark-luna-date-context-2026-09-05.md)与[逐题证据](archive/benchmarks/benchmark-luna-date-context-2026-09-05.json)。 ### 工程门禁与验收证据 Python既有CI运行全套pytest;新增pi-contracts CI job运行Node22、npm ci、TypeScript typecheck及Pi行为测试,不使用模型凭证。永久回归覆盖官方EX/Contract差异、Top-5数据偶合、冻结数据/预算/上下文漂移、已评分失败分母、原候选哈希、未知标签/成本及日期冲突。 -[`benchmark-standards-engineering-2026-09-05.json`](benchmark-standards-engineering-2026-09-05.json)记录实际CLI冻结/重放/对比、质量与日期审计、HTTP协议门禁、浏览器预算/未知成本和双侧验证。R500本次仅冻结与校验,不是新的500题模型运行;旧10候选诊断重放仍双臂4/5,不宣称新收益。 +[`archive/benchmarks/benchmark-standards-engineering-2026-09-05.json`](archive/benchmarks/benchmark-standards-engineering-2026-09-05.json)记录实际CLI冻结/重放/对比、质量与日期审计、HTTP协议门禁、浏览器预算/未知成本和双侧验证。R500本次仅冻结与校验,不是新的500题模型运行;旧10候选诊断重放仍双臂4/5,不宣称新收益。 ### REQ-046:失败延续、七三抽样与每轮简报 @@ -253,7 +272,7 @@ forge evaluate --run-id "evr_" ### 同候选、同Gold、不同评价版本 -证据:[benchmark-sol-metric-replay-2026-09-05.json](benchmark-sol-metric-replay-2026-09-05.json)。保留原Sol Run与归因JSON;校验1000个候选/SQL、500个Gold及996个可执行结果的原始哈希,并逐项复现旧比较器判定。只读公开SQLite重执行上限120秒,Gold采用已核对内容和SQL哈希的仓库缓存;未重跑Assurance,不是时延或新生成基准。 +证据:[benchmark-sol-metric-replay-2026-09-05.json](archive/benchmarks/benchmark-sol-metric-replay-2026-09-05.json)。保留原Sol Run与归因JSON;校验1000个候选/SQL、500个Gold及996个可执行结果的原始哈希,并逐项复现旧比较器判定。只读公开SQLite重执行上限120秒,Gold采用已核对内容和SQL哈希的仓库缓存;未重跑Assurance,不是时延或新生成基准。 | 指标 | Forge | Direct SQL | |---|---:|---:| @@ -268,7 +287,7 @@ forge evaluate --run-id "evr_" ### 冻结清单与剩余门禁 -[accuracy-evaluation-cohorts-2026-09-05.json](accuracy-evaluation-cohorts-2026-09-05.json) 冻结R=500题,D=16道value_grounding诊断题+34道旧基线两指标通过对照,覆盖11库与33个数据库/难度分层;对照从258道eligible中按固定SHA排序和配额产生,未按修复后得分挑选。S的20个比较器输入期望全部通过,7个既有安全测试引用共14个参数化用例通过。D/R不是独立业务正确性标签。 +[accuracy-evaluation-cohorts-2026-09-05.json](archive/benchmarks/accuracy-evaluation-cohorts-2026-09-05.json) 冻结R=500题,D=16道value_grounding诊断题+34道旧基线两指标通过对照,覆盖11库与33个数据库/难度分层;对照从258道eligible中按固定SHA排序和配额产生,未按修复后得分挑选。S的20个比较器输入期望全部通过,7个既有安全测试引用共14个参数化用例通过。D/R不是独立业务正确性标签。 H只冻结选择/独立审核协议,状态 `not_ready`:旧hard子集与R重叠;Spider2未找到能同时证明未参与调参、完成题意/模板隔离和独立标签审核的现成切片。P未授权。R保持500个case_id,公开question_id实际498个;重复官方实例保留,不以question_id去重。**ACC-1A维护完成,但ACC-1整体及ACC-6独立验证门禁未通过。**下一步补齐独立H来源与审核,冻结ACC-2A单变量实验卡和总调用预算后,才进入新候选实验。 @@ -278,19 +297,19 @@ H只冻结选择/独立审核协议,状态 `not_ready`:旧hard子集与R重 ## ACC-2前置实证:恢复已有元数据,不宣称新得分(2026-09-05) -`REQ-2026-09-05-037` 的[元数据审计](accuracy-metadata-treatment-audit-2026-09-05.json)发现:format+PK对D16/25错误arm没有新增有效取值证据,因此停止该追加Prompt实验。 +`REQ-2026-09-05-037` 的[元数据审计](archive/benchmarks/accuracy-metadata-treatment-audit-2026-09-05.json)发现:format+PK对D16/25错误arm没有新增有效取值证据,因此停止该追加Prompt实验。 -[CSV绑定修复证据](accuracy-metadata-binding-fix-2026-09-05.json)记录了实际缺陷:`student_club`描述CSV的大小写与schema不同,48列已有元数据被丢弃,其中17列有非空values。现按SQLite ASCII标识符规则匹配表/列,保留schema原名,大小写碰撞失败关闭,不对Unicode标识符做额外合并。D50真实context复算仅5题输入改变,md-065的`approved`取值说明恢复;Prompt/Compiler/Gold不变。这只证明输入修复,不是准确率改善。 +[CSV绑定修复证据](archive/benchmarks/accuracy-metadata-binding-fix-2026-09-05.json)记录了实际缺陷:`student_club`描述CSV的大小写与schema不同,48列已有元数据被丢弃,其中17列有非空values。现按SQLite ASCII标识符规则匹配表/列,保留schema原名,大小写碰撞失败关闭,不对Unicode标识符做额外合并。D50真实context复算仅5题输入改变,md-065的`approved`取值说明恢复;Prompt/Compiler/Gold不变。这只证明输入修复,不是准确率改善。 -[H来源审计](accuracy-holdout-source-audit-2026-09-05.json)机械冻结1011候选/964依赖组件,最终H仍未抽样。已曝光SQL解析失败、独立题意/Gold/依赖审核、数据快照和访问隔离仍未完成;公开新版Gold不替代独立审核,也不改写Mini-Dev旧分数。 +[H来源审计](archive/benchmarks/accuracy-holdout-source-audit-2026-09-05.json)机械冻结1011候选/964依赖组件,最终H仍未抽样。已曝光SQL解析失败、独立题意/Gold/依赖审核、数据快照和访问隔离仍未完成;公开新版Gold不替代独立审核,也不改写Mini-Dev旧分数。 -[实验卡](accuracy-csv-binding-experiment-card-2026-09-05.json)准备阶段选取全部5道输入受影响的D题,原提案20次配对生成。后续授权与实际Luna结果见下一节。准备时发现Run的temperature/max_output_tokens仅为声明值,Codex适配器不写8192输出上限且session默认自动重试;实际实验另行约束重试并捕获请求参数,不把8192当token或费用硬上限。 +[实验卡](archive/benchmarks/accuracy-csv-binding-experiment-card-2026-09-05.json)准备阶段选取全部5道输入受影响的D题,原提案20次配对生成。后续授权与实际Luna结果见下一节。准备时发现Run的temperature/max_output_tokens仅为声明值,Codex适配器不写8192输出上限且session默认自动重试;实际实验另行约束重试并捕获请求参数,不把8192当token或费用硬上限。 验证:修复前失败反例已消除;Python725 passed/26 skipped,TypeScript typecheck通过;50题context输入与双臂指令哈希复算通过。新模型调用0,当前Official EA保持下表不变。 ## Luna五题修复前后实测(2026-09-05) -[完整差异与复算证据](benchmark-luna-binding-2026-09-05.json)。通过现有Pi OAuth与 `PiBenchmarkRuntime` 完成5题×2条件×2臂。首次2个请求因显式temperature参数被拒;用户批准总上限22后,默认采样完成20个有效候选,无自动重试。以下计分不含那2个无答案的参数canary,也不将其隐藏为免费重试。 +[完整差异与复算证据](archive/benchmarks/benchmark-luna-binding-2026-09-05.json)。通过现有Pi OAuth与 `PiBenchmarkRuntime` 完成5题×2条件×2臂。首次2个请求因显式temperature参数被拒;用户批准总上限22后,默认采样完成20个有效候选,无自动重试。以下计分不含那2个无答案的参数canary,也不将其隐藏为免费重试。 | 指标 | 修复前 | 修复后 | |---|---:|---:| @@ -310,13 +329,13 @@ md-065两臂由`approved=Yes`改为`true`,从空结果变为非空分类汇总 用户批准1题双臂、最多2次Luna请求。实际2次、零自动重试,两臂HTTP200。Forge真实HTTP请求中strict=true、tool_choice指定emit_forge_query、parallel_tool_calls=false;未经过SDK强制转换的原始参数独立通过严格Schema校验,规范化后通过编译和执行。该题双臂EA/Contract通过,仅证明协议链路可用,不外推总体准确率;Forge 4185 tokens,Direct 2182 tokens。 -[完整请求证据与原始/规范化候选](benchmark-luna-strict-output-2026-09-05.json)。TypeScript typecheck与129项Pi测试通过。仅Luna/Codex完成服务端验证;其他OpenAI兼容接口不能据此宣称支持。严格结构不保证字符串别名、取值绑定、范围或业务语义正确,md-052别名问题仍单独处理。历史成绩保留原生成契约,不追溯标记为strict。 +[完整请求证据与原始/规范化候选](archive/benchmarks/benchmark-luna-strict-output-2026-09-05.json)。TypeScript typecheck与129项Pi测试通过。仅Luna/Codex完成服务端验证;其他OpenAI兼容接口不能据此宣称支持。严格结构不保证字符串别名、取值绑定、范围或业务语义正确,md-052别名问题仍单独处理。历史成绩保留原生成契约,不追溯标记为strict。 ## 隐式关系别名修复:固定候选离线复算(2026-09-05) `REQ-2026-09-05-039` 修复Compiler关系解析不一致:SQL渲染接受event e,但引用绑定只识别event AS e。共用解析器现在支持省略AS的表/限定表/括号子查询别名;完整引用标识符不拆分,SQL尾部子句不误作别名,原表名遮蔽与重复绑定继续拒绝。无需修改模型输出或放宽Assurance。 -对上述同一批20个Luna候选和冻结HTTP上下文离线复算,只有处理组md-052 Forge的SQL改变;返回September Speaker,编译、Assurance、执行、Official EA与Contract均通过。处理组Forge从2/5恢复3/5,控制组Forge及双条件Direct保持3/5;零回退、零新增模型调用。原始Run/证据不覆盖,新结果单独保存于[别名修复复算证据](benchmark-luna-alias-fix-2026-09-05.json)。 +对上述同一批20个Luna候选和冻结HTTP上下文离线复算,只有处理组md-052 Forge的SQL改变;返回September Speaker,编译、Assurance、执行、Official EA与Contract均通过。处理组Forge从2/5恢复3/5,控制组Forge及双条件Direct保持3/5;零回退、零新增模型调用。原始Run/证据不覆盖,新结果单独保存于[别名修复复算证据](archive/benchmarks/benchmark-luna-alias-fix-2026-09-05.json)。 Compiler/Benchmark聚焦141项通过,5方言解析通过;原始回归在修复前有3项失败。该结果纠正Compiler缺陷归因,不证明元数据处理带来准确率提升,未重评历史500题。 @@ -333,7 +352,7 @@ Compiler/Benchmark聚焦141项通过,5方言解析通过;原始回归在修 **中途故障必须计入审计**:第10次请求后,Pi递归子Schema强制转换栈溢出;第二轮Agent尝试在HTTP前被阻止,未额外调用。原Run错误标为completed且丢失3819 tokens。现已把严格校验/归一化移至prepareArguments,再由Pi校验canonical Schema;缺失候选失败关闭并保留token。用户确认只继续剩余10次,原响应不补跑、不改写。最终20个原始候选统一离线复算;恢复的md-046候选仍被Assurance拒绝,不判对。 -[原始请求、费用、故障和统一复算证据](benchmark-luna-strict-paired-2026-09-05.json)。10个Forge原始参数及真实Pi校验通过,20个原始候选评分已复核;132项Pi测试/typecheck通过。历史运行不覆盖,历史500题不重评;暂不扩大量测,优先明确费用分组和姓名输出契约。 +[原始请求、费用、故障和统一复算证据](archive/benchmarks/benchmark-luna-strict-paired-2026-09-05.json)。10个Forge原始参数及真实Pi校验通过,20个原始候选评分已复核;132项Pi测试/typecheck通过。历史运行不覆盖,历史500题不重评;暂不扩大量测,优先明确费用分组和姓名输出契约。 ## Luna当前配置跨库十题扩展回归(2026-09-05) @@ -352,7 +371,7 @@ Compiler/Benchmark聚焦141项通过,5方言解析通过;原始回归在修 - md-241:两臂找到同一个Felipe Massa,但把Evidence定义的forename/surname合为一列;仍按原列数契约判错。 - **md-454反例**:Forge漏Top-5条件,当前公开数据结果集仍与Gold相同,EA通过;隔离构造同县6校后返回6行而不是5行,证明逻辑并不等价。该题Contract失败源于行序,不表示它识别了漏过滤。官方6/10不改写,也不把它当语义正确率。 -[完整请求、候选、只读结果核对与六校反例](benchmark-luna-expanded-regression-2026-09-05.json)。本轮未改代码、Gold、Prompt或评分;样本作为通用问题证据,不成为业务规则来源,不扩样凑收益,历史500题得分不变。 +[完整请求、候选、只读结果核对与六校反例](archive/benchmarks/benchmark-luna-expanded-regression-2026-09-05.json)。本轮未改代码、Gold、Prompt或评分;样本作为通用问题证据,不成为业务规则来源,不扩样凑收益,历史500题得分不变。 ## 投影完整性生成指令配对验证(2026-09-05) @@ -369,7 +388,7 @@ REQ-044已确认以BIRD建立查询准确性基础。先离线重现3个原始 **不采用候选Prompt**:Forge零新增通过、零正确回退,3个正确对照均保持通过。md-436两条件现在都生成相同正确SQL,不能将相对上轮的恢复记作候选收益;md-259原指令分母范围错,候选输出三个中间计数,仍漏百分比并违反列数契约。Direct指令未变却4/5→5/5,是生成波动,不是处理收益。 -[原始候选、单变量校验、官方EX复算与不采纳决定](benchmark-luna-projection-instructions-2026-09-05.json)。此为5道已曝光开发题的诊断,不代表整体80%准确率,不替代历史500题成绩;保留现行Prompt,不补跑、不继续堆叠提醒或扩样追分。 +[原始候选、单变量校验、官方EX复算与不采纳决定](archive/benchmarks/benchmark-luna-projection-instructions-2026-09-05.json)。此为5道已曝光开发题的诊断,不代表整体80%准确率,不替代历史500题成绩;保留现行Prompt,不补跑、不继续堆叠提醒或扩样追分。 ## 当前得分 @@ -432,7 +451,7 @@ REQ-044已确认以BIRD建立查询准确性基础。先离线重现3个原始 --- ## Sol 固定候选错题初步归因(2026-09-05) -`REQ-2026-09-05-034` 完成离线 P0 分析。可复核清单见 [benchmark-sol-error-triage-2026-09-05.json](benchmark-sol-error-triage-2026-09-05.json):保存全部 500 题、1000 个原始候选及当前 SQL、问题/Evidence/Gold SQL、结果摘要与哈希、双评分、373 个失败 arm 的逐项理由和主审修订。未修改 Prompt、Compiler、评分器、Gold 或原始 Run,未生成新候选。 +`REQ-2026-09-05-034` 完成离线 P0 分析。可复核清单见 [benchmark-sol-error-triage-2026-09-05.json](archive/benchmarks/benchmark-sol-error-triage-2026-09-05.json):保存全部 500 题、1000 个原始候选及当前 SQL、问题/Evidence/Gold SQL、结果摘要与哈希、双评分、373 个失败 arm 的逐项理由和主审修订。未修改 Prompt、Compiler、评分器、Gold 或原始 Run,未生成新候选。 同一 Sol Run 的诊断重放仍为 Forge 313/500 EA、280/500 Contract、496/500 Execution;Direct 314/500、291/500、500/500。重放使用只读公开 SQLite、当前 Compiler 和两个比较器,不重新运行 Assurance;慢查询诊断时限延长至 120 秒,两条慢 Gold 查询使用已校验 SQL SHA-256 的仓库缓存。因此这是固定候选诊断,不是新的正式运行或时延成绩。 @@ -606,7 +625,7 @@ Method AI 使用 large 40 题电商数仓基准、火山方舟 Coding Plan 的 相对上一交付基线 Method AF,Run ACC 从 97.5% 提升到 100.0%。Method AF 使用 DeepSeek V4 Pro,Method AI 使用 Ark Coding Plan,因此这组只表示当前可复现交付结果, -不作为严格的同模型 A/B。详见 [2026-07-13 测试报告](test-report-2026-07-13.md)。 +不作为严格的同模型 A/B。详见 [2026-07-13 测试报告](archive/engineering/test-report-2026-07-13.md)。 ## 上一交付基线:Method AF @@ -632,7 +651,7 @@ Method AF 使用 large 40 题电商数仓基准、DeepSeek V4 Pro、每题 3 次 | Run ACC | 89.2% | 97.5% | | 编译失败率 | 0.0% | 0.0% | -详见 [2026-05-06 测试报告](test-report-2026-05-06.md)。 +详见 [2026-05-06 测试报告](archive/engineering/test-report-2026-05-06.md)。 ## 自有用例:40 题 @@ -713,7 +732,7 @@ ANTI/SEMI JOIN 差距最大(+0.80):直接生成 SQL 的模型频繁产生 全部四个 Method 均使用相同 Forge DSL 模式 + 语义库(`use_semantic_lib=True`)。Method L/R/N 每题 3 次运行,Method T(Claude)因调用方式特殊(`claude --print` 子进程)为 1 次运行,Run ACC 数字可直接和 Case EA(any) 对比,但严格讲三者不完全等价。 -> **版本说明**:M2.7 (R) 首次运行于 2026-03-18(baseline 62.5%);2026-03-19 修复设计缺陷后重跑,提升至 65.0%。设计修复内容见 `docs/benchmark_failure_analysis_2026-03-18.md`。 +> **版本说明**:M2.7 (R) 首次运行于 2026-03-18(baseline 62.5%);2026-03-19 修复设计缺陷后重跑,提升至 65.0%。设计修复内容见 `docs/archive/benchmarks/benchmark_failure_analysis_2026-03-18.md`。 ### 总体得分 diff --git a/docs/candidate-delivery-2026-09-08.json b/docs/candidate-delivery-2026-09-08.json new file mode 100644 index 0000000..1b3f5d4 --- /dev/null +++ b/docs/candidate-delivery-2026-09-08.json @@ -0,0 +1,346 @@ +{ + "schema_version": "candidate-delivery-v1", + "date": "2026-09-08", + "requirement": "REQ-2026-09-08-063", + "status": "candidate_pr_open_code_ci_passed", + "base_commit": "018317d89edfa0f56c48c865f35c9a45204d9d11", + "candidate_branch": "review/forge-engineering-evidence-2026-09-08", + "authorization": { + "commit": true, + "push_candidate_branch": true, + "create_pull_request": true, + "merge_main": false, + "tag": false, + "release": false, + "deploy": false, + "model_calls": false + }, + "scope": { + "requirements": [ + "REQ-2026-09-07-060", + "REQ-2026-09-07-061", + "REQ-2026-09-08-062" + ], + "additional_maintenance": "Update existing external-agent integration guide for implemented public Evaluate/Enforce/Explain APIs; retain prepare-query compatibility boundary. No new external-agent adapter. Fix pytest console collection of source-only tools via test-only pythonpath configuration; keep tools excluded from runtime distributions." + }, + "publication_review": { + "method": "Scoped public-diff/source review and bounded literal scans; not an independent security certification.", + "python_current_files": 67, + "pi_web_tools_current_files": 179, + "documentation_files": 107, + "archive_files_matching_governance_manifest": 84, + "excluded_private_paths_in_change_set": [], + "confirmed_new_credential_findings": [], + "document_scan_dispositions": [ + { + "path": "docs/archive/engineering/golden-journey-acceptance-2026-08-24.md", + "line": 122, + "kind": "personal_absolute_path", + "disposition": "Already-redacted file:///home/.../index.html placeholder describing a historical PDF leak; not a personal path." + }, + { + "path": "docs/requirements-pool.md", + "line": 443, + "kind": "personal_absolute_path", + "disposition": "Already-redacted file:///home/.../index.html placeholder describing a historical PDF leak; not a personal path." + } + ], + "inherited_observations": [ + { + "severity": "low", + "path": "web/feishu.py", + "line": 782, + "reason": "A hard-coded RFC1918 address remains in the chart URL fallback. The identical literal exists at baseline line 775; this is inherited internal-endpoint publication hygiene, not a newly introduced credential. Address is intentionally redacted. Do not infer a live secret or a newly introduced blocker from this finding." + } + ], + "limits": [ + "Private originals, existing excluded legacy results/data/databases and full Git history were not inspected.", + "No model calls, live credential validation, production configuration access or external channel calls were performed.", + "gitleaks and trufflehog were not available; scans and scoped manual review do not certify absence of all secrets." + ], + "source_reports": { + "scope": "Original pre-commit scoped reports are preserved byte-for-byte. The later source adjustments and final dispositions remain separately recorded here; this summary does not replace the originals.", + "artifacts": [ + { + "path": "docs/archive/engineering/candidate-python-publication-audit-2026-09-08.json", + "sha256": "d83a938bfbaf86e3afaa0b579df9b1c4d1189ff88b8b8208dea56564912ece06", + "bytes": 8477 + }, + { + "path": "docs/archive/engineering/candidate-pi-web-publication-audit-2026-09-08.json", + "sha256": "998f36b546ef6f41f59c5176d54893c6996f10035ed4e89408ced90f66feb256", + "bytes": 31996 + }, + { + "path": "docs/archive/engineering/candidate-documentation-publication-audit-2026-09-08.json", + "sha256": "7b70ac7888fe5753a6de4431a03e34dc58389281e1e986a7718c0cf18c4b6baf", + "bytes": 615 + } + ] + } + }, + "local_verification": { + "related_contract_tests": { + "passed": 63, + "command": "pytest tests/test_evaluate.py tests/test_enforce.py tests/test_explain.py tests/test_docs_links.py -q", + "environment": "Isolated public source snapshot, clean environment and private-source/network sandbox.", + "warning": "Third-party protobuf datetime.utcfromtimestamp deprecation." + }, + "actual_quickstart": { + "command": "forge quickstart --workdir --yes --json", + "run_receipt": { + "schema_version": 1, + "forge_version": "0.1.0", + "environment": { + "system": "Darwin", + "release": "25.6.0", + "machine": "arm64", + "python_implementation": "CPython", + "python_version": "3.14.7" + }, + "started_at": "2026-09-07T16:59:19.238240+00:00", + "completed_at": "2026-09-07T16:59:22.458273+00:00", + "runtime_duration_ms": 3222, + "outcome": { + "query_run_id": "qr_b07af09a49b44e27aa62f742f6647a3c", + "fail_closed": { + "status": "failed", + "failure": { + "stage": "assurance", + "code": "readonly_violation", + "retryable": false + } + }, + "evaluate": { + "status": "passed", + "policy_verdict": "allow_review", + "result_comparison": "passed" + }, + "enforce": { + "status": "completed", + "truncated": true + }, + "explain": { + "integrity": "verified", + "evidence_types": [ + "candidate", + "policy", + "query", + "assurance", + "source", + "approval", + "result" + ], + "limitations": [ + "semantic_correctness_unproven", + "live_data_no_snapshot", + "result_truncated" + ] + }, + "dashboard": { + "status": "passed", + "path": "/admin/dashboard" + } + }, + "receipt_hash": "sha256:77f035188cbc5f23a555e7e27d090e0ae00fe08c8455bc39855d401db4025557" + }, + "scope": "Maintainer synthetic-data HTTP/CLI smoke; automatic approval explicitly requested, not independent adoption evidence." + }, + "setup_correction": "python -m forge is not a supported entry point (no forge.__main__); the documented forge console entry point was then exercised successfully. No runtime change was made.", + "previous_full_validation": "See docs/file-structure-governance-2026-09-07.json for prior 983 Python passed / 28 skipped, 215 Pi passed, typecheck, wheel/sdist and documentation-site evidence; those suites were not re-labelled as fresh runs here.", + "pre_commit_checks": { + "reviewed_paths_staged": 557, + "unexpected_staged_paths": 0, + "diff_check": "passed", + "source_only_adjustments": [ + { + "path": "agent/audit.py", + "change": "Remove EOF blank lines only; byte comparison against reviewed snapshot confirmed no other change." + }, + { + "path": "services/pi-orchestrator/tests/product-projections.test.ts", + "change": "Remove EOF blank lines only; byte comparison against reviewed snapshot confirmed no other change." + }, + { + "path": "tests/test_architecture_course_docs.py", + "change": "Remove EOF blank lines only; byte comparison against reviewed snapshot confirmed no other change." + }, + { + "path": "tests/test_diagnostics_delivery.py", + "change": "Remove EOF blank lines only; byte comparison against reviewed snapshot confirmed no other change." + }, + { + "path": "web/routes/benchmark_v2.py", + "change": "Remove EOF blank lines only; byte comparison against reviewed snapshot confirmed no other change." + } + ], + "staging_warning": "git add reported an ignored legacy results directory after staging; exact index comparison confirmed all 557 reviewed paths and no extras. No force-add was used." + }, + "pytest_console_regression": { + "python": "3.11.14", + "pytest": "9.1.1", + "environment": "Fresh minimal venv, cleared environment, public source snapshot; sandbox denied network and reads of the original repository.", + "before_fix": "pytest tests/test_accuracy_triage.py -q exited 2 during collection with ModuleNotFoundError: No module named tools.", + "after_fix": { + "console_entry_point": "2 passed", + "python_module_entry_point": "2 passed" + }, + "retained_behavior": "Missing per-group TopN filters are classified as topn_filter; an outer rank filter avoids that false attribution.", + "test_cleanup": "Removed test_triage_renders_markdown_backlog because it pinned wording and input echo. The two semantic regression tests remain; no skip or error suppression was added.", + "fix_commit": "c5a3954f11a85cb3bb070363cbbda9da6ae83769" + } + }, + "remote_ci": { + "status": "passed_for_code_revision", + "verified_head_sha": "c5a3954f11a85cb3bb070363cbbda9da6ae83769", + "attempts": [ + { + "run_id": 34146824586, + "url": "https://github.com/shisuidata/Forge/actions/runs/34146824586", + "head_sha": "7b267d727a9f0ee28596958cffce0b2f3996da61", + "conclusion": "failure", + "jobs": [ + { + "name": "pi-contracts", + "conclusion": "success", + "started_at": "2026-09-07T17:15:17Z", + "completed_at": "2026-09-07T17:15:43Z", + "url": "https://github.com/shisuidata/Forge/actions/runs/34146824586/job/101820552086" + }, + { + "name": "distribution (wheel)", + "conclusion": "success", + "started_at": "2026-09-07T17:15:17Z", + "completed_at": "2026-09-07T17:15:58Z", + "url": "https://github.com/shisuidata/Forge/actions/runs/34146824586/job/101820552265" + }, + { + "name": "test", + "conclusion": "failure", + "started_at": "2026-09-07T17:15:17Z", + "completed_at": "2026-09-07T17:15:51Z", + "url": "https://github.com/shisuidata/Forge/actions/runs/34146824586/job/101820552292" + }, + { + "name": "compatibility", + "conclusion": "success", + "started_at": "2026-09-07T17:15:17Z", + "completed_at": "2026-09-07T17:16:29Z", + "url": "https://github.com/shisuidata/Forge/actions/runs/34146824586/job/101820552361" + }, + { + "name": "distribution (sdist)", + "conclusion": "success", + "started_at": "2026-09-07T17:15:17Z", + "completed_at": "2026-09-07T17:15:58Z", + "url": "https://github.com/shisuidata/Forge/actions/runs/34146824586/job/101820552415" + } + ], + "failure": { + "job": "test", + "stage": "collection", + "message": "ModuleNotFoundError: No module named tools", + "test_module": "tests/test_accuracy_triage.py", + "cause": "The pytest console entry point did not place the repository root on sys.path; source-only tools are intentionally absent from installed runtime packages." + } + }, + { + "run_id": 34147746296, + "url": "https://github.com/shisuidata/Forge/actions/runs/34147746296", + "head_sha": "c5a3954f11a85cb3bb070363cbbda9da6ae83769", + "conclusion": "success", + "jobs": [ + { + "name": "pi-contracts", + "conclusion": "success", + "started_at": "2026-09-07T17:28:26Z", + "completed_at": "2026-09-07T17:29:00Z", + "url": "https://github.com/shisuidata/Forge/actions/runs/34147746296/job/101823322222" + }, + { + "name": "compatibility", + "conclusion": "success", + "started_at": "2026-09-07T17:28:26Z", + "completed_at": "2026-09-07T17:29:38Z", + "url": "https://github.com/shisuidata/Forge/actions/runs/34147746296/job/101823322341" + }, + { + "name": "test", + "conclusion": "success", + "started_at": "2026-09-07T17:28:26Z", + "completed_at": "2026-09-07T17:29:28Z", + "url": "https://github.com/shisuidata/Forge/actions/runs/34147746296/job/101823322389" + }, + { + "name": "distribution (wheel)", + "conclusion": "success", + "started_at": "2026-09-07T17:28:26Z", + "completed_at": "2026-09-07T17:29:05Z", + "url": "https://github.com/shisuidata/Forge/actions/runs/34147746296/job/101823322406" + }, + { + "name": "distribution (sdist)", + "conclusion": "success", + "started_at": "2026-09-07T17:28:26Z", + "completed_at": "2026-09-07T17:29:11Z", + "url": "https://github.com/shisuidata/Forge/actions/runs/34147746296/job/101823322411" + } + ], + "python": { + "passed": 982, + "skipped": 28, + "warnings": 5 + }, + "pi": { + "passed": 215, + "failed": 0, + "skipped": 0, + "typecheck": "passed" + }, + "compatibility": { + "sqlite": "1 passed", + "postgresql_16": "1 passed", + "mysql_8": "1 passed" + } + } + ], + "warnings": "Observed third-party lark_oapi/pkg_resources deprecations, GitHub action runtime deprecations and Node SQLite experimental warnings; these are not product test failures.", + "scope": "This recorded success applies to the stated code head. The subsequent evidence-only commit must independently pass PR checks; its final run is recorded in the PR completion comment, avoiding recursive evidence commits." + }, + "adoption": { + "issue": "https://github.com/shisuidata/Forge/issues/9", + "observed_comments": 0, + "external_agent_adapter_issue": "https://github.com/shisuidata/Forge/issues/8", + "adapter_status": "not_implemented_by_this_delivery", + "R0_6": "not_passed", + "holdout_H": "not_promoted", + "public_signal_correction": { + "observed_date": "2026-09-08", + "issue_list_records": 10, + "issues_excluding_pull_requests": 8, + "pull_requests": 2, + "previous_projection": "9 Issues and 1 PR", + "correction": "The Issues API includes PR records. Current projection now separates record types; historical source reports are not rewritten.", + "candidate_pr_created_by_this_session": true, + "candidate_pr_counts_as_independent_adoption": false + } + }, + "pull_request": { + "number": 10, + "url": "https://github.com/shisuidata/Forge/pull/10", + "state_at_recording": "open", + "base": "main", + "author": "rockythink", + "created_by_this_session": true + }, + "candidate_commits": [ + { + "sha": "7b267d727a9f0ee28596958cffce0b2f3996da61", + "role": "Reviewed REQ-060/061/062/063 payload and initial evidence" + }, + { + "sha": "c5a3954f11a85cb3bb070363cbbda9da6ae83769", + "role": "pytest console collection fix and semantic-test cleanup" + } + ] +} diff --git a/docs/commercial-readiness.md b/docs/commercial-readiness.md index 6704424..ee95b43 100644 --- a/docs/commercial-readiness.md +++ b/docs/commercial-readiness.md @@ -228,9 +228,9 @@ large 40 题已经证明技术路线成立,但客户交付还需要: - `forge/lint.py`:补充 large schema 字段契约、输出契约、排序契约、过滤口径、窗口和反连接稳定性检查。 - `tests/test_lint.py`:lint 回归测试扩展到 `53 passed`。 - `tests/datasets/large/field_conventions.registry.yaml`:补充 Method AF 所需的字段和结果契约。 -- `tests/accuracy/methods/method_ae.py`:稳定性实验方法。 -- `tests/accuracy/methods/method_af.py`:当前推荐 DeepSeek V4 Pro 基线。 -- `docs/test-report-2026-05-06.md`:更新本轮测试报告。 +- `tools/benchmarks/accuracy/methods/method_ae.py`:稳定性实验方法。 +- `tools/benchmarks/accuracy/methods/method_af.py`:当前推荐 DeepSeek V4 Pro 基线。 +- `docs/archive/engineering/test-report-2026-05-06.md`:更新本轮测试报告。 - `config.py`:生产认证开关支持 `AUTH_ENABLED` 环境变量,补充查询超时和数据库只读确认配置。 - `forge/executor.py`:执行器增加查询超时兜底。 - `main.py`:readiness 增加数据库只读确认、查询超时、Secure Cookie 检查。 diff --git a/docs/current-project-state.md b/docs/current-project-state.md index e78f167..3382f13 100644 --- a/docs/current-project-state.md +++ b/docs/current-project-state.md @@ -1,6 +1,6 @@ # Forge 当前项目状态 -> 状态:当前事实投影 · Last updated: 2026-09-07 +> 状态:当前事实投影 · Last updated: 2026-09-08 > > 本页是人和 Coding Agent 进入仓库后的第一入口。它只投影当前有效状态,不替代需求历史、主动计划或架构文档。 @@ -38,45 +38,52 @@ Forge 当前验证的是: - `REQ-2026-09-04-029` 已验证定向结果:Pi Benchmark Forge 分支改为完整 Forge Schema 的 terminating custom tool,Prompt 只保留语义规则并移除默认四位舍入。相同 GPT-5.6 revision、相同 ContextSnapshot 的 20 道历史 Forge 错题中,Structured Forge 修复 9 题(0/20 → 9/20),其中舍入类 5/6;20/20 均生成通过工具校验的对象。Prompt 本文缩短 44.54%,但工具 Schema 使 provider prompt tokens 增加 25.54%;total tokens 降 4.52%、平均生成时延降 6.96%。该定向样本不代表完整 500 题成绩,语义类 0/4;当时剩余的 Compiler/identifier 非执行已由 `REQ-2026-09-04-030` 处理,仍不能宣称总体优势。 - `REQ-2026-09-04-030` 已验证:quoted qualified identifier 绑定、source/output identifier 方言渲染和 HAVING 双侧聚合 alias 展开已修复。旧 Structured Tool 的相同候选离线重评从 9/20 EA、10/20 Contract、15/20 Execution 提升到 14/20、15/20、20/20;重新生成的同一 20 题候选经最终 Compiler 重评为 Forge 17/20 EA、18/20 Contract、20/20 Execution/Compile,同期 Direct 为 14/20 EA。后者跨生成且样本有选择偏差;完整 500 题 53.20% vs 62.20% 基线不变。 - `REQ-2026-09-04-031` 已验证:完整 Structured GPT-5.6 运行 500/500 返回工具校验对象;最终 Compiler 对相同候选离线重评从 287/500 EA、257/500 Contract、439/500 Execution 提升到 313/500、280/500、496/500,Compile 500/500,零 EA 回退。Direct 为 314/500 EA;最终配对 Forge only 22、Direct only 23,exact p=1.0,支持统计持平而非 Forge 优势。Forge 仍多 59.57% tokens、51.69% 平均生成时间;历史与新候选不同,Structured Tool、Prompt、舍入规则和生成波动不能拆成单因素因果。 -- `REQ-2026-09-05-034` 已完成 P0 固定候选离线归因:209道至少一臂EA失败的题、373个失败arm均有可复核记录,清单为 `docs/benchmark-sol-error-triage-2026-09-05.json`。Agent辅助初判86个arm存在候选错误、150个参考冲突、133个意图/输出歧义、4个未定;不是人审裁决、不是纠正后准确率,官方313/500 vs314/500不变。可确认错误以值/实体绑定最多(25个arm/16题);下一步优先验证字段格式/枚举及范围、粒度和输出契约,不盲扩Compiler或模型调用。未修改运行时代码、Gold或Prompt,不替代外部采用门禁。 +- `REQ-2026-09-05-034` 已完成 P0 固定候选离线归因:209道至少一臂EA失败的题、373个失败arm均有可复核记录,清单为 `docs/archive/benchmarks/benchmark-sol-error-triage-2026-09-05.json`。Agent辅助初判86个arm存在候选错误、150个参考冲突、133个意图/输出歧义、4个未定;不是人审裁决、不是纠正后准确率,官方313/500 vs314/500不变。可确认错误以值/实体绑定最多(25个arm/16题);下一步优先验证字段格式/枚举及范围、粒度和输出契约,不盲扩Compiler或模型调用。未修改运行时代码、Gold或Prompt,不替代外部采用门禁。 - `REQ-2026-09-05-035` 整体准确率规划保留为参考,详见唯一主动计划15.1节。ACC-0/ACC-1A已验证,H独立审核未完成;ACC-2首次Luna五题诊断已完成但未达到晋级条件,后续按具体错因做短反馈闭环,不机械推进阶段或扩大模型调用。500题只作回归集;R0.6外部采用门禁独立保留。 -- `REQ-2026-09-05-036` 已验证:比较器升级至 `semantic-result-compare-v2`,公开Evaluate与Pi Benchmark绑定评价版本,未知映射失败关闭、版本漂移不发布completed混合成绩。原500题同候选Official EA仍313/500 vs314/500;Contract为284/500 vs294/500,相对v1新增4/3、零回退,仅为评价器纠错。`benchmark-sol-metric-replay-2026-09-05.json` 保存全量证据;`accuracy-evaluation-cohorts-2026-09-05.json` 冻结D50/R500/S27及H审核协议;后续进展见REQ-037。 +- `REQ-2026-09-05-036` 已验证:比较器升级至 `semantic-result-compare-v2`,公开Evaluate与Pi Benchmark绑定评价版本,未知映射失败关闭、版本漂移不发布completed混合成绩。原500题同候选Official EA仍313/500 vs314/500;Contract为284/500 vs294/500,相对v1新增4/3、零回退,仅为评价器纠错。`archive/benchmarks/benchmark-sol-metric-replay-2026-09-05.json` 保存全量证据;`archive/benchmarks/accuracy-evaluation-cohorts-2026-09-05.json` 冻结D50/R500/S27及H审核协议;后续进展见REQ-037。 - `REQ-2026-09-05-037` 已完成元数据审计、CSV绑定修复与Luna五题诊断:原format+PK对D16没有新增有效取值证据,停止该假设;通用大小写绑定修复恢复48列已有元数据。20个有效Luna候选中,Official EA/Contract均为Forge 3/5→2/5、Direct 3/5→3/5;零新增通过、一个Forge编译回退,不能宣称准确率提升。md-065取值绑定改善,md-077 Forge日期/人员金额改善,但仍有参考与输出契约差异,不改判。 -- REQ-037的Luna实测共22次请求(2次temperature参数被拒+20次有效生成;补额获用户确认),复用Pi OAuth与Pi Benchmark Runtime,默认采样、无自动重试。20个候选结果与5个Gold均完成只读复算;双臂tokens 28,611→38,709(+35.29%),不扩大调用。保留元数据完整性修复;该轮md-052失败已由后续REQ-039定位为Compiler别名解析不一致并修复。原始证据:`benchmark-luna-binding-2026-09-05.json`。 -- `REQ-2026-09-05-038` 已验证:Forge Benchmark改为Provider原生strict:true函数工具,保留完整DSL并去除传输占位null,不静默回退;历史prefer或Schema版本漂移禁止续跑。用户批准的1题双臂canary实际2次Luna请求、零重试,HTTP200且Forge完成编译执行;原始参数独立通过严格Schema校验。仅证明该协议链路可用,不代表准确率提升或其他Provider已验证。证据:`benchmark-luna-strict-output-2026-09-05.json`。 -- `REQ-2026-09-05-039` 已验证:Compiler共用关系解析器支持省略AS的表/子查询别名,保留引号和作用域拒绝。20个原Luna候选离线复算仅处理组md-052 Forge的SQL改变,编译/Assurance/执行/EA/Contract通过;处理组Forge 2/5→3/5,其余三组3/5不变,零回退、零模型调用。修复前3个行为反例失败,修复后141项聚焦测试与5方言解析通过。证据:`benchmark-luna-alias-fix-2026-09-05.json`;不重写历史500题或宣称元数据准确率优势。 -- `REQ-2026-09-05-040` 已完成20次Luna配对复测及全部原响应离线复核:旧元数据Forge EA/Contract 2/5、Direct 3/5,修复后元数据两臂3/5。处理组tokens 33883 vs24021(+41.06%);无总体准确率或稳定收益结论。第10次发生Pi递归子Schema强制转换栈溢出,已改为校验前严格归一化;缺失候选失败关闭且保留tokens,132项Pi测试/typecheck通过。用户确认仅继续剩余10次;原故障响应恢复3819 tokens,仍因CTE漏投影被Assurance拒绝,未补跑。证据:`benchmark-luna-strict-paired-2026-09-05.json`;下一步优先澄清费用分组/姓名输出契约,不继续盲目扩大模型调用。 -- `REQ-2026-09-05-041` 已完成当前配置10库10题扩展回归:用户批准20次请求、全部HTTP200、零Provider重试/替换;Forge EA6/10、Contract5/10、Compile/Execution10/10,Direct EA/Contract7/10、Execution10/10。tokens 51077 vs29953(+70.52%),总81030;20个原始候选独立复算、10个strict/Pi参数校验、源码与10库hash一致。暴露聚合投影遗漏、JOIN分母、日期/粒度和姓名列契约问题;md-454漏Top-5却过当前EA,隔离六校反例证明逻辑不等价,评分未改。证据:`benchmark-luna-expanded-regression-2026-09-05.json`。已曝光样本、无旧配置对照,不证明泛化或优化因果;本轮未改代码/Gold/Prompt/评分,不扩大调用。 -- `REQ-2026-09-05-044` 已确认以BIRD固定快照/官方EX建设查询准确性基础,日常小样本、阶段R500全量,高覆盖/低静默错误/低用户负担共同约束。首个投影诊断重现3个原始候选、6种合法合成行为,机械补列破坏4个结果契约。用户另批20次Luna配对生成:Forge EX/Contract4/5→4/5,Direct4/5→5/5,3个正确对照保持通过;20份原始候选经Forge与官方EX核心复算零差异,零Provider重试/替换。总72546 tokens,Forge自身+0.25%;未变Direct指令仍出现波动,旧失败恢复不归因于候选。候选Prompt不采用,保持源码/Schema/Gold/评分,不加拒绝/补列或扩样追分。证据:`benchmark-luna-projection-instructions-2026-09-05.json`;5题不代表整体80%,历史500题不变。 -- `REQ-2026-09-05-045` 已工程落地并验证:`forge benchmark bird freeze/validate/replay/compare/audit-context`与`forge benchmark quality`可复用;仓库固定500题/11库/88资产校验清单,D/R/H/S和EX/Contract/业务标签分离。Pi绑定不可变输入、2N显式授权、单回合/零重试/120秒/隔离上下文及源码/SDK/model版本,保留失败和未知成本;原候选/源码漂移不可冒充收益。实际CLI、HTTP与Web验收通过,Python786 passed/26 skipped、Pi143 passed/typecheck通过,CI新增Pi门禁。十个历史原候选重放仍双臂4/5,零付费新调用、无Prompt采纳或新准确率结论。标准见`benchmarks.md`,证据见`benchmark-standards-engineering-2026-09-05.json`。 -- REQ-045首次标准Luna D20实跑:用户另批最多40次,Pi实际派发40次、返回39份候选;md-472 Forge 120秒超时且usage未知,运行failed、不补跑。原候选离线重放发现md-340两臂Gold均在30秒超时,评分不完整,compare拒绝纳入可比基线。完整20题分母下Forge已确认正确10、失败9、未评分1;Direct正确9、失败10、未评分1,不发布正式准确率或增益。已报告149300 tokens,另有一次未知消耗;37份已评分且有候选记录与运行判定一致,40份raw hash一致。证据:`benchmark-luna-standard-d20-2026-09-05.json`。Pi局部19题指标及未评分false字段不能当完整成绩;下一步先处理零模型调用的Gold预检与评分状态贯通,不直接扩至R500。 -- REQ-046已验证评分门禁与混合回归:同模型历史曝光33题,seed43冻结11延续/6新/3旧。用户明确批准Gold不可评题留分母但零调用;md-340跳过两次生成,其余19题实际38次派发/38候选、无补跑、用量完整139490 tokens。EX确认正确Forge8/Direct9,Contract5/8,各1题未知;新6题EX双臂6/6但Contract4/6与5/6,不能宣称整体提升。md-259 Direct恢复;md-429 Forge仅EX恢复、Contract仍失败;Forge md-046/md-249再生成回退。40条臂判定重放一致、38份raw hash一致,compare因Gold未知拒绝正式基线。Python803 passed/26 skipped、Pi149 passed/typecheck与真实页面通过。简报与证据:`benchmark-luna-mixed-d20-2026-09-05.md/.json`;每轮必须交付简报。Gold规划器问题仍在,不改原SQL/库/超时;下一轮按规则延续15题(含Gold阻塞),余5位4新1旧,本次未自动启动。 -- REQ-046历史续测seed45已完成(前轮seed44简报保留):用户授权20题为16延续+3新+1旧,md-340留分母零调用,实际38派发/38候选,tokens137028且用量完整。EX确认正确6/6、Contract3/4,各1题未知;同一15道可评分延续题EX为Forge2→4/Direct4→4,Contract0→1/2→2。Forge md-289恢复,md-429仅恢复EX且Contract仍失败;共享题无EX/Contract回退,但md-447再次被字段校验拒绝。同配置重生成,不作优化因果结论。38响应hash、40臂重放及源码/模型/运行版本/数据指纹一致,compare拒绝正式基线。简报:`benchmark-luna-mixed-d20-seed45-2026-09-05.md`,证据同名JSON;下轮17延续+2新+1旧,未自动启动,优先离线归因持续错题。 -- REQ-046后续已完成零新生成离线归因:17延续题主因分为6道生成/作用域错误、6道参考冲突、4道输出契约歧义、1道Gold阻塞;不是纠正后准确率。91条分片SQL独立重执行一致,原38候选的SQL与EX/Contract重评不变,源码/数据指纹一致。md-447源字段实际存在,错误为QUALIFY外层作用域不可见,撤回“虚构字段”推断;未采用自动迁移筛选或按Gold换列。未满足狭窄确定性修复门槛,本轮不改Compiler/Prompt/Gold/评分。简报及证据:`benchmark-luna-offline-triage-2026-09-05.md/.json`;下一候选优先实际日期格式上下文,须单独冻结变量/预算,不启动新生成。 +- REQ-037的Luna实测共22次请求(2次temperature参数被拒+20次有效生成;补额获用户确认),复用Pi OAuth与Pi Benchmark Runtime,默认采样、无自动重试。20个候选结果与5个Gold均完成只读复算;双臂tokens 28,611→38,709(+35.29%),不扩大调用。保留元数据完整性修复;该轮md-052失败已由后续REQ-039定位为Compiler别名解析不一致并修复。原始证据:`archive/benchmarks/benchmark-luna-binding-2026-09-05.json`。 +- `REQ-2026-09-05-038` 已验证:Forge Benchmark改为Provider原生strict:true函数工具,保留完整DSL并去除传输占位null,不静默回退;历史prefer或Schema版本漂移禁止续跑。用户批准的1题双臂canary实际2次Luna请求、零重试,HTTP200且Forge完成编译执行;原始参数独立通过严格Schema校验。仅证明该协议链路可用,不代表准确率提升或其他Provider已验证。证据:`archive/benchmarks/benchmark-luna-strict-output-2026-09-05.json`。 +- `REQ-2026-09-05-039` 已验证:Compiler共用关系解析器支持省略AS的表/子查询别名,保留引号和作用域拒绝。20个原Luna候选离线复算仅处理组md-052 Forge的SQL改变,编译/Assurance/执行/EA/Contract通过;处理组Forge 2/5→3/5,其余三组3/5不变,零回退、零模型调用。修复前3个行为反例失败,修复后141项聚焦测试与5方言解析通过。证据:`archive/benchmarks/benchmark-luna-alias-fix-2026-09-05.json`;不重写历史500题或宣称元数据准确率优势。 +- `REQ-2026-09-05-040` 已完成20次Luna配对复测及全部原响应离线复核:旧元数据Forge EA/Contract 2/5、Direct 3/5,修复后元数据两臂3/5。处理组tokens 33883 vs24021(+41.06%);无总体准确率或稳定收益结论。第10次发生Pi递归子Schema强制转换栈溢出,已改为校验前严格归一化;缺失候选失败关闭且保留tokens,132项Pi测试/typecheck通过。用户确认仅继续剩余10次;原故障响应恢复3819 tokens,仍因CTE漏投影被Assurance拒绝,未补跑。证据:`archive/benchmarks/benchmark-luna-strict-paired-2026-09-05.json`;下一步优先澄清费用分组/姓名输出契约,不继续盲目扩大模型调用。 +- `REQ-2026-09-05-041` 已完成当前配置10库10题扩展回归:用户批准20次请求、全部HTTP200、零Provider重试/替换;Forge EA6/10、Contract5/10、Compile/Execution10/10,Direct EA/Contract7/10、Execution10/10。tokens 51077 vs29953(+70.52%),总81030;20个原始候选独立复算、10个strict/Pi参数校验、源码与10库hash一致。暴露聚合投影遗漏、JOIN分母、日期/粒度和姓名列契约问题;md-454漏Top-5却过当前EA,隔离六校反例证明逻辑不等价,评分未改。证据:`archive/benchmarks/benchmark-luna-expanded-regression-2026-09-05.json`。已曝光样本、无旧配置对照,不证明泛化或优化因果;本轮未改代码/Gold/Prompt/评分,不扩大调用。 +- `REQ-2026-09-05-044` 已确认以BIRD固定快照/官方EX建设查询准确性基础,日常小样本、阶段R500全量,高覆盖/低静默错误/低用户负担共同约束。首个投影诊断重现3个原始候选、6种合法合成行为,机械补列破坏4个结果契约。用户另批20次Luna配对生成:Forge EX/Contract4/5→4/5,Direct4/5→5/5,3个正确对照保持通过;20份原始候选经Forge与官方EX核心复算零差异,零Provider重试/替换。总72546 tokens,Forge自身+0.25%;未变Direct指令仍出现波动,旧失败恢复不归因于候选。候选Prompt不采用,保持源码/Schema/Gold/评分,不加拒绝/补列或扩样追分。证据:`archive/benchmarks/benchmark-luna-projection-instructions-2026-09-05.json`;5题不代表整体80%,历史500题不变。 +- `REQ-2026-09-05-045` 已工程落地并验证:`forge benchmark bird freeze/validate/replay/compare/audit-context`与`forge benchmark quality`可复用;仓库固定500题/11库/88资产校验清单,D/R/H/S和EX/Contract/业务标签分离。Pi绑定不可变输入、2N显式授权、单回合/零重试/120秒/隔离上下文及源码/SDK/model版本,保留失败和未知成本;原候选/源码漂移不可冒充收益。实际CLI、HTTP与Web验收通过,Python786 passed/26 skipped、Pi143 passed/typecheck通过,CI新增Pi门禁。十个历史原候选重放仍双臂4/5,零付费新调用、无Prompt采纳或新准确率结论。标准见`benchmarks.md`,证据见`archive/benchmarks/benchmark-standards-engineering-2026-09-05.json`。 +- REQ-045首次标准Luna D20实跑:用户另批最多40次,Pi实际派发40次、返回39份候选;md-472 Forge 120秒超时且usage未知,运行failed、不补跑。原候选离线重放发现md-340两臂Gold均在30秒超时,评分不完整,compare拒绝纳入可比基线。完整20题分母下Forge已确认正确10、失败9、未评分1;Direct正确9、失败10、未评分1,不发布正式准确率或增益。已报告149300 tokens,另有一次未知消耗;37份已评分且有候选记录与运行判定一致,40份raw hash一致。证据:`archive/benchmarks/benchmark-luna-standard-d20-2026-09-05.json`。Pi局部19题指标及未评分false字段不能当完整成绩;下一步先处理零模型调用的Gold预检与评分状态贯通,不直接扩至R500。 +- REQ-046已验证评分门禁与混合回归:同模型历史曝光33题,seed43冻结11延续/6新/3旧。用户明确批准Gold不可评题留分母但零调用;md-340跳过两次生成,其余19题实际38次派发/38候选、无补跑、用量完整139490 tokens。EX确认正确Forge8/Direct9,Contract5/8,各1题未知;新6题EX双臂6/6但Contract4/6与5/6,不能宣称整体提升。md-259 Direct恢复;md-429 Forge仅EX恢复、Contract仍失败;Forge md-046/md-249再生成回退。40条臂判定重放一致、38份raw hash一致,compare因Gold未知拒绝正式基线。Python803 passed/26 skipped、Pi149 passed/typecheck与真实页面通过。简报与证据:`archive/benchmarks/benchmark-luna-mixed-d20-2026-09-05.md/.json`;每轮必须交付简报。Gold规划器问题仍在,不改原SQL/库/超时;下一轮按规则延续15题(含Gold阻塞),余5位4新1旧,本次未自动启动。 +- REQ-046历史续测seed45已完成(前轮seed44简报保留):用户授权20题为16延续+3新+1旧,md-340留分母零调用,实际38派发/38候选,tokens137028且用量完整。EX确认正确6/6、Contract3/4,各1题未知;同一15道可评分延续题EX为Forge2→4/Direct4→4,Contract0→1/2→2。Forge md-289恢复,md-429仅恢复EX且Contract仍失败;共享题无EX/Contract回退,但md-447再次被字段校验拒绝。同配置重生成,不作优化因果结论。38响应hash、40臂重放及源码/模型/运行版本/数据指纹一致,compare拒绝正式基线。简报:`archive/benchmarks/benchmark-luna-mixed-d20-seed45-2026-09-05.md`,证据同名JSON;下轮17延续+2新+1旧,未自动启动,优先离线归因持续错题。 +- REQ-046后续已完成零新生成离线归因:17延续题主因分为6道生成/作用域错误、6道参考冲突、4道输出契约歧义、1道Gold阻塞;不是纠正后准确率。91条分片SQL独立重执行一致,原38候选的SQL与EX/Contract重评不变,源码/数据指纹一致。md-447源字段实际存在,错误为QUALIFY外层作用域不可见,撤回“虚构字段”推断;未采用自动迁移筛选或按Gold换列。未满足狭窄确定性修复门槛,本轮不改Compiler/Prompt/Gold/评分。简报及证据:`archive/benchmarks/benchmark-luna-offline-triage-2026-09-05.md/.json`;下一候选优先实际日期格式上下文,须单独冻结变量/预算,不启动新生成。 - REQ-047严格归因复核已完成:撤回md-020/249/273/429四道“输出契约歧义”,转为两道输出粒度错误、两道表示差异;md-153时间口径和md-234同址实体合并保留中等置信度业务澄清,独立候选错误与原官方评分保留。日期观察以默认off的窄开关同时提供给两臂,绑定来源、样本局限和上下文hash;不改CSV、Gold、Compiler或评分。 -- REQ-047日期上下文配对实跑已闭环:用户另批完整20次,Pi实际20派发/20候选,零重试策略/补跑/替换,用量完整73565 tokens。Forge EX/Contract2/5→3/5、Direct3/5→3/5;唯一新增通过md-289没有日期补充且输入未变,不计日期收益。md-483双臂及md-077 Forge改用正确ISO日期,但仍有聚合粒度/姓名列表示与参考的差异,目标无新增通过;默认off、不推广、不扩额。20臂重放/原始响应hash、19个可执行候选独立官方EX核心复算及来源一致性通过,1个Assurance拒绝保留。简报与证据:`benchmark-luna-date-context-2026-09-05.md/.json`。下一步先离线核对输出契约;日常17+2+1、H与R0.6门禁不变。 -- REQ-047后续输出契约复核已完成(2026-09-06,零新Luna调用):md-483的grouped提示由本地each/per正则生成并进入两臂Prompt,与Gold总计冲突,不是业务确认;真实粒度分歧不豁免独立日期错误。md-077的CSV明确支持姓名拼接,Gold另加活动关联/DISTINCT,当前快照掩盖范围与重复差异。26条结果查询、5个完整DDL且外键有效的隔离夹具、8份Prompt来源核对完成;不改运行时代码、Gold或原成绩。简报:`benchmark-luna-output-contract-review-2026-09-06.md/.json`。允许主动分析Gold总结通用改进,禁止答案泄漏、改分和伪装独立泛化;下一狭窄候选是移除未经确认的expected_grain,不扩关键词特判或自动追加生成。 -- REQ-046历史滚动续测seed46已完成(2026-09-06):用户“继续吧”授权17延续+2新+1旧,日期off;md-340留20题分母零调用,实际38派发/38候选、136237 tokens且用量完整。EX确认正确Forge6/Direct4,Contract3/2,各1未知。同一16道可评分延续题EX3→4/3→2、Contract0→1/1→0;Forge md-249恢复,Direct md-082 Contract与md-429 EX回退,md-447恢复执行但仍错、md-483被SQL解析拒绝。38响应hash与40臂评分/SQL重放一致;保留md-340 Forge编译状态not_applicable/pending投影差异。共享输入/生成契约/数据未变,但协议v2及中间日期机制源码指纹不同,不作正式配对或优化因果结论。简报:`benchmark-luna-mixed-d20-seed46-2026-09-06.md/.json`;下轮18延续+1新+1旧,累计Luna曝光48题,未自动启动。 -- REQ-048付费配对实验仍未完成:正常Python/Pi ResultContract已删除未确认的expected_grain;显式grain_context对照不作为业务事实,也不逐字复原seed46。用户授权76次,实际52派发、48候选、4次空响应,24臂未派发且未补跑。共同有效5题的两臂EX/Contract均无变化;off组EX正确均4、Contract Forge1/Direct2,各1道Gold未评分。已观测172108 tokens,另4次用量未知,不能宣称准确率或成本收益。原运行及配对证据JSON不变;简报:`benchmark-luna-grain-context-2026-09-06.md/.json`。 -- REQ-048后续维护已验证(零新增模型调用):replay保留output=null且scored=false的未评分状态,真实生成失败仍计失败;新Pi原始响应保存content/stopReason/errorMessage,错误详情在Run重开后可查。修复前两个回归反例均失败,修复后Python814 passed/26 skipped、Pi150 passed/typecheck通过。使用当前源码新冻结的diagnostic上下文重放上一轮80臂,24个未派发臂不再被误判;80臂SQL/评分/execution与原Pi一致,原输出和raw_output不变,compare仍拒绝晋级。历史4次空响应根因无法追补;旧源码冻结不得续跑。证据:`benchmark-luna-grain-maintenance-2026-09-06.json`。预定off父Run的19延续+1新已在后续seed48执行;H/R0.6门禁不变。 -- REQ-049 SQLite标量极值CTE执行瓶颈已修复(零模型调用):仅对简单列MIN/MAX且参与INNER/CROSS JOIN的非递归标量CTE采用窄物化,优化SQL要求SQLite≥3.35。md-199原Forge JSON不变,从30秒超时恢复为Assurance/执行/EX/Contract通过,独立只读烟测79.26ms。原80臂重放仅此臂恢复,另79臂核心状态/评分/SQL不变;24个旧Forge候选的120项五方言编译结果只改变此SQLite SQL。两个修复前预算反例及NULL/空输入/下推边界通过,Python818 passed/26 skipped、Pi150 passed/typecheck通过。简报:`benchmark-luna-scalar-cte-fix-2026-09-06.json`。原付费结果不改写,新diagnostic有效、旧冻结与晋级仍拒绝;不代表新模型收益。后续seed48已按独立授权执行19延续+1新,H/R0.6门禁不变。 -- REQ-046最新滚动seed48已交付简报(2026-09-06):用户另批38次,19延续+新md-313,日期/粒度均off。实际32派发/30候选后失败:md-234 Forge生成120秒超时,md-447 Forge被取消;3题6臂未启动,md-340 Gold留分母零调用,无补跑。完整20题下两臂EX均4正确/12失败/4未知、Contract均1/15/4;仅新md-313双臂全过。Direct md-429恢复EX、md-259回退EX/Contract;md-199新Forge候选引用CTE未输出的best_ms,与REQ-049已修复旧候选不同。观察107160 tokens,另2臂用量未知。生成前删除冗余浮点比例字段修复Python/JS协议hash漂移,题目/上下文/预算不变;Python819 passed/26 skipped、Pi150 passed/typecheck,真实HTTP往返通过。32留存响应hash、40臂核心评分重放、28可执行候选独立EX一致;差异和446日志封存。简报:`benchmark-luna-mixed-d20-seed48-2026-09-06.md/.json`。服务已停,不完整基线不晋级;累计Luna曝光50题,下轮19延续+1新,未授权自动执行。 -- REQ-050生成终止证据竞态已修复(零模型调用):同一会话复用abort Promise,等待取消完成后再封存失败的raw_output/hash/usage,末尾事件处理完才退订与dispose;120秒上限、单派发/零重试、失败即停和评分不变。修复前deadline回归丢失末尾响应,修复后持久化与重开一致;迟到SQL不送评分、后续题不派发。真实Pi SDK合成流烟测确认最终消息/usage晚于abort发出,网络请求0。Pi151 passed/typecheck、Python819 passed/26 skipped,seed48原40臂诊断重放与旧工件hash不变。报告:`benchmark-luna-cancellation-evidence-fix-2026-09-06.json`。历史md-234内容与两臂未知usage不补造,不宣称准确率收益或自动启动新生成。 -- REQ-051生成阶段定向诊断已完成:用户单独授权4次,md-234/md-447各一个独立双臂Run;实际4次均生成/执行成功,EX/Contract均0/4,19831 tokens且无未知用量。Forge耗时11.18/23.60秒,工具参数可见区间3.27/7.46秒,未复现旧超时,不能宣称延迟改善。4份Prompt与seed48对应臂hash一致、4个原候选重放/独立EX一致;md-234暴露次数请求与Gold列集合差异,md-447为DOCType/DOC表示差异,仅作未采纳的只读反事实。未修改生产源码或生成策略、未追加调用,服务已停;不是seed49,滚动父Run仍为seed48。见`benchmark-luna-generation-stages-2026-09-06.md`及同名JSON。 -- REQ-052 CTE字段绑定维护已验证(零模型调用):删除显式限定名前缀剥离及裸列强绑主CTE;5个合法投影/聚合/窗口/CTE输出反例恢复预期SQLite结果。公共Forge JSON末尾复用`assure_compiled_sql`,Assurance升v8,两个CTE未投影字段漏拒关闭,原关系/Policy与执行授权边界保留。40个旧Forge候选200项五方言编译结果及5份原Run hash不变;md-032/md-199四臂诊断重放评分/SQL不变,缺列不补。真实CLI/HTTP正负例和返回SQL烟测通过,Python825 passed/26 skipped、Pi151 passed/typecheck通过,服务已停。不宣称BIRD收益或解决全部公共CTE前置限制;新诊断单独冻结,父Run仍seed48。见`benchmark-luna-cte-binding-fix-2026-09-06.md/.json`。 -- REQ-053离线闭环(零被测模型调用):R500原1000候选在当前Compiler/Assurance v8下诊断,旧正确误拒0、已评分正确/错误转换0;EX Forge311/187/2、Direct312/186/2,Contract282/216/2、292/206/2(正确/失败/未知),md-340/md-393两臂Gold超时保留未知。14变化臂全审,原候选/源码/数据hash保留;不是完整可比成绩或v8单因素收益。gasstations.Segment当前上下文确缺5个存储值,三个字面量反事实证明大小写机制,但原四臂仍1/4,不计模型提升。提出带来源的分类取值证据处理与4题16次对照提案,未实施、未授权调用;无新源码/Prompt/Schema改动,进程已退出。见`benchmark-r500-v8-binding-audit-2026-09-06.md/.json`。 -- REQ-054取值证据默认off实现及获批16次Luna对照已完成:v4只对可见限定列附相同观察后缀,不改SQL/Gold/评分。Forge EX/Contract2/4→3/4、Direct3/4→4/4,目标四臂1/4→3/4未达预声明4/4,控制四臂两条件均通过。35572 tokens、未知用量0,处理组+17.85%;保持off,不补跑/扩样。md-009 Forge已用Discount但漏接cze/svk的FROM/JOIN,共享Assurance v8漏拒此样本,SQLite报unknown_column;不自动补JOIN。16响应hash、原候选回放与独立SQLite评分一致,216日志/Pi快照已封存,服务已停;Python873 passed/26 skipped、Pi151 passed/typecheck通过。准备期依赖误同步另行披露,最终两条件同环境。下一窄维护候选为FROM作用域校验;父Run仍seed48,H/R0.6未推进。见`benchmark-luna-value-context-2026-09-06.md/.json`。 -- REQ-055 FROM作用域漏拒已修复(零模型调用):共享Assurance升v9,区分可用CTE与实际FROM/JOIN绑定,并按使用位置保留合法祖先相关环境;不补关系、不改SQL。1016份历史SQL仅新增拒绝REQ-054处理组md-009 Forge,R500原997通过/3拒绝不变,旧正确新增误拒0。16原候选诊断重放的输出/SQL/EX/Contract全不变,仅该臂从执行失败前移为Assurance拒绝。65个SQLite边界无新增合法误拒,另18项仅静态方言/Scope检查;真实CLI/鉴权HTTP及合法返回SQL通过。Python887 passed/26 skipped、Pi151 passed/typecheck;13份历史来源hash不变,旧冻结和诊断晋级拒绝,服务已停。取值上下文保持off、父Run仍seed48,非准确率收益。见`benchmark-luna-from-scope-fix-2026-09-07.md/.json`。 +- REQ-047日期上下文配对实跑已闭环:用户另批完整20次,Pi实际20派发/20候选,零重试策略/补跑/替换,用量完整73565 tokens。Forge EX/Contract2/5→3/5、Direct3/5→3/5;唯一新增通过md-289没有日期补充且输入未变,不计日期收益。md-483双臂及md-077 Forge改用正确ISO日期,但仍有聚合粒度/姓名列表示与参考的差异,目标无新增通过;默认off、不推广、不扩额。20臂重放/原始响应hash、19个可执行候选独立官方EX核心复算及来源一致性通过,1个Assurance拒绝保留。简报与证据:`archive/benchmarks/benchmark-luna-date-context-2026-09-05.md/.json`。下一步先离线核对输出契约;日常17+2+1、H与R0.6门禁不变。 +- REQ-047后续输出契约复核已完成(2026-09-06,零新Luna调用):md-483的grouped提示由本地each/per正则生成并进入两臂Prompt,与Gold总计冲突,不是业务确认;真实粒度分歧不豁免独立日期错误。md-077的CSV明确支持姓名拼接,Gold另加活动关联/DISTINCT,当前快照掩盖范围与重复差异。26条结果查询、5个完整DDL且外键有效的隔离夹具、8份Prompt来源核对完成;不改运行时代码、Gold或原成绩。简报:`archive/benchmarks/benchmark-luna-output-contract-review-2026-09-06.md/.json`。允许主动分析Gold总结通用改进,禁止答案泄漏、改分和伪装独立泛化;下一狭窄候选是移除未经确认的expected_grain,不扩关键词特判或自动追加生成。 +- REQ-046历史滚动续测seed46已完成(2026-09-06):用户“继续吧”授权17延续+2新+1旧,日期off;md-340留20题分母零调用,实际38派发/38候选、136237 tokens且用量完整。EX确认正确Forge6/Direct4,Contract3/2,各1未知。同一16道可评分延续题EX3→4/3→2、Contract0→1/1→0;Forge md-249恢复,Direct md-082 Contract与md-429 EX回退,md-447恢复执行但仍错、md-483被SQL解析拒绝。38响应hash与40臂评分/SQL重放一致;保留md-340 Forge编译状态not_applicable/pending投影差异。共享输入/生成契约/数据未变,但协议v2及中间日期机制源码指纹不同,不作正式配对或优化因果结论。简报:`archive/benchmarks/benchmark-luna-mixed-d20-seed46-2026-09-06.md/.json`;下轮18延续+1新+1旧,累计Luna曝光48题,未自动启动。 +- REQ-048付费配对实验仍未完成:正常Python/Pi ResultContract已删除未确认的expected_grain;显式grain_context对照不作为业务事实,也不逐字复原seed46。用户授权76次,实际52派发、48候选、4次空响应,24臂未派发且未补跑。共同有效5题的两臂EX/Contract均无变化;off组EX正确均4、Contract Forge1/Direct2,各1道Gold未评分。已观测172108 tokens,另4次用量未知,不能宣称准确率或成本收益。原运行及配对证据JSON不变;简报:`archive/benchmarks/benchmark-luna-grain-context-2026-09-06.md/.json`。 +- REQ-048后续维护已验证(零新增模型调用):replay保留output=null且scored=false的未评分状态,真实生成失败仍计失败;新Pi原始响应保存content/stopReason/errorMessage,错误详情在Run重开后可查。修复前两个回归反例均失败,修复后Python814 passed/26 skipped、Pi150 passed/typecheck通过。使用当前源码新冻结的diagnostic上下文重放上一轮80臂,24个未派发臂不再被误判;80臂SQL/评分/execution与原Pi一致,原输出和raw_output不变,compare仍拒绝晋级。历史4次空响应根因无法追补;旧源码冻结不得续跑。证据:`archive/benchmarks/benchmark-luna-grain-maintenance-2026-09-06.json`。预定off父Run的19延续+1新已在后续seed48执行;H/R0.6门禁不变。 +- REQ-049 SQLite标量极值CTE执行瓶颈已修复(零模型调用):仅对简单列MIN/MAX且参与INNER/CROSS JOIN的非递归标量CTE采用窄物化,优化SQL要求SQLite≥3.35。md-199原Forge JSON不变,从30秒超时恢复为Assurance/执行/EX/Contract通过,独立只读烟测79.26ms。原80臂重放仅此臂恢复,另79臂核心状态/评分/SQL不变;24个旧Forge候选的120项五方言编译结果只改变此SQLite SQL。两个修复前预算反例及NULL/空输入/下推边界通过,Python818 passed/26 skipped、Pi150 passed/typecheck通过。简报:`archive/benchmarks/benchmark-luna-scalar-cte-fix-2026-09-06.json`。原付费结果不改写,新diagnostic有效、旧冻结与晋级仍拒绝;不代表新模型收益。后续seed48已按独立授权执行19延续+1新,H/R0.6门禁不变。 +- REQ-046最新滚动seed48已交付简报(2026-09-06):用户另批38次,19延续+新md-313,日期/粒度均off。实际32派发/30候选后失败:md-234 Forge生成120秒超时,md-447 Forge被取消;3题6臂未启动,md-340 Gold留分母零调用,无补跑。完整20题下两臂EX均4正确/12失败/4未知、Contract均1/15/4;仅新md-313双臂全过。Direct md-429恢复EX、md-259回退EX/Contract;md-199新Forge候选引用CTE未输出的best_ms,与REQ-049已修复旧候选不同。观察107160 tokens,另2臂用量未知。生成前删除冗余浮点比例字段修复Python/JS协议hash漂移,题目/上下文/预算不变;Python819 passed/26 skipped、Pi150 passed/typecheck,真实HTTP往返通过。32留存响应hash、40臂核心评分重放、28可执行候选独立EX一致;差异和446日志封存。简报:`archive/benchmarks/benchmark-luna-mixed-d20-seed48-2026-09-06.md/.json`。服务已停,不完整基线不晋级;累计Luna曝光50题,下轮19延续+1新,未授权自动执行。 +- REQ-050生成终止证据竞态已修复(零模型调用):同一会话复用abort Promise,等待取消完成后再封存失败的raw_output/hash/usage,末尾事件处理完才退订与dispose;120秒上限、单派发/零重试、失败即停和评分不变。修复前deadline回归丢失末尾响应,修复后持久化与重开一致;迟到SQL不送评分、后续题不派发。真实Pi SDK合成流烟测确认最终消息/usage晚于abort发出,网络请求0。Pi151 passed/typecheck、Python819 passed/26 skipped,seed48原40臂诊断重放与旧工件hash不变。报告:`archive/benchmarks/benchmark-luna-cancellation-evidence-fix-2026-09-06.json`。历史md-234内容与两臂未知usage不补造,不宣称准确率收益或自动启动新生成。 +- REQ-051生成阶段定向诊断已完成:用户单独授权4次,md-234/md-447各一个独立双臂Run;实际4次均生成/执行成功,EX/Contract均0/4,19831 tokens且无未知用量。Forge耗时11.18/23.60秒,工具参数可见区间3.27/7.46秒,未复现旧超时,不能宣称延迟改善。4份Prompt与seed48对应臂hash一致、4个原候选重放/独立EX一致;md-234暴露次数请求与Gold列集合差异,md-447为DOCType/DOC表示差异,仅作未采纳的只读反事实。未修改生产源码或生成策略、未追加调用,服务已停;不是seed49,滚动父Run仍为seed48。见`archive/benchmarks/benchmark-luna-generation-stages-2026-09-06.md`及同名JSON。 +- REQ-052 CTE字段绑定维护已验证(零模型调用):删除显式限定名前缀剥离及裸列强绑主CTE;5个合法投影/聚合/窗口/CTE输出反例恢复预期SQLite结果。公共Forge JSON末尾复用`assure_compiled_sql`,Assurance升v8,两个CTE未投影字段漏拒关闭,原关系/Policy与执行授权边界保留。40个旧Forge候选200项五方言编译结果及5份原Run hash不变;md-032/md-199四臂诊断重放评分/SQL不变,缺列不补。真实CLI/HTTP正负例和返回SQL烟测通过,Python825 passed/26 skipped、Pi151 passed/typecheck通过,服务已停。不宣称BIRD收益或解决全部公共CTE前置限制;新诊断单独冻结,父Run仍seed48。见`archive/benchmarks/benchmark-luna-cte-binding-fix-2026-09-06.md/.json`。 +- REQ-053离线闭环(零被测模型调用):R500原1000候选在当前Compiler/Assurance v8下诊断,旧正确误拒0、已评分正确/错误转换0;EX Forge311/187/2、Direct312/186/2,Contract282/216/2、292/206/2(正确/失败/未知),md-340/md-393两臂Gold超时保留未知。14变化臂全审,原候选/源码/数据hash保留;不是完整可比成绩或v8单因素收益。gasstations.Segment当前上下文确缺5个存储值,三个字面量反事实证明大小写机制,但原四臂仍1/4,不计模型提升。提出带来源的分类取值证据处理与4题16次对照提案,未实施、未授权调用;无新源码/Prompt/Schema改动,进程已退出。见`archive/benchmarks/benchmark-r500-v8-binding-audit-2026-09-06.md/.json`。 +- REQ-054取值证据默认off实现及获批16次Luna对照已完成:v4只对可见限定列附相同观察后缀,不改SQL/Gold/评分。Forge EX/Contract2/4→3/4、Direct3/4→4/4,目标四臂1/4→3/4未达预声明4/4,控制四臂两条件均通过。35572 tokens、未知用量0,处理组+17.85%;保持off,不补跑/扩样。md-009 Forge已用Discount但漏接cze/svk的FROM/JOIN,共享Assurance v8漏拒此样本,SQLite报unknown_column;不自动补JOIN。16响应hash、原候选回放与独立SQLite评分一致,216日志/Pi快照已封存,服务已停;Python873 passed/26 skipped、Pi151 passed/typecheck通过。准备期依赖误同步另行披露,最终两条件同环境。下一窄维护候选为FROM作用域校验;父Run仍seed48,H/R0.6未推进。见`archive/benchmarks/benchmark-luna-value-context-2026-09-06.md/.json`。 +- REQ-055 FROM作用域漏拒已修复(零模型调用):共享Assurance升v9,区分可用CTE与实际FROM/JOIN绑定,并按使用位置保留合法祖先相关环境;不补关系、不改SQL。1016份历史SQL仅新增拒绝REQ-054处理组md-009 Forge,R500原997通过/3拒绝不变,旧正确新增误拒0。16原候选诊断重放的输出/SQL/EX/Contract全不变,仅该臂从执行失败前移为Assurance拒绝。65个SQLite边界无新增合法误拒,另18项仅静态方言/Scope检查;真实CLI/鉴权HTTP及合法返回SQL通过。Python887 passed/26 skipped、Pi151 passed/typecheck;13份历史来源hash不变,旧冻结和诊断晋级拒绝,服务已停。取值上下文保持off、父Run仍seed48,非准确率收益。见`archive/benchmarks/benchmark-luna-from-scope-fix-2026-09-07.md/.json`。 - H来源仍仅有1011个机械候选/964依赖组件,最终H未选;独立审核、曝光SQL解析失败与完整快照缺口未关闭。Pi历史原始Run中的temperature=0/max_output_tokens=8192不代表有效请求设置,当时实际payload不传二者;新Run已显式记录provider_default/null。历史500题分数和H/外部采用门禁不因小样本或标准落地改变。 - `REQ-2026-09-03-027` 已验证:Compiler 仅在非集合查询中把未投影的聚合排序别名展开为原聚合表达式,保持可见结果列和已投影别名不变。公开 BIRD 历史候选离线回放中,case 988 run 3 从 `no such column` 变为 Official EA exact match;case 1011 的两个同类候选恢复可执行但仍因输出列契约不匹配保持 EA 失败。未发起新模型调用,也未改写完整 500 题 45.40% 基线。 - R0.6 证据采集准备已完成:Quickstart 先用写 SQL 证明 `assurance/readonly_violation` 失败关闭,再运行已审核只读查询;`summary.json` 生成不含 hostname、username、路径、SQL rows、凭证或私有 schema 的 `run_receipt` 与 SHA-256 漂移校验。公开 Quickstart adoption Issue 表单收集 tested revision、fresh-clone setup time、首个失败/困惑点、回执及开发者对 Policy、Evidence 和限制的独立解释;Forge 不发送 telemetry,checksum 不证明身份。 - 当前切入要求:R0.6 必须取得外部开发者独立完成 Golden Path 或提交 Adapter、Rule、Dataset、真实 failure case 的采用证据,并记录 setup time、失败点与修复闭环;内部 smoke、页面数量、自有题集和测试通过不能替代外部证据。可测试公开 revision 已发布,独立试跑招募见 [GitHub #9](https://github.com/shisuidata/Forge/issues/9);下一步等待未参与实现的外部开发者 fresh clone 试跑并提交公开回执。 - 当前不扩张通用 Product Shell、SaaS Connector、非 SQL Action、Economics/Outcome Ledger 或完整企业权限平台;真实客户数据、生产凭证和高风险数据源仍需单独授权。 -- REQ-056分母范例16次Luna对照已完成:16派发/16候选、未知用量0;Forge EX/Contract2/4→3/4,Direct2/4→2/4。md-259恢复全体750分母及完整答案,md-000恢复;正确对照md-079出现CTE聚合别名/投影不一致,Assurance拒绝,预声明零回退门槛失败,故默认不启用。总53058 tokens,处理组+6.03%;成本/P95护栏通过但不覆盖回退。16原响应hash/重放/独立SQLite核对及218日志、原生Pi快照已封存;25准备工件和源码/数据/输入hash不变,服务已停。无补跑/扩样/自动返修或seed49,日期/粒度/取值仍off、父Run仍seed48。见`benchmark-luna-denominator-scope-2026-09-07.json`。 -- REQ-057表达式别名绑定维护已完成(零被测模型调用):去掉SELECT expr限定名前缀剥离,改为SQLGlot AST本层Column单次替换,保留常量/注释、函数/类型名、子查询和插入SQL;修复相关HAVING、FIRST_VALUE/LAST_VALUE与隐藏聚合排序漏展开。12项回归先红后绿、42组独立边界全通过;依赖下限27经完整矩阵验证。548份历史候选2740项五方言编译不变,上一轮16份候选诊断的输出/EX/Contract/失败分类不变,md-079缺失别名仍拒绝,非生成准确率收益。真实CLI/API正负例和返回SQL通过,Python901 passed/26 skipped、Pi155 passed/typecheck;服务已停。默认Prompt/控制上下文hash不变,各可选上下文off,父Run仍seed48。见`benchmark-cte-expression-binding-fix-2026-09-07.json`。 -- REQ-058 CTE接口范例16次独立授权开发对照已完成,门槛失败、默认不启用。Forge EX/Contract3/4→3/4:md-199新增正确、md-079回退;Direct3/4→2/4,md-079漏乘100,其输入不变,不能归因于Forge范例。总67367 tokens、未知用量0;处理总量+8.57%,Forge每正确答案+13.11%、生成P95+41.53%,后两项护栏失败。16原候选重放/独立SQLite及响应hash、215日志已核对,19准备工件和源码/数据/输入不变;首次本地鉴权拒绝发生于运行创建前、模型派发0,另有回执。预算余0,不补跑/扩样/自动返修,各可选上下文off、父Run仍seed48。准备证据保留;生成报告`benchmark-luna-cte-interface-2026-09-07.json`。 -- 2026-09-07发布核对:71份历史测试/实验报告逐一建索引,公开副本仅脱敏本机路径/个人联系样本及修正私有链接;原件和hash留在本地,成绩不变。发现并修复既有嵌套CTE名称遮蔽物理表权限漏洞,Assurance升v10;旧v9 QueryRun须重新prepare/审批。旧生成报告仍是历史版本证据,不据此重写成绩或声称新版本准确率收益。发布验证见`release-verification-2026-09-07.json`,公开处理见`report-publication-2026-09-07.json`。 +- REQ-056分母范例16次Luna对照已完成:16派发/16候选、未知用量0;Forge EX/Contract2/4→3/4,Direct2/4→2/4。md-259恢复全体750分母及完整答案,md-000恢复;正确对照md-079出现CTE聚合别名/投影不一致,Assurance拒绝,预声明零回退门槛失败,故默认不启用。总53058 tokens,处理组+6.03%;成本/P95护栏通过但不覆盖回退。16原响应hash/重放/独立SQLite核对及218日志、原生Pi快照已封存;25准备工件和源码/数据/输入hash不变,服务已停。无补跑/扩样/自动返修或seed49,日期/粒度/取值仍off、父Run仍seed48。见`archive/benchmarks/benchmark-luna-denominator-scope-2026-09-07.json`。 +- REQ-057表达式别名绑定维护已完成(零被测模型调用):去掉SELECT expr限定名前缀剥离,改为SQLGlot AST本层Column单次替换,保留常量/注释、函数/类型名、子查询和插入SQL;修复相关HAVING、FIRST_VALUE/LAST_VALUE与隐藏聚合排序漏展开。12项回归先红后绿、42组独立边界全通过;依赖下限27经完整矩阵验证。548份历史候选2740项五方言编译不变,上一轮16份候选诊断的输出/EX/Contract/失败分类不变,md-079缺失别名仍拒绝,非生成准确率收益。真实CLI/API正负例和返回SQL通过,Python901 passed/26 skipped、Pi155 passed/typecheck;服务已停。默认Prompt/控制上下文hash不变,各可选上下文off,父Run仍seed48。见`archive/benchmarks/benchmark-cte-expression-binding-fix-2026-09-07.json`。 +- REQ-058 CTE接口范例16次独立授权开发对照已完成,门槛失败、默认不启用。Forge EX/Contract3/4→3/4:md-199新增正确、md-079回退;Direct3/4→2/4,md-079漏乘100,其输入不变,不能归因于Forge范例。总67367 tokens、未知用量0;处理总量+8.57%,Forge每正确答案+13.11%、生成P95+41.53%,后两项护栏失败。16原候选重放/独立SQLite及响应hash、215日志已核对,19准备工件和源码/数据/输入不变;首次本地鉴权拒绝发生于运行创建前、模型派发0,另有回执。预算余0,不补跑/扩样/自动返修,各可选上下文off、父Run仍seed48。准备证据保留;生成报告`archive/benchmarks/benchmark-luna-cte-interface-2026-09-07.json`。 +- 2026-09-07发布核对:71份历史测试/实验报告逐一建索引,公开副本仅脱敏本机路径/个人联系样本及修正私有链接;原件和hash留在本地,成绩不变。发现并修复既有嵌套CTE名称遮蔽物理表权限漏洞,Assurance升v10;旧v9 QueryRun须重新prepare/审批。旧生成报告仍是历史版本证据,不据此重写成绩或声称新版本准确率收益。发布验证见`archive/engineering/release-verification-2026-09-07.json`,公开处理见`archive/engineering/report-publication-2026-09-07.json`。 +- REQ-060整体工程质量优化已按用户后续授权完成OP-1至OP-6(零模型调用):统一Stage/State事务和取消重试协议,隔离基准Profile并使用显式ExecutionResult,修复默认方言和非editable资源,下移Benchmark核心服务,统一Stage/Artifact契约并收口Plan、Benchmark及渠道投递生命周期。Web→Pi→Forge安全诊断、未知用量和只读审计已贯通;真实浏览器丢响应同Command重送仍仅一个Task,挂起HTTP停止/超时及独立owner进程烟测通过。Assurance现为v11/scoped-policy-v1,旧QueryRun需重新prepare/审批。原[评估报告](archive/engineering/architecture-quality-review-2026-09-07.json)保留基线018317d;逐项验收、Python/Pi回归及wheel/sdist安装证据见[实施报告](archive/engineering/architecture-quality-implementation-2026-09-07.json)。未访问真实运行库、未commit/push/部署,不改历史成绩或R0.6/H门禁。 +- REQ-061文件结构专项治理已完成(零模型调用):204个公开文件归位,独立基准工具与历史文档分离,PoC模板进入包内、造数脚本归demo;稳定核心包和公开启动入口保留。44份历史JSON原字节不变,旧公开路径与目标hash全部核验;真实配置、数据库、旧本地results及缓存未搬迁。非editable安装的PoC缺模板故障已复现并修复,wheel/sdist初始化、校验和Quickstart通过,Python/Pi回归及文档站构建/导航通过。目录职责见[CONTRIBUTING](../CONTRIBUTING.md#repository-layout),逐文件映射、验证与待人工确认资产见[治理记录](file-structure-governance-2026-09-07.json)。未commit/push/部署,不改变R0.6/H。 +- REQ-062长期知识保全要求已确认:测试证据、负结果、报告及沟通中沉淀的决策是核心资产;代码替换、归档或新测试通过不构成删除理由。原报告、原话和后续提炼分别保留,纠错追加且可溯源;总入口与维护规则见[长期知识资产](README.md#长期知识资产)。本地落盘不等于Git提交或异地备份,本轮不授权新模型调用、发布或阶段晋级。 +- REQ-063候选交付已创建[PR #10](https://github.com/shisuidata/Forge/pull/10):分支`review/forge-engineering-evidence-2026-09-08`交付REQ-060/061/062成果。首轮pytest收集失败已复现并修复,代码修订`c5a3954`的五项远端CI通过;证据回写提交的最终检查见PR检查与完成评论。不合并main、不Release或部署,不新增#8独立适配器;[候选记录](candidate-delivery-2026-09-08.json)保留全过程,R0.6/H不晋级。 +- REQ-064生成优化调研已完成(零被测模型调用):旧Sol配对统计仍313/500 vs314/500、22 vs23、exact p=1.0;当前strict工具实际删除72条Schema说明,定义/引用键序另有可研究负担,均不是已证失分原因。500旧候选只重排键后编译SQL全不变;结构合法的缺失引用仍被共享Assurance拒绝。建议先单独验证关键DSL说明,再研究有来源答案规划,键序/一次修正各自独立;六项外部方法、负结果与待授权64次开发设计见[REQ-064](requirements-pool.md#req-2026-09-08-064以超过direct-sql的ex为目标重评forge-json生成优化)及[调研证据](archive/benchmarks/forge-json-generation-research-2026-09-08.json)。未改默认生成/源码/Gold/评分或主动计划,不宣称超过Direct;H/R0.6不变。 +- REQ-065关键DSL说明候选已完成64次Luna ABBA实跑,预注册门槛失败,保持off:真实HTTP64/64为200、用量完整222015 tokens。Forge EX/Contract10/16→12/16、Direct10/16→10/16;无目标题两重复稳定恢复,md-052第二重复回退,处理组控制7/8。总tokens+3.39%、Forge每正确答案tokens−11.73%、生成P95−5.42%,相对成本门槛通过但不抵消正确性门槛失败。64份原SSE与候选/用量匹配,64臂重放一致,零重试/补跑;人民币费用门禁已被用户撤销,订阅成本不可核算,不宣称免费或总体超过Direct。见[实跑报告](archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.json)及[原准备卡](archive/benchmarks/benchmark-luna-schema-descriptions-ready-2026-09-08.json)。不扩样、不自动开启,H/R0.6不晋级。 +- `REQ-2026-09-08-066` 记录本轮限定样本里程碑:开启说明后的Forge两重复各6/8 vsDirect5/8,EX/Contract合计12/16 vs10/16;不是历史首次或总体优势。已整理[具体优化动作与技术简报](archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.md)及[未发布文案](devlog/2026-09-08-forge-schema-descriptions-milestone.md)。用户仅授权当前候选分支commit/push,不merge/tag/Release/部署安装,不启用候选,不增加调用;实际提交与远端状态以Git记录为准。 ## 4. 已完成且可复用的工程基础 @@ -91,7 +98,7 @@ Forge 当前验证的是: ## 5. 未关闭的验收与采用事实 -- 公开 GitHub 信号盘点中,现有 9 个 Issue 与 1 个 Pull Request 均由维护者身份提交;11 stars 与 1 fork 仅是传播信号。尚无可确认的外部开发者 Golden Path 回执,也没有外部 Adapter、Rule、Dataset 或真实 failure case 贡献。 +- 2026-09-08按GitHub API记录类型分离:8个Issue(不含PR)、2个PR;#10为本会话创建的候选交付,不计独立外部贡献。此前“9个Issue与1个PR”投影已纠正,原始记录不追改。stars/forks仅是传播信号;尚无可确认的外部Golden Path回执或外部Adapter、Rule、Dataset、真实failure case贡献。 - R0.6 的失败关闭样例、隐私有界回执与公开提交表单已发布;[Issue #9](https://github.com/shisuidata/Forge/issues/9) 是维护者创建的外部试跑招募入口,不是采用证据。当前仍没有外部独立完成记录,R0.6 外部采用门禁未通过。 - W2 主体内容规则、Product Spine 与完整 Product Shell 的 Atlas candidate 仍有历史人工复验项,但不再主导当前产品路线。 - Governance Action Catalog 的 14 个 supported Action 中仅 `query.prepare`、`query.approve`、`query.execute` 已完成 v1 Runtime Enforcement,覆盖率为 3/14(21.4%);Explain 是只读证据投影,不新增 Action Runtime Enforcement,Contract Coverage 不能替代其余运行时执行覆盖。 diff --git a/docs/devlog/2026-09-08-forge-schema-descriptions-milestone.md b/docs/devlog/2026-09-08-forge-schema-descriptions-milestone.md new file mode 100644 index 0000000..7326c76 --- /dev/null +++ b/docs/devlog/2026-09-08-forge-schema-descriptions-milestone.md @@ -0,0 +1,56 @@ +--- +title: Forge 的一次局部突破:把接口讲清楚,而不是继续堆提示词 +status: review +date: 2026-09-08 +tags: [Forge, Benchmark, 工程复盘] +--- + +# Forge 的一次局部突破:把接口讲清楚,而不是继续堆提示词 + +> 未发布文案。事实来源为 REQ-065;本次只归档并提交 GitHub,不发布软件版本或分发内容。完整数据与优化动作见[技术简报](../archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.md)。 + +## 主文案 + +今天,Forge 有一个值得记下来的局部突破。 + +在这一轮固定的 8 道开发题、两次重复测试中,增强后的 Forge EX 得分是 **12/16,75%**;同期 Direct SQL 是 **10/16,62.5%**。两个重复分别都是 **6/8 对 5/8**。 + +只谈这轮数据,可以明确说:**Forge 得分超过了 Direct SQL,高 12.5 个百分点。** + +这次没有换更大的模型,没有追加重试,也没有让编译器猜着补列。我们做的事情更小:把工具接口的语义讲清楚。 + +此前审计发现,模型使用的 strict Schema 保留了结构约束,却去掉了原 Schema 的说明。模型知道 JSON 可以有哪些字段,但“声明一个 CTE”“把它放进 FROM”“把结果导出给下一层”,不是同一件事。 + +于是,我们只给五个关键接口补上经过审核的说明: + +- `scan`:先绑定数据来源;声明 CTE 不等于引用了它。 +- `cte`:下一层能用哪些列,由这一层的 `select` 决定。 +- `agg`:定义聚合不等于把聚合结果输出。 +- `window`:同层过滤与跨层导出有不同边界。 +- `select`:中间层导出必要字段,最终层只返回问题要求的答案。 + +模型、Prompt、上下文、字段顺序、Compiler 和评分都保持不变。围绕这个单一变量,我们按 ABBA 顺序完成 64 次真实请求,保留所有原响应,再重放检查 SQL、执行状态和评分;没有补跑追分。 + +这轮结果的意义,不是证明“JSON 天然优于 SQL”,而是留下一个值得继续研究的观察:**把 DSL 的接口含义表达清楚,这个窄改动在本轮伴随了更高的最终答案得分。** 五条说明各自贡献多少、能否推广到更多题,还没有得到证明。 + +好消息也不能把坏消息挤掉。虽然两个重复的总分都领先,但改善的题并不相同;第二个重复还有一道原本正确的控制题答错。我们事先约定的稳定改善、零回退和控制全对门槛,没有全部通过。 + +所以,**里程碑记下,候选暂不启用。** + +16 是作答次数,不是 16 道独立题;这也不是新的全量基准或统计显著性结论。我们保留这次得分领先,同时保留回退、成本和原始证据。工程上的进展,不必靠省略限制才能成立。 + +## 短文案 + +Forge 在一轮固定小样本实验中取得了局部突破:8 道开发题各跑两次,增强后的 Forge EX/Contract 均为 **12/16(75%)**,同期 Direct SQL 为 **10/16(62.5%)**,两个重复均为 **6/8 vs 5/8**。 + +本轮只为 `scan/cte/agg/window/select` 补充模型可见的工具 Schema 语义说明,没有换模型、改评分或追加重试。64 次真实请求与原响应重放证据完整保留。 + +这不是总体优势结论:目标题改善尚未稳定复现,且有控制题回退。我们记录这次领先,但保持候选默认关闭,暂不发布版本。 + +## 使用口径 + +- 标题及节选必须保留“本轮”或“限定样本”,不能只摘“Forge 准确率 75%”。 +- 领先幅度是 **12.5 个百分点**,不是“提升 12.5%”;不把 16 次重复作答改写成 16 道独立题。 +- 不称“历史首次”“全面超过”“统计显著”或“已经上线”。历史上已有其他定向样本局部领先。 +- 成本如需引用:本轮共 222,015 tokens;处理组相对对照组的双臂总 tokens +3.39%,Forge 每正确答案 tokens −11.73%。不是比 Direct 更省,也不是人民币结算价;不承诺订阅免费。 +- 技术数据以[实跑 JSON](../archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.json)为源,回退与未通过门槛不能从对外版本中删除。 diff --git a/docs/file-structure-governance-2026-09-07.json b/docs/file-structure-governance-2026-09-07.json new file mode 100644 index 0000000..c4418cc --- /dev/null +++ b/docs/file-structure-governance-2026-09-07.json @@ -0,0 +1,1890 @@ +{ + "schema_version": "file-structure-governance-v1", + "date": "2026-09-07", + "requirement": "REQ-2026-09-07-061", + "status": "implemented_and_locally_verified", + "scope": "公开受控源码、契约、文档、演示与分发资源;不含私有配置/真实运行数据", + "decisions": [ + { + "action": "keep", + "paths": [ + "main.py", + "config.py", + "diagnostics.py", + "pyproject.toml", + "Dockerfile", + "docker-compose*.yml", + ".env*.example", + "forge.yaml.example" + ], + "reason": "公开启动/配置/分发入口,移动会破坏既有契约且没有足够组织收益。" + }, + { + "action": "keep", + "paths": [ + "forge/", + "agent/", + "registry/", + "web/", + "services/pi-orchestrator/" + ], + "reason": "已存在且已验证的职责边界;不再机械增加src层或拆子包。" + }, + { + "action": "keep", + "paths": [ + "tests/test_*.py", + "tests/datasets/", + "agent/contracts/", + "registry/contracts/" + ], + "reason": "自动回归、公共合成夹具及生成契约;保留演示Registry的生产拒绝门禁。" + }, + { + "action": "keep", + "paths": [ + "tools/chart-engine-bakeoff/", + "tools/chart-storytelling-echarts-candidate/", + "tools/web-product-shell-prototype/", + "tools/chart_storytelling_candidate.py", + "scripts/" + ], + "reason": "可复现实验已独立隔离;其余运维脚本规模适中,不为命名制造更深目录。" + }, + { + "action": "keep", + "paths": [ + "website/", + "examples/", + "constraints/", + ".github/", + "docs/architecture-course/", + "docs/architecture-diagrams/", + "docs/devlog/" + ], + "reason": "已有独立构建、示例、依赖/CI与文档职责。" + }, + { + "action": "move", + "from": "tests/accuracy/", + "to": "tools/benchmarks/accuracy/", + "reason": "独立手工/模型实验,不是pytest回归。" + }, + { + "action": "move", + "from": "tests/benchmark/", + "to": "tools/benchmarks/synthetic/", + "reason": "独立合成问数基准,与自动回归分离。" + }, + { + "action": "move", + "from": "tests/spider2/", + "to": "tools/benchmarks/spider2/", + "reason": "外部数据集下载/评测工具,不进入普通测试或核心发行。" + }, + { + "action": "move", + "from": "tests/text-to-sql-failures/", + "to": "tools/benchmarks/text_to_sql_failures/", + "reason": "人工失败样例研究工具;公开报告另归历史证据。" + }, + { + "action": "move", + "from": "customer-poc-template/", + "to": "forge/templates/poc/", + "reason": "由forge.poc运行时消费,必须归属包内并纳入wheel/sdist。" + }, + { + "action": "move", + "from": "scripts/seed_mock_data.py", + "to": "demo/seed_mock_data.py", + "reason": "与现有demo造数脚本集中;不运行真实存储填充。" + }, + { + "action": "archive", + "from": "docs/中已完成的报告及过时实施计划", + "to": "docs/archive/{benchmarks,engineering,plans}/", + "reason": "与当前状态、稳定指南、主动计划分离;JSON证据原字节保留,Markdown只改必要引用。" + }, + { + "action": "requires_owner_review", + "paths": [ + ".forge/", + "services/pi-orchestrator/.runtime/", + "旧tests下ignored results/data", + "*.db", + "私有配置与凭证", + "本地缓存及生成包元数据" + ], + "reason": "不读取、不移动、不清理;治理仅处理公开受控文件,历史本地资产由所有者另行决定。" + } + ], + "moves": [ + { + "from": "customer-poc-template/README.md", + "to": "forge/templates/poc/README.md", + "sha256_before": "04ecb261ce525c941503d9de9c0f7380edb4ccb6cd429a5b8645d4bc253a49b8", + "sha256_after": "04ecb261ce525c941503d9de9c0f7380edb4ccb6cd429a5b8645d4bc253a49b8", + "change_reason": "relocation_only" + }, + { + "from": "customer-poc-template/cases.example.json", + "to": "forge/templates/poc/cases.example.json", + "sha256_before": "dfc02275c420760e9291611bebe839b3fb6ae3655a50e065ed57b1587449cfb2", + "sha256_after": "dfc02275c420760e9291611bebe839b3fb6ae3655a50e065ed57b1587449cfb2", + "change_reason": "relocation_only" + }, + { + "from": "customer-poc-template/delivery_report.template.md", + "to": "forge/templates/poc/delivery_report.template.md", + "sha256_before": "3be698eb5ac027b893ce149af13210df43373582645dcf84cc060b586479a739", + "sha256_after": "3be698eb5ac027b893ce149af13210df43373582645dcf84cc060b586479a739", + "change_reason": "relocation_only" + }, + { + "from": "customer-poc-template/failure_triage.template.md", + "to": "forge/templates/poc/failure_triage.template.md", + "sha256_before": "cf322af262f34515a67f1ea6d9f0203f2a50f11045d0afdd5c7801568979ed22", + "sha256_after": "cf322af262f34515a67f1ea6d9f0203f2a50f11045d0afdd5c7801568979ed22", + "change_reason": "relocation_only" + }, + { + "from": "customer-poc-template/provider-smoke.example.json", + "to": "forge/templates/poc/provider-smoke.example.json", + "sha256_before": "e350033f02dad123cef63df7614ae5145dc60db5136b02197815921c5fbda6b8", + "sha256_after": "e350033f02dad123cef63df7614ae5145dc60db5136b02197815921c5fbda6b8", + "change_reason": "relocation_only" + }, + { + "from": "customer-poc-template/registry/disambiguations.registry.yaml", + "to": "forge/templates/poc/registry/disambiguations.registry.yaml", + "sha256_before": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356", + "sha256_after": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356", + "change_reason": "relocation_only" + }, + { + "from": "customer-poc-template/registry/field_conventions.registry.yaml", + "to": "forge/templates/poc/registry/field_conventions.registry.yaml", + "sha256_before": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356", + "sha256_after": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356", + "change_reason": "relocation_only" + }, + { + "from": "customer-poc-template/registry/metrics.registry.yaml", + "to": "forge/templates/poc/registry/metrics.registry.yaml", + "sha256_before": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356", + "sha256_after": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356", + "change_reason": "relocation_only" + }, + { + "from": "customer-poc-template/registry/schema.registry.json", + "to": "forge/templates/poc/registry/schema.registry.json", + "sha256_before": "deb9cae237c61fcac650e2bcb1b907a493c66f1984b7e7896c70c8fadf2580c6", + "sha256_after": "deb9cae237c61fcac650e2bcb1b907a493c66f1984b7e7896c70c8fadf2580c6", + "change_reason": "relocation_only" + }, + { + "from": "docs/accuracy-csv-binding-experiment-card-2026-09-05.json", + "to": "docs/archive/benchmarks/accuracy-csv-binding-experiment-card-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "c6e561599dadc969cad7b548e14fc16703c3332a593dc866377a5e0a8a73602b", + "sha256_after": "c6e561599dadc969cad7b548e14fc16703c3332a593dc866377a5e0a8a73602b" + }, + { + "from": "docs/accuracy-evaluation-cohorts-2026-09-05.json", + "to": "docs/archive/benchmarks/accuracy-evaluation-cohorts-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "393c627927eca6075ff4b567c0a2e61f74579f4c290e4885660b9583c99eb314", + "sha256_after": "393c627927eca6075ff4b567c0a2e61f74579f4c290e4885660b9583c99eb314" + }, + { + "from": "docs/accuracy-holdout-source-audit-2026-09-05.json", + "to": "docs/archive/benchmarks/accuracy-holdout-source-audit-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "281f97b8f56098dcd75e70f9e4dba9fbafe808847381f6fcdf7ed7ac0bbd7e2f", + "sha256_after": "281f97b8f56098dcd75e70f9e4dba9fbafe808847381f6fcdf7ed7ac0bbd7e2f" + }, + { + "from": "docs/accuracy-metadata-binding-fix-2026-09-05.json", + "to": "docs/archive/benchmarks/accuracy-metadata-binding-fix-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "f2f848448f49b6663b0c1f3a6bddde42fe4ff0063bb4982a9b36b9eac552110a", + "sha256_after": "f2f848448f49b6663b0c1f3a6bddde42fe4ff0063bb4982a9b36b9eac552110a" + }, + { + "from": "docs/accuracy-metadata-treatment-audit-2026-09-05.json", + "to": "docs/archive/benchmarks/accuracy-metadata-treatment-audit-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "3758e4820ca0fe0a106b7905e94b5ff9dd82a5ab27df402b0d1c39a4c1a4e8ec", + "sha256_after": "3758e4820ca0fe0a106b7905e94b5ff9dd82a5ab27df402b0d1c39a4c1a4e8ec" + }, + { + "from": "docs/architecture-quality-implementation-2026-09-07.json", + "to": "docs/archive/engineering/architecture-quality-implementation-2026-09-07.json", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "92ab945c031bc0ec4ca5372d9cd55c4f195da155d4164b2605152f31c0fb988c", + "sha256_after": "92ab945c031bc0ec4ca5372d9cd55c4f195da155d4164b2605152f31c0fb988c" + }, + { + "from": "docs/architecture-quality-review-2026-09-07.json", + "to": "docs/archive/engineering/architecture-quality-review-2026-09-07.json", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "225ba9ebb20f4ea11ade2e7124efb6c34dfe3200bef259077900b5f977fab4aa", + "sha256_after": "225ba9ebb20f4ea11ade2e7124efb6c34dfe3200bef259077900b5f977fab4aa" + }, + { + "from": "docs/benchmark-cte-expression-binding-fix-2026-09-07.json", + "to": "docs/archive/benchmarks/benchmark-cte-expression-binding-fix-2026-09-07.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "3675d1d464da0b4c9e91ef23c2e8a689d7013d0ba5098d2fc833d194d8193087", + "sha256_after": "3675d1d464da0b4c9e91ef23c2e8a689d7013d0ba5098d2fc833d194d8193087" + }, + { + "from": "docs/benchmark-cte-interface-ready-2026-09-07.json", + "to": "docs/archive/benchmarks/benchmark-cte-interface-ready-2026-09-07.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "9a9319fe4d829f22468489c40bf436b628583d92a195a275e5facf56cdb890f4", + "sha256_after": "9a9319fe4d829f22468489c40bf436b628583d92a195a275e5facf56cdb890f4" + }, + { + "from": "docs/benchmark-denominator-scope-ready-2026-09-07.json", + "to": "docs/archive/benchmarks/benchmark-denominator-scope-ready-2026-09-07.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "d92287418384517a9bfffc9c785c770fb4492497a876890c6a386fd4aebe20e9", + "sha256_after": "d92287418384517a9bfffc9c785c770fb4492497a876890c6a386fd4aebe20e9" + }, + { + "from": "docs/benchmark-historical-runs-2026-09-07.json", + "to": "docs/archive/benchmarks/benchmark-historical-runs-2026-09-07.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "56d3c2fe77adfe674a4fc2e557fa352b181285c07bcdef4f55a940253cc33396", + "sha256_after": "56d3c2fe77adfe674a4fc2e557fa352b181285c07bcdef4f55a940253cc33396" + }, + { + "from": "docs/benchmark-luna-alias-fix-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-luna-alias-fix-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "9e56a4d6c9fd0d9a0d84107fda2b292fd1c1cac068764c6342a2fd2c231e9e76", + "sha256_after": "9e56a4d6c9fd0d9a0d84107fda2b292fd1c1cac068764c6342a2fd2c231e9e76" + }, + { + "from": "docs/benchmark-luna-binding-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-luna-binding-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "a1dd1fddf3d2cb5140e9d452f3f81b80000c4fba93228e06581b29bb736900bf", + "sha256_after": "a1dd1fddf3d2cb5140e9d452f3f81b80000c4fba93228e06581b29bb736900bf" + }, + { + "from": "docs/benchmark-luna-cancellation-evidence-fix-2026-09-06.json", + "to": "docs/archive/benchmarks/benchmark-luna-cancellation-evidence-fix-2026-09-06.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "68f3354dd3a4631555564312574b195de42c3bad44b617492dd8e1f55bcf4c90", + "sha256_after": "68f3354dd3a4631555564312574b195de42c3bad44b617492dd8e1f55bcf4c90" + }, + { + "from": "docs/benchmark-luna-cte-binding-fix-2026-09-06.json", + "to": "docs/archive/benchmarks/benchmark-luna-cte-binding-fix-2026-09-06.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "9d20eeaea9fca60f664aa98f10513c1a09d42586e2b6fe1d3cfe2f6333a14b67", + "sha256_after": "9d20eeaea9fca60f664aa98f10513c1a09d42586e2b6fe1d3cfe2f6333a14b67" + }, + { + "from": "docs/benchmark-luna-cte-binding-fix-2026-09-06.md", + "to": "docs/archive/benchmarks/benchmark-luna-cte-binding-fix-2026-09-06.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "15ff645036c8e069f7bd083103e42bf064e630ab955d99dd4d3e31f451c05568", + "sha256_after": "15ff645036c8e069f7bd083103e42bf064e630ab955d99dd4d3e31f451c05568" + }, + { + "from": "docs/benchmark-luna-cte-interface-2026-09-07.json", + "to": "docs/archive/benchmarks/benchmark-luna-cte-interface-2026-09-07.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "dfcb5e6a3faba7d3c2dedb4cf76fedc23696a370cb39b1b0613fdda9e4bf98d2", + "sha256_after": "dfcb5e6a3faba7d3c2dedb4cf76fedc23696a370cb39b1b0613fdda9e4bf98d2" + }, + { + "from": "docs/benchmark-luna-date-context-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-luna-date-context-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "97e7842a38a7bd3f3b0f27d9a63d9875ebf81da8e7cfd5c07a9bac21c11acd46", + "sha256_after": "97e7842a38a7bd3f3b0f27d9a63d9875ebf81da8e7cfd5c07a9bac21c11acd46" + }, + { + "from": "docs/benchmark-luna-date-context-2026-09-05.md", + "to": "docs/archive/benchmarks/benchmark-luna-date-context-2026-09-05.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "6e9ed6bed6bc76a3c40f0a69c0f03a5cfa6331368841d1f0f5ab783611e4b2e3", + "sha256_after": "6e9ed6bed6bc76a3c40f0a69c0f03a5cfa6331368841d1f0f5ab783611e4b2e3" + }, + { + "from": "docs/benchmark-luna-denominator-scope-2026-09-07.json", + "to": "docs/archive/benchmarks/benchmark-luna-denominator-scope-2026-09-07.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "69546731b83a6d0e25aa13c38084d56d45f9d6360e3ae0d17cd0f54aa7458506", + "sha256_after": "69546731b83a6d0e25aa13c38084d56d45f9d6360e3ae0d17cd0f54aa7458506" + }, + { + "from": "docs/benchmark-luna-expanded-regression-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-luna-expanded-regression-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "a6a59cf5eb520ccfb7bb27ecb1faf3ef0e8931e562dd5e84b4fdd890173b4b84", + "sha256_after": "a6a59cf5eb520ccfb7bb27ecb1faf3ef0e8931e562dd5e84b4fdd890173b4b84" + }, + { + "from": "docs/benchmark-luna-from-scope-fix-2026-09-07.json", + "to": "docs/archive/benchmarks/benchmark-luna-from-scope-fix-2026-09-07.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "9fc45cc81ebb7a25c67a73c98be4b43c3a86ee63e049bd0aa58518fe27cac87a", + "sha256_after": "9fc45cc81ebb7a25c67a73c98be4b43c3a86ee63e049bd0aa58518fe27cac87a" + }, + { + "from": "docs/benchmark-luna-from-scope-fix-2026-09-07.md", + "to": "docs/archive/benchmarks/benchmark-luna-from-scope-fix-2026-09-07.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "a1fe8cbc2664646bd8e465f5e2f9644697ba6acbc357b344db72c2bea977855b", + "sha256_after": "a1fe8cbc2664646bd8e465f5e2f9644697ba6acbc357b344db72c2bea977855b" + }, + { + "from": "docs/benchmark-luna-generation-stages-2026-09-06.json", + "to": "docs/archive/benchmarks/benchmark-luna-generation-stages-2026-09-06.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "4623e9c993ab9dd0d8d12260c2e91e3436c42e2ae980033847755485bbc5da09", + "sha256_after": "4623e9c993ab9dd0d8d12260c2e91e3436c42e2ae980033847755485bbc5da09" + }, + { + "from": "docs/benchmark-luna-generation-stages-2026-09-06.md", + "to": "docs/archive/benchmarks/benchmark-luna-generation-stages-2026-09-06.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "ac75c0b8b095d24e567bee0e5be7504e0678f3ec90d6f1d71587f828a1f2478c", + "sha256_after": "ac75c0b8b095d24e567bee0e5be7504e0678f3ec90d6f1d71587f828a1f2478c" + }, + { + "from": "docs/benchmark-luna-grain-context-2026-09-06.json", + "to": "docs/archive/benchmarks/benchmark-luna-grain-context-2026-09-06.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "084f875c25afaac747deecad2eb43d126bbe1ab55c86725024469306f3aab398", + "sha256_after": "084f875c25afaac747deecad2eb43d126bbe1ab55c86725024469306f3aab398" + }, + { + "from": "docs/benchmark-luna-grain-context-2026-09-06.md", + "to": "docs/archive/benchmarks/benchmark-luna-grain-context-2026-09-06.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "8810c9dd3f430ef0cb0f2a6035631c209e02e2c784fded89e4efa7f5e9f0c2b9", + "sha256_after": "8810c9dd3f430ef0cb0f2a6035631c209e02e2c784fded89e4efa7f5e9f0c2b9" + }, + { + "from": "docs/benchmark-luna-grain-context-preparation-2026-09-06.json", + "to": "docs/archive/benchmarks/benchmark-luna-grain-context-preparation-2026-09-06.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "3ee49e50add4f82fa58db9744107d56e4a04df1621f9fac92dab4583c4d4b34a", + "sha256_after": "3ee49e50add4f82fa58db9744107d56e4a04df1621f9fac92dab4583c4d4b34a" + }, + { + "from": "docs/benchmark-luna-grain-maintenance-2026-09-06.json", + "to": "docs/archive/benchmarks/benchmark-luna-grain-maintenance-2026-09-06.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "6d62d65acdb2dc48299e12a7559eea6b9dab1c0ff62ea72009ca036ca568c7a2", + "sha256_after": "6d62d65acdb2dc48299e12a7559eea6b9dab1c0ff62ea72009ca036ca568c7a2" + }, + { + "from": "docs/benchmark-luna-mixed-d20-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-luna-mixed-d20-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "9bdafa66ede6b32ccaa7da344d4cd980caf9b6705449321dcea9938fe535fa94", + "sha256_after": "9bdafa66ede6b32ccaa7da344d4cd980caf9b6705449321dcea9938fe535fa94" + }, + { + "from": "docs/benchmark-luna-mixed-d20-2026-09-05.md", + "to": "docs/archive/benchmarks/benchmark-luna-mixed-d20-2026-09-05.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "844858561328cecb7daf8023a9a74d60a52bc325a923bb26f7ddd5c78b7b858f", + "sha256_after": "844858561328cecb7daf8023a9a74d60a52bc325a923bb26f7ddd5c78b7b858f" + }, + { + "from": "docs/benchmark-luna-mixed-d20-seed44-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-luna-mixed-d20-seed44-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "1a09a98b738844df7120edb58926137e8eafe60a8e230f7bff6e7e04ecec3bd2", + "sha256_after": "1a09a98b738844df7120edb58926137e8eafe60a8e230f7bff6e7e04ecec3bd2" + }, + { + "from": "docs/benchmark-luna-mixed-d20-seed44-2026-09-05.md", + "to": "docs/archive/benchmarks/benchmark-luna-mixed-d20-seed44-2026-09-05.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "19894edcdec5efc6c2de3fe1d671e2e04f857dcd3bfb6fa85a0d09726272f796", + "sha256_after": "19894edcdec5efc6c2de3fe1d671e2e04f857dcd3bfb6fa85a0d09726272f796" + }, + { + "from": "docs/benchmark-luna-mixed-d20-seed45-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-luna-mixed-d20-seed45-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "0fbc01fa64039f6c5106b07c778f0bce76f97236ba32258d7d0b464df8fa9b03", + "sha256_after": "0fbc01fa64039f6c5106b07c778f0bce76f97236ba32258d7d0b464df8fa9b03" + }, + { + "from": "docs/benchmark-luna-mixed-d20-seed45-2026-09-05.md", + "to": "docs/archive/benchmarks/benchmark-luna-mixed-d20-seed45-2026-09-05.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "5569655dbbe9f0e16c52ce48e2cb979ed1801f8f4b5e041ed80e59184f7851fc", + "sha256_after": "5569655dbbe9f0e16c52ce48e2cb979ed1801f8f4b5e041ed80e59184f7851fc" + }, + { + "from": "docs/benchmark-luna-mixed-d20-seed46-2026-09-06.json", + "to": "docs/archive/benchmarks/benchmark-luna-mixed-d20-seed46-2026-09-06.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "e3d37fe513220923135d3fb0dfcbc0f7205ac5bc1ba41b0a45effbde2aa27225", + "sha256_after": "e3d37fe513220923135d3fb0dfcbc0f7205ac5bc1ba41b0a45effbde2aa27225" + }, + { + "from": "docs/benchmark-luna-mixed-d20-seed46-2026-09-06.md", + "to": "docs/archive/benchmarks/benchmark-luna-mixed-d20-seed46-2026-09-06.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "81e40d0667d3711cfda75955b36af003ee3d9b826008e9386fd3be1b095bc02d", + "sha256_after": "81e40d0667d3711cfda75955b36af003ee3d9b826008e9386fd3be1b095bc02d" + }, + { + "from": "docs/benchmark-luna-mixed-d20-seed48-2026-09-06.json", + "to": "docs/archive/benchmarks/benchmark-luna-mixed-d20-seed48-2026-09-06.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "5ccd523bc00603cd2a464498c6f10631162f8ae0c7c6c924dd83a0e2a2fbd7f0", + "sha256_after": "5ccd523bc00603cd2a464498c6f10631162f8ae0c7c6c924dd83a0e2a2fbd7f0" + }, + { + "from": "docs/benchmark-luna-mixed-d20-seed48-2026-09-06.md", + "to": "docs/archive/benchmarks/benchmark-luna-mixed-d20-seed48-2026-09-06.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "2ab3977b150508e789136be5963d794e0b8787407bb7de612abc2ab0cb7313ea", + "sha256_after": "2ab3977b150508e789136be5963d794e0b8787407bb7de612abc2ab0cb7313ea" + }, + { + "from": "docs/benchmark-luna-offline-triage-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-luna-offline-triage-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "253e682ed846369a3cb7e6c7d02c2c3c71ad45a22329aba9a85376ce6e5dc913", + "sha256_after": "253e682ed846369a3cb7e6c7d02c2c3c71ad45a22329aba9a85376ce6e5dc913" + }, + { + "from": "docs/benchmark-luna-offline-triage-2026-09-05.md", + "to": "docs/archive/benchmarks/benchmark-luna-offline-triage-2026-09-05.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "0b750f79a986bc0909e3c0a7b0d3f3f0736d58c68b9238762f631f619ef25ef7", + "sha256_after": "0b750f79a986bc0909e3c0a7b0d3f3f0736d58c68b9238762f631f619ef25ef7" + }, + { + "from": "docs/benchmark-luna-output-contract-review-2026-09-06.json", + "to": "docs/archive/benchmarks/benchmark-luna-output-contract-review-2026-09-06.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "0a0eab910f00ba3913e9200990fdf439e6e6024829e795ddcf81c317337e73a6", + "sha256_after": "0a0eab910f00ba3913e9200990fdf439e6e6024829e795ddcf81c317337e73a6" + }, + { + "from": "docs/benchmark-luna-output-contract-review-2026-09-06.md", + "to": "docs/archive/benchmarks/benchmark-luna-output-contract-review-2026-09-06.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "40948a5dad37d1584f093f29db74b6f16dde67f8d1a03cb4175f4e12c43e779e", + "sha256_after": "40948a5dad37d1584f093f29db74b6f16dde67f8d1a03cb4175f4e12c43e779e" + }, + { + "from": "docs/benchmark-luna-projection-instructions-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-luna-projection-instructions-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "b59dac931ff210af8ec4a38f75e6b92587758a2f1cadcbdfb951a0a8d604a602", + "sha256_after": "b59dac931ff210af8ec4a38f75e6b92587758a2f1cadcbdfb951a0a8d604a602" + }, + { + "from": "docs/benchmark-luna-scalar-cte-fix-2026-09-06.json", + "to": "docs/archive/benchmarks/benchmark-luna-scalar-cte-fix-2026-09-06.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "2360ad7431c6691b79152e3d0d1e60d4dc0df8504e1260d4f33119cc6e19b4b2", + "sha256_after": "2360ad7431c6691b79152e3d0d1e60d4dc0df8504e1260d4f33119cc6e19b4b2" + }, + { + "from": "docs/benchmark-luna-standard-d20-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-luna-standard-d20-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "eca6b674670f97aaeac58e848d287bab09b9e646bda75ee58cf0810e6ae93a7b", + "sha256_after": "eca6b674670f97aaeac58e848d287bab09b9e646bda75ee58cf0810e6ae93a7b" + }, + { + "from": "docs/benchmark-luna-strict-output-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-luna-strict-output-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "ebf40971bf892a7f1522be380f34aecdf59d727471479bbe598b95c1081920bf", + "sha256_after": "ebf40971bf892a7f1522be380f34aecdf59d727471479bbe598b95c1081920bf" + }, + { + "from": "docs/benchmark-luna-strict-paired-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-luna-strict-paired-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "d9a7c8f84eef88f28450f5842a5116ba591df712ada3aa0480fef26d02141186", + "sha256_after": "d9a7c8f84eef88f28450f5842a5116ba591df712ada3aa0480fef26d02141186" + }, + { + "from": "docs/benchmark-luna-value-context-2026-09-06.json", + "to": "docs/archive/benchmarks/benchmark-luna-value-context-2026-09-06.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "6077229f0efb9ef678eed4e14a37aa50c23575f89abb197b81c4592d16e739be", + "sha256_after": "6077229f0efb9ef678eed4e14a37aa50c23575f89abb197b81c4592d16e739be" + }, + { + "from": "docs/benchmark-luna-value-context-2026-09-06.md", + "to": "docs/archive/benchmarks/benchmark-luna-value-context-2026-09-06.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "e36635ae1c4a4e54466fd0ee404d21f323105026e41f9c472a2418d7e8867303", + "sha256_after": "e36635ae1c4a4e54466fd0ee404d21f323105026e41f9c472a2418d7e8867303" + }, + { + "from": "docs/benchmark-luna-value-context-ready-2026-09-06.json", + "to": "docs/archive/benchmarks/benchmark-luna-value-context-ready-2026-09-06.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "28d269aac945ce49ffc5d97e5611ba655448674fb8006564308119f0cec1644e", + "sha256_after": "28d269aac945ce49ffc5d97e5611ba655448674fb8006564308119f0cec1644e" + }, + { + "from": "docs/benchmark-luna-value-context-ready-2026-09-06.md", + "to": "docs/archive/benchmarks/benchmark-luna-value-context-ready-2026-09-06.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "bc08bc3e37efc3fe2a27cd3ed3fc1977d75689356c157a0fcf7cf189503c74f8", + "sha256_after": "bc08bc3e37efc3fe2a27cd3ed3fc1977d75689356c157a0fcf7cf189503c74f8" + }, + { + "from": "docs/benchmark-r500-v8-binding-audit-2026-09-06.json", + "to": "docs/archive/benchmarks/benchmark-r500-v8-binding-audit-2026-09-06.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "e6fd6e2f267997ee134539bcfbfd8117f83fcae6ff62a7255862ea88e380eb18", + "sha256_after": "e6fd6e2f267997ee134539bcfbfd8117f83fcae6ff62a7255862ea88e380eb18" + }, + { + "from": "docs/benchmark-r500-v8-binding-audit-2026-09-06.md", + "to": "docs/archive/benchmarks/benchmark-r500-v8-binding-audit-2026-09-06.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "63f55b1c754acedf17efbf7cd60f29775aa60604c7722037cdc97f4c393dd909", + "sha256_after": "63f55b1c754acedf17efbf7cd60f29775aa60604c7722037cdc97f4c393dd909" + }, + { + "from": "docs/benchmark-sol-error-triage-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-sol-error-triage-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "39cdfcf83d51d2f4dbb2618d54021f326598b668bca08f25565473fde1335573", + "sha256_after": "39cdfcf83d51d2f4dbb2618d54021f326598b668bca08f25565473fde1335573" + }, + { + "from": "docs/benchmark-sol-metric-replay-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-sol-metric-replay-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "2eee5ba01fe2f20c01542c74a6131be625bcf9c13a5847b1e85dc733403af796", + "sha256_after": "2eee5ba01fe2f20c01542c74a6131be625bcf9c13a5847b1e85dc733403af796" + }, + { + "from": "docs/benchmark-standards-engineering-2026-09-05.json", + "to": "docs/archive/benchmarks/benchmark-standards-engineering-2026-09-05.json", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "07181975c230e5cd80499cec17ad9f9d2c0e9428d2f91c2441d491a10f193e46", + "sha256_after": "07181975c230e5cd80499cec17ad9f9d2c0e9428d2f91c2441d491a10f193e46" + }, + { + "from": "docs/benchmark_failure_analysis_2026-03-18.md", + "to": "docs/archive/benchmarks/benchmark_failure_analysis_2026-03-18.md", + "change_reason": "Archive completed dated benchmark/accuracy evidence; preserve historical claims and JSON bytes.", + "sha256_before": "3504120a9d8e012d79b7be0dc9a52b7729f5bda91bf8633fa9f4d0356c5a0815", + "sha256_after": "3504120a9d8e012d79b7be0dc9a52b7729f5bda91bf8633fa9f4d0356c5a0815" + }, + { + "from": "docs/chart-engine-bakeoff-2026-08-24.md", + "to": "docs/archive/engineering/chart-engine-bakeoff-2026-08-24.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "e6dcefe27acf36b073942750a53422ce6ab58fb97935478df886a554e693c82b", + "sha256_after": "e6dcefe27acf36b073942750a53422ce6ab58fb97935478df886a554e693c82b" + }, + { + "from": "docs/chart-storytelling-echarts-focused-evidence-2026-08-24.md", + "to": "docs/archive/engineering/chart-storytelling-echarts-focused-evidence-2026-08-24.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "3d64fdfb11e9ee9a83ad1c88c980be47eb7a63a95d521273ae16cf68ad593d61", + "sha256_after": "3d64fdfb11e9ee9a83ad1c88c980be47eb7a63a95d521273ae16cf68ad593d61" + }, + { + "from": "docs/chart-storytelling-r0-evidence-2026-08-24.md", + "to": "docs/archive/engineering/chart-storytelling-r0-evidence-2026-08-24.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "5acf0a8b7446b4c45de85d353f5781f5abc7f2da3f3bc6a4ce530e80594f4705", + "sha256_after": "5acf0a8b7446b4c45de85d353f5781f5abc7f2da3f3bc6a4ce530e80594f4705" + }, + { + "from": "docs/delivery-assessment-2026-05-07.md", + "to": "docs/archive/engineering/delivery-assessment-2026-05-07.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "e946bd83ce853b38981b23e166fd0ad503c940b9f01e9869dddbf2c63b5fff50", + "sha256_after": "e946bd83ce853b38981b23e166fd0ad503c940b9f01e9869dddbf2c63b5fff50" + }, + { + "from": "docs/forge-goal-gap-assessment-2026-08-24.md", + "to": "docs/archive/engineering/forge-goal-gap-assessment-2026-08-24.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes. Markdown differs only by rebasing relative navigation links from the archive destination; no historical commands, report strings, claims, results or scores rewritten.", + "sha256_before": "f868876346eb0a865673d5ab9dc698c7652a0aed5a823521a8e5b27203fcfac5", + "sha256_after": "58d684cb5718896d97519639038236e1006dec3fa20424ff7de17dae1af44cda" + }, + { + "from": "docs/golden-journey-acceptance-2026-08-24.md", + "to": "docs/archive/engineering/golden-journey-acceptance-2026-08-24.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes. Markdown differs only by rebasing relative navigation links from the archive destination; no historical commands, report strings, claims, results or scores rewritten.", + "sha256_before": "af171d39d751a4f7d3c4116b099a1aaf016601159d0b62a4b4ac98ee28755657", + "sha256_after": "d5d2aaf9442ea2c48721ed3d40b9e025b08f02dc259e5c83f88675b8d9295455" + }, + { + "from": "docs/golden-journey-p0-closure-2026-08-24.md", + "to": "docs/archive/engineering/golden-journey-p0-closure-2026-08-24.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes. Markdown differs only by rebasing relative navigation links from the archive destination; no historical commands, report strings, claims, results or scores rewritten.", + "sha256_before": "87dc5c6aaf37eede217de17d9158f599031e4acb80163680e49d949fbbc19144", + "sha256_after": "b561a475b6b44b39a816681d28235a28e45f72a79719a00ee9a32b093f060281" + }, + { + "from": "docs/governance-contract-review-2026-08-24.md", + "to": "docs/archive/engineering/governance-contract-review-2026-08-24.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "ce190dcd25674b8bc6a467d3ba3df22fb0cb3c0af803612af71818ede6ec1d60", + "sha256_after": "ce190dcd25674b8bc6a467d3ba3df22fb0cb3c0af803612af71818ede6ec1d60" + }, + { + "from": "docs/optimization_plan_2026-03-19.md", + "to": "docs/archive/plans/optimization_plan_2026-03-19.md", + "change_reason": "Archive superseded implementation plan; retain active plan authority and historical claims.", + "sha256_before": "c54fe0e44c1db604911e886664dd9b67717b53d94bd1be2faa7760d6a27388bf", + "sha256_after": "c54fe0e44c1db604911e886664dd9b67717b53d94bd1be2faa7760d6a27388bf" + }, + { + "from": "docs/pi-forge-integration-plan.md", + "to": "docs/archive/plans/pi-forge-integration-plan.md", + "change_reason": "Archive superseded implementation plan; retain active plan authority and historical claims. Markdown differs only by rebasing relative navigation links from the archive destination; no historical commands, report strings, claims, results or scores rewritten.", + "sha256_before": "495336486b490aca0f66e52844a510f38ac19926cb560b54bde619031dd38294", + "sha256_after": "851b7bd510031a5c9f9d39bd18f94c8d5c890ff7e35c2f50f00d6bc8a9247d78" + }, + { + "from": "docs/product-direction-architecture-review-2026-08-24.md", + "to": "docs/archive/engineering/product-direction-architecture-review-2026-08-24.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes. Markdown differs only by rebasing relative navigation links from the archive destination; no historical commands, report strings, claims, results or scores rewritten.", + "sha256_before": "a0d64852635be818d050570aec04ca1b9cdec1998f5af3c3bb0e520019b9e985", + "sha256_after": "8cdef2d5fa3e2d2d9b19c5c542aa49d64b29da4bc2209b2bdfbb24d30fe27a09" + }, + { + "from": "docs/product-spine-sp1-evidence-2026-08-25.md", + "to": "docs/archive/engineering/product-spine-sp1-evidence-2026-08-25.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "a3e746001c887a62b94d8d3c231a3dad70409289381aca7b6f357017b072756c", + "sha256_after": "a3e746001c887a62b94d8d3c231a3dad70409289381aca7b6f357017b072756c" + }, + { + "from": "docs/product-spine-sp2-evidence-2026-08-25.md", + "to": "docs/archive/engineering/product-spine-sp2-evidence-2026-08-25.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "f1902264b518022fe9005ce1ff51ecbd3156fc7196d16fa7c33a64fec6f04777", + "sha256_after": "f1902264b518022fe9005ce1ff51ecbd3156fc7196d16fa7c33a64fec6f04777" + }, + { + "from": "docs/product-spine-sp3-evidence-2026-08-25.md", + "to": "docs/archive/engineering/product-spine-sp3-evidence-2026-08-25.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "eea43f188d8ec01e52dfcd4892031e4d2273f1d82ad963b3ca948b58450fbd6f", + "sha256_after": "eea43f188d8ec01e52dfcd4892031e4d2273f1d82ad963b3ca948b58450fbd6f" + }, + { + "from": "docs/product-spine-sp4-evidence-2026-08-25.md", + "to": "docs/archive/engineering/product-spine-sp4-evidence-2026-08-25.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "d4fda79e44d6d207e86675f1454d1f769c71a692d4c218bb2371287a6c1ef984", + "sha256_after": "d4fda79e44d6d207e86675f1454d1f769c71a692d4c218bb2371287a6c1ef984" + }, + { + "from": "docs/product-spine-sp5-evidence-2026-08-25.md", + "to": "docs/archive/engineering/product-spine-sp5-evidence-2026-08-25.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes. Markdown differs only by rebasing relative navigation links from the archive destination; no historical commands, report strings, claims, results or scores rewritten.", + "sha256_before": "c14a0b2387752d5d6036d48df95338783bf74080f3bce1dc612086034f77f4ca", + "sha256_after": "65f9f82a3401fed149b52a647e6217f9b2444063ececa63f0b1d3d515300d88d" + }, + { + "from": "docs/release-verification-2026-09-07.json", + "to": "docs/archive/engineering/release-verification-2026-09-07.json", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "a895922a914828cf722f47e29bbf463d618745ed433f363b48c487696ffff099", + "sha256_after": "a895922a914828cf722f47e29bbf463d618745ed433f363b48c487696ffff099" + }, + { + "from": "docs/report-publication-2026-09-07.json", + "to": "docs/archive/engineering/report-publication-2026-09-07.json", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "03a24cb184002d800567914bb8023d228ca255a4001bcba3379adf98830e552c", + "sha256_after": "03a24cb184002d800567914bb8023d228ca255a4001bcba3379adf98830e552c" + }, + { + "from": "docs/short-term-product-spine-plan-2026-08-25.md", + "to": "docs/archive/plans/short-term-product-spine-plan-2026-08-25.md", + "change_reason": "Archive superseded implementation plan; retain active plan authority and historical claims. Markdown differs only by rebasing relative navigation links from the archive destination; no historical commands, report strings, claims, results or scores rewritten.", + "sha256_before": "1252dcce7856206fc35e71b2cd1801704a0e7ddcebab013c849a399dfaa4655f", + "sha256_after": "9c7680501dc601ecdb6102e066722ae34ac426b98ff18a348444bd1e06805bc1" + }, + { + "from": "docs/test-report-2026-05-05.md", + "to": "docs/archive/engineering/test-report-2026-05-05.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "ca25b6c3ab2b156cfab1c558ece122538599d992db07705254c81abce7471c93", + "sha256_after": "ca25b6c3ab2b156cfab1c558ece122538599d992db07705254c81abce7471c93" + }, + { + "from": "docs/test-report-2026-05-06.md", + "to": "docs/archive/engineering/test-report-2026-05-06.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "8a1968a6fbb79e23d165a4e5cba6fb09dee5d07917b8ab8fd8b7a6db9fbc8c78", + "sha256_after": "8a1968a6fbb79e23d165a4e5cba6fb09dee5d07917b8ab8fd8b7a6db9fbc8c78" + }, + { + "from": "docs/test-report-2026-07-13.md", + "to": "docs/archive/engineering/test-report-2026-07-13.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "58ce841590d348a15ea63b19e8013696377500989006a041aa3c61d51748fcd1", + "sha256_after": "58ce841590d348a15ea63b19e8013696377500989006a041aa3c61d51748fcd1" + }, + { + "from": "docs/web-product-content-audit-2026-08-24.md", + "to": "docs/archive/engineering/web-product-content-audit-2026-08-24.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "96941d15998bee9bedc4f4431b7343838e2d18fefd7debe8e40e43ed2aa6d6ea", + "sha256_after": "96941d15998bee9bedc4f4431b7343838e2d18fefd7debe8e40e43ed2aa6d6ea" + }, + { + "from": "docs/web-product-shell-plan-2026-08-24.md", + "to": "docs/archive/plans/web-product-shell-plan-2026-08-24.md", + "change_reason": "Archive superseded implementation plan; retain active plan authority and historical claims. Markdown differs only by rebasing relative navigation links from the archive destination; no historical commands, report strings, claims, results or scores rewritten.", + "sha256_before": "7a94df7948ce17596c5e2b6c65e99100c2a256b42fcf9907740d52877d400781", + "sha256_after": "b803774ff21fd173d00c3054c031ff0c78baa00c0e3b3ba80771a56b9f86199e" + }, + { + "from": "docs/web-product-shell-w3a-evidence-2026-08-24.md", + "to": "docs/archive/engineering/web-product-shell-w3a-evidence-2026-08-24.md", + "change_reason": "Archive completed engineering, test, release or assessment evidence; preserve historical claims and JSON bytes.", + "sha256_before": "80f21671c9cfcc024cb71b1a3101be8b16a476f191ce543b8ac25f867e127ad9", + "sha256_after": "80f21671c9cfcc024cb71b1a3101be8b16a476f191ce543b8ac25f867e127ad9" + }, + { + "from": "scripts/seed_mock_data.py", + "to": "demo/seed_mock_data.py", + "sha256_before": "65103dfbf436fbf6a731721e711842358a900c93bb3f2505ed228433c783ce39", + "sha256_after": "5f157990e2071f3c0bd64d705f41a6d13fdf29b5309ee0ca86fb37020f97989d", + "change_reason": "Relocate demo data seeder; update two usage examples only." + }, + { + "from": "tests/accuracy/build_context.py", + "to": "tools/benchmarks/accuracy/build_context.py", + "sha256_before": "ec257664ec04aaf207b0da9698b91d855787c871a6243f5d56d58b9ea7159d3e", + "sha256_after": "ec257664ec04aaf207b0da9698b91d855787c871a6243f5d56d58b9ea7159d3e", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/compare.py", + "to": "tools/benchmarks/accuracy/compare.py", + "sha256_before": "8c770874a600d390b4c4b5c7755e4a324ac77f3898f2aa57f199698f71f5e6f2", + "sha256_after": "0a160a2e57436df2b6ae2bc9925bd4927bbee97fd80f1412d8668136aaad4fbd", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/evaluate_ea.py", + "to": "tools/benchmarks/accuracy/evaluate_ea.py", + "sha256_before": "51351388e591222efd14c921a344ba28e59504a959170e463382af55c33dcca6", + "sha256_after": "fb7eb0bdcf3bfc1e19b6fcfa47e23eddb9651f2ee36590d1e0286a78c0705fc0", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/generate_cases.py", + "to": "tools/benchmarks/accuracy/generate_cases.py", + "sha256_before": "9e7cc999131fe07be7c2822457925f7f1ab8cc6fddfd087812d7b89092736556", + "sha256_after": "db92d301517baf9566eb7222cd9e40f4fae060220b02810215fce1c1525d203d", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/generate_cases_large.py", + "to": "tools/benchmarks/accuracy/generate_cases_large.py", + "sha256_before": "b3853348c3cdfbfa67fb2afacc7c42eb17a55857e8c3c893290d3cf7163294b1", + "sha256_after": "b311fabd7e03cd20ad475c5eff2216aacfb3e5f52735a9a860d5b972037c49a1", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/grade.py", + "to": "tools/benchmarks/accuracy/grade.py", + "sha256_before": "1bf0be0f72311a7ff2fdc3d102c694630cbe272b97891898b25bbf03a0ac6913", + "sha256_after": "80d38efba33a63127952463440dc6a1ef337a45f614d33b7258bdcb2e49ad207", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/__init__.py", + "to": "tools/benchmarks/accuracy/methods/__init__.py", + "sha256_before": "58cca2dedc66414dbd4dc7460ff159b2f55a38af621a230a8c095ed458e70b61", + "sha256_after": "58cca2dedc66414dbd4dc7460ff159b2f55a38af621a230a8c095ed458e70b61", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/legacy/method_a.py", + "to": "tools/benchmarks/accuracy/methods/legacy/method_a.py", + "sha256_before": "c5ca7b215ec6fed8af55c4924db11d9f15904bfec56e00914d191a738b71442b", + "sha256_after": "c5ca7b215ec6fed8af55c4924db11d9f15904bfec56e00914d191a738b71442b", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/legacy/method_d.py", + "to": "tools/benchmarks/accuracy/methods/legacy/method_d.py", + "sha256_before": "76ca61f46619980adbfc631833ea6ea33409eefd8ea952bfda7819e9b6e65504", + "sha256_after": "76ca61f46619980adbfc631833ea6ea33409eefd8ea952bfda7819e9b6e65504", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/legacy/method_e.py", + "to": "tools/benchmarks/accuracy/methods/legacy/method_e.py", + "sha256_before": "309e1b5c50f47158a2b5da30c73c3970cba3084ad9da9c94e31f691c46e66eef", + "sha256_after": "309e1b5c50f47158a2b5da30c73c3970cba3084ad9da9c94e31f691c46e66eef", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/legacy/method_f.py", + "to": "tools/benchmarks/accuracy/methods/legacy/method_f.py", + "sha256_before": "96745e4508b3ce540c78643a3635afcbbf1d168afae33e43b660ace8f146cf40", + "sha256_after": "96745e4508b3ce540c78643a3635afcbbf1d168afae33e43b660ace8f146cf40", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/legacy/method_h.py", + "to": "tools/benchmarks/accuracy/methods/legacy/method_h.py", + "sha256_before": "529a48ec6f7c5b97fcb362009c556251c451efdfe1d82f6a43e5636819e62353", + "sha256_after": "529a48ec6f7c5b97fcb362009c556251c451efdfe1d82f6a43e5636819e62353", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/legacy/method_i.py", + "to": "tools/benchmarks/accuracy/methods/legacy/method_i.py", + "sha256_before": "a87a1d4df78bcdde62806402e3f45ec10997a87b81092fa9372f23f44d8a1c7c", + "sha256_after": "a87a1d4df78bcdde62806402e3f45ec10997a87b81092fa9372f23f44d8a1c7c", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/method_aa.py", + "to": "tools/benchmarks/accuracy/methods/method_aa.py", + "sha256_before": "38db7cf50513faaeb7a2e7864d65407e935c0d697ff9e5c6cb9af61b9ac59972", + "sha256_after": "c7455423469948ea7a541007c8e7a3591375f381f351be36369902d4a24d8860", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_ab.py", + "to": "tools/benchmarks/accuracy/methods/method_ab.py", + "sha256_before": "c2e2c4ce56a45c0a18bb903b841b0df9ca9fd00ff790cefb59adda26d705ad41", + "sha256_after": "b45cc8740348fa3f5a6a6e0be603677cfb7195466fd9faab0863098b7652dcae", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_ac.py", + "to": "tools/benchmarks/accuracy/methods/method_ac.py", + "sha256_before": "c91cfc002db2c001fd777629d0bb3cd6c9720b6ef1814374abbfd745ba47bceb", + "sha256_after": "ffebd5067fbbe8b7412a387299dffddc3c69948094240f5a89e4a929ac59a2c7", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_ad.py", + "to": "tools/benchmarks/accuracy/methods/method_ad.py", + "sha256_before": "f234f1757f18106c35eace9932b6ddd9b3d0bd2a97c2d3d0b2c6ac9b807beec5", + "sha256_after": "737ccc69493a0ba7779dc599d3715d5263f6c62b5c4edee66a8de270a5f6d892", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_ae.py", + "to": "tools/benchmarks/accuracy/methods/method_ae.py", + "sha256_before": "04f4d2814fc1b5bed801365c47d92f153521b2a53341efa3a5722645d5d31799", + "sha256_after": "0871c7a882aa2c5299a77c682349cb85959e50c0ffa962cffd33cfaf84f7e8ae", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_af.py", + "to": "tools/benchmarks/accuracy/methods/method_af.py", + "sha256_before": "2035f4f974131ea1efd389bcd6b4c940473f66ee1be77cdce0bff12c67c6eabc", + "sha256_after": "62d5cd48067dc362b3669faf5ef326b450a7e6d9d34fdbe96b90eeb984be8f75", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_ag.py", + "to": "tools/benchmarks/accuracy/methods/method_ag.py", + "sha256_before": "ca50f2c632bcc5afad7b42b5ed269b8c14926c4d91cbfdca8e15de721fcc77d8", + "sha256_after": "b12e331038843c5e2093148ec5d73fc7b0511c421bd130c9a17494bcaeb38ed0", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_ah.py", + "to": "tools/benchmarks/accuracy/methods/method_ah.py", + "sha256_before": "c40a45e575ba5792f287e9256acdd397110f416536e05de271a95c89cdd98495", + "sha256_after": "f85282e2ec744f1f7f573dbc2a20037d49e10dbc5bd36bc75175b93fc1fda133", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_ai.py", + "to": "tools/benchmarks/accuracy/methods/method_ai.py", + "sha256_before": "2c5bcf2dbfdea407d5296d962237ad88a184820e3907bd834fd1fcfbb56ea8e1", + "sha256_after": "99151034d3a18da4c0d4e349ac0849e68f6abf544f64de16031583ff8620da23", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_b.py", + "to": "tools/benchmarks/accuracy/methods/method_b.py", + "sha256_before": "1bfbb8ff4fc9dab985b09b42c062560be5f4b7a705a54ac5aef25a27ae03640d", + "sha256_after": "1bfbb8ff4fc9dab985b09b42c062560be5f4b7a705a54ac5aef25a27ae03640d", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/method_b_large.py", + "to": "tools/benchmarks/accuracy/methods/method_b_large.py", + "sha256_before": "c156a356b1f6bc565333261d962ddf656c3bafdd5f2929cb37c29bbe902d9b74", + "sha256_after": "c156a356b1f6bc565333261d962ddf656c3bafdd5f2929cb37c29bbe902d9b74", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/method_b_large_sem.py", + "to": "tools/benchmarks/accuracy/methods/method_b_large_sem.py", + "sha256_before": "ebd11df6482377455569b62a8f0c4bb6a9aab34d4a80b62847605f73f96ddb4a", + "sha256_after": "ebd11df6482377455569b62a8f0c4bb6a9aab34d4a80b62847605f73f96ddb4a", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/method_b_qwen.py", + "to": "tools/benchmarks/accuracy/methods/method_b_qwen.py", + "sha256_before": "b231cecbf215de24249e9985e246fcac2e9386b1a0f9d0f86455b2c69787d17b", + "sha256_after": "1725b366e4128a04561e312b7f85d915e1a6fe88d1d58c3c90e5f30f6ea6a66c", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_b_sem.py", + "to": "tools/benchmarks/accuracy/methods/method_b_sem.py", + "sha256_before": "5cb16b3c3ae3e48d9b1b3a90c5497a181460cfa015fb2122b613977f3b529639", + "sha256_after": "5cb16b3c3ae3e48d9b1b3a90c5497a181460cfa015fb2122b613977f3b529639", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/method_g.py", + "to": "tools/benchmarks/accuracy/methods/method_g.py", + "sha256_before": "fedbf8d688c22aea6ea8024759795a4bce012ebcb5ba52879585c9d9b14f08ea", + "sha256_after": "fedbf8d688c22aea6ea8024759795a4bce012ebcb5ba52879585c9d9b14f08ea", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/method_j.py", + "to": "tools/benchmarks/accuracy/methods/method_j.py", + "sha256_before": "d199c923b4af79d66843b896fdffc563e1a5c3423ebb14e970870ff2662b04ad", + "sha256_after": "d199c923b4af79d66843b896fdffc563e1a5c3423ebb14e970870ff2662b04ad", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/method_j_sem.py", + "to": "tools/benchmarks/accuracy/methods/method_j_sem.py", + "sha256_before": "90d0f7c42e2d159ce912261781dfee742cf7dad042295ef534e4f91376046c21", + "sha256_after": "90d0f7c42e2d159ce912261781dfee742cf7dad042295ef534e4f91376046c21", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/method_k.py", + "to": "tools/benchmarks/accuracy/methods/method_k.py", + "sha256_before": "ea7b3cc8c1f3c1f1602afc342e63ff1def0a18cf683b1780f46d26f43aadc90e", + "sha256_after": "ea7b3cc8c1f3c1f1602afc342e63ff1def0a18cf683b1780f46d26f43aadc90e", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/methods/method_l.py", + "to": "tools/benchmarks/accuracy/methods/method_l.py", + "sha256_before": "3462bc3a5f1ae34341fbb70305d2ec2a6733cb3debab0ea459fb030f9cde6cdd", + "sha256_after": "12b714f076e573f95bf6c92a64b16b54a69e6a82fe441fb59b58e836fed825f0", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_m.py", + "to": "tools/benchmarks/accuracy/methods/method_m.py", + "sha256_before": "32c759a2293c08a8460ce6661eac97a66a6c42f472e11508523ac2648d7ee506", + "sha256_after": "88c28a41a16da5a0e3d058ee65b0718d2efddc8e847ebd1d2ca726255fb588c6", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_n.py", + "to": "tools/benchmarks/accuracy/methods/method_n.py", + "sha256_before": "0817a243ae1ef67334e44dedcc3150954bc2b24a06a5096eef8ba739081d20ba", + "sha256_after": "518fe90cda61329d6a9a369f44427329b4b1f0b24ffe75aba4b4496d1ec75ef9", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_o.py", + "to": "tools/benchmarks/accuracy/methods/method_o.py", + "sha256_before": "b4b82e4a12cf147b934f93b15ba6ef54c6264d7ba1d56427d5d56ece140a49af", + "sha256_after": "c17fb5f41df6256f81e42dd67aeef6a5d11e65e569371bde1d2e13cd62a6c1a2", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_p.py", + "to": "tools/benchmarks/accuracy/methods/method_p.py", + "sha256_before": "5aac50f7ac21ad3ed4bb92bf4150aa739251cd9d8cc0259ea5b116575fd4680a", + "sha256_after": "2769d133e1a06696e7f5e529a355f58c984b4598f3561678e8bb010d33ef146c", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_q.py", + "to": "tools/benchmarks/accuracy/methods/method_q.py", + "sha256_before": "a28738337ecde0245a4da51c199054ae15bcf7f2030ac966b3a5b6a662033ae8", + "sha256_after": "a36a58df5665d81e2d67851a1d7a19e4cec87c55695c521cd3c1856bdbe44d4f", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_r.py", + "to": "tools/benchmarks/accuracy/methods/method_r.py", + "sha256_before": "a5fdde3a019042a9a6ba8d09c0c8507685c934e7e6b4878c28ccfc25cf5fad93", + "sha256_after": "fc0fe9f38c7011cadbd251cbda7730f2d145eb44fa4b18028342495bd0d3eab0", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_s.py", + "to": "tools/benchmarks/accuracy/methods/method_s.py", + "sha256_before": "c4c4c07c69f228567b4845f365f844fb4d8291dbcc99064d364ced3904834dfb", + "sha256_after": "38cafa13cfdb6c302c6ac6346c985e93cc4c24a75e36d4991d217b96ffc03e44", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_t.py", + "to": "tools/benchmarks/accuracy/methods/method_t.py", + "sha256_before": "85fec0213992826db2c233747436c5f5b7a9d162663c198d983cf006da208b6c", + "sha256_after": "2ed666bbdffa2f0ca0b010cdbb0010c4bb8001e7f4881d4b2cca38ff6825d3ed", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_u.py", + "to": "tools/benchmarks/accuracy/methods/method_u.py", + "sha256_before": "ed5cc7561c0999d2a519a889c732d9886527a6fbc2f34213832081f1adac7240", + "sha256_after": "5d957b41bcd3afb7ec9e366d24d8975833a1e929d3592044427fcf8cffc109a4", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_v.py", + "to": "tools/benchmarks/accuracy/methods/method_v.py", + "sha256_before": "d4bd6927092ed1a3a4514df4f99a8bb50ee2e742255486dd219ee875ceca07dc", + "sha256_after": "c75ea7bd2088e73a0466f2b4b044ee17bf45e1c787feaf5edd92d3e0650c721d", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_w.py", + "to": "tools/benchmarks/accuracy/methods/method_w.py", + "sha256_before": "279e56b40c8cf95c1d16150ae6f63f14aab62abc9708ea91ceb78a785537bc88", + "sha256_after": "d0fb155e8407d9dbe2e273a40d4566acb94329c2d99c77de570c3dd7075dfee8", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_x.py", + "to": "tools/benchmarks/accuracy/methods/method_x.py", + "sha256_before": "613e08fcd290df941b007a61e8a6bc6ae4087b753cf7ae91fd4064da8d50eaa9", + "sha256_after": "fde53a64f12e6791f2ad018cbe733880cf7818379d8a25dbe8702dba7466b8a5", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_y.py", + "to": "tools/benchmarks/accuracy/methods/method_y.py", + "sha256_before": "c25b9cd7d631f6aafbb86cd12a2fdb985b339fb30f990bb6b847711e018d9eb1", + "sha256_after": "f92caeabc869d258a56335ac2fccabe0d3b2262fd19ce05d0ed8a05396f5efda", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/methods/method_z.py", + "to": "tools/benchmarks/accuracy/methods/method_z.py", + "sha256_before": "9429423ab6c5a40ed6168b408b443563381e692729f6f71f3f78368cf8aadb10", + "sha256_after": "a5241057adc2e6fa6ca421984fc75597d29a9f1c3bfb40f89ebf2372eff03e92", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/results/cases_large.json", + "to": "tools/benchmarks/accuracy/cases_large.json", + "sha256_before": "c2744dcb590c666aa678cbafd04cca753e6c3979391a7d8c0e2dd2045043dbe7", + "sha256_after": "c2744dcb590c666aa678cbafd04cca753e6c3979391a7d8c0e2dd2045043dbe7", + "change_reason": "Relocate versioned public synthetic case definitions beside their generator, separating evaluator input from private generated method results; preserve fixture bytes." + }, + { + "from": "tests/accuracy/results/method_k/report_2026-03-15_185406.md", + "to": "docs/archive/benchmarks/report_2026-03-15_185406.md", + "sha256_before": "4ccee05cb0acbd646b38163ec6b1fee029a527f1d7b68388daaf33002f38dabd", + "change_reason": "Archive the tracked public Method K historical benchmark report; ignored/private result data remain in place.", + "sha256_after": "4ccee05cb0acbd646b38163ec6b1fee029a527f1d7b68388daaf33002f38dabd" + }, + { + "from": "tests/accuracy/run_claude_direct.py", + "to": "tools/benchmarks/accuracy/run_claude_direct.py", + "sha256_before": "568997d3ad620c4625a0c74c4b84348452ed0cc16f479b5baccc1199b412eb19", + "sha256_after": "e7650ea4a9a9d26f9f3eef67eddf93ee1d19bb63d54b77f647e6d208ee81bd45", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/runner.py", + "to": "tools/benchmarks/accuracy/runner.py", + "sha256_before": "b228ab6da9ff9e62734840a3cc8057098ba5432958753203a39be7ff47305823", + "sha256_after": "4afbcec78b4c772e1c2169ed336b9142a12f2e588d4d2bd7a7601eb2bdfb74fe", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/accuracy/semantic_lib.py", + "to": "tools/benchmarks/accuracy/semantic_lib.py", + "sha256_before": "866a9a237b689ea3aa79f06b50eb702722d058694244727c07e8d2a8a9ea3d37", + "sha256_after": "866a9a237b689ea3aa79f06b50eb702722d058694244727c07e8d2a8a9ea3d37", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/accuracy/triage_failures.py", + "to": "tools/benchmarks/accuracy/triage_failures.py", + "sha256_before": "283ee8a0522dbcc80f685fb9bcba148255e93d241a432cdaec5093cf93d1f50f", + "sha256_after": "9e0dab578bd5ff7bc520de8afeb01b778f3b3a3cd5c173b2c27c6bee6c208fa2", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/benchmark/cases.json", + "to": "tools/benchmarks/synthetic/cases.json", + "sha256_before": "5c9542fac5f0a8444a37a2fcb83d7ab77eabd837a64a2baadb254fdd6a587c21", + "sha256_after": "5c9542fac5f0a8444a37a2fcb83d7ab77eabd837a64a2baadb254fdd6a587c21", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/create_db.py", + "to": "tools/benchmarks/synthetic/create_db.py", + "sha256_before": "b723ef1090fe5d4ac5944e292b3f889ff8f740ee4941667c12d027c60e48799f", + "sha256_after": "801a4ce3bd0e4c80b33cf67c272e18646e95147fcf94d31891248d8835f6f569", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/benchmark/demo_retrieval.py", + "to": "tools/benchmarks/synthetic/demo_retrieval.py", + "sha256_before": "271020cf16f875edcda0da9d422d1e96da937b383bfb0a8532b69f4b405dcd67", + "sha256_after": "d68d38265878651f50c912f579c3eac06cae31d922e208aa16e52e142cfe5a83", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/benchmark/gold/C01.csv", + "to": "tools/benchmarks/synthetic/gold/C01.csv", + "sha256_before": "b0f497b7da52311233352a3297578754db2094b19b0f7ad58e08714fa6362b0b", + "sha256_after": "b0f497b7da52311233352a3297578754db2094b19b0f7ad58e08714fa6362b0b", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C02.csv", + "to": "tools/benchmarks/synthetic/gold/C02.csv", + "sha256_before": "d0370fe5e0b54e4f412f5d56c71984f898cca97b2ac4e0b3a63e2e366d35fbbb", + "sha256_after": "d0370fe5e0b54e4f412f5d56c71984f898cca97b2ac4e0b3a63e2e366d35fbbb", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C03.csv", + "to": "tools/benchmarks/synthetic/gold/C03.csv", + "sha256_before": "00cca6a2a47a4d662b343e8fed44b00132949f467b57c42568c1347188c76e78", + "sha256_after": "00cca6a2a47a4d662b343e8fed44b00132949f467b57c42568c1347188c76e78", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C04.csv", + "to": "tools/benchmarks/synthetic/gold/C04.csv", + "sha256_before": "68dcded91d903b9d49d86a529a5455da6216d8aa8ec1f99173544501dbd95af8", + "sha256_after": "68dcded91d903b9d49d86a529a5455da6216d8aa8ec1f99173544501dbd95af8", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C05.csv", + "to": "tools/benchmarks/synthetic/gold/C05.csv", + "sha256_before": "ab11e122d0e521bb0058a2ad34000b5d854f35fdc79e5aecd1460e3e45e64a42", + "sha256_after": "ab11e122d0e521bb0058a2ad34000b5d854f35fdc79e5aecd1460e3e45e64a42", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C06.csv", + "to": "tools/benchmarks/synthetic/gold/C06.csv", + "sha256_before": "315ce20827c3be5e353a95fa53b4bf135a5640ee1fed92f8bc764537aa75563f", + "sha256_after": "315ce20827c3be5e353a95fa53b4bf135a5640ee1fed92f8bc764537aa75563f", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C07.csv", + "to": "tools/benchmarks/synthetic/gold/C07.csv", + "sha256_before": "08e1b6c8db993a1fad0673cb4dee1fa61bd8e9229aecf68e92f00f6efe3140e2", + "sha256_after": "08e1b6c8db993a1fad0673cb4dee1fa61bd8e9229aecf68e92f00f6efe3140e2", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C08.csv", + "to": "tools/benchmarks/synthetic/gold/C08.csv", + "sha256_before": "c347fb4407f1cc6d311ca38f67878e4586c7e3be87887a353661b12f3b3701a3", + "sha256_after": "c347fb4407f1cc6d311ca38f67878e4586c7e3be87887a353661b12f3b3701a3", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C09.csv", + "to": "tools/benchmarks/synthetic/gold/C09.csv", + "sha256_before": "b340b5713520cee16b5f19b79a146f544884437f9935c101d613b99c1af5a203", + "sha256_after": "b340b5713520cee16b5f19b79a146f544884437f9935c101d613b99c1af5a203", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C10.csv", + "to": "tools/benchmarks/synthetic/gold/C10.csv", + "sha256_before": "fc372a902ad80cd6088700fd20f297b8ff171e06fec0fbdff2674019afea2a39", + "sha256_after": "fc372a902ad80cd6088700fd20f297b8ff171e06fec0fbdff2674019afea2a39", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C11.csv", + "to": "tools/benchmarks/synthetic/gold/C11.csv", + "sha256_before": "9dd91542920356e09b457d6067d845fd2142f41b6a9b732b39c911bc1c7d3cb9", + "sha256_after": "9dd91542920356e09b457d6067d845fd2142f41b6a9b732b39c911bc1c7d3cb9", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C12.csv", + "to": "tools/benchmarks/synthetic/gold/C12.csv", + "sha256_before": "bda5e844646c548d13a31c701ee7521ec3e0022fb7fe0f4817773310eb7d3ed5", + "sha256_after": "bda5e844646c548d13a31c701ee7521ec3e0022fb7fe0f4817773310eb7d3ed5", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C13.csv", + "to": "tools/benchmarks/synthetic/gold/C13.csv", + "sha256_before": "5d8aa1c0b03d4a16506ba53a0493715782fbd2b37b4fffc051acc5c2db9674b3", + "sha256_after": "5d8aa1c0b03d4a16506ba53a0493715782fbd2b37b4fffc051acc5c2db9674b3", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C14.csv", + "to": "tools/benchmarks/synthetic/gold/C14.csv", + "sha256_before": "4bcaf565c6475cb34b095c782f81f9f96718bcb6aac610fe7a62360c9fd7f29c", + "sha256_after": "4bcaf565c6475cb34b095c782f81f9f96718bcb6aac610fe7a62360c9fd7f29c", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C15.csv", + "to": "tools/benchmarks/synthetic/gold/C15.csv", + "sha256_before": "540ec2da222d5b8899e9d678be7ccbececc201f1b41967e39d4ecec02938316c", + "sha256_after": "540ec2da222d5b8899e9d678be7ccbececc201f1b41967e39d4ecec02938316c", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C16.csv", + "to": "tools/benchmarks/synthetic/gold/C16.csv", + "sha256_before": "06db4d7c06068c20d88fa37282efde2f422f7b74f5d0120a536d927c39a3c4e4", + "sha256_after": "06db4d7c06068c20d88fa37282efde2f422f7b74f5d0120a536d927c39a3c4e4", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C17.csv", + "to": "tools/benchmarks/synthetic/gold/C17.csv", + "sha256_before": "52a5bfca9d4c99162faab41143e72933264ed76df8d658711c3f9dcdfc48a131", + "sha256_after": "52a5bfca9d4c99162faab41143e72933264ed76df8d658711c3f9dcdfc48a131", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C18.csv", + "to": "tools/benchmarks/synthetic/gold/C18.csv", + "sha256_before": "a62540eca58bbb3534b99a70cbd14493e51109df262c731cced5ecfc575c8768", + "sha256_after": "a62540eca58bbb3534b99a70cbd14493e51109df262c731cced5ecfc575c8768", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C19.csv", + "to": "tools/benchmarks/synthetic/gold/C19.csv", + "sha256_before": "0dd9da1aa1074c755a012d500deae63475f4e3f185cf147d02d232ec600e7817", + "sha256_after": "0dd9da1aa1074c755a012d500deae63475f4e3f185cf147d02d232ec600e7817", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C20.csv", + "to": "tools/benchmarks/synthetic/gold/C20.csv", + "sha256_before": "7f660bd4946c0e06a49e7a2c913e99ebe8540ed650b157d8b15945d28e4bb417", + "sha256_after": "7f660bd4946c0e06a49e7a2c913e99ebe8540ed650b157d8b15945d28e4bb417", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C21.csv", + "to": "tools/benchmarks/synthetic/gold/C21.csv", + "sha256_before": "be0d20bd83a407609ea7622ee6a3af8c224d05c79b90e5315a30fa9f71b8e696", + "sha256_after": "be0d20bd83a407609ea7622ee6a3af8c224d05c79b90e5315a30fa9f71b8e696", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C22.csv", + "to": "tools/benchmarks/synthetic/gold/C22.csv", + "sha256_before": "bfa5f8d94027ec4b6a4c5515dbb8c3827b44f77f6e10f27b6786f1c98bcd24c7", + "sha256_after": "bfa5f8d94027ec4b6a4c5515dbb8c3827b44f77f6e10f27b6786f1c98bcd24c7", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C23.csv", + "to": "tools/benchmarks/synthetic/gold/C23.csv", + "sha256_before": "62f1c32aef55d8453bc9afb1c69866e7a9955bbf03c57a7e6840c03ba995bf2c", + "sha256_after": "62f1c32aef55d8453bc9afb1c69866e7a9955bbf03c57a7e6840c03ba995bf2c", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C24.csv", + "to": "tools/benchmarks/synthetic/gold/C24.csv", + "sha256_before": "d6fa5560fb97ec7455dd96eeac5336a2907fe9ef0e5d80fb48b014668b918791", + "sha256_after": "d6fa5560fb97ec7455dd96eeac5336a2907fe9ef0e5d80fb48b014668b918791", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C25.csv", + "to": "tools/benchmarks/synthetic/gold/C25.csv", + "sha256_before": "e42fc1c66ebde31b59df8afbe65a9cdb3344aa3acb96417ba311f94341f501e2", + "sha256_after": "e42fc1c66ebde31b59df8afbe65a9cdb3344aa3acb96417ba311f94341f501e2", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C26.csv", + "to": "tools/benchmarks/synthetic/gold/C26.csv", + "sha256_before": "6de5c44652763994dc248ccf1555cc07e1f32f30f5428eb2fb46b69727c6277c", + "sha256_after": "6de5c44652763994dc248ccf1555cc07e1f32f30f5428eb2fb46b69727c6277c", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C27.csv", + "to": "tools/benchmarks/synthetic/gold/C27.csv", + "sha256_before": "d69fe16cb654b8efb3d862906a8d58266088e0edcab20892da49d802317482dd", + "sha256_after": "d69fe16cb654b8efb3d862906a8d58266088e0edcab20892da49d802317482dd", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C28.csv", + "to": "tools/benchmarks/synthetic/gold/C28.csv", + "sha256_before": "d4f1784995658796544a89b12b943a5f4a261ebd4286ba2120d444ce089bd432", + "sha256_after": "d4f1784995658796544a89b12b943a5f4a261ebd4286ba2120d444ce089bd432", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C29.csv", + "to": "tools/benchmarks/synthetic/gold/C29.csv", + "sha256_before": "be37be3b205d125fcb82e7b76192e96e01e55405b73e93c5a3cff6e6a1c59611", + "sha256_after": "be37be3b205d125fcb82e7b76192e96e01e55405b73e93c5a3cff6e6a1c59611", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C30.csv", + "to": "tools/benchmarks/synthetic/gold/C30.csv", + "sha256_before": "8872ff16498caa90371b4dcddb98e03ff9b493db1b4e65c5fcada44e8855fdd8", + "sha256_after": "8872ff16498caa90371b4dcddb98e03ff9b493db1b4e65c5fcada44e8855fdd8", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C31.csv", + "to": "tools/benchmarks/synthetic/gold/C31.csv", + "sha256_before": "549328b87fff3a9e1c7845f2b6a36f1061932cdad0e46b580a04bccd70aa7c95", + "sha256_after": "549328b87fff3a9e1c7845f2b6a36f1061932cdad0e46b580a04bccd70aa7c95", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C32.csv", + "to": "tools/benchmarks/synthetic/gold/C32.csv", + "sha256_before": "ac88809d22b0979eb9ca66a994a8a0adfe47b2dc40ef2ce32b45a7ee75868ecb", + "sha256_after": "ac88809d22b0979eb9ca66a994a8a0adfe47b2dc40ef2ce32b45a7ee75868ecb", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C33.csv", + "to": "tools/benchmarks/synthetic/gold/C33.csv", + "sha256_before": "87a3d75b03048749e630783bd21f71d2f526e9bb31093f97b57f04bb1054f0dc", + "sha256_after": "87a3d75b03048749e630783bd21f71d2f526e9bb31093f97b57f04bb1054f0dc", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C34.csv", + "to": "tools/benchmarks/synthetic/gold/C34.csv", + "sha256_before": "71f7e41520d9e433f5450a336ccc9d56ddd02ede5fca294dde5044c701e8aaf7", + "sha256_after": "71f7e41520d9e433f5450a336ccc9d56ddd02ede5fca294dde5044c701e8aaf7", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C35.csv", + "to": "tools/benchmarks/synthetic/gold/C35.csv", + "sha256_before": "b866b919f8bfb7a88f69879bd973a6a604c668d427a1f0dbd873e848131c49db", + "sha256_after": "b866b919f8bfb7a88f69879bd973a6a604c668d427a1f0dbd873e848131c49db", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C36.csv", + "to": "tools/benchmarks/synthetic/gold/C36.csv", + "sha256_before": "17caa4bce87474fab60050661eb71dc9fe8d3ac85f69fc980cb31553ec1dc7d6", + "sha256_after": "17caa4bce87474fab60050661eb71dc9fe8d3ac85f69fc980cb31553ec1dc7d6", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C37.csv", + "to": "tools/benchmarks/synthetic/gold/C37.csv", + "sha256_before": "6c2aa6f3fd98c0298c68549b280bee11fdfee13405f9b5f4dc7f8a80471eaf8d", + "sha256_after": "6c2aa6f3fd98c0298c68549b280bee11fdfee13405f9b5f4dc7f8a80471eaf8d", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C38.csv", + "to": "tools/benchmarks/synthetic/gold/C38.csv", + "sha256_before": "53862fe8dabcd8e7266521ec6b4e20d6e6f2bfbca130d46f7839970c8ad66fde", + "sha256_after": "53862fe8dabcd8e7266521ec6b4e20d6e6f2bfbca130d46f7839970c8ad66fde", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C39.csv", + "to": "tools/benchmarks/synthetic/gold/C39.csv", + "sha256_before": "2e5a25030994b404e6a5dbb6a5fc4103bd9cdbba55a5dbf1e646eb7c80f990a5", + "sha256_after": "2e5a25030994b404e6a5dbb6a5fc4103bd9cdbba55a5dbf1e646eb7c80f990a5", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/gold/C40.csv", + "to": "tools/benchmarks/synthetic/gold/C40.csv", + "sha256_before": "510befe7e2da070eb0744f472a5f467e59411acda27760b0ae1adc3ab6b7fa7d", + "sha256_after": "510befe7e2da070eb0744f472a5f467e59411acda27760b0ae1adc3ab6b7fa7d", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/benchmark/report.py", + "to": "tools/benchmarks/synthetic/report.py", + "sha256_before": "eb8c7e726ff120af43037093ae731735b2d3655f81d472e7d5fabd9bc99b7685", + "sha256_after": "2b6c001f9354c094029c06e463fdf59885df5c215abaab3335f672ae52ca4c14", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/benchmark/runner.py", + "to": "tools/benchmarks/synthetic/runner.py", + "sha256_before": "85f50be74a1bfc6cf6979144bf3d3d88c1ee684f9a58bd5a6a972615116f973e", + "sha256_after": "b65aa0d2904ce1a7736f27e315574888e6c6125ddc8d50575ea77583427ad588", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/spider2/__init__.py", + "to": "tools/benchmarks/spider2/__init__.py", + "sha256_before": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "sha256_after": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/spider2/evaluate.py", + "to": "tools/benchmarks/spider2/evaluate.py", + "sha256_before": "d5d05f786e296ce505627c21ed95fee5561450fd356417edb4ec5242bb328a26", + "sha256_after": "30a0b1f31534b4bbbe2cb11589a9af6438db6830780a16fe145371c7419f962f", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/spider2/prompts.py", + "to": "tools/benchmarks/spider2/prompts.py", + "sha256_before": "b3ebdd9657b428ebf79b561d589f3912a94718ffa95a39f7ac6eec57d95e5887", + "sha256_after": "b3ebdd9657b428ebf79b561d589f3912a94718ffa95a39f7ac6eec57d95e5887", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/spider2/run_siliconflow.sh", + "to": "tools/benchmarks/spider2/run_siliconflow.sh", + "sha256_before": "b374b5d603317928c26e281bd2c794318bb0d20d546db7b3fe4f856bbe435fa4", + "sha256_after": "71794a77b9ffb87db11766ba3885502afced3322d5f1ceef7ecda6a8d9e9b247", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/spider2/runner.py", + "to": "tools/benchmarks/spider2/runner.py", + "sha256_before": "865bb99ce5cacd75435bc60e81dfcac91e0ef2ea959a6d09b7c230997e2d8188", + "sha256_after": "1a05e83f011fa9622c7a973e735989f1d3de41ecb7114fcf6762446c8f624aa5", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/spider2/setup.py", + "to": "tools/benchmarks/spider2/setup.py", + "sha256_before": "63c949af58a1e0bffac0dfda775d048483e58cf7de80d67e053dfc5f3748cec1", + "sha256_after": "ff89534ccfcac025753401133f7be2027d882e486851c6825d85f554cc0a19c9", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + }, + { + "from": "tests/text-to-sql-failures/A-join-traps.md", + "to": "tools/benchmarks/text_to_sql_failures/A-join-traps.md", + "change_reason": "Co-locate tracked failure corpus documentation with benchmark tooling; no local datasets or results moved.", + "sha256_before": "8714dba63c21203a424bae3edb6f6c374f42c8d08e2eb4e64eb104e4346a9676", + "sha256_after": "8714dba63c21203a424bae3edb6f6c374f42c8d08e2eb4e64eb104e4346a9676" + }, + { + "from": "tests/text-to-sql-failures/B-aggregation-traps.md", + "to": "tools/benchmarks/text_to_sql_failures/B-aggregation-traps.md", + "change_reason": "Co-locate tracked failure corpus documentation with benchmark tooling; no local datasets or results moved.", + "sha256_before": "22553838d9b4e4a32f49aeb7b4c4fbc23dc0c418d7186bed8d50a924bd83cdc7", + "sha256_after": "22553838d9b4e4a32f49aeb7b4c4fbc23dc0c418d7186bed8d50a924bd83cdc7" + }, + { + "from": "tests/text-to-sql-failures/C-time-traps.md", + "to": "tools/benchmarks/text_to_sql_failures/C-time-traps.md", + "change_reason": "Co-locate tracked failure corpus documentation with benchmark tooling; no local datasets or results moved.", + "sha256_before": "9dfd5b4ef755a3de0338cc364c3de7ac22b690d4212d77fbadc770d927ebf11f", + "sha256_after": "9dfd5b4ef755a3de0338cc364c3de7ac22b690d4212d77fbadc770d927ebf11f" + }, + { + "from": "tests/text-to-sql-failures/D-semantic-traps.md", + "to": "tools/benchmarks/text_to_sql_failures/D-semantic-traps.md", + "change_reason": "Co-locate tracked failure corpus documentation with benchmark tooling; no local datasets or results moved.", + "sha256_before": "f6f63c1973f69b620c6692d11bdca3164c49b48ec1a2cee0ccc9b6ebb61b63b6", + "sha256_after": "f6f63c1973f69b620c6692d11bdca3164c49b48ec1a2cee0ccc9b6ebb61b63b6" + }, + { + "from": "tests/text-to-sql-failures/E-dialect-traps.md", + "to": "tools/benchmarks/text_to_sql_failures/E-dialect-traps.md", + "change_reason": "Co-locate tracked failure corpus documentation with benchmark tooling; no local datasets or results moved.", + "sha256_before": "029366402290b0f6354bedecfa5e0cf37648f414a6381774504f4e9dd31e5c22", + "sha256_after": "029366402290b0f6354bedecfa5e0cf37648f414a6381774504f4e9dd31e5c22" + }, + { + "from": "tests/text-to-sql-failures/README.md", + "to": "tools/benchmarks/text_to_sql_failures/README.md", + "change_reason": "Co-locate tracked failure corpus documentation with benchmark tooling; no local datasets or results moved.", + "sha256_before": "56a85096c850c6f73b94e2e8cd7a8dadc3f58d063ee3782a93a414b81259f385", + "sha256_after": "56a85096c850c6f73b94e2e8cd7a8dadc3f58d063ee3782a93a414b81259f385" + }, + { + "from": "tests/text-to-sql-failures/create_db.py", + "to": "tools/benchmarks/text_to_sql_failures/create_db.py", + "sha256_before": "ba9cf0f578fd5645713d1a2fc792533f627a2b05bbb4c481aff3758ae11a1822", + "sha256_after": "ba9cf0f578fd5645713d1a2fc792533f627a2b05bbb4c481aff3758ae11a1822", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration." + }, + { + "from": "tests/text-to-sql-failures/run_ea.py", + "to": "tools/benchmarks/text_to_sql_failures/run_ea.py", + "sha256_before": "463b3cfeacbc257f87f8a70379eee4d6dc889ab1432d6b9bbf72c97b26c3bbb8", + "sha256_after": "379662e92f068965a8160c3ade102dd3402a3cf81dbb5b3c2e1405653be34537", + "change_reason": "Relocate standalone benchmark source/public synthetic fixture outside pytest regression tree; no local data migration. Rebase launcher/import/fixture-root references only; experiment prompts and scoring unchanged." + } + ], + "verification": { + "migration": { + "moved_files": 204, + "byte_identical_files": 153, + "rebased_files": 51, + "historical_json_byte_identical": 44, + "old_public_paths_remaining": 0, + "duplicate_paths": 0, + "destination_hash_mismatches": 0, + "destination_groups": { + "tools/benchmarks/": 110, + "docs/archive/benchmarks/": 57, + "docs/archive/engineering/": 23, + "docs/archive/plans/": 4, + "forge/templates/poc/": 9, + "demo/": 1 + }, + "pi_governance_link_target_exists": true + }, + "python": { + "version": "3.14", + "command": "python -m pytest tests -q -rs", + "environment": "isolated public source snapshot; dotenv disabled; original private assets and external network denied", + "passed": 983, + "skipped": 28, + "skip_reasons": { + "browser_e2e": 26, + "uninstalled_full_minidev_assets": 2 + }, + "warnings": [ + "Third-party lark_oapi protobuf uses deprecated datetime.utcfromtimestamp." + ] + }, + "pi": { + "tests_passed": 215, + "typecheck": "passed" + }, + "distribution": { + "python_version": "3.11.14", + "build": "sdist then wheel from sdist", + "baseline_reproduction": "Non-editable wheel forge poc init failed with FileNotFoundError for site-packages/customer-poc-template.", + "wheel": "passed", + "sdist": "passed", + "commands": [ + "forge --help", + "forge compile", + "forge poc init", + "forge poc validate", + "forge quickstart" + ], + "observed": { + "poc": "ok", + "enforce_status": "completed", + "result_truncated": true, + "evidence_integrity": "verified" + }, + "boundaries": "Import caused no database connection/private runtime read; core evaluation did not import Web; all execution data was newly synthesized." + }, + "benchmark_tools": { + "cli": [ + { + "path": "tools/benchmarks/accuracy/runner.py", + "args": [ + "--help" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/accuracy/evaluate_ea.py", + "args": [ + "--help" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/accuracy/triage_failures.py", + "args": [ + "--help" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/accuracy/grade.py", + "args": [ + "--help" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/accuracy/compare.py", + "args": [ + "--help" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/accuracy/run_claude_direct.py", + "args": [ + "--help" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/accuracy/generate_cases_large.py", + "args": [ + "--help" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/synthetic/runner.py", + "args": [ + "--help" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/synthetic/report.py", + "args": [ + "--help" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/synthetic/demo_retrieval.py", + "args": [ + "--help" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/spider2/runner.py", + "args": [ + "--help" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/spider2/evaluate.py", + "args": [ + "--help" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/text_to_sql_failures/run_ea.py", + "args": [ + "--help" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/accuracy/runner.py", + "args": [ + "--list" + ], + "exit_code": 0 + }, + { + "path": "tools/benchmarks/accuracy/generate_cases_large.py", + "args": [], + "exit_code": 0 + } + ], + "dotenv": "disabled before benchmark imports", + "network": "audit blocked", + "database": "new temporary synthetic databases only", + "listed_methods": 33, + "shared_fixture_methods": 25, + "synthetic_csv_roundtrips": 40, + "failure_corpus_reference_queries": 7, + "spider_synthetic_loader_and_execution": true, + "existing_triage_regressions": 3, + "shell": { + "path": "tools/benchmarks/spider2/run_siliconflow.sh", + "syntax": "bash -n passed", + "missing_key_gate": { + "exit_code": 1, + "observed": "SF_API_KEY required before any Python/model call" + } + } + }, + "seed_demo": { + "command": "python demo/seed_mock_data.py --help", + "status": "passed", + "database_execution": false + }, + "docs": { + "public_local_links": "passed", + "extended_navigation": { + "status": "PASS", + "public_markdown_files": 146, + "checked_links": 512, + "repository_url_links": 105, + "missing": [], + "coverage": "Tracked public root Markdown, docs including architecture course and archives, website README/content, tools Markdown, relocated PoC templates", + "excluded_targets": [ + { + "source": "docs/governance-contracts.md", + "target": "../services/pi-orchestrator/src/governance-contracts.ts", + "reason": "Pi service tree outside authorized access scope; target not read/stat-checked by extended audit" + } + ] + }, + "pi_governance_excluded_target_resolved_by_parent": true, + "current_state_inline_paths_rebased": 11 + }, + "website": { + "build": "passed", + "pages": 28, + "browser": "Chromium course/11-evidence page rendered; navigation to reference/benchmarks rendered and was visually confirmed.", + "archive_link": "Course test report href points to docs/archive/engineering/test-report-2026-07-13.md.", + "setup_issue": "Initial copied-site node_modules symlink crossed project roots and failed Astro compile metadata lookup; copying dependencies into isolated site resolved it without source changes.", + "warning": "Astro sitemap skipped because site option is unset.", + "remote_github_links": "Local repository targets checked; unpushed remote URLs not fetched." + } + }, + "limits": [ + "不commit/push/部署", + "零模型调用、零真实数据库或外部渠道验证", + "不改历史评分、产品职责或R0.6/H门禁" + ], + "summary": { + "moved_files": 204, + "byte_identical_files": 153, + "rebased_files": 51, + "historical_json_byte_identical": 44, + "old_public_paths_remaining": 0, + "duplicate_paths": 0, + "destination_hash_mismatches": 0, + "destination_groups": { + "tools/benchmarks/": 110, + "docs/archive/benchmarks/": 57, + "docs/archive/engineering/": 23, + "docs/archive/plans/": 4, + "forge/templates/poc/": 9, + "demo/": 1 + }, + "pi_governance_link_target_exists": true + }, + "code_changes": [ + { + "path": "forge/poc.py", + "change": "Use importlib.resources files/as_file for packaged PoC templates; remove checkout-relative ROOT/TEMPLATE_DIR." + }, + { + "path": "pyproject.toml", + "change": "Include templates/poc and registry resource files in forge package data." + }, + { + "path": "scripts/package_smoke.py", + "change": "Keep regression smoke for installed PoC initialization/validation, alongside existing import/CLI/Quickstart checks." + }, + { + "path": "demo/seed_mock_data.py", + "change": "Relocate existing seeder; update usage examples only; no real database seeding performed." + }, + { + "path": "tests/test_accuracy_triage.py", + "change": "Rebase benchmark tool/fixture references or ignore rules; remove unused accuracy path constant, without adding a runtime dependency on tools." + }, + { + "path": "tests/test_compiler.py", + "change": "Rebase benchmark tool/fixture references or ignore rules; remove unused accuracy path constant, without adding a runtime dependency on tools." + }, + { + "path": "demo/seed.py", + "change": "Rebase benchmark tool/fixture references or ignore rules; remove unused accuracy path constant, without adding a runtime dependency on tools." + }, + { + "path": "forge/accuracy_benchmark.py", + "change": "Rebase benchmark tool/fixture references or ignore rules; remove unused accuracy path constant, without adding a runtime dependency on tools." + }, + { + "path": ".gitignore", + "change": "Rebase benchmark tool/fixture references or ignore rules; remove unused accuracy path constant, without adding a runtime dependency on tools." + }, + { + "path": ".dockerignore", + "change": "Rebase benchmark tool/fixture references or ignore rules; remove unused accuracy path constant, without adding a runtime dependency on tools." + }, + { + "path": "tests/test_commercial_readiness.py", + "change": "Remove report-wording assertion; retain observable readiness status and CLI workspace validation." + } + ], + "documentation": { + "layout_contract": "CONTRIBUTING.md#repository-layout", + "navigation": "docs/README.md", + "reference_updates": [ + "README.md", + "README.zh-CN.md", + "docs/README.md", + "docs/architecture-course/11-evidence.md", + "docs/architecture-course/12-labs.md", + "docs/archive/engineering/forge-goal-gap-assessment-2026-08-24.md", + "docs/archive/engineering/golden-journey-acceptance-2026-08-24.md", + "docs/archive/engineering/golden-journey-p0-closure-2026-08-24.md", + "docs/archive/engineering/product-direction-architecture-review-2026-08-24.md", + "docs/archive/engineering/product-spine-sp5-evidence-2026-08-25.md", + "docs/archive/plans/pi-forge-integration-plan.md", + "docs/archive/plans/short-term-product-spine-plan-2026-08-25.md", + "docs/archive/plans/web-product-shell-plan-2026-08-24.md", + "docs/benchmarks.md", + "docs/commercial-readiness.md", + "docs/current-project-state.md", + "docs/forge-enterprise-evolution-plan.md", + "docs/governance-contracts.md", + "docs/poc-playbook.md", + "docs/product-design-roadmap-2026-08-25.md", + "docs/product-north-star.md", + "docs/product-projection-contracts.md", + "docs/requirements-pool.md", + "website/README.md", + "website/src/content/docs/course/11-evidence.md", + "website/src/content/docs/course/12-labs.md" + ], + "current_state_inline_path_rebases": 11, + "historical_paths": "Historical JSON remains byte-identical. Resolve historical paths through moves; do not rewrite evidence or recreate legacy runtime data." + }, + "protected_legacy_assets": [ + { + "path": "tests/accuracy/results/method_k/grading_prompt.txt", + "action": "keep_unread_pending_owner_review" + }, + { + "path": "tests/accuracy/results/method_k/runs.json", + "action": "keep_unread_pending_owner_review" + }, + { + "path": "tests/accuracy/results/method_k/scores.json", + "action": "keep_unread_pending_owner_review" + }, + { + "path": "tests/text-to-sql-failures/test.db", + "action": "keep_unread_pending_owner_review" + } + ] +} diff --git a/docs/forge-enterprise-evolution-plan.md b/docs/forge-enterprise-evolution-plan.md index f3369f1..2d8b70b 100644 --- a/docs/forge-enterprise-evolution-plan.md +++ b/docs/forge-enterprise-evolution-plan.md @@ -1,8 +1,8 @@ # Forge 企业演进阶段性实施计划 v1.2 -> 状态:`REQ-2026-09-03-025` 为当前产品主线;`REQ-2026-08-26-024` SQL Accuracy Benchmark 已验证并作为反证基线;`REQ-2026-08-25-023` 已吸收为历史短期切口。当前阶段为 R0 Open-source Trust Runtime Product Cut / Adoption Baseline,R0.1–R0.5 已完成,当前切片为 R0.6 External Adoption Evidence;Runtime Governance Coverage 为 3/14(21.4%) · Last updated: 2026-09-05 +> 状态:`REQ-2026-09-03-025` 为当前产品主线;`REQ-2026-08-26-024` SQL Accuracy Benchmark 已验证并作为反证基线;`REQ-2026-08-25-023` 已吸收为历史短期切口。当前阶段为 R0 Open-source Trust Runtime Product Cut / Adoption Baseline,R0.1–R0.5 已完成,当前切片为 R0.6 External Adoption Evidence;Runtime Governance Coverage 为 3/14(21.4%) · Last updated: 2026-09-08 > -> 本文是 2026-08-24 起的**唯一主动计划真相源**。历史实施与验收证据保留在 [`pi-forge-integration-plan.md`](pi-forge-integration-plan.md);目标职责边界见 [`platform-architecture.md`](platform-architecture.md);产品约束见 [`product-axioms.md`](product-axioms.md);当前产品决策见 [`requirements-pool.md`](requirements-pool.md#req-2026-09-03-025以开源-trust-runtime-收敛-forge-产品方向)。 +> 本文是 2026-08-24 起的**唯一主动计划真相源**。历史实施与验收证据保留在 [`archive/plans/pi-forge-integration-plan.md`](archive/plans/pi-forge-integration-plan.md);目标职责边界见 [`platform-architecture.md`](platform-architecture.md);产品约束见 [`product-axioms.md`](product-axioms.md);当前产品决策见 [`requirements-pool.md`](requirements-pool.md#req-2026-09-03-025以开源-trust-runtime-收敛-forge-产品方向)。 > > 每个工作包继续遵循“先更新计划 → 再实现 → 验证 → 回写状态、风险与下一步”。真实客户数据、生产凭证、权限变化和高风险副作用必须单独授权。 @@ -124,7 +124,7 @@ GTM:Open-source Developer First 仅修改文档和仓库基线,不改变运行时行为: 1. 统一状态:产品方向与四平面框架标记为“已确认”;本文标记为当前唯一主动计划;是否进入运行时 M1 与计划确认分开记录。 -2. 将 `docs/pi-forge-integration-plan.md` 明确标记为历史实施快照;章节中的“进行中/当前”增加历史时间语义,避免被误当作当前 TODO。 +2. 将 `docs/archive/plans/pi-forge-integration-plan.md` 明确标记为历史实施快照;章节中的“进行中/当前”增加历史时间语义,避免被误当作当前 TODO。 3. 更新实际验证基线为 Python `540 passed / 24 skipped`、Pi `86 passed`、TypeScript typecheck 通过、npm audit 0 vulnerabilities。 4. 恢复 `tests/datasets/spider/data` 为仓库记录的 symlink `../../spider2/data`,不修改 benchmark 数据内容,使全局 `git diff --check` 可复现。 5. 将新战略文档和对应测试纳入版本管理范围;不提交 `.env`、运行状态、个人 `.pi/.codex` 配置或凭证。 @@ -221,7 +221,7 @@ JSON Schema/TypeBox 继续负责形状;共享 review fixture 和 Python/TypeSc - 新增 `governance-review-fixtures.v1.json`,以 Web Human、Feishu Human 和 Agent 三条 review-only trace 组合 Principal、Mandate、Policy、Binding、Action、human approval snapshot、request binding 与 Query lineage;Economics/Context 扩展显式为 `null`。 - Python `governance_semantics.py` 与 TypeScript `validateGovernanceReviewTrace` 对同一共享 corpus 验证 Organization/Workspace、时间、delegation、Task/Audience/Purpose/Capability/Resource、Policy/Binding、approval 和 SQL/Assurance lineage。 - 40 个命名 mutation 覆盖跨租户、过期/撤销、扩权、默认拒绝前置条件、漂移审批、请求重用和隐式 Context;两端使用同一稳定 reason code 断言。 -- [`governance-contract-review-2026-08-24.md`](governance-contract-review-2026-08-24.md) 完成 Threat Model、legacy migration、TaskRun v2、切换与 rollback 设计;Verdict 为 **Approved for M1A proposal**。 +- [`archive/engineering/governance-contract-review-2026-08-24.md`](archive/engineering/governance-contract-review-2026-08-24.md) 完成 Threat Model、legacy migration、TaskRun v2、切换与 rollback 设计;Verdict 为 **Approved for M1A proposal**。 - 当前验证:Python `550 passed / 24 skipped`;Pi `91 passed`;TypeScript typecheck 通过;npm audit 0 vulnerabilities;JSON 与 `git diff --check` 通过。 - 未修改 Task API、数据库 Schema、现有授权逻辑、QueryRun 行为或 OAuth Runtime;Action Catalog 的 Runtime Governance Coverage 保持 0%。 @@ -238,7 +238,7 @@ M0 通过后单独进行 Contract 评审,才进入 M1A。 ### M0.1–M0.3 实施结果(2026-08-24) -- 计划状态已收口:产品方向与四平面框架确认,本文成为唯一主动计划;`pi-forge-integration-plan.md` 明确为历史快照。 +- 计划状态已收口:产品方向与四平面框架确认,本文成为唯一主动计划;`archive/plans/pi-forge-integration-plan.md` 明确为历史快照。 - `tests/datasets/spider/data` 已恢复为仓库记录的 `../../spider2/data` symlink,未修改 benchmark 数据内容。 - 初版 `agent/contracts/` 新增 `PrincipalContext v1`、`AgentMandate v1`、`PolicyDecision v1`、`ResourceRef v1`、`DatasourceBinding v1`、`RegistryBinding v1` 及共享有效/无效 fixture;Contract 评审发现 AgentMandate 与 Coverage 语义问题,当前正在修订,不能据初版进入 M1A。 - `services/pi-orchestrator/src/governance-contracts.ts` 提供对应 TypeBox 类型;Python JSON Schema 与 TypeScript 使用同一 fixture corpus 做行为 parity。 @@ -295,7 +295,7 @@ M0 通过后单独进行 Contract 评审,才进入 M1A。 2. 明确 Conversation、Task、Plan、Decision、Artifact、Evidence、Data Asset、Agent Client 和 Outcome 的关系、Owner、真相源和当前实现差距。 3. 提出按角色分组的信息架构、深链接 Route、核心 Human/Agent/Steward Journeys,以及 loading/needs_input/waiting_decision/partial/failed/forbidden 等状态投影。 4. 重新排序 W3A/W3B、M1A、Agent Runtime MVP、Data Trust Control Plane、平台 Assurance、Reusable Deliverables、Economics/Coordination 和第二场景;每阶段必须有证伪门禁与不做项。 -5. 标明旧 `web-product-shell-plan-2026-08-24.md` 和 `821065f` 原型中可保留、需删除和必须重建的部分;不修改现有原型和生产 Web。 +5. 标明旧 `archive/plans/web-product-shell-plan-2026-08-24.md` 和 `821065f` 原型中可保留、需删除和必须重建的部分;不修改现有原型和生产 Web。 6. 用户对提案给出 `PASS / CHANGE / REMOVE` 后,才回写批准后的实施顺序并启动下一版 W3A。 ### N2 提案结果(2026-08-25) @@ -304,12 +304,12 @@ M0 通过后单独进行 Contract 评审,才进入 M1A。 - 定义 Workspace/Principal/Agent Client/Conversation/Task/Plan/Decision/Action/Artifact/Evidence/Data Asset/Deliverable/Outcome 的产品关系、Owner、当前真相源和实现缺口。 - 提出按“工作 / 信任 / 接入 / 系统”分组的 IA、Route 兼容、H1/H2/A1/S1/F1 五条 Journey、统一状态语言、旧 W3A 的保留/修改/删除清单和质量/Agent 指标。 - 初版曾建议 W3A.2 隔离原型 → W3B Human Control Plane → M1A/R1/G1/Q1/H6;用户随后通过 `REQ-2026-08-25-017` 明确改为底层 Product Spine 先行,初版短期顺序不再生效。 -- 旧 [`web-product-shell-plan-2026-08-24.md`](web-product-shell-plan-2026-08-24.md) 已标记为历史第一版;N2 本身未修改 `tools/web-product-shell-prototype/`、生产 Web、Runtime、API、数据库或部署。 +- 旧 [`archive/plans/web-product-shell-plan-2026-08-24.md`](archive/plans/web-product-shell-plan-2026-08-24.md) 已标记为历史第一版;N2 本身未修改 `tools/web-product-shell-prototype/`、生产 Web、Runtime、API、数据库或部署。 - 文档链接/内容测试 `4 passed`,提案 8 项必要结构断言与 `git diff --check` 通过;长期 Agent/Governance 阶段仍需后续真实测试证据,不由 N2 自动批准。 ## SP0–SP5:短期 Product Spine(自动门禁通过,待用户 Atlas 确认) -> Requirement:[`REQ-2026-08-25-017`](requirements-pool.md#req-2026-08-25-017短期-product-spine-底层优先实施计划) · 详细计划:[`short-term-product-spine-plan-2026-08-25.md`](short-term-product-spine-plan-2026-08-25.md) +> Requirement:[`REQ-2026-08-25-017`](requirements-pool.md#req-2026-08-25-017短期-product-spine-底层优先实施计划) · 详细计划:[`archive/plans/short-term-product-spine-plan-2026-08-25.md`](archive/plans/short-term-product-spine-plan-2026-08-25.md) 用户确认近期不再以隔离 fixture 原型作为主路径,而是先完成足以支撑真实产品 Journey 的底层框架,再接 Web Product Shell: @@ -335,35 +335,35 @@ SP0 Projection Contract / truth source closure - 从真实 Pi Store 构建 Conversation/Task Product Projection,增加 authenticated/no-store read API、opaque pagination、scope/lineage/redaction/2 MB boundary 与 restart recovery。 - 10K Task Conversation list 从首版约 19,040 ms 优化到平均约 26.8 ms;使用单次 window CTE 消除相关子查询/N+1,没有提前增加 schema v5。 -- Pi `114 passed`、Python `569 passed / 24 skipped`、typecheck/npm audit/`git diff --check` 通过;正式证据见 [`product-spine-sp1-evidence-2026-08-25.md`](product-spine-sp1-evidence-2026-08-25.md)。 +- Pi `114 passed`、Python `569 passed / 24 skipped`、typecheck/npm audit/`git diff --check` 通过;正式证据见 [`archive/engineering/product-spine-sp1-evidence-2026-08-25.md`](archive/engineering/product-spine-sp1-evidence-2026-08-25.md)。 - 未新增 Conversation Store、DB Schema、Task 状态或 Web 页面。SP2 当前开始。 ### SP2 验证结果(2026-08-25) - ReportStore scope-aware list/index 与 authenticated Product BFF 已完成;Workspace 可在 Pi/Report/Registry 失效时 partial/offline,不复制 Task/Report 状态。 - 增加同版本 `TaskSummaryV1`,BFF 执行二次 Contract/scope gate、去敏、bounded 和 no-store;Registry revision 使用内容 hash。 -- Python `575 passed / 24 skipped`、SP2 定向 `34 passed`、Pi `114 passed`、typecheck/npm audit/`git diff --check` 通过;证据见 [`product-spine-sp2-evidence-2026-08-25.md`](product-spine-sp2-evidence-2026-08-25.md)。 +- Python `575 passed / 24 skipped`、SP2 定向 `34 passed`、Pi `114 passed`、typecheck/npm audit/`git diff --check` 通过;证据见 [`archive/engineering/product-spine-sp2-evidence-2026-08-25.md`](archive/engineering/product-spine-sp2-evidence-2026-08-25.md)。 - Backend Gate PASS,SP3 当前开始;仍无 Product 页面或部署变更。 ### SP3 验证结果(2026-08-25) - 新增 local-only Product Shell template/CSS/JS 与 `/static` mount;短期导航、共享状态、focus/reduced-motion/mobile navigation 基础完成。 - 0 CDN、0 inline style/script、0 fixture、0 data fetch/localStorage;现有 Admin 未被一次性重写。 -- Python `581 passed / 24 skipped`、SP3/Docs `10 passed`、Pi `114 passed`、typecheck/npm audit/`git diff --check` 通过;证据见 [`product-spine-sp3-evidence-2026-08-25.md`](product-spine-sp3-evidence-2026-08-25.md)。 +- Python `581 passed / 24 skipped`、SP3/Docs `10 passed`、Pi `114 passed`、typecheck/npm audit/`git diff --check` 通过;证据见 [`archive/engineering/product-spine-sp3-evidence-2026-08-25.md`](archive/engineering/product-spine-sp3-evidence-2026-08-25.md)。 - SP4 当前开始,首次将 Shell 接到真实 Product BFF。 ### SP4 验证结果(2026-08-25) - Workspace/Conversation/Task list+detail/Report Library/Data 页面已接 Product BFF;Chat/Task action 复用原 typed ChannelEvent endpoint。 - 任务详情首轮视觉审查的主审批可发现性、pending 状态和层级 P0 已修正;复审无 P0。 -- Python `583 passed / 24 skipped`、Product/Web/Docs `33 passed`、Pi `114 passed`、typecheck/npm audit/JS syntax/Playwright 双桌面 viewport/0 error/0 overflow/`git diff --check` 通过;证据见 [`product-spine-sp4-evidence-2026-08-25.md`](product-spine-sp4-evidence-2026-08-25.md)。 +- Python `583 passed / 24 skipped`、Product/Web/Docs `33 passed`、Pi `114 passed`、typecheck/npm audit/JS syntax/Playwright 双桌面 viewport/0 error/0 overflow/`git diff --check` 通过;证据见 [`archive/engineering/product-spine-sp4-evidence-2026-08-25.md`](archive/engineering/product-spine-sp4-evidence-2026-08-25.md)。 ### SP5 验证结果(2026-08-25) - Candidate `product-spine-5dcd4715941a` 已使用独立 Pi/QueryRun/Report/Registry/Artifact 状态和 candidate 内 mode `0400` 只读数据副本,认证开启;生产 Forge/Pi 未替换。 - 固定渠道指标问题在最终配置下连续 3 次完成真实 Conversation → SQL Review → 单次只读执行 → Analysis → Report → Report Library;每次 1 个 QueryRun/`query.completed`、4 个 succeeded StageAttempt,PDF/PPTX ready。 - 重复消息返回原任务,过期重复批准 409 且不重放 SQL;等待审批/完成态 restart recovery、Pi offline partial、双桌面 12 routes/0 external request/0 error/0 overflow 通过。 - Live Gate 修复 insecure-HTTP ID、瞬时 ready 轮询、同源 HTTP Report URL、空 Attempt error、长 SQL Grid overflow 和完成态历史审核误标权限;复杂查询 Assurance 拒绝与 Analysis `incomplete` 作为反证保留。 -- Python `583 passed / 24 skipped`、Pi `115 passed`、typecheck/npm audit/JS syntax/`git diff --check` 通过;证据见 [`product-spine-sp5-evidence-2026-08-25.md`](product-spine-sp5-evidence-2026-08-25.md)。 +- Python `583 passed / 24 skipped`、Pi `115 passed`、typecheck/npm audit/JS syntax/`git diff --check` 通过;证据见 [`archive/engineering/product-spine-sp5-evidence-2026-08-25.md`](archive/engineering/product-spine-sp5-evidence-2026-08-25.md)。 每个工作包单独门禁。SP0–SP5 自动门禁现已通过,但用户尚未给出 Atlas `PASS / CHANGE / REMOVE`,因此 Product Spine 不能标记为最终接受,也不能据此自动启动 M1A、G1、Q1 或 H6。 @@ -577,7 +577,7 @@ Forge 当前从可查询数据库/数仓开始,不承担外部内容、支付 实施结果: -- 已审计 `web/templates/` 19 个模板及 Web 暴露的 Architecture Atlas,命中与保留理由见 [`web-product-content-audit-2026-08-24.md`](web-product-content-audit-2026-08-24.md)。 +- 已审计 `web/templates/` 19 个模板及 Web 暴露的 Architecture Atlas,命中与保留理由见 [`archive/engineering/web-product-content-audit-2026-08-24.md`](archive/engineering/web-product-content-audit-2026-08-24.md)。 - 已清理 Chat slogan/营销空状态、Tasks integration/架构宣传、Registry 控制面 eyebrow、全局与登录页产品描述,以及 Architecture Atlas 中的产品主张;管理员技术状态、架构事实与审批/DDL 风险说明保留。 - H5 candidate 删除“可信数据报告”、英文氛围标签和 Renderer/版本/候选说明;业务 Evidence 与报告限制保留。 - `tests/test_web_product_content.py` 与相关 Web 定向测试共 76 passed;桌面 H5 candidate 0 browser errors。等待用户视觉确认后再标记 verified。 @@ -607,7 +607,7 @@ Forge 当前从可查询数据库/数仓开始,不承担外部内容、支付 ### W3.3 分门顺序 -1. **W3A 产品地图与高保真骨架**:按 [`web-product-shell-plan-2026-08-24.md`](web-product-shell-plan-2026-08-24.md) 的页面/对象/路由矩阵、关键旅程、状态与动作清单,构建无 CDN 的桌面隔离原型,覆盖全部主页面和 waiting/failed/empty 等关键状态;发布 Atlas 独立预览,由用户逐页门禁。 +1. **W3A 产品地图与高保真骨架**:按 [`archive/plans/web-product-shell-plan-2026-08-24.md`](archive/plans/web-product-shell-plan-2026-08-24.md) 的页面/对象/路由矩阵、关键旅程、状态与动作清单,构建无 CDN 的桌面隔离原型,覆盖全部主页面和 waiting/failed/empty 等关键状态;发布 Atlas 独立预览,由用户逐页门禁。 2. **W3B 生产 Shell 与核心旅程**:通过门禁后才改生产 `base.html` 与本地静态资源;新增 Task Detail 和 Report Library projection;打通新建任务→计划→补充/审批→结果→分析→报告→列表的真实桌面路径;使用单一 feature flag 和回滚点。 3. **W3C 数据资产与管理收口**:重组二级导航和入口,保留现有领域真相源;不顺带建设 M1B、M2、M3 或通用 Memory。 @@ -630,7 +630,7 @@ M1A 不取消,但顺延为 W3 核心 Product Shell 稳定后的首个后端工 - 所有页面显示“交互原型/演示数据”;源码无生产网络请求。审批 dialog 绑定任务、数据源、范围、限制、完整 SQL 和检查结果;演示确认不会写生产 Store。 - prototype tests `5 passed`、build/audit 通过;Python 全量 `564 passed / 24 skipped`(Web 定向 `19 passed`);Pi typecheck/`103 passed`。Playwright 在 1440×900、1600×1000 本地与 Atlas 走通关键 route、dialog、fixture state、search、back/forward/reload,0 console error、0 横向溢出。 - 固定 commit `821065f` 发布到 Atlas `/srv/forge/previews/web-shell-821065f/`,`forge-web-shell-preview.service` 仅绑定 `preview.internal.invalid:18006`。生产 Jinja、Forge/Pi、Store 和 `d2b0fd9` checkout 未修改。 -- 用户门禁已给出 `CHANGE`:连续 Chat 不应被一次性创建表单替代;同时“分析工作台”不足以概括产品。当前先复核 2026-08-21 至 2026-08-24 的产品对话,重新确认 Conversation、Task、Artifact、Decision、Governance 与 Agent-facing Runtime 的产品投影。新的 IA 未确认前不修改生产 route/API,不进入 W3B。原型自动证据见 [`web-product-shell-w3a-evidence-2026-08-24.md`](web-product-shell-w3a-evidence-2026-08-24.md)。 +- 用户门禁已给出 `CHANGE`:连续 Chat 不应被一次性创建表单替代;同时“分析工作台”不足以概括产品。当前先复核 2026-08-21 至 2026-08-24 的产品对话,重新确认 Conversation、Task、Artifact、Decision、Governance 与 Agent-facing Runtime 的产品投影。新的 IA 未确认前不修改生产 route/API,不进入 W3B。原型自动证据见 [`archive/engineering/web-product-shell-w3a-evidence-2026-08-24.md`](archive/engineering/web-product-shell-w3a-evidence-2026-08-24.md)。 ## H1:Analysis Stage 延迟与真实进度修复(P0 独立切片) @@ -777,7 +777,7 @@ Playwright 驱动并在每一步建立 checkpoint: - 9 个 ExecutionPlan revision、QueryResult/Chart/Analysis/RenderedOutput/TechnicalReport/ReportBundle/Publication lineage 连续;HTML/PDF/PPTX ready;测试 datasource 无 WAL/SHM。 - Playwright 保存桌面逐阶段 screenshot,DOM/ARIA/focus/overflow/console/page-error 自动断言通过;视觉模型逐图评审。用户后续明确当前不考虑移动端,移动证据不参与 Verdict。 - 正式 verdict:**Physical chain PASS / Trusted product outcome FAIL**。P0 为:①真实 PDF footer 泄漏内部 `file:///home/...` 路径;②长 Analysis 底部 action 后 same-page Report/Publication 主区空白,刷新后才可见;③ Chart builder 未验证 grain/重复 label,报告可生成误导性品类图。 -- P1 包括 decision-readiness、SQL review 修改需求路径、结果单位/异常、主进度可读、长卡片 action、报告风险前置和 PPTX 封面截断。完整证据见 [`golden-journey-acceptance-2026-08-24.md`](golden-journey-acceptance-2026-08-24.md)。 +- P1 包括 decision-readiness、SQL review 修改需求路径、结果单位/异常、主进度可读、长卡片 action、报告风险前置和 PPTX 封面截断。完整证据见 [`archive/engineering/golden-journey-acceptance-2026-08-24.md`](archive/engineering/golden-journey-acceptance-2026-08-24.md)。 - 隔离服务已停止,临时 service/channel keys 删除;生产 Forge/Pi health/readiness 正常。P0 修复已登记 `REQ-2026-08-24-008`。 ### H4:Golden Journey P0 Closure(已完成) @@ -807,7 +807,7 @@ H4 门禁: - 自动验证:Python `553 passed / 24 skipped`;Pi `96 passed`;TypeScript、npm audit、targeted report/Web tests 和桌面 Playwright 通过。桌面 80 条 Flow event 下 body 高度保持 1000px,Report/Publication 同页可见,0 console/page error。 - NAS Chrome 146 实际 PDF 内容扫描不含 `file://`、`/home/`、`forge-m4.1`、`index.html` 或默认日期 header;不是只检查 command/file size。 - 同一真实 Golden Journey 在独立 Store 和 mode-0400 datasource 重跑完成:Task 262.399s,Query 107 rows/31ms,4/4 Attempt succeeded,1 approval/1 execution,重复 Web message HTTP 200 且 QueryRun count=1;PDF/PPTX ready,0 ChartArtifact,same-page completion 可见。 -- NAS 已部署并保留回滚点 `~/services/forge-m4.1/backups/h4-p0-20260824T110913Z/`;隔离服务、override 和 tunnel 已清理,生产 health/readiness `ok`。完整证据见 [`golden-journey-p0-closure-2026-08-24.md`](golden-journey-p0-closure-2026-08-24.md)。 +- NAS 已部署并保留回滚点 `~/services/forge-m4.1/backups/h4-p0-20260824T110913Z/`;隔离服务、override 和 tunnel 已清理,生产 health/readiness `ok`。完整证据见 [`archive/engineering/golden-journey-p0-closure-2026-08-24.md`](archive/engineering/golden-journey-p0-closure-2026-08-24.md)。 - 剩余风险显式转入 P1/H5:当前 0 Chart 是正确的安全降级,不是理想专业报告体验。 ### H5:Evidence-bound Chart Storytelling(R0 自动化通过、用户视觉门禁失败,修订中) @@ -842,20 +842,20 @@ R0 实际结果: - 完成品类横截面与月度多系列两个 fixture:4 张图分别回答排名、集中度、拐点和增长来源,非重复视图。 - 完成自包含 HTML、5 页 PDF、5 页 16:9 PPTX 候选;HTML DOM/ARIA/交互/console/print PASS,PDF 无本地路径/header/footer 泄漏,PDF/PPTX 静态保留单位、Annotation、quality 和 Evidence。 - 完成 Analysis/Report Skills、Structured Tool、`skill-executor`、Skills package、Contract、Renderer、Exporter 的 R1 同版本兼容矩阵。 -- 正式证据:[`chart-storytelling-r0-evidence-2026-08-24.md`](chart-storytelling-r0-evidence-2026-08-24.md)。R1 未自动批准,NAS 与生产 Skills/Prompt 未修改。 +- 正式证据:[`archive/engineering/chart-storytelling-r0-evidence-2026-08-24.md`](archive/engineering/chart-storytelling-r0-evidence-2026-08-24.md)。R1 未自动批准,NAS 与生产 Skills/Prompt 未修改。 - 用户视觉门禁反馈为 FAIL:首屏深绿色候选宣传 Hero 不承载报告决策内容,却占据接近整屏;交互位于首屏以下且缺少可发现反馈,元信息标签外观又误导为按钮。修订要求是删除宣传壳,首屏直接显示数据范围/质量/执行摘要/第一决策图,并把 tooltip、series 控制、table fallback 和 Evidence feedback 做成无需猜测的可见操作。 - 用户明确要求“产品不要重复造轮子”。生产 Renderer 不继续扩展手写 SVG/JavaScript;图表 tooltip、legend、zoom/selection、annotation geometry、layout 与 SVG/canvas rendering 必须复用成熟 chart engine。Forge 自有代码只负责 ChartArtifact v2 的受控适配、Evidence/quality binding、设计 token 和跨媒介 Gate。正式实现前用同一双 fixture 比较 ECharts、Vega/Vega-Lite、AntV G2;Highcharts/AG Charts 只有在商业授权成本被明确接受后才进入候选。生产最终只选一个默认 engine,不建设多引擎插件平台。 - 用户已批准继续开源 engine bake-off。实现必须位于隔离开发工具包,不修改生产 Pi `package.json`、Skills/Prompt 或 Renderer;每个 engine 必须消费相同 normalized fixture、使用本地固定依赖而非 CDN,并生成可比较的桌面 HTML/截图/交互与构建体积证据。 -- Bake-off 已完成,正式证据见 [`chart-engine-bakeoff-2026-08-24.md`](chart-engine-bakeoff-2026-08-24.md)。初步选择 ECharts:按需 SVG bundle 约 193 kB gzip、warm median 58.5 ms;Vega-Lite 约 276 kB/85.3 ms 且需 CSP interpreter;G2 约 398 kB/368.5 ms。数字仅为同机相对证据。 +- Bake-off 已完成,正式证据见 [`archive/engineering/chart-engine-bakeoff-2026-08-24.md`](archive/engineering/chart-engine-bakeoff-2026-08-24.md)。初步选择 ECharts:按需 SVG bundle 约 193 kB gzip、warm median 58.5 ms;Vega-Lite 约 276 kB/85.3 ms 且需 CSP interpreter;G2 约 398 kB/368.5 ms。数字仅为同机相对证据。 - 用户已确认继续 ECharts focused candidate。该门仍只修改隔离工具包:报告首屏直接进入摘要和第一决策图;渠道视图必须从存量堆叠图改为可复算的 4→6 月增量贡献拆解,标出总增量 174K、直营 87K/50% 和 Evidence;排名视图表达前两名差距,避免赢家错觉;ECharts Option 只能由 allowlisted semantic adapter 生成。完成 HTML tooltip/legend/Evidence/table、strict CSP、print/PDF/PPTX 静态一致性和桌面视觉审查后回写证据。生产 package、Skills/Prompt/Tool/Renderer 和 NAS 仍不得修改。 -- Focused candidate 已完成,正式证据见 [`chart-storytelling-echarts-focused-evidence-2026-08-24.md`](chart-storytelling-echarts-focused-evidence-2026-08-24.md)。4 SVG/0 Canvas、tooltip、series toggle、Evidence、table、no-JS 核心结论、5 页 PDF/PPTX、strict CSP 和零浏览器错误通过;首图在 1600×1000 的 y=585.8px 开始可见。候选同时遵守 W2,只呈现报告主体内容。 +- Focused candidate 已完成,正式证据见 [`archive/engineering/chart-storytelling-echarts-focused-evidence-2026-08-24.md`](archive/engineering/chart-storytelling-echarts-focused-evidence-2026-08-24.md)。4 SVG/0 Canvas、tooltip、series toggle、Evidence、table、no-JS 核心结论、5 页 PDF/PPTX、strict CSP 和零浏览器错误通过;首图在 1600×1000 的 y=585.8px 开始可见。候选同时遵守 W2,只呈现报告主体内容。 - R1 新增阻断:ChartArtifact v2 当前无法完整声明 period-delta/output-grain。正式进入生产前必须扩展确定性 transform 和 semantic gate,并与 Skills/Tool/Compatibility/Renderer 同版本发布;不允许 focused adapter 的固定计算静默变成 Renderer 猜测。 - 用户再次判定视觉门禁 FAIL:虽然宣传文案已删除,但大标题双栏、深色摘要块、导航卡片、大圆角章节和彩色侧栏仍是 Landing Page composition,不是专业报告。新增 `REQ-2026-08-24-012` 并进入 Editorial Report revision:文档画布、紧凑报告头、连续章节、figure caption、观察/判断/限制结构;保留现代 ECharts 交互。 - Inline 强调固定为版本化语义 token:strong=证据化结论/数字,emphasis=术语/假设,superseded=有 revision lineage 的旧标准,underline=仅链接/Evidence,code=标识符,mark=少量待审定义;Callout 仅 `info/decision/warning/limitation`,不得由模型提供 HTML/CSS/class/color。 - 用户补充“内容专业不等于术语密度”:正文必须优先用准确普通中文,按观察→有限判断→限制→待补证据组织;内部 `Evidence/Revision/Ready/baseline/comparison` 不占据业务正文,不能用语气、粗体或 Callout 制造确定性。 - 用户决定当前 Editorial revision 先暂定保留、后续迭代。该决定不是完整视觉 PASS,也不批准生产 R1。当前按 `REQ-2026-08-24-013` 只将固定构建物部署为 Atlas 独立预览,然后重评估总体目标差距。 - Atlas 隔离预览已完成:`/srv/forge/previews/editorial-929e8d4/` 为不可写固定构建物,`forge-report-preview.service` 仅绑定 LAN `preview.internal.invalid:18005`;远端 browser gate 通过,生产 Forge/Pi active、源码仍为干净 `d2b0fd9`。生产 readiness 保留已知的内网 HTTP `secure_cookie` fail,本次未改认证或 HTTPS。 -- 阶段重评估见 [`forge-goal-gap-assessment-2026-08-24.md`](forge-goal-gap-assessment-2026-08-24.md):近期可信数据任务产品约完成 65%–70%,长期企业目标约完成 30%–35%。当前首要差距不是图表视觉,而是 Runtime Governance Coverage=0;下一建议工作包仍是单独批准 M1A。 +- 阶段重评估见 [`archive/engineering/forge-goal-gap-assessment-2026-08-24.md`](archive/engineering/forge-goal-gap-assessment-2026-08-24.md):近期可信数据任务产品约完成 65%–70%,长期企业目标约完成 30%–35%。当前首要差距不是图表视觉,而是 Runtime Governance Coverage=0;下一建议工作包仍是单独批准 M1A。 ## 3. M1A:服务身份、Delegation 与默认拒绝(近期,详细) @@ -1089,7 +1089,7 @@ R0.6 Structured Forge Compiler 兼容性维护关闭:`REQ-2026-09-04-030` 统 R0.6 Accuracy Lab DeepSeek 复验阻塞证据:`REQ-2026-09-04-032` 先后按用户选择尝试火山 Coding Plan 与官方 DeepSeek。Benchmark Runtime 的扩展注册时序已修复并通过 Pi 118 个测试与 TypeScript typecheck;火山 canary 仍由 `429 AccountQuotaExceeded` 阻断。官方入口降低到并发 1 后,nominal full Run `pbr_9d5e4263afdb46cd8636d4b6599f0708` 写入 500 个 case,但每臂只有 78 个候选、422 个候选缺失,独立探针返回 `402 Insufficient Balance`。该 Run 失败关闭,不形成新分数、不改写三轮有效完整基线,也不替代 R0.6 External Adoption Evidence 门禁;额度恢复且双臂 canary 通过后才允许从隔离状态库重跑。 -R0.6 Accuracy Lab 离线归因关闭:`REQ-2026-09-05-034` 固定 Sol Run `pbr_6778bf9d34ae42fba0b070a5f9c154ba`,完成209题/373个EA失败arm的Agent辅助初步审查及500题候选/SQL哈希证据。清单见 `benchmark-sol-error-triage-2026-09-05.json`;86个候选错误、150个参考冲突、133个意图/输出歧义、4个未定是初筛标签,不是人审裁决或可扣除的错误数。Official EA 62.6% vs62.8%不变;未发新基准调用、未改Prompt/Compiler/Gold/评分器。下一实验建议以值/实体绑定为先,结合范围、粒度及输出契约;须另行明确实施范围,不扩展平台或替代外部采用证据。 +R0.6 Accuracy Lab 离线归因关闭:`REQ-2026-09-05-034` 固定 Sol Run `pbr_6778bf9d34ae42fba0b070a5f9c154ba`,完成209题/373个EA失败arm的Agent辅助初步审查及500题候选/SQL哈希证据。清单见 `archive/benchmarks/benchmark-sol-error-triage-2026-09-05.json`;86个候选错误、150个参考冲突、133个意图/输出歧义、4个未定是初筛标签,不是人审裁决或可扣除的错误数。Official EA 62.6% vs62.8%不变;未发新基准调用、未改Prompt/Compiler/Gold/评分器。下一实验建议以值/实体绑定为先,结合范围、粒度及输出契约;须另行明确实施范围,不扩展平台或替代外部采用证据。 R0 未通过前,不恢复 M1A、G1、Q1、H6 或更广企业平台实现。Atlas candidate 可在不扩张产品范围的前提下单独复验;不得因产品切割删除已有 Contract、测试、审计或失败关闭边界。 @@ -1209,16 +1209,16 @@ Official EA沿用官方tuple-set语义,另报版本化Contract Accuracy(列 #### 15.1.12 ACC-1A关闭证据与剩余门禁(REQ-2026-09-05-036) - **已完成**:比较器修复与 `semantic-result-compare-v2`;公开Evaluate结果版本入hash,保留可靠列身份并区分false与inconclusive;Pi新Run冻结版本并在context/evaluate漂移时失败关闭,历史未知版本不伪造、不重写、不按新版恢复。Official EA和已有审批/只读/ACL边界不变。 -- **同候选重评**:`benchmark-sol-metric-replay-2026-09-05.json` 记录全部500题/1000个候选,996个可执行结果哈希一致且逐项复现旧判定;Forge Contract 280→284,Direct 291→294,零回退、此集零inconclusive。Official EA仍313/500与314/500;新增7个通过仅为评价器纠错,另181个真错诊断由映射歧义改为值错误。未发起模型调用,未重跑Assurance或生成新时延结论。 -- **D/R/S冻结**:`accuracy-evaluation-cohorts-2026-09-05.json` 以修复前归因证据冻结R500、D50(16错题+34旧基线对照,11库/33难度分层)及S27项。父执行器独立复算清单/hash/配额,S20比较器边界、7个既有安全引用/14参数化用例通过。完整验证为Python722 passed/26 skipped、Pi124 passed、TypeScript typecheck通过。 +- **同候选重评**:`archive/benchmarks/benchmark-sol-metric-replay-2026-09-05.json` 记录全部500题/1000个候选,996个可执行结果哈希一致且逐项复现旧判定;Forge Contract 280→284,Direct 291→294,零回退、此集零inconclusive。Official EA仍313/500与314/500;新增7个通过仅为评价器纠错,另181个真错诊断由映射歧义改为值错误。未发起模型调用,未重跑Assurance或生成新时延结论。 +- **D/R/S冻结**:`archive/benchmarks/accuracy-evaluation-cohorts-2026-09-05.json` 以修复前归因证据冻结R500、D50(16错题+34旧基线对照,11库/33难度分层)及S27项。父执行器独立复算清单/hash/配额,S20比较器边界、7个既有安全引用/14参数化用例通过。完整验证为Python722 passed/26 skipped、Pi124 passed、TypeScript typecheck通过。 - **未完成的外部前置条件**:H只有冻结协议、无已证明独立且审定标签的case;现有500/旧hard已参与调参,Spider2剩余公开材料也未满足完整独立性与题意/模板隔离证明。P无业务数据授权及Owner确认。不将这些缺口包装成ACC-1或ACC-6完成,不把已有Gold文件等同于独立审核。 - **后续实证**:新增来源、原2A假设的停止依据和下一实验门禁见15.1.13。独立H审核未完成时是否允许D诊断先行,以及调用预算,仍须明确确认。未经预算授权不发canary,不自动推进后续阶段。 #### 15.1.13 元数据机制实证与CSV绑定修复(REQ-2026-09-05-037) -- **实证结论**:`accuracy-metadata-treatment-audit-2026-09-05.json` 覆盖11库/75表/798列;format+PK对D16的25个失败arm新增有效取值证据为0,停止原追加Prompt假设。通用CSV绑定修复已进入 `forge/hard_accuracy_benchmark.py`,按SQLite ASCII大小写规则匹配并对歧义失败关闭,未写题号/Gold特例。 -- **行为证明**:`accuracy-metadata-binding-fix-2026-09-05.json` 记录48列已有元数据恢复;重算全部D50真实context与100份双臂control指令,只有md-034/046/052/065/077输入改变,表/关系范围不变。md-065的approved=true/false证据已进入两臂输入;这不是新答案、不是EA改善。修复前2个回归反例失败,修复后Python全套725 passed/26 skipped、TypeScript typecheck通过。 -- **H来源证据**:`accuracy-holdout-source-audit-2026-09-05.json` 从官方完整dev的1534题机械排除523题,冻结1011候选/964依赖组件;父执行器盲态复核哈希、集合、稳定ID和题面重叠。最终H未抽样,159条曝光SQL解析/qualification失败记录、独立题意/Gold/依赖审核及完整数据快照仍未闭环,不能称为独立H。 +- **实证结论**:`archive/benchmarks/accuracy-metadata-treatment-audit-2026-09-05.json` 覆盖11库/75表/798列;format+PK对D16的25个失败arm新增有效取值证据为0,停止原追加Prompt假设。通用CSV绑定修复已进入 `forge/hard_accuracy_benchmark.py`,按SQLite ASCII大小写规则匹配并对歧义失败关闭,未写题号/Gold特例。 +- **行为证明**:`archive/benchmarks/accuracy-metadata-binding-fix-2026-09-05.json` 记录48列已有元数据恢复;重算全部D50真实context与100份双臂control指令,只有md-034/046/052/065/077输入改变,表/关系范围不变。md-065的approved=true/false证据已进入两臂输入;这不是新答案、不是EA改善。修复前2个回归反例失败,修复后Python全套725 passed/26 skipped、TypeScript typecheck通过。 +- **H来源证据**:`archive/benchmarks/accuracy-holdout-source-audit-2026-09-05.json` 从官方完整dev的1534题机械排除523题,冻结1011候选/964依赖组件;父执行器盲态复核哈希、集合、稳定ID和题面重叠。最终H未抽样,159条曝光SQL解析/qualification失败记录、独立题意/Gold/依赖审核及完整数据快照仍未闭环,不能称为独立H。 - **准备阶段提案**:5道输入受影响的D题,2条件×2臂,原提案20次生成,包含前2题canary;不等同于完整D50或泛化验证。后续用户授权、参数失败补额和Luna实测结果见15.1.14。 - **调用前风险**:现有Pi Run的temperature=0/max_output_tokens=8192是记录值,未在session调用显式绑定;离线实际Codex适配器探针即使传maxTokens=8192也不写输出上限,session默认仍允许自动重试。尚无可承诺的8192-token成本硬上限;必须先明确实际参数/请求计数/重试策略,再获得预算授权。模型真实能力与扩展覆写未验证,不追溯伪造历史请求参数。 - **准备轮边界**:新模型调用0;Official EA仍313/500 vs314/500。未变更Gold/Prompt/Compiler/生产配置,未commit/push/部署。 @@ -1226,7 +1226,7 @@ Official EA沿用官方tuple-set语义,另报版本化Contract Accuracy(列 #### 15.1.14 Luna五题机制验证结果 - **实际调用**:Pi现有OAuth入口与 `PiBenchmarkRuntime`,固定Luna。首次显式temperature被接口拒绝,两请求HTTP400、无答案;用户确认“继续,最多22次”后,改用Provider默认采样,两条件一致。最终22次生成HTTP请求:2次参数失败+20个有效候选,无自动重试;不将失败canary包装成准确率结果。 -- **五题实测**:Official EA与Contract v2均为Forge 3/5→2/5,Direct 3/5→3/5;Forge执行5/5→4/5,Direct保持5/5。无新增评价通过,Forge新增1个回退;这是全部5道输入受影响开发题,不是Luna总体准确率。证据:`benchmark-luna-binding-2026-09-05.json`。 +- **五题实测**:Official EA与Contract v2均为Forge 3/5→2/5,Direct 3/5→3/5;Forge执行5/5→4/5,Direct保持5/5。无新增评价通过,Forge新增1个回退;这是全部5道输入受影响开发题,不是Luna总体准确率。证据:`archive/benchmarks/benchmark-luna-binding-2026-09-05.json`。 - **错误变化**:md-065两臂approved从Yes改为true,空结果变为非空;但费用类型分组与Gold的event.type仍有语义/参考冲突,未改判。md-077 Forge日期恢复ISO格式,查到与Gold相同的两个人及金额,但姓名合并成一列,仍按原输出契约判失败;Direct日期仍错。md-052处理组Forge把SQL式别名写入scan/table,编译器复现“JOIN 条件引用了未声明的表:b, e。”,不能归因为稳定的元数据负效应。 - **代价与决定**:双臂合计tokens 28,611→38,709(+35.29%),超过预设20%晋级阈值;不扩大调用、不宣称准确率改善。保留元数据完整性修复;下一短闭环优先处理已复现的Forge别名表示错误,参考/输出契约争议单独处理,不机械推进阶段表。 - **复核与边界**:20个候选的评分/编译结果只读复现,5个Gold缓存与真实SQL执行一致;实际payload、session、请求记录和Pi run_id已封存。Raw Pi中的temperature=0/max_output_tokens=8192仍是旧声明字段,实际请求不传二者;不伪造历史参数。未改Gold/比较器/运行器生产源码,未commit/push/部署;独立H与外部采用门禁仍未通过。 @@ -1235,21 +1235,21 @@ Official EA沿用官方tuple-set语义,另报版本化Contract Accuracy(列 - **用户确认与实施**:REQ-2026-09-05-038要求实际strict:true而非prefer。沿用Pi Benchmark会话与onPayload钩子,从完整Forge Schema派生严格传输Schema;递归、CTE、子查询与集合运算保留。可选占位null在进入现有编译评估链路前移除,SQL NULL保留;Direct仍为文本SQL。 - **失败关闭**:不支持的API或显式supportsStrictMode:false拒绝;禁止第二次Forge生成请求,Provider与Session自动重试关闭;历史prefer及Schema/Prompt漂移不得续跑混分。 -- **实证**:用户批准最多2次Luna请求;实际md-034双臂各1次、均HTTP200、零自动重试。Forge真实payload含strict:true、指定函数tool_choice及parallel_tool_calls:false;原始参数独立通过严格Schema校验,规范化后完成编译执行。证据:`benchmark-luna-strict-output-2026-09-05.json`。 +- **实证**:用户批准最多2次Luna请求;实际md-034双臂各1次、均HTTP200、零自动重试。Forge真实payload含strict:true、指定函数tool_choice及parallel_tool_calls:false;原始参数独立通过严格Schema校验,规范化后完成编译执行。证据:`archive/benchmarks/benchmark-luna-strict-output-2026-09-05.json`。 - **边界与决定**:TypeScript typecheck和129项Pi测试通过;仅Luna/Codex服务端完成实证。结构合法不等于别名或业务语义正确,不将1题成功称为准确率提升,不改写历史500题/独立H/外部采用门禁,不扩大量测。 #### 15.1.16 隐式别名确定性修复 - **范围与根因**:用户确认继续处理md-052;REQ-039修复Compiler渲染接受event e、引用校验却只识别event AS e的不一致。共用解析器支持省略AS的表/限定表/括号子查询别名,不改变Prompt、Schema或模型输出;不放宽未知引用与重复绑定检查。 - **验证**:修复前3个行为反例失败;修复后Compiler/Benchmark聚焦141项、5方言解析通过。20个原Luna候选与冻结HTTP上下文离线复算,仅处理组md-052 Forge的SQL改变;编译/Assurance/执行/EA/Contract通过,结果September Speaker。 -- **结果与边界**:处理组Forge 2/5→3/5,其余三组仍3/5;零回退、零模型调用。证据:`benchmark-luna-alias-fix-2026-09-05.json`。不覆盖历史运行、不重评历史500题;修复Compiler不代表元数据有准确率增量,也不解除H与外部采用门禁。 +- **结果与边界**:处理组Forge 2/5→3/5,其余三组仍3/5;零回退、零模型调用。证据:`archive/benchmarks/benchmark-luna-alias-fix-2026-09-05.json`。不覆盖历史运行、不重评历史500题;修复Compiler不代表元数据有准确率增量,也不解除H与外部采用门禁。 #### 15.1.17 严格输出二十次新生成配对 - **授权与输入**:REQ-040,用户明确选择完整配对20次;同5题、两元数据条件、双臂一次生成,当前strict Schema与Compiler一致。10份上下文和20份用户指令冻结。 - **实际执行**:总20次HTTP200、零Provider自动重试、零替换调用。第10次发生Pi递归子Schema强制转换栈溢出,本地第二轮尝试被拦截;用户确认仅继续剩余10次。原失败记录不覆盖,所有原始响应经同一最终本地链路复核。 - **运行器修复**:strict原始参数在prepareArguments中校验并归一化,再交Pi canonical Schema校验;Provider Schema不变、未修改依赖。缺失候选不发布completed,失败token不再清零或从合计排除;132项Pi测试/typecheck通过。原故障臂3819 tokens从session恢复,候选仍因CTE未投影total被Assurance拒绝。 -- **结果与代价**:旧元数据Forge EA/Contract 2/5、Direct3/5;修复后元数据两臂3/5。tokens 24021→33883(+41.06%),总57904。当前配置Forge与前轮固定候选复算同为3/5;md-052四臂均通过,md-065分组参考争议和md-077姓名列契约未解决。证据:`benchmark-luna-strict-paired-2026-09-05.json`。 +- **结果与代价**:旧元数据Forge EA/Contract 2/5、Direct3/5;修复后元数据两臂3/5。tokens 24021→33883(+41.06%),总57904。当前配置Forge与前轮固定候选复算同为3/5;md-052四臂均通过,md-065分组参考争议和md-077姓名列契约未解决。证据:`archive/benchmarks/benchmark-luna-strict-paired-2026-09-05.json`。 - **决定**:不以5题或跨生成差异宣称总体/严格输出单因素优势,不更新历史500题成绩,不扩大调用;下一步先明确业务分组和结果列契约,H与外部采用门禁不变。 @@ -1259,7 +1259,7 @@ Official EA沿用官方tuple-set语义,另报版本化Contract Accuracy(列 - **用户确认**:REQ-041,选择10题/20次请求;不是自动扩大REQ-040,也不解除H审核门禁。 - **冻结与目的**:从R500按固定哈希跨10库各取1题,排除最近5题;只依赖库/题号,不依据答案。当前配置单条件双臂,新生成后不修改代码、Prompt、元数据或评分。 - **门禁**:最多20次,零自动重试、零替换,异常停止;只读公开数据、Pi SDK认证。独立复核原始候选、EA/Contract、执行和真实消耗;不将无旧配置对照的小样本结果宣称优化增益或泛化。 -- **完成证据**:20次HTTP200、零Provider重试/替换,10个Forge参数严格/真实Pi校验、20个原候选独立复算通过,源码与10库hash不变。Forge EA6/10、Contract5/10、Compile/Execution10/10;Direct EA/Contract7/10、Execution10/10。tokens 51077 vs29953(+70.52%),总81030。证据:`benchmark-luna-expanded-regression-2026-09-05.json`。 +- **完成证据**:20次HTTP200、零Provider重试/替换,10个Forge参数严格/真实Pi校验、20个原候选独立复算通过,源码与10库hash不变。Forge EA6/10、Contract5/10、Compile/Execution10/10;Direct EA/Contract7/10、Execution10/10。tokens 51077 vs29953(+70.52%),总81030。证据:`archive/benchmarks/benchmark-luna-expanded-regression-2026-09-05.json`。 - **暴露问题与决定**:目标聚合未投影、JOIN改变分母、日期格式/粒度和姓名列契约仍有失败;md-454漏Top-5但当前数据EA通过,隔离六校反例证明逻辑不等价。原评分不改、无新代码调优或扩大调用;将样本当故障证据,不当业务规则来源,不宣称泛化或优化单因素增益。 #### 15.1.19 BIRD查询准确性基础建设(REQ-044) @@ -1270,16 +1270,16 @@ Official EA沿用官方tuple-set语义,另报版本化Contract Accuracy(列 - **阶段验收规则**:固定模型/数据/评分/预算与对照,逐项证明改善和回退;EX、Contract、覆盖、静默错误和成本分别报告。暂不设无依据的百分比门槛;不自动扩大模型调用、切换输入路径或实施新Agent循环。 - **首个诊断完成**:3份原始生成的select已漏掉目标表达式,Compiler忠实复现;6种合成行为通过,机械补齐所有agg别名导致4个合法结果契约被破坏。确认生成表达问题,不把原因泛化为Compiler计算缺陷;Prompt是否是原因未获因果证明。 - **单变量实验完成**:用户另批20次新生成;5题×两指令条件×Forge/Direct,全部HTTP200、零Provider重试/替换。Forge EX/Contract4/5→4/5,3个正确对照保持通过;Direct指令完全相同却4/5→5/5,保留生成波动事实。20个原始候选经运行链路与BIRD官方EX核心分别复算零差异,10份strict/Pi参数校验通过。 -- **决定与代价**:候选Prompt不采纳,源码/Schema/Gold/评分不改;不以旧失败题本轮恢复宣称收益,不追加拒绝、补列或付费抽样。双臂tokens36284→36262,总72546,Forge自身+0.25%。证据:`benchmark-luna-projection-instructions-2026-09-05.json`。首个表达说明假设闭环为未获收益,后续须另选有证据的通用机制并单独冻结实验。 +- **决定与代价**:候选Prompt不采纳,源码/Schema/Gold/评分不改;不以旧失败题本轮恢复宣称收益,不追加拒绝、补列或付费抽样。双臂tokens36284→36262,总72546,Forge自身+0.25%。证据:`archive/benchmarks/benchmark-luna-projection-instructions-2026-09-05.json`。首个表达说明假设闭环为未获收益,后续须另选有证据的通用机制并单独冻结实验。 #### 15.1.20 评测标准与工程化协议(REQ-045) - **用户确认实施**:将BIRD基础能力基准、高覆盖/低错误/低交互负担和实验规则固化为可执行工程;本次不发起新模型调用或部署。 - **实施切片**:复用CLI/Benchmark链路提供不可变协议清单、分层选题、离线重放和严格对比;Pi原生绑定清单、明确预算、隔离上下文、保存真实候选/使用量并禁额外回合。增加质量指标与字段日期证据审计,不新建Orchestrator。 - **门禁已落地**:固定88个公开数据资产;Gold-only评分,SHM/空WAL不当数据漂移,非空WAL/journal拒绝。已评分失败保留EX=0与分母且可比较,未评分/漂移/旧诊断失败关闭;固定候选跨Compiler/Schema对比绑定原始output hash,生成源码/SDK/model/预算保留。缺usage显式未知,不从成本消失。 -- **验收完成**:实际D5/R500冻结及验证、10个历史候选重放、合成失败分母/可比与诊断不可比命令、质量指标与日期审计、HTTP协议门禁、实际Web预算及未知成本展示均通过。Python786 passed/26 skipped,Pi143 passed,typecheck通过,Pi门禁接入CI;零外部模型调用、无部署。证据:`benchmark-standards-engineering-2026-09-05.json`。 +- **验收完成**:实际D5/R500冻结及验证、10个历史候选重放、合成失败分母/可比与诊断不可比命令、质量指标与日期审计、HTTP协议门禁、实际Web预算及未知成本展示均通过。Python786 passed/26 skipped,Pi143 passed,typecheck通过,Pi门禁接入CI;零外部模型调用、无部署。证据:`archive/benchmarks/benchmark-standards-engineering-2026-09-05.json`。 - **后续边界**:这是可复用测试工程,不是新准确率收益;现行Prompt和官方EX不变,H审核与R0.6外部采用仍未关闭。任何新生成实验按标准单独声明假设/变量与预算。 -- **首次标准真实运行(另批40次)**:Luna D20/seed42覆盖11库,Pi派发40次、返回39候选;md-472 Forge 120秒超时使Run failed,md-340 Gold在原30秒限制内不可评分。离线重放与compare按不完整记录拒绝晋级,20题中Forge确认正确10/失败9/未评分1,Direct9/10/1;已观测149300 tokens加一次未知消耗,不发布正式准确率或收益。40份raw hash与37份已评分候选判定核对一致。证据:`benchmark-luna-standard-d20-2026-09-05.json`。先处理Gold预检及未评分状态贯通;不自动重试、放宽Gold/评分、扩大R500或改变H/外部采用门禁。 +- **首次标准真实运行(另批40次)**:Luna D20/seed42覆盖11库,Pi派发40次、返回39候选;md-472 Forge 120秒超时使Run failed,md-340 Gold在原30秒限制内不可评分。离线重放与compare按不完整记录拒绝晋级,20题中Forge确认正确10/失败9/未评分1,Direct9/10/1;已观测149300 tokens加一次未知消耗,不发布正式准确率或收益。40份raw hash与37份已评分候选判定核对一致。证据:`archive/benchmarks/benchmark-luna-standard-d20-2026-09-05.json`。先处理Gold预检及未评分状态贯通;不自动重试、放宽Gold/评分、扩大R500或改变H/外部采用门禁。 #### 15.1.21 评分就绪与混合回归(REQ-046) @@ -1287,8 +1287,8 @@ Official EA沿用官方tuple-set语义,另报版本化Contract Accuracy(列 - **本轮冻结口径**:已有Luna留存生成覆盖33题;上轮11题必须延续,余9位为6新/3旧,seed43。历史其他模型完整500题曝光仍保留,不称独立holdout。复用CLI freeze、Pi原生protocol和原候选replay,不新增调度或任务状态。 - **门禁**:默认require_all在Gold预检失败时拒绝整轮;用户追加批准skip_unscorable,将Gold阻塞留分母、零生成,并固定缩减预算和阻塞报告,预检漂移需重新冻结。失败题超规模或池不足仍拒绝,不换题/比例/预算。SQL/Gold/数据与30s/120s限制不默改。 - **验证与本轮闭环**:Python803 passed/26 skipped,Pi149 passed/typecheck与实际界面通过。20题中Gold跳过1题,实际38次派发/38候选,无生成超时与补跑,tokens139490。EX确认正确8/9、Contract5/8,各1题未知;新题6/6 EX但Contract4/6与5/6,不能仅看EX或跨混合样本宣称提升。38响应hash与40臂重放一致,compare拒绝正式基线。 -- **每轮交付与下一步**:用户要求每轮测试后出简报;本轮见`benchmark-luna-mixed-d20-2026-09-05.md`和同名JSON。Gold规划器问题仍阻塞,md-046/md-249 Forge再生成回退、md-259 Direct恢复。下轮按规则15延续+4新+1旧,未自动追加模型调用;H与R0.6门禁不变。 -- **同配置续测seed44/45**:分别获用户“好的,那就继续”“继续,”授权,各38派发全部返回,tokens分别134585/137028;Gold阻塞均留20题分母。最新seed45为16延续/3新/1旧,EX确认正确6/6、Contract3/4,各1未知;相同15道可评分延续题EX2→4/4→4,Contract0→1/2→2。Forge md-289完整恢复,md-429仅EX恢复,未形成代码优化因果证据。两轮均38响应hash与40臂重放一致,源码/模型/运行版本/数据指纹不变。最新简报:`benchmark-luna-mixed-d20-seed45-2026-09-05.md`,同名JSON及seed44历史报告保留。下一轮17延续+2新+1旧,未自动追加调用,优先离线归因持续错题。 +- **每轮交付与下一步**:用户要求每轮测试后出简报;本轮见`archive/benchmarks/benchmark-luna-mixed-d20-2026-09-05.md`和同名JSON。Gold规划器问题仍阻塞,md-046/md-249 Forge再生成回退、md-259 Direct恢复。下轮按规则15延续+4新+1旧,未自动追加模型调用;H与R0.6门禁不变。 +- **同配置续测seed44/45**:分别获用户“好的,那就继续”“继续,”授权,各38派发全部返回,tokens分别134585/137028;Gold阻塞均留20题分母。最新seed45为16延续/3新/1旧,EX确认正确6/6、Contract3/4,各1未知;相同15道可评分延续题EX2→4/4→4,Contract0→1/2→2。Forge md-289完整恢复,md-429仅EX恢复,未形成代码优化因果证据。两轮均38响应hash与40臂重放一致,源码/模型/运行版本/数据指纹不变。最新简报:`archive/benchmarks/benchmark-luna-mixed-d20-seed45-2026-09-05.md`,同名JSON及seed44历史报告保留。下一轮17延续+2新+1旧,未自动追加调用,优先离线归因持续错题。 - **离线归因闭环(用户另批继续,零新生成)**:17延续题主因6道生成/作用域错误、6道参考冲突、4道输出契约歧义、1道Gold阻塞;不改官方判分、不发布纠正后准确率。独立重执行91条分片SQL与原38候选全链路重评一致,源码/数据不变。md-447实际为QUALIFY外层缺少源列作用域而非虚构字段;搬条件和换Gold编码的手工反事实不作为收益。未满足狭窄确定性修复门槛,未改Compiler/Prompt/Schema/Gold/评分;下一候选聚焦带来源的实际日期格式上下文,机制/预算另行冻结,不自动新增模型调用。见`benchmark-luna-offline-triage-2026-09-05.md/.json`。 - **恢复滚动seed46(2026-09-06,用户另批“继续吧”)**:20题为17延续/2新/1旧,日期off,md-340留分母零调用;38派发/38候选、136237 tokens且用量完整。EX确认正确6/4、Contract3/2,各1未知;同一16道可评分延续题EX3→4/3→2、Contract0→1/1→0。Forge md-249恢复;Direct md-082 Contract、md-429 EX回退;新md-044与旧md-034双臂通过,md-222双臂失败。38响应hash、40臂评分与SQL一致;md-340 Forge编译状态投影not_applicable/pending差异保留,不影响未知评分。共享输入/生成契约/模型/数据未变,但日期机制已使协议升v2及三处源码指纹不同,不宣称正式跨轮可比或优化收益。简报:`benchmark-luna-mixed-d20-seed46-2026-09-06.md/.json`。累计Luna曝光48题;下轮18延续+1新+1旧,未自动启动,未在本轮移除expected_grain。 @@ -1304,7 +1304,7 @@ Official EA沿用官方tuple-set语义,另报版本化Contract Accuracy(列 - **离线验收完成**:实际CLI冻结/预检/历史诊断重放通过,过期源码清单拒绝;两臂日期后缀相同,原snapshot/schema未变,无日期对照后缀为空。10个历史候选判分不变,原seed45的38个可评分候选重评不变;Python810 passed/26 skipped、Pi149 passed/typecheck通过。此处只有工程与评分保真证据,没有新生成收益。 - **调用已闭环**:用户在预算选项中明确选择“执行完整20次”;两条件各10派发、共20候选,零补跑/替换,重试策略0,用量全部已知。基线Run `pbr_716a9e146af7424a858e735647680aec`,处理Run `pbr_f90aeca4d5544fd59aa74f6809db7886`;本轮临时本地服务已停止。 - **实跑结果与决定**:Forge EX/Contract2/5→3/5、Direct3/5→3/5;唯一新增通过是未获得日期补充且输入相同的md-289,不能计为日期收益。md-483两臂从YYMMDD改为ISO、md-077 Forge日期绑定恢复,仍因结果粒度/姓名表示与参考不同未通过;预声明目标题门槛未满足,默认off、不推广、不补样。两条件tokens34621→38944(+12.49%),总73565。 -- **最终证据**:20臂原始hash及离线重放一致;19个可执行候选和5个Gold经只读SQLite与官方EX集合核心独立复算一致,1个Assurance拒绝保留。源码/数据/模型/生成Contract及冻结上下文一致,比较门禁通过但不构成稳定因果。简报:`benchmark-luna-date-context-2026-09-05.md`,同名JSON保存逐题候选及证据hash。下一步仅建议离线复核输出契约,不改Gold追分;日常17+2+1、H与R0.6门禁不变。 +- **最终证据**:20臂原始hash及离线重放一致;19个可执行候选和5个Gold经只读SQLite与官方EX集合核心独立复算一致,1个Assurance拒绝保留。源码/数据/模型/生成Contract及冻结上下文一致,比较门禁通过但不构成稳定因果。简报:`archive/benchmarks/benchmark-luna-date-context-2026-09-05.md`,同名JSON保存逐题候选及证据hash。下一步仅建议离线复核输出契约,不改Gold追分;日常17+2+1、H与R0.6门禁不变。 - **输出契约复核闭环(2026-09-06,用户继续,零新调用)**:26条结果查询、5个完整DDL且外键有效的隔离反例、8份冻结Prompt来源核对完成。md-483的expected_grain=grouped来自each/per正则并进入两臂输入;每月单位也触发grouped,不能当业务确认。当前一账户一贷款不是DDL保证,合成数据区分总计3与账户2/1。md-077的CSV明确支持拼接全名;Gold活动关联把14/12个参与记录扩为26行再去重为2,隔离反例揭示范围、重复、不可逆姓名和NULL边界。原候选日期错误、官方评分和原20次结论保留。见`benchmark-luna-output-contract-review-2026-09-06.md/.json`。 - **Gold诊断与下一候选**:允许主动分析Gold定位错因并总结通用改进;禁止泄漏本题答案进入被测生成、篡改原始分数及把调参集冒充独立H。对照Gold不是作弊,也不意味着每个参考JOIN都是业务规则。优先考虑将未经确认的expected_grain移出生成契约,保留问题与事实;不添加更多per特判或按题号硬编码。此次仅完成诊断、未修改实现,新的生成消融仍须单独冻结与授权;日期观察默认off及H/R0.6门禁不变。 @@ -1317,21 +1317,21 @@ Official EA沿用官方tuple-set语义,另报版本化Contract Accuracy(列 - **生成终态**:对照Run `pbr_fb550c000ff34a559d1f79e7738107ec`仅14派发/10候选,md-153、md-199两臂均空响应,24臂未派发且不可resume;off Run `pbr_cb5bcb3341a24f619b7e8a75bbd83236`完成38派发/38候选,仅因Gold未知不构成完整Run。合计52派发/48候选,观测172108 tokens,另4次用量未知;无补跑。 - **结果与门禁**:共同有效5题的两臂EX均3/5、Contract均1/5,零恢复、零回退,不能以此幸存子集满足完整配对验收。off的EX正确均4、Contract Forge1/Direct2,各1道Gold未评分;Forge91339 tokens、Direct50198,未显示准确率或成本优势。保留工程切换,不宣布生成收益,不晋级正式基线或H/R0.6。 - **后续维护已验证**:用户“好的”接受先修复两项维护问题,不新增模型调用。replay只对无候选且显式scored=false的记录保留未评分/原执行状态,真实生成失败仍计失败;新Pi raw_output.assistant保存content、stopReason、errorMessage,失败日志带Provider原因。两个修复前反例均失败,修复后Python814 passed/26 skipped、Pi150 passed/typecheck通过;本地合成Provider失败经真实Pi工作器、SQLite与日志读取验证,未调用真实Provider。历史丢失的4次错误原因不追补。 -- **证据与后续边界**:准备及付费证据保持原样;后续维护证据为`benchmark-luna-grain-maintenance-2026-09-06.json`。用当前源码新冻结的diagnostic上下文重放原80臂:24个未派发臂恢复未评分,80臂SQL/EX/Contract/scored/execution与原Pi一致,原output/raw_output不变;Gold及生成失败的compile投影差异另列。源码指纹已改变,旧付费冻结不得续跑或强行比较,diagnostic/未评分仍不晋级。下一轮19延续+1新+0复核,Luna已见49/未见451;未启动下一轮,剩余24次授权未补跑。 +- **证据与后续边界**:准备及付费证据保持原样;后续维护证据为`archive/benchmarks/benchmark-luna-grain-maintenance-2026-09-06.json`。用当前源码新冻结的diagnostic上下文重放原80臂:24个未派发臂恢复未评分,80臂SQL/EX/Contract/scored/execution与原Pi一致,原output/raw_output不变;Gold及生成失败的compile投影差异另列。源码指纹已改变,旧付费冻结不得续跑或强行比较,diagnostic/未评分仍不晋级。下一轮19延续+1新+0复核,Luna已见49/未见451;未启动下一轮,剩余24次授权未补跑。 #### 15.1.24 SQLite 标量极值 CTE 执行瓶颈(REQ-049) - **范围已接受并闭环**:用户明确选择“修复执行瓶颈”,接受零模型调用与该优化SQL的SQLite≥3.35边界。只对参与INNER/CROSS JOIN的简单非递归列MIN/MAX标量CTE使用窄物化策略,不改原候选、Prompt、Schema、Gold或评分。 - **回归与边界**:修复前MIN/MAX两个固定VM预算反例失败,修复后通过,保留并列极值、NULL、空输入和标识符引用;未投影聚合保留下推。13类不应优化的结构与原源码输出一致,24个旧Forge候选的120项五方言编译结果只改变md-199的SQLite SQL。 - **实际收益**:原80臂完整离线重放,原output/raw_output均不变;只有off/md-199/Forge从30秒execution_timeout恢复为Assurance/执行/EX/Contract通过,独立本机只读烟测79.26ms。off Forge EX正确4→5、Contract1→2,各仍1未知;其他79臂核心状态/评分/SQL不变,Direct及对照不变。 -- **验证与证据**:Python818 passed/26 skipped,Pi150 passed/typecheck通过;新diagnostic协议有效,旧源码协议与diagnostic晋级仍失败关闭。完整简报及证据索引为`benchmark-luna-scalar-cte-fix-2026-09-06.json`;旧Run、旧冻结与付费结果不改写,未启动新模型调用。 +- **验证与证据**:Python818 passed/26 skipped,Pi150 passed/typecheck通过;新diagnostic协议有效,旧源码协议与diagnostic晋级仍失败关闭。完整简报及证据索引为`archive/benchmarks/benchmark-luna-scalar-cte-fix-2026-09-06.json`;旧Run、旧冻结与付费结果不改写,未启动新模型调用。 - **后续门禁**:收益限定于同候选Compiler修复,不能宣称新模型准确率、独立泛化或完整粒度配对收益。预定off父Run的续测已按新冻结与独立38次授权执行seed48,结果见15.1.21;本节固定候选修复与后续新生成分开记录,旧24次未派发预算不自动沿用。H与R0.6外部采用门禁不变。 #### 15.1.25 生成终止后的证据封存(REQ-050) - **已接受的维护与闭环**:用户要求继续优化;只修复已确认的生命周期竞态,不增加模型调用或改变停止策略。原catch封存早于finally等待abort,可能遗漏最终assistant及usage;现共享同一abort Promise,在取消完成后封存,随后退订与dispose。 - **行为门禁**:120秒deadline、单次派发、零重试、失败即停、迟到输出拒绝与未知用量不变;不改Prompt/Schema/Compiler/Gold,不自动补列或按题号修分。原finally已经等待abort,本次不扩大生成窗口;不增加逐片全量复制或第二套响应状态。 -- **验证证据**:deadline回归修复前失败、修复后Run重开仍保留最终响应/usage/hash且不执行迟到SQL。真实Pi SDK合成流显示最终化先后0→1条assistant、0→93个合成tokens,网络0;不是实际Luna用量恢复。Pi151 passed/typecheck、Python819 passed/26 skipped,原40臂diagnostic重放与旧工件hash不变,compare拒绝晋级。报告:`benchmark-luna-cancellation-evidence-fix-2026-09-06.json`。 +- **验证证据**:deadline回归修复前失败、修复后Run重开仍保留最终响应/usage/hash且不执行迟到SQL。真实Pi SDK合成流显示最终化先后0→1条assistant、0→93个合成tokens,网络0;不是实际Luna用量恢复。Pi151 passed/typecheck、Python819 passed/26 skipped,原40臂diagnostic重放与旧工件hash不变,compare拒绝晋级。报告:`archive/benchmarks/benchmark-luna-cancellation-evidence-fix-2026-09-06.json`。 - **后续边界**:这项修复改善归因可靠性,不提升已有候选成绩,也不能补回旧md-234缺失内容或两次未知usage。Pi runtime指纹变化,旧Run不跨版本续跑;下一轮仍需独立冻结授权,H/R0.6门禁不变。 #### 15.1.26 生成流阶段定向诊断(REQ-051) @@ -1339,14 +1339,14 @@ Official EA沿用官方tuple-set语义,另报版本化Contract Accuracy(列 - **已接受并完成**:用户另批4次;md-234/md-447两个独立单题双臂Run按题串行,保持Luna、Prompt、Schema、120秒、零重试及日期/粒度off。观察器仅聚合SDK可见事件;先做正常/取消合成流零网络烟测,不新增生产遥测或状态源。 - **真实结果**:4次生成与执行均成功,EX/Contract均0/4;19831 tokens、未知用量0。Forge生成11.18/23.60秒,工具参数可见包络3.27/7.46秒;未复现超时,不能把可见thinking包络解释为全部推理或证明REQ-050有延迟收益。 - **归因边界**:md-234的Gold不含题目所求次数,Direct另有按circuitId分组差异;md-447的候选DOCType与Gold DOC仅输出表示不同,离线换列得到相同Gold行多重集。反事实不采纳、不改原评分,不因追分删列或硬换编码。 -- **证据与门禁**:4份Prompt与seed48对应臂hash一致;4份响应hash、4臂原候选重放及独立EX核验通过,57条日志与Pi完整快照封存,服务已停。未修改生产源码/生成策略、未追加请求;不是seed49,滚动父Run及H/R0.6门禁不变。简报:`benchmark-luna-generation-stages-2026-09-06.md`及同名JSON。 +- **证据与门禁**:4份Prompt与seed48对应臂hash一致;4份响应hash、4臂原候选重放及独立EX核验通过,57条日志与Pi完整快照封存,服务已停。未修改生产源码/生成策略、未追加请求;不是seed49,滚动父Run及H/R0.6门禁不变。简报:`archive/benchmarks/benchmark-luna-generation-stages-2026-09-06.md`及同名JSON。 #### 15.1.27 保留CTE字段绑定与统一SQL保障(REQ-052) - **已完成维护**:用户要求继续优化,零模型调用。删除Compiler的CTE限定名剥离与主CTE裸列猜测,不自动补聚合/投影或按Gold换字段。5个真实SQLite结果反例修复前失败、修复后通过;窗口测试从前缀断言改为结果行/Top-N验证。 - **公共边界闭环**:烟测发现CTE未输出字段在SELECT/WHERE中可被旧Forge JSON字段门禁放过。`assure_query`复用已有`assure_compiled_sql`,使用同一已限定Registry并保留先前门禁证据;Assurance升v8,两个漏拒反例已关闭,歧义拒绝对照保持。既有关系/业务Policy不放宽,Evaluate不授予执行权。 - **验证与收益边界**:40个历史Forge候选200项五方言结果不变、5份原Run hash不变;新v8诊断中md-032/md-199四臂SQL/EX/Contract不变,缺列继续拒绝。真实CLI/HTTP与返回SQL的隔离执行通过;Python825 passed/26 skipped、Pi151 passed/typecheck,服务已停止。不是新生成收益或完整R500复评,不解除旧协议漂移、H或R0.6门禁;滚动父Run仍seed48。 -- **交付**:`benchmark-luna-cte-binding-fix-2026-09-06.md`及同名JSON。公共CTE→物理表关系和右CTE裸列的既有前置限制如实保留,不将Compiler合法等同全部业务Policy通过。 +- **交付**:`archive/benchmarks/benchmark-luna-cte-binding-fix-2026-09-06.md`及同名JSON。公共CTE→物理表关系和右CTE裸列的既有前置限制如实保留,不将Compiler合法等同全部业务Policy通过。 #### 15.1.28 当前栈回归收口与枚举绑定增量审计(REQ-053) @@ -1377,7 +1377,7 @@ Official EA沿用官方tuple-set语义,另报版本化Contract Accuracy(列 - 复用现有prompt变量与forge_prompt_revision作为有限内置范例的选择/绑定,不另造Prompt平台或新Task状态;默认Prompt逐字不变,Direct指令/Schema/Context/Compiler/Assurance/Gold/评分不变。 - 零调用准备已完成:一条范例、8组隔离SQLite夹具/16次正反执行;默认500题输入hash不变,仅候选Forge指令增加2209 UTF-8 bytes。四题md-259/079/000/312双条件冻结与Gold预检通过,CLI/鉴权HTTP及Pi生产类合成消费/持久化/漂移失败关闭通过;Python889 passed/26 skipped、Pi155 passed/typecheck。合成会话不是模型效果。 - 用户后续明确批准16次,实际16派发/16候选完成:Forge EX/Contract2/4→3/4,Direct2/4不变;md-259完整恢复、md-000恢复,但md-079别名/投影错误回退。总53058 tokens、未知0,处理组+6.03%,成本/P95护栏通过;预声明零回退门槛失败,不启用默认,不补跑/扩样/自动返修或启动seed49。 -- 16原响应hash/重放/独立SQLite与218日志、原生Pi状态快照一致,25准备工件及源码/数据/输入hash不变,服务已停。准备证据保留,正式结果见`benchmark-luna-denominator-scope-2026-09-07.json`;后续仅记录CTE别名/中间投影一致性为独立候选,尚无新实现/调用授权。 +- 16原响应hash/重放/独立SQLite与218日志、原生Pi状态快照一致,25准备工件及源码/数据/输入hash不变,服务已停。准备证据保留,正式结果见`archive/benchmarks/benchmark-luna-denominator-scope-2026-09-07.json`;后续仅记录CTE别名/中间投影一致性为独立候选,尚无新实现/调用授权。 #### 15.1.32 CTE接口诊断与别名绑定维护(REQ-057) @@ -1385,7 +1385,7 @@ Official EA沿用官方tuple-set语义,另报版本化Contract Accuracy(列 - 复用SQLGlot解析、本层Column引用和原文跨度,仅展开真实本地别名;显式限定、字符串/注释、函数/类型名、子查询内部及插入SQL均不猜测改写。统一HAVING/QUALIFY与已有窗口/排序接口的相关漏展开。 - 已验证:12项回归先红后绿,42组独立边界全通过;SQLGlot下限27通过相同矩阵。548份历史候选2740次五方言编译不变;另3份合成探针仅限定列反例改变。上一轮16份原候选诊断输出/评分/失败分类不变,md-079仍拒绝。 - 实际CLI/API正负例及返回SQL通过;Python901 passed/26 skipped、Pi155 passed/typecheck,文档同步后相关107 passed。旧协议拒绝、新诊断独立冻结,默认Prompt/控制输入和数据hash不变;服务已停,不重试Gold阻塞或启动seed49。 -- 结论:修复的是Compiler静默改写,不是模型CTE接口不一致;不宣称准确率收益,不启用自动补列/返修。报告:`benchmark-cte-expression-binding-fix-2026-09-07.json`。 +- 结论:修复的是Compiler静默改写,不是模型CTE接口不一致;不宣称准确率收益,不启用自动补列/返修。报告:`archive/benchmarks/benchmark-cte-expression-binding-fix-2026-09-07.json`。 #### 15.1.33 生成端CTE接口范例准备及开发对照(REQ-058) @@ -1403,3 +1403,45 @@ Official EA沿用官方tuple-set语义,另报版本化Contract Accuracy(列 - 维护既有全局CTE名称过滤造成的表权限漏检:按SQLGlot Scope来源和MappingSchema方言归一化校验物理表;合法CTE/derived保留,扁平Registry未授权的schema/catalog限定来源拒绝。Assurance v10使旧v9 QueryRun审批漂移失败关闭,必须重新prepare/审核;不迁移旧证据。 - 合成回归与实际API/SQLite维护零被测模型调用;旧报告、未知用量、失败/未完成实验及H/R0.6门禁不变,不把本次维护记为模型准确率增益。版本验证结果集中于release-verification-2026-09-07.json。 - 首次push的CI暴露外部DATA旁仓依赖,随后加强隔离又暴露六项HTTP测试默认状态目录依赖;只修复测试夹具与独立配置,不跳过用例、不改生产失败关闭语义。首轮失败和隔离更正保留于同一发布验证报告。 + +#### 15.1.35 关键DSL说明单变量候选(REQ-065,实跑完成、门槛未过) + +- 用户接受REQ-064首选方向;本切片只增加默认off的interfaces-v1工具Schema说明,五字段scan/cte/agg/window/select,字段顺序与完整DSL不变;不叠加范例、键序、答案规划或返修。 +- 沿用现有冻结/双臂/重放链,新增参数型schema_descriptions因素,不放宽原schema确定性重放。共享说明契约绑定canonical与wire hash,Python/Pi校验同一来源;新协议拒绝旧冻结续跑。 +- 已完成零调用验收:45项SQLite正反行为、500题默认输入/off wire不变、候选仅增1137 Schema字节;16原候选两条件SQL/结果/EX/Contract相同。真实CLI/认证HTTP和真实Pi SDK本地合成SSE通过,重开/漂移拒绝由回归覆盖;不将合成回放记作模型生成。 +- 八题D与ABBA两重复原卡已执行:用户撤销后加的人民币20元门禁,保留64次订阅OAuth/零重试/扩样。实际64次HTTP200、64原响应匹配与64臂重放一致;Forge EX/Contract10/16→12/16,Direct保持10/16,但无目标题两重复稳定恢复,md-052控制回退、控制7/8,预注册门槛失败。222015 tokens且用量完整,总tokens+3.39%、Forge每正确答案tokens−11.73%、生成P95−5.42%;人民币不可核算,不承诺免费。默认继续off,不补跑追分、不自动扩大R500/H,R0.6不晋级。保留[原准备卡](archive/benchmarks/benchmark-luna-schema-descriptions-ready-2026-09-08.json)与[实跑报告](archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.json)。 + +#### 15.1.36 限定样本里程碑归档(REQ-066,不发布版本) + +- 用户明确要求记录本轮突破、具体优化动作、文案与文档,并commit/push GitHub。沿当前候选分支串行交付,不恢复模型实验,不merge main/tag/Release/部署安装。 +- 里程碑为本轮处理Forge EX/Contract12/16 vsDirect10/16、两重复各6/8 vs5/8;保留8题重复分母、md-052控制回退及未通过门槛,不称首次/总体/统计优势。 +- 复用同名[技术简报](archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.md)、[devlog文案](devlog/2026-09-08-forge-schema-descriptions-milestone.md)和原JSON事实源;区分五字段description单变量、实验完整性工程及历史Structured/Compiler基础。默认off、H/R0.6与历史得分不变;归档不等于阶段晋级。 + +## 16. 整体工程质量优化(REQ-060,已实施并本地验收) + +- 整体评估已完成,基线018317d;16项发现与6个优化包的证据见[architecture-quality-review-2026-09-07.json](archive/engineering/architecture-quality-review-2026-09-07.json)。该文件保留评估时点,不改写为实施证据。 +- 用户后续明确“好的,那就按照你的调研结果执行吧”,授权OP-1至OP-6;先推进默认入口/分发、Stage生命周期/State一致性、通用规则适用域和执行结果契约,再推进诊断/投递、核心依赖与扩展/派生状态。 +- 实施门禁已完成:双State适配器/跨Python-Pi契约回归、无模型调用的隔离反例、Python3.11非editable wheel/sdist Quickstart、真实Web→Pi→SQLite丢响应恢复、Benchmark独立进程owner与挂起HTTP烟测。逐项结论及未测边界见[实施报告](archive/engineering/architecture-quality-implementation-2026-09-07.json);不以编译或内部测试替代外部采用。 +- Pi/Forge/Skills职责、权限/审批/失败关闭、历史成绩与R0.6/H门禁保持不变。本轮不commit/push、发布、部署或访问真实配置/运行库;不借结构优化扩张产品。 + +## 17. 文件结构专项治理(REQ-061,已完成) + +- 用户明确继续:盘点全仓公开受控文件,按保留/迁移/归档/待确认执行有收益的归位。保持稳定核心包与公开入口,处理tests内独立基准工具、docs内历史材料、包外PoC模板和演示脚本。 +- 历史JSON与本地运行资产不改写;Markdown只调整必要引用。迁移映射与前后hash留存,验证导入、CLI、CI、分发资源和文档链接。 +- 不删除未知工作、不访问真实配置/运行库、不调用模型、不commit/push/部署;不改变R0.6/H。 + +- 2026-09-07已完成:204文件归位,44份历史JSON字节不变;稳定核心包与入口保留,无旧公开路径包装层。目录职责与完整映射见[CONTRIBUTING](../CONTRIBUTING.md#repository-layout)及[治理记录](file-structure-governance-2026-09-07.json)。 +- 非editable PoC缺模板故障已先复现后修复,wheel/sdist资源与Quickstart、独立工具无模型合成烟测、Python/Pi回归、文档引用及站点构建/浏览器导航均通过。跳过项与环境限制在治理记录中逐项披露,不替代外部采用。 +- 旧本地results/data、已跟踪原始运行结果、数据库与缓存保留原位并列人工确认边界;未读取真实配置/运行库,不新增模型调用或自动重放,不commit/push/部署。 + +## 18. 长期知识资产保全(REQ-062,维护约定) + +- 用户明确要求后续推进时优先保存测试结论、报告和沟通沉淀;以[知识资产索引及维护规则](README.md#长期知识资产)为统一入口,不另建知识库或第二套决策真相源。 +- 保留原始问题、负结果、未采纳方案、决策理由与适用边界。纠错与新证据追加并链接原记录;目录归档、代码替换与当前测试通过不触发历史清理。 +- 本轮只核验已有公开材料、补齐索引与保存规则;真实配置/运行库不访问,模型不调用,不commit/push或部署。异地备份与原始数据迁移需单独授权,R0.6/H不晋级。 + +## 19. 候选分支与 PR(REQ-063,已授权) + +- 已明确授权审查后在独立候选分支commit、push并创建PR,验证远端CI;不合并main、不tag、不Release、不部署,不新增被测模型调用。 +- 本轮交付REQ-060/061/062已验收成果,并维护现行公共API接入说明,不新增#8外部Agent适配器。分支为`review/forge-engineering-evidence-2026-09-08`,阶段证据见[候选交付记录](candidate-delivery-2026-09-08.json)。 +- 公开范围审查未发现本次新增凭证/私有运行资产;历史84份归档hash匹配。63项相关契约/文档检查和隔离Quickstart通过。[PR #10](https://github.com/shisuidata/Forge/pull/10)已创建:首轮CI的pytest收集失败已复现并修复,代码修订`c5a3954`的五项远端检查通过;失败与成功run均留在候选记录。证据回写提交的最终CI以PR检查与完成评论为准。CI、本会话PR与维护者回执均不是外部采用证据,R0.6/H不晋级。 diff --git a/docs/governance-contracts.md b/docs/governance-contracts.md index e740b04..024dcab 100644 --- a/docs/governance-contracts.md +++ b/docs/governance-contracts.md @@ -6,7 +6,7 @@ ## 1. Contract 边界 -M0 只固定跨 Python/TypeScript 的治理语义,不修改 Task API、SQLite Schema、Forge QueryRun、数据库授权或 OAuth Runtime。跨 Contract 评审、Threat Model 与迁移结论见 [`governance-contract-review-2026-08-24.md`](governance-contract-review-2026-08-24.md)。 +M0 只固定跨 Python/TypeScript 的治理语义,不修改 Task API、SQLite Schema、Forge QueryRun、数据库授权或 OAuth Runtime。跨 Contract 评审、Threat Model 与迁移结论见 [`archive/engineering/governance-contract-review-2026-08-24.md`](archive/engineering/governance-contract-review-2026-08-24.md)。 | Contract | Owner | Truth Source | 用途 | |---|---|---|---| diff --git a/docs/platform-architecture.md b/docs/platform-architecture.md index 24508e6..d446c7a 100644 --- a/docs/platform-architecture.md +++ b/docs/platform-architecture.md @@ -1,6 +1,6 @@ -# Forge AI 数据任务平台架构 +# Forge Trust Runtime 与 Pi 目标架构 -> 状态:已确认目标架构,企业演进横向平面已纳入规划 · Last updated: 2026-08-25。本文描述 Pi、Forge、拾穗 DATA Skills 与渠道之间的长期边界,不表示所有模块均已实现。产品存在理由和方向边界见 [`product-north-star.md`](product-north-star.md),主动实施计划见 [`forge-enterprise-evolution-plan.md`](forge-enterprise-evolution-plan.md)。 +> 状态:长期目标与迁移边界,现状更新于 2026-09-07;不是第二份当前主架构。当前权威入口见 [`architecture.md`](architecture.md)。企业演进横向平面仍属规划,不表示所有模块均已实现。产品边界见 [`product-north-star.md`](product-north-star.md),主动实施计划见 [`forge-enterprise-evolution-plan.md`](forge-enterprise-evolution-plan.md)。 > > 中文架构全景图:[`architecture-diagrams/forge-platform-architecture.html`](architecture-diagrams/forge-platform-architecture.html),包含产品、技术、元数据、流程、闭环、部署、模型、安全、状态和接口等 11 个视角。 @@ -47,7 +47,7 @@ Pi Agent Platform 当前确认的是上述问题框架和产品公理,不是新的大范围实施承诺: -- Forge 当前对外定位继续是**可信 AI 数据任务平台**;结构化数据任务是高价值、高风险、可复算的第一验证场景。 +- Forge 当前对外定位是 **Trust Runtime:Evaluate → Enforce → Explain**;Pi 数据任务平台是其任务编排消费者,结构化数据任务是第一验证场景。 - “跨 Agent 长期上下文连续性”是高可信需求;“所有信息进入单一统一记忆系统”仍是待验证假设。集中式 Memory Store、联邦式 Context Plane、Registry/Event Store 组合之间尚未定案。 - 长期架构研究可讨论 Agent Native、Data-Team Led、Business Accessible、Human Accountable,但不得据此让 Forge 吞并通用 Agent Runtime、全部业务真相源或无边界工具执行。 - 任何新基础设施必须先由第二个真实消费者、明确责任边界、可证伪指标和相对现有方案的不可替代价值证明,再进入实施计划。 @@ -479,12 +479,12 @@ Web `/chat` 可复用同一观察能力提供当前任务右侧视图,但权 ## 12. 当前 Forge 职责迁移映射 -目标不是在现有 Forge Pipeline 外再套一层 Pi,而是消除重复调度。当前模块应按下表演进: +目标不是在旧 Forge Pipeline 外再套一层 Pi,而是消除重复调度。下表保留长期迁移职责;其中 Task 主权、QueryRun 审批和 Web 主链切换已完成,不应再向旧 Agent 添加主流程。 | 当前模块/能力 | 目标归属 | 处理方式 | |---|---|---| -| `agent/pipeline.py` Pipeline 路由与 Stage 推进 | Pi | 在 Pi Task Runtime 稳定后迁移并停止作为主编排器 | -| `agent/agent.py` 通用对话循环、pending state | Pi + Forge QueryRun | 对话和任务状态归 Pi;查询准备、审批状态改为 Forge QueryRun | +| `agent/pipeline.py` Pipeline 路由与 Stage 推进 | Pi | 已退出当前主编排;仅旧兼容入口保留 | +| `agent/agent.py` 通用对话循环、pending state | Pi + Forge QueryRun | 当前对话和任务状态归 Pi,审批/执行归 QueryRun;旧 pending state 仅回滚路径 | | `agent/llm.py` Registry 注入与 Forge JSON 生成 | Forge Contract + 可插拔 Model Backend | Forge 保留 PlanningEnvelope、Context、Contract 与接受权;API-key backend 可进程内生成,Pi OAuth backend 只提交不可信候选,统一进入 Forge Assurance | | `agent/prompts.py` 通用分析/表达 prompt | 拾穗 DATA Skills | 逐步替换为版本化 Skill 和 Artifact Schema | | `agent/memory` EMS/WMB 会话状态 | Pi | 当前会话、断点和工作记忆迁移到 Pi Task/Session | @@ -497,7 +497,7 @@ Web `/chat` 可复用同一观察能力提供当前任务右侧视图,但权 | `forge/executor.py` | Forge | 保留,且仍是唯一数据库执行入口 | | `agent/audit.py` 查询审计 | Forge | 保留并增加 `task_run_id` 关联 | | 图表和报告 Stage 调度 | Pi | Pi 选择 Skill 和顺序;确定性渲染器可以作为受控工具 | -| Web `/api/chat` 任务入口 | Pi | 渐进切换到 Pi Task API | +| Web `/api/chat` 任务入口 | Pi | 当前 Web 已走 Pi ChannelEvent/Task;旧 HTTP 默认 410、显式回滚才启用 | | Forge `/api/prepare-query` | Forge | 保持查询能力 API,不承担任务编排 | 迁移完成后的硬约束: @@ -508,23 +508,17 @@ Web `/chat` 可复用同一观察能力提供当前任务右侧视图,但权 - Pi 不复制 Registry 检索、Forge JSON 业务契约、Compiler、Lint 或 Executor;OAuth Session 只能消费 Forge 签发的有界 Context,并通过 Forge 定义的 Tool 生成不可信候选。 - 同一职责在目标架构中只能有一个主实现;旧实现只允许作为有明确下线时间的兼容路径。 -## 13. 当前实现基础 +## 13. 当前实现与仍待验收边界 -当前已有基础: +当前已经存在,不再列为“需要新增”: -- Forge `agent/pipeline.py`:Pipeline、Stage、Artifact 和断点状态雏形。 -- Forge `/api/prepare-query`:外部 Agent 生成待审核 SQL的安全边界。 -- Forge Web `/api/chat`、`/api/approve`:内部查询与审批路径。 -- Forge Registry、Compiler、Executor、Audit、Feedback 和 Memory。 -- 拾穗 DATA 的正式 Skills、示例、测试用例和发布门禁。 -- Pi 的 Skills、Extensions、SDK 和 RPC 能力。 +- `services/pi-orchestrator/`:Pi 主 Task/Attempt/Artifact 生命周期、Skill 执行及状态存储。 +- Forge 公共 Evaluate/Enforce/Explain 和 QueryRun 级 Policy、审批 hash、执行 lease、Evidence 完整性链。 +- Web Product BFF 与 Pi ChannelEvent/Task 主入口;飞书受限 runtime 与渠道适配。 +- Registry、Compiler、Assurance、只读 Executor、规范化执行结果;Benchmark 业务服务在 `forge/benchmark_service.py`,HTTP 层只做认证/DTO/异常适配。 +- 纯 `forge/dialects.py` 由 Evaluate/Enforce 统一消费。Evaluate 不探测生产 URL;执行 caller 显式传可信绑定,保留 tenant/scope ACL 交集。 +- wheel/sdist 中的核心 Schema、模板、静态资源及非 editable 合成 Quickstart 门禁。 -目标架构需要新增: +明确保留的兼容路径:`agent/agent.py`、`agent/pipeline.py`、旧 EMS/WMB 和 `/api/prepare-query`。`LEGACY_AGENT_API_ENABLED` 控制旧 Chat/Approve/Cancel HTTP 回滚,不影响当前 Pi/QueryRun 权威。旧 Memory 只在实际使用时初始化存储;关闭旧 HTTP 不意味着删除合法知识管理能力。 -- 独立、受限的 Pi Orchestrator Runtime。 -- 稳定的 TaskRun 与 Artifact Contract。 -- Pi 到 Forge 的 QueryRun 级审批协议。 -- 拾穗 DATA Skills 的 Pi Package 发布方式。 -- Web、飞书、钉钉共享的渠道适配接口。 - -迁移期间不删除 Forge 当前查询主链;新链路先以受控垂直切片并行验证,达到验收标准后再逐步替换硬编码的分析和报告 Stage。 +仍属长期目标或独立验收项:完整企业身份与委托、横向经济/上下文治理、全部渠道与客户生产部署。部署、模型统计准确率和生产数据库兼容性不能由本地结构/Quickstart 验证替代。 diff --git a/docs/poc-playbook.md b/docs/poc-playbook.md index e04ee06..f3d32da 100644 --- a/docs/poc-playbook.md +++ b/docs/poc-playbook.md @@ -25,13 +25,13 @@ customer-poc/ └── results/ ``` -仓库提供了 `customer-poc-template/` 作为起点,包含 `cases.example.json`、`failure_triage.template.md`、`delivery_report.template.md` 和空 Registry 文件。优先使用 CLI 初始化客户私有目录: +仓库提供了 `forge/templates/poc/` 作为起点,包含 `cases.example.json`、`failure_triage.template.md`、`delivery_report.template.md` 和空 Registry 文件。优先使用 CLI 初始化客户私有目录: ```bash forge poc init /path/to/customer-poc ``` -手工 fallback:`cp -R customer-poc-template /path/to/customer-poc`,然后把 `cases.example.json` 复制为 `cases.json`,把两个 `*.template.md` 复制为正式交付文件。 +手工 fallback:`cp -R forge/templates/poc /path/to/customer-poc`,然后把 `cases.example.json` 复制为 `cases.json`,把两个 `*.template.md` 复制为正式交付文件。 当前 EA 自动比较器以 SQLite fixture 为标准入口。客户可以使用脱敏后的最小数据副本;真实 PostgreSQL/MySQL 连接用于 compatibility smoke 和最终人工审核,不要把生产数据复制进仓库。 @@ -68,15 +68,15 @@ forge sync --db "$DATABASE_URL" --out customer-poc/registry/schema.registry.json 3. 验证数据库账号确实只读,再设置 `DATABASE_READONLY_CONFIRMED=true`。只有当客户环境已确认该账号无法写入、无法 DDL、无法访问超出授权的敏感表时,才能打开这个开关;否则 `forge doctor --profile poc` 的 fail 是可信执行门禁,不能为了通过检查而绕过。 4. 录入 5–10 个核心原子指标及必要衍生指标,补充歧义和字段约定。 -5. 复制一个现有 `tests/accuracy/methods/method_*.py`,只调整客户 Registry、cases、provider 和模型,不在文件中写 API Key。 +5. 复制一个现有 `tools/benchmarks/accuracy/methods/method_*.py`,只调整客户 Registry、cases、provider 和模型,不在文件中写 API Key。 6. 每题至少运行三次: ```bash -python tests/accuracy/runner.py --method --runs 3 --retry 2 --fresh -python tests/accuracy/evaluate_ea.py --methods \ +python tools/benchmarks/accuracy/runner.py --method --runs 3 --retry 2 --fresh +python tools/benchmarks/accuracy/evaluate_ea.py --methods \ --cases /absolute/path/customer-poc/cases.json \ --db /absolute/path/customer-poc/database.db --save -python tests/accuracy/triage_failures.py --method \ +python tools/benchmarks/accuracy/triage_failures.py --method \ --cases /absolute/path/customer-poc/cases.json ``` diff --git a/docs/product-design-roadmap-2026-08-25.md b/docs/product-design-roadmap-2026-08-25.md index ea9687b..067a10a 100644 --- a/docs/product-design-roadmap-2026-08-25.md +++ b/docs/product-design-roadmap-2026-08-25.md @@ -4,7 +4,7 @@ > > Requirement:[`REQ-2026-08-25-016`](requirements-pool.md#req-2026-08-25-016基于产品北极星重建产品设计与阶段计划) > -> 本文依据 [`product-north-star.md`](product-north-star.md) 重建 Forge 的产品结构与未来顺序。它不批准代码实施,不替代 [`forge-enterprise-evolution-plan.md`](forge-enterprise-evolution-plan.md)。旧 [`web-product-shell-plan-2026-08-24.md`](web-product-shell-plan-2026-08-24.md) 和 `821065f` 原型保留为第一版历史与反例。 +> 本文依据 [`product-north-star.md`](product-north-star.md) 重建 Forge 的产品结构与未来顺序。它不批准代码实施,不替代 [`forge-enterprise-evolution-plan.md`](forge-enterprise-evolution-plan.md)。旧 [`archive/plans/web-product-shell-plan-2026-08-24.md`](archive/plans/web-product-shell-plan-2026-08-24.md) 和 `821065f` 原型保留为第一版历史与反例。 ## 1. 重建结论 diff --git a/docs/product-north-star.md b/docs/product-north-star.md index 0d35d92..af03532 100644 --- a/docs/product-north-star.md +++ b/docs/product-north-star.md @@ -528,9 +528,9 @@ Forge 的学习不应是“模型自动记住一切”,而是: | 本文 | 产品北极星、定位、正确性与共识边界 | | [`product-axioms.md`](product-axioms.md) | 不可轻易违反的稳定公理 | | [`ai-native-enterprise-thesis.md`](ai-native-enterprise-thesis.md) | 完整论证、反证、未来情景和待验证假设 | -| [`product-direction-architecture-review-2026-08-24.md`](product-direction-architecture-review-2026-08-24.md) | 当前代码与产品方向的证据化复审 | +| [`archive/engineering/product-direction-architecture-review-2026-08-24.md`](archive/engineering/product-direction-architecture-review-2026-08-24.md) | 当前代码与产品方向的证据化复审 | | [`product-design-roadmap-2026-08-25.md`](product-design-roadmap-2026-08-25.md) | 基于北极星重建的产品面、对象、信息架构与长期阶段方向 | -| [`short-term-product-spine-plan-2026-08-25.md`](short-term-product-spine-plan-2026-08-25.md) | 先底层 Product Projection/BFF、后真实 Web Shell 的近期实施计划 | +| [`archive/plans/short-term-product-spine-plan-2026-08-25.md`](archive/plans/short-term-product-spine-plan-2026-08-25.md) | 先底层 Product Projection/BFF、后真实 Web Shell 的近期实施计划 | | [`platform-architecture.md`](platform-architecture.md) | Pi、Forge、Skills、渠道和真相源职责 | | [`forge-enterprise-evolution-plan.md`](forge-enterprise-evolution-plan.md) | 唯一主动实施计划和阶段门禁 | | [`requirements-pool.md`](requirements-pool.md) | 所有需求、评估、决策和状态历史 | diff --git a/docs/product-projection-contracts.md b/docs/product-projection-contracts.md index f666ea5..df4e5e3 100644 --- a/docs/product-projection-contracts.md +++ b/docs/product-projection-contracts.md @@ -210,7 +210,7 @@ npm --prefix services/pi-orchestrator test .venv/bin/pytest -q tests/test_product_projection_contracts.py tests/test_artifact_contracts.py ``` -TypeScript 测试会检查生成 JSON Schema 与 TypeBox 完全同步;Python 使用同一生成 Schema,并通过 `agent/contracts/product_projection_semantics.py` 对全部正向 fixtures 和全部结构/语义负向 mutation 做 reason-code parity。 +Python 使用生成 Schema,并通过 `agent/contracts/product_projection_semantics.py`;TypeScript 使用 TypeBox 与对应 semantic gate。双侧消费全部正向 fixtures 和结构/语义负向 mutation,验证接受/拒绝及 reason-code parity;不以源码对象相等代替语义一致。 ## 11. SP1 结果与 SP2 入口 @@ -222,6 +222,26 @@ SP1 已完成: - authenticated read-only Pi API; - 2 MB 响应边界、去敏、损坏引用、pagination、10K Task 性能与 restart recovery 测试。 -证据见 [`product-spine-sp1-evidence-2026-08-25.md`](product-spine-sp1-evidence-2026-08-25.md)。 +证据见 [`archive/engineering/product-spine-sp1-evidence-2026-08-25.md`](archive/engineering/product-spine-sp1-evidence-2026-08-25.md)。 SP2 只能增加 scope-aware `ReportStore.list`、authenticated `/api/product/*` BFF、Workspace partial/offline 聚合和对应 Python 测试。不得在 SP2 新增第二状态源、开始 Product Shell 或开放 Agent Runtime。 + +## 12. 契约族 owner 与 Stage 扩展(2026-09-07) + +本节记录后续契约收敛;上节保留 SP1 当时的阶段边界,不充当当前主动计划。 + +| 契约族 | 唯一结构编辑源 | 跨语言语义验证 | +|---|---|---| +| Product Projection | `services/pi-orchestrator/src/product-projections.ts` TypeBox | `product-projection-fixtures.v1.json`,TS/Python 双侧 semantic gate | +| Clarification / MetricDefinition / QueryResult / Analysis / Advisory / RenderedOutput | `structured-artifact-tools.ts` payload + `contracts.ts` envelope/registry | `structured-artifact-fixtures.v1.json`,TS validator 与 Python `artifact_semantics.py` | +| Governance / Benchmark / Reporting 既有 schema 族 | `agent/contracts/*.schema.json` Python 侧契约源 | 保持已有契约族测试;本轮不从 TS 手写镜像反向覆盖 | + +Structured Artifact 结构统一通过 `npm --prefix services/pi-orchestrator run export:structured-contracts` 导出。Python 调用 `validate_contract` 同时执行 schema 与语义,不只调用裸 JSON Schema。42 个共享正反例覆盖持久化 `row_count == len(rows)`(包括 truncated)、每行宽度、重复列、producer、版本、额外字段、日期时区/闰日/闰秒、不完整输出的补查或问题要求,以及分析内容边界。该契约族日期校验不依赖 jsonschema 可选 RFC3339 extras 是否安装。 + +调用时的 evidence allowlist、QueryRun 归属、报告源 Artifact 身份与逐字 finding 保留,仍由显式 Stage submission 边界验证;静态 artifact 本身不能证明这些上下文事实。QueryResult-required Advisory 不允许用 `ctx_*` 代替查询行证据。 + +`stage-descriptors.ts` 集中授权 Skill 身份、output/tool、model stage 和 evidence policy。Advisory 的名单、类型与 policy 列表从该表派生;`skill:*` attempt 按授权 Skill 的确切 descriptor 取 scope,历史核心 attempt 使用精确映射。未知身份失败关闭,不再用 report/query 子串猜 scope。所有专业业务方法仍是明确类型的 `clarify/reviewMetric/analyze/advise/writeReport`,不存在 `execute(any)`。 + +本地隔离源副本演练已实际执行:新增 Advisory 只加 descriptor 行并复用既有 advise/tool/schema;新增一等 Stage 增加 descriptor/output、scope、明确类型 executor 方法、TypeBox registry 及 Python contract 注册,随后 TS/Python 接受其结果并拒绝未知版本/额外字段。Application 生命周期、HTTP 暴露、planning 和产品展示仍需按业务显式接入,不宣称由 descriptor 自动生成。演练未调用模型或外部渠道,临时源副本与脚本已移除。 + +Product Attempt 的 `request_id`、`usage_status`、`model_revision`、`skill_policy_version` 是可选诊断字段;`usage_status` 仅允许 `not_started/known/unknown`。缺失与未知不能推断为零成本;契约新增不意味着已有历史 Attempt 可恢复真实成本。 diff --git a/docs/requirements-pool.md b/docs/requirements-pool.md index 1a1d455..2beaf93 100644 --- a/docs/requirements-pool.md +++ b/docs/requirements-pool.md @@ -426,7 +426,7 @@ ID / 标题 / 日期 / 状态 - **Plan**:`forge-enterprise-evolution-plan.md` H3。 - **Architecture**:不改变 Pi/Forge/渠道职责;测试环境只验证现有 Contract、状态和 Renderer,不成为第二套生产状态机。 - **执行结果**:同一 TaskRun 完成 Query→Approval→Execution→Analysis→Report,物理不变量全部 PASS;桌面产品旅程与可信业务结果 FAIL。Analysis 183.265s,完整 Task 349.028s;PDF/PPTX 均 ready,重复 ChannelEvent 未重放 SQL。 -- **正式评审**:[`golden-journey-acceptance-2026-08-24.md`](golden-journey-acceptance-2026-08-24.md)。Verdict:`Physical chain PASS / Trusted product outcome FAIL`。 +- **正式评审**:[`golden-journey-acceptance-2026-08-24.md`](archive/engineering/golden-journey-acceptance-2026-08-24.md)。Verdict:`Physical chain PASS / Trusted product outcome FAIL`。 - **证据**:NAS `~/services/forge-m4.1/e2e/golden-20260824T101129Z/`;本地 `/tmp/forge-golden-journey-evidence/`。隔离服务已停止,临时 service/channel keys 已删除,生产 Forge/Pi health 正常。 --- @@ -467,7 +467,7 @@ ID / 标题 / 日期 / 状态 - Python `553 passed / 24 skipped`;Pi `96 passed`;typecheck、npm audit、桌面 Playwright 和实际 NAS Chrome PDF 内容扫描均通过。 - 同一 Golden Journey 重跑 262.399s 完成,1 次审批/1 次执行,重复消息未创建第二个 QueryRun;Report/PDF/PPTX ready,数据源保持 mode `0400` 且无 WAL/SHM。 - Report running 与 Publication complete 同页可见;PDF 不再包含 `file://`/`/home/`/默认 header;重复品类 label 使 ChartArtifact fail-closed 为 0,不再发布误导图。 -- 正式证据:[`golden-journey-p0-closure-2026-08-24.md`](golden-journey-p0-closure-2026-08-24.md)。 +- 正式证据:[`golden-journey-p0-closure-2026-08-24.md`](archive/engineering/golden-journey-p0-closure-2026-08-24.md)。 --- @@ -943,7 +943,7 @@ ReportRun / ReportRevision(不可变快照) - **阶段顺序提案**:N2 用户门禁 → W3A.2 北极星驱动原型 → W3B Human Control Plane → M1A Runtime Trust → R1 Agent Data Runtime MVP → G1 Data Trust Control Plane → Q1 Quality/Assurance → H6 Reusable Deliverables → 按证据选择 M1B/M2/M3 → M5 第二场景。 - **关键门禁**:Agent Runtime 执行能力不得早于 M1A;W3B 只接已有 Human truth sources;G1/Q1 不用页面或 Contract 冒充 Runtime;R1 必须通过真实 Agent Golden Journey。 -旧 [`web-product-shell-plan-2026-08-24.md`](web-product-shell-plan-2026-08-24.md) 已标记为历史第一版;当前原型和生产代码均未修改。2026-08-25 用户进一步确认短期实施必须采用“底层真实框架 → 前端真实投影 → 持续人工测试”的顺序;完整导航和长期阶段仍可在真实测试中修订。 +旧 [`web-product-shell-plan-2026-08-24.md`](archive/plans/web-product-shell-plan-2026-08-24.md) 已标记为历史第一版;当前原型和生产代码均未修改。2026-08-25 用户进一步确认短期实施必须采用“底层真实框架 → 前端真实投影 → 持续人工测试”的顺序;完整导航和长期阶段仍可在真实测试中修订。 --- @@ -972,7 +972,7 @@ ReportRun / ReportRevision(不可变快照) ### 实施计划产出 -详细计划见 [`short-term-product-spine-plan-2026-08-25.md`](short-term-product-spine-plan-2026-08-25.md): +详细计划见 [`short-term-product-spine-plan-2026-08-25.md`](archive/plans/short-term-product-spine-plan-2026-08-25.md): ```text SP0 Contract / Truth Source Closure @@ -1008,7 +1008,7 @@ SP0 Contract / Truth Source Closure - 增加 authenticated read-only Pi API:`GET /v1/conversations`、`GET /v1/conversations/{conversation_id}`、`GET /v1/tasks/{task_run_id}/detail`;响应 `no-store`,scope mismatch 不披露对象。 - 10K Task/1K Conversation 首版 list 约 `19,040 ms`,定位为相关子查询 + N+1 JSON scan;改为 scoped CTE + window rank + grouped first/latest 后平均约 `26.8 ms`,因此未新增 schema v5。 - 验证:Pi `114 passed`、Python `569 passed / 24 skipped`、typecheck、npm audit、101-entry pagination、SQLite restart、auth/scope/no-store/bad cursor、2 MB boundary 和 `git diff --check` 通过。 -- 正式证据:[`product-spine-sp1-evidence-2026-08-25.md`](product-spine-sp1-evidence-2026-08-25.md)。 +- 正式证据:[`product-spine-sp1-evidence-2026-08-25.md`](archive/engineering/product-spine-sp1-evidence-2026-08-25.md)。 SP2 已完成并通过 Backend Gate,现进入 SP3。 @@ -1020,7 +1020,7 @@ SP2 已完成并通过 Backend Gate,现进入 SP3。 - SP2 在暴露 Task list 前补充同版本 `TaskSummaryV1`,避免前端消费 raw TaskRun metadata;Task list 明确 bounded/truncated,Report list 支持 cursor。 - Registry revision 改为内容 SHA-256;Workspace 在 Pi/Report/Registry 或读取上限发生时显示 partial/offline,不伪装 ready。 - 验证:Python `575 passed / 24 skipped`、SP2 定向 `34 passed`、Pi `114 passed`、typecheck、npm audit 0 vulnerabilities、scope/auth/cursor/offline tests 和 `git diff --check` 通过。 -- 正式证据:[`product-spine-sp2-evidence-2026-08-25.md`](product-spine-sp2-evidence-2026-08-25.md)。 +- 正式证据:[`product-spine-sp2-evidence-2026-08-25.md`](archive/engineering/product-spine-sp2-evidence-2026-08-25.md)。 Backend Gate 已通过,SP3 已完成,现进入 SP4。 @@ -1031,7 +1031,7 @@ Backend Gate 已通过,SP3 已完成,现进入 SP4。 - 建立统一 panel/status/button/field/table/notice/empty/partial/offline/skeleton/code/evidence 组件及 skip-link/focus/reduced-motion/mobile-nav 基础。 - Shell JS 只处理导航和状态标签,不 fetch、不写 localStorage、不持有业务状态。 - 验证:Python `581 passed / 24 skipped`、SP3/Docs 定向 `10 passed`、Pi `114 passed`、typecheck、npm audit、static serving、template render 和 `git diff --check` 通过。 -- 证据:[`product-spine-sp3-evidence-2026-08-25.md`](product-spine-sp3-evidence-2026-08-25.md)。 +- 证据:[`product-spine-sp3-evidence-2026-08-25.md`](archive/engineering/product-spine-sp3-evidence-2026-08-25.md)。 SP4 已完成并通过 SP5 入口门禁,现进入 SP5。 @@ -1042,7 +1042,7 @@ SP4 已完成并通过 SP5 入口门禁,现进入 SP5。 - 使用本地安全 DOM Markdown renderer,无 `innerHTML/eval`,不复制业务状态。 - 首轮视觉审查发现审批操作不在主路径、pending 错标“可用”、状态层级混淆;均已修正,复审无 P0。 - 验证:Python `583 passed / 24 skipped`、Product/Web/Docs `33 passed`、Pi `114 passed`、typecheck/npm audit/JS syntax/Playwright 1440×900 与 1600×1000/0 error/0 overflow/chat send/dialog/`git diff --check` 通过。 -- 证据:[`product-spine-sp4-evidence-2026-08-25.md`](product-spine-sp4-evidence-2026-08-25.md);截图 `/tmp/forge-sp4-task-detail.png`。 +- 证据:[`product-spine-sp4-evidence-2026-08-25.md`](archive/engineering/product-spine-sp4-evidence-2026-08-25.md);截图 `/tmp/forge-sp4-task-detail.png`。 ### SP5 Human Golden Gate + Atlas Candidate(自动门禁已通过) @@ -1051,7 +1051,7 @@ SP4 已完成并通过 SP5 入口门禁,现进入 SP5。 - 重复消息返回原任务;过期重复批准返回 409 且不重放 SQL。等待审批与完成态通过 restart recovery;Pi offline 时 Workspace 返回 partial,Report/Data 继续可读。 - Live Gate 修复 insecure-HTTP ID、瞬时 ready 轮询、同源 HTTP Report URL、空 Attempt error、长 SQL Grid overflow 和完成态历史审核误标权限;复杂查询 Assurance 拒绝与 Analysis `incomplete` 作为 fail-closed 反证保留。 - 最终验证:Python `583 passed / 24 skipped`、Pi `115 passed`、typecheck/npm audit/JS syntax/`git diff --check`、双桌面 12 routes/0 external request/0 error/0 overflow 全部通过。 -- 正式证据:[`product-spine-sp5-evidence-2026-08-25.md`](product-spine-sp5-evidence-2026-08-25.md)。自动门禁 PASS;用户仍需对稳定 Atlas URL 给出 `PASS / CHANGE / REMOVE`,在此之前不选择 M1A/G1/Q1/H6,也不替换生产。 +- 正式证据:[`product-spine-sp5-evidence-2026-08-25.md`](archive/engineering/product-spine-sp5-evidence-2026-08-25.md)。自动门禁 PASS;用户仍需对稳定 Atlas URL 给出 `PASS / CHANGE / REMOVE`,在此之前不选择 M1A/G1/Q1/H6,也不替换生产。 ## REQ-2026-08-25-018:Atlas 网站性能严重不可接受 @@ -2233,8 +2233,8 @@ Forge 的公开定位面向国际开源开发者,但 GitHub 仓库首页默认 - 版本审阅发现既有全局CTE名称过滤可能把同名未授权物理表当作CTE跳过。已用按scope来源和方言归一化的物理关系校验修复;扁平Registry不授权schema/catalog限定来源,合法CTE/derived不受误伤。 - Assurance升级query-assurance-v10;旧v9 QueryRun审批必须以assurance_revision_drift失败关闭,重新prepare/审核,不迁移旧证据。此项是既有安全行为维护,不是模型成绩提升。 -- Python/Pi全量、定向回归、跨方言静态校验与真实合成SQLite/API冒烟、Quickstart、站点构建及文档链接的实测结果与跳过范围见[发布验证报告](release-verification-2026-09-07.json)。本轮被测模型调用0。 -- 全部报告入口见[文档导航](README.md),原件/公开副本映射见[报告公开说明](report-publication-2026-09-07.json)。产品需求与H/R0.6门禁不因仓库推送自动晋级。 +- Python/Pi全量、定向回归、跨方言静态校验与真实合成SQLite/API冒烟、Quickstart、站点构建及文档链接的实测结果与跳过范围见[发布验证报告](archive/engineering/release-verification-2026-09-07.json)。本轮被测模型调用0。 +- 全部报告入口见[文档导航](README.md),原件/公开副本映射见[报告公开说明](archive/engineering/report-publication-2026-09-07.json)。产品需求与H/R0.6门禁不因仓库推送自动晋级。 ### 远端CI阻断与测试隔离修复 @@ -2242,3 +2242,187 @@ Forge 的公开定位面向国际开源开发者,但 GitHub 仓库首页默认 - 改用临时Skill包和真实Pi加载器验证白名单与单Skill隔离;去掉生产Skill文案及固定20数量断言,保留缺失包失败关闭,不改生产源码、跳过用例或放宽readiness。 - 加强沙箱后另发现六项HTTP测试会写默认.runtime/state,已改用每测试独立配置。初轮本地门禁未覆盖此目录,不能声称初轮完全没有运行目录访问;未读取或清理该既有目录。 - 禁止访问旁仓、真实.runtime及凭证,并禁止对外联网后,定向20通过、完整Pi155通过、typecheck通过;本轮模型调用仍0。首次失败、隔离更正和本地结果追加在发布验证报告中,后续远端结论以对应提交的CI为准。 + +## REQ-2026-09-07-060:整体产品模式与代码演进质量评估 + +### 原始表达 + +> 我们从整体的产品设计模式,包括代码的模型质量上,去评估一下我们代码未来的可维护性、可观测性以及可扩展性。 +> +> 我们要去优化一下当前所有的这些代码,看一下在一些代码复用,或者是在代码整体的全局结构上面,是不是有很多优化的地方。 + +### 价值、边界与评估方式 + +- 已授权整体评估:以当前产品模式和实际调用链核对职责、领域/状态建模、代码复用、故障观测及扩展成本,产出证据分级与可执行优化顺序。代码模型质量按领域/状态/Contract建模理解,同时审视模型生成质量与确定性安全边界的分离,不发起付费模型实验。 +- 当前产品主线仍是Evaluate→Enforce→Explain;Pi保持Task真相源,Forge保持可信执行权,DATA Skills保持专业方法层。不借评估扩张平台、不改变审批、权限、Evidence或历史评分。 +- 先做跨目录静态结构度量、代表性调用链审查和隔离反例验证;文件大、重复字符串或抽象数量不直接判为缺陷。未阅读部分和未测的生产规模必须明确标记,不能把评估称作穷尽证明。 +- 替代方案是全面重写、微服务拆分或统一万能基类;会引入大范围回归并推迟真实采用验证,不作为默认方案。优先考虑减少职责混合、统一确属同一业务规则的实现、建立可验证的演进边界。 +- 风险:跨Python/Pi Contract漂移、持久状态迁移、可观测性采集敏感数据、抽象后更难诊断;建议必须给出收益、反证、迁移边界和验证方式。机会成本是暂停新增特性而投入结构治理,须以具体风险和变更成本排序。 +- 本轮不自动实施未确认的全局重构,不commit/push、部署、读取凭证或真实运行数据库;候选实施包待用户基于评估结果明确接受。 + +### 已完成评估(基线018317d) + +- 116个运行时代码文件完成结构解析(82 Python、31 TypeScript、3 JavaScript),共46529行;另对当前主链、契约、CI/打包及入口文档定点深审,不声称全仓逐行审计。完整范围、16项分级发现、反证、验证和6个候选工作包见[整体工程质量评估](archive/engineering/architecture-quality-review-2026-09-07.json)。 +- 已隔离复现:默认阶段重试复用终止Attempt、取消不触发阶段abort、内存/SQLite失败语义不同、数据集规则拒绝自定义Registry、Evaluate默认auto的两输入分歧、上游500/503误映射404、合法执行结果被文案前缀判错。非editable wheel实建成功但缺forge/schema.json,import forge失败;没有因此否定已验证的editable Quickstart。 +- 产品边界、QueryRun hash/审批/lease、Pi SDK隔离工具、既有Contract导出与共享fixture是应保留的基础。真正优先的复用对象是领域规则、阶段生命周期、错误/结果契约及投影语义,不是按行数拆文件或建立万能基类。 +- 推荐首批候选为外部默认入口/打包、阶段生命周期/State一致性、规则适用域/结构化执行结果;随后推进观测/投递、核心依赖边界及扩展契约。所有候选尚未获得具体实施授权,不自动转入重构执行。 +- 本轮模型调用0、生产源码改动0;未访问真实配置/运行库、未运行生产负载/外部渠道/浏览器视觉验收,静态并发与投递风险保持未实测标记。前次绿色CI不覆盖本轮新增反例;本轮没有以全套测试替代这些实验。 + +### 实施授权(2026-09-07) + +> 好的,那就按照你的调研结果执行吧 + +- 用户接受上述调研建议,授权实施OP-1至OP-6;先完成入口/分发、阶段生命周期、规则适用域及执行结果,再收敛诊断/投递、核心依赖和扩展契约。 +- 保持现有产品范围、Pi Task权威、审批/权限/失败关闭及历史证据,不新增调度器、模型实验、Connector或生产迁移。不commit/push、发布或部署。 +- 验收逐项绑定AQ-01至AQ-16:隔离反例与跨层回归、非editable安装烟测、实际Web表面验证;未知成本和交付结果必须显式表达。 + +### 实施完成与边界(2026-09-07) + +- OP-1至OP-6及AQ-01至AQ-16已完成实现与本地验收;逐项变更、失败反例和实际运行证据见[实施报告](archive/engineering/architecture-quality-implementation-2026-09-07.json),原评估不回写为实施证据。 +- Stage统一使用不可拆分State bundle、双适配器事务、默认新Attempt和成功Command回放;取消/超时/中断不允许迟到Artifact改写终态,Plan随权威Task迁移收口。Benchmark准入与Task同事务、单机单owner、挂起HTTP有界停止,不自动重放模型调用。 +- 公共Evaluate使用纯方言解析;Forge JSON缺少受信方言返回dialect_required,Direct可用generic parser。Executor统一ExecutionResult,基准数据集规则必须显式Profile;Assurance v11/scoped-policy-v1使旧审批证据按既有漂移门禁失效。wheel与sdist在Python3.11非editable安装、离开源码cwd后完成真实Quickstart。 +- Web/Pi/Forge保留安全request/业务ID、稳定错误code及未知用量;审计只读联查不双写,飞书receipt只重送原Task presentation,连接状态不由进程存活推断。真实Web/Pi/SQLite丢响应重发只有一个Task,乱序Conversation与诊断显示经浏览器验收。 +- Python3.14回归983 passed/28 skipped,隔离Python3.11为983 passed/3 skipped(其中一个为未安装Playwright的整模块跳过);Pi215 passed及typecheck通过。数字是本次观察,不是永久完成门槛。 +- 不宣称生产HA、远端副作用撤销、真实飞书可达、已知结算成本、统计准确率收益或外部采用。模型调用0,未访问真实配置/运行库,未commit/push、发布或部署;R0.6/H未晋级。 + +--- + +## REQ-2026-09-07-061:仓库文件结构专项治理 + +### 原始表达与授权 + +> 好的,另外我们项目的文件结构也做了一遍治理了吗 +> +> 好的,那就继续 + +- 用户接受在REQ-060局部边界治理之外继续做全仓文件组织专项:先形成保留/迁移/归档/待确认清单,再执行有收益的归位并验证实际引用。 +- 价值:把可维护运行时、自动化回归、独立基准工具、模板资源、演示脚本和历史证据分清,避免维护者误把付费实验当测试、把旧计划当当前任务,修复包外运行资源。 +- 边界:保留Pi/Forge职责及现有CLI/API;不借目录整理改业务规则,不机械采用src布局,不删除历史证据,不读取或搬迁真实配置、凭证、数据库、未跟踪运行结果及缓存。既有未提交修改全部保留;不commit/push/部署,不调用模型或外部渠道。 +- 决策:独立Benchmark工具从tests归tools/benchmarks;历史文档按证据与旧计划归docs/archive;PoC模板归forge包内资源;造数脚本归demo。稳定核心包、公开启动文件、现有工具原型和规模适中的运维scripts保留。 +- 风险与替代:迁移可能破坏相对路径、历史链接、安装资源和忽略规则;逐项记录路径与hash,JSON历史证据保持原字节,Markdown只修复必要引用。仅加目录说明虽便宜但不能解决测试误分类和包外资源;全面重排则回归面大于收益。 +- 机会成本:本轮只做文件组织与必要入口修复,不推进产品扩张或用内部结构验收替代R0.6/H外部采用。 +- 验收:治理清单与完整move映射、受影响引用、无模型CLI/合成数据烟测、Python/Pi回归、非editable资源及文档链接;旧本地运行数据保持原位并列为人工迁移边界。 + +### 实施与验证(2026-09-07) + +- 已归位204个公开文件:110个独立基准工具/语料文件、84份历史文档/证据、9个包内PoC模板和1个demo脚本。153文件字节不变,51文件仅必要路径/引用调整;44份历史JSON原字节保留。逐文件前后路径与SHA-256、保留及待人工确认清单见[治理记录](file-structure-governance-2026-09-07.json)。 +- 修复真实分发缺陷:旧非editable wheel运行`forge poc init`缺少包外模板;改为包内资源并加入现有package smoke,Python3.11 wheel与sdist安装后初始化/校验及Quickstart均通过。 +- 基准工具13个help入口、33方法发现、25方法共享夹具、40个合成CSV往返、7条失败语料参考查询、Spider合成加载/执行和无Key拒绝烟测通过;未调用模型、访问真实数据或重跑历史成绩。 +- Python3.14为983 passed/28 skipped;跳过26项浏览器E2E与2项缺少完整Mini-Dev资产测试。Pi215 passed及typecheck通过,扩展文档检查146份Markdown/512个链接,无缺失;Pi目标由主流程补核验。网站28页构建及真实浏览器课程→基准页导航通过;未检查尚未推送的GitHub URL在线可达性。 +- 目录职责纳入[CONTRIBUTING](../CONTRIBUTING.md#repository-layout)。保留旧ignored results/data、数据库和缓存的忽略规则;已跟踪的旧Method K原始结果及failure corpus test.db未读取/搬迁,是否迁移或移出版本控制须人工确认。既有未提交工作保留,不commit/push/部署;R0.6/H不晋级。 + +--- + +## REQ-2026-09-08-062:测试证据与沟通沉淀的长期保全 + +### 原始表达与授权 + +> 好的,我认为可以继续了,保存好我们之前的测试结论我报告文档和在沟通过程中沉淀出来的文档,我觉得这个项目可能最有价值的部分就是这些了 + +- 用户明确将既有测试结论、报告和沟通中沉淀的文档视为项目长期核心资产,要求后续推进时完整保留。此要求授权文档维护和保全核对,不授权新模型实验、发布、commit/push或访问原始私有运行数据。 +- 价值:让未来实现、研究和复盘能够恢复当时的问题、证据、反例、决策理由及限制,避免重走已验证无效的路线;代码替换或计划过期不使这些知识失效。 +- 决策:复用docs/README.md作为知识资产总入口,requirements-pool.md追加沟通原话与决策,当前状态投影只保留有效结论;历史证据和被替代计划继续留在原归档路径。补齐缺失入口,将保留规则写入既有维护约定,不另建一套知识库或复制全部报告。 +- 边界与风险:不以整理、去重、压缩上下文或当前测试通过为由删除历史负结果;纠错另记依据与受影响结论,不回填原成绩。公开脱敏副本与受限原件严格分开,不从私有数据库或完整会话补造材料。当前可见沟通的归档不等于全部聊天记录已备份。 +- 替代与机会成本:仅口头承诺不能约束后续维护;复制多套报告会造成版本分叉,建设新知识平台会偏离R0.6。本轮只补索引与持久规则,保持产品、架构和实验门禁不变。 +- 验收:归档文件与既有迁移hash一致、逐文件导航无遗漏,既有需求历史保留;文档本地链接通过。明确区分本地落盘、Git提交和异地备份,不宣称未执行的备份。 + +### 本轮保全核验(2026-09-08) + +- 已补齐4份历史产品/架构评审的入口,84份归档文件现均在[文档总索引](README.md)逐项可达,并与REQ-061迁移记录中的目标SHA-256一致。 +- 84份归档及38份稳定设计、课程、复盘/失败案例与图示,共122份受核验文件前后字节一致;此前需求历史未改写,既有主动计划只追加本要求。 +- 公开Markdown及CONTRIBUTING本地链接核验通过。只运行文档/hash核验,不重跑实验或修改业务代码;真实配置、私有会话和原始运行库未读取。 +- 用户原话、价值判断与保留边界已落盘,知识资产入口和维护规则已写入README、CONTRIBUTING及当前状态。此结论不代表所有历史聊天已导出,也不代表Git提交、远端发布或异地备份已完成。 + +--- + +## REQ-2026-09-08-063:候选分支与 PR 交付 + +### 原始表达与授权 + +> 我们继续下一步 + +用户在交互选项中明确选择“候选分支与 PR”:先审查公开范围和敏感内容,再将已验收变更commit、push到独立分支并创建PR,验证远端CI;暂不合并main、不发Release、不部署。 + +- 目标与价值:把REQ-060工程优化、REQ-061文件治理和REQ-062知识保全变成可追溯、可克隆的候选版本,为R0.6独立试跑提供固定revision。 +- 范围:审查当前未提交差异及新文件;保持历史报告hash与原始结论,排除真实配置、数据库、缓存、原始运行结果及未知私有工作。修正现行外部接入指南与已实现公共API之间的过时描述,不新增#8 Agent适配器或第二套Runtime。 +- 风险与控制:候选推送会公开源码和文档;先核对范围及敏感字面量,再显式暂存。真实CI失败按最小范围修复并留痕,不跳过失败测试;不得把内部CI或维护者复测算作外部采用。 +- 替代与机会成本:仅本地提交不能提供新的远端试跑版本;先补Agent示例会继续增加未封存改动。本轮选择先交付已验收成果,不合并、不tag、不Release、不部署,也不新增付费模型调用。 +- 验收:独立候选分支、可审查commit/PR与远端CI结果;历史证据完整、无私有运行资产进入本次提交;说明仍未关闭的R0.6/H及外部独立回执要求。 + +### 交付与验证(2026-09-08) + +- 已创建[PR #10](https://github.com/shisuidata/Forge/pull/10),候选代码提交为`7b267d727a9f0ee28596958cffce0b2f3996da61`,CI修复提交为`c5a3954f11a85cb3bb070363cbbda9da6ae83769`;未合并main、tag、Release或部署。 +- [首轮CI](https://github.com/shisuidata/Forge/actions/runs/34146824586)在`test_accuracy_triage.py`收集阶段因`ModuleNotFoundError: tools`失败;其余四项检查通过。Python 3.11最小隔离环境复现同一失败,在pytest配置中显式加入源根目录后,console与`python -m pytest`入口的两项TopN语义回归均通过。工具仍不进入运行时分发包,未加skip或抑制异常。移除的一个旧测试仅钉死Markdown措辞和输入回显;不把它重新钉死为新的文字。 +- [修复后CI](https://github.com/shisuidata/Forge/actions/runs/34147746296)五项检查通过:Python 982 passed / 28 skipped / 5第三方弃用warnings;Pi 215 passed与typecheck;wheel/sdist安装和Quickstart烟测;SQLite、PostgreSQL 16、MySQL 8各一项兼容性烟测。原983项本地通过记录保留为历史事实,不改写成当前测试数量。 +- 已在[候选交付记录](candidate-delivery-2026-09-08.json)保留首轮失败、修复与成功任务链接;证据回写后的最终HEAD还须通过独立PR检查,最终run在PR完成评论记录,避免为记录自身CI无限生成提交。 +- GitHub Issues API含PR记录:本轮按类型分离为8个Issue、2个PR,修正当前投影先前“9个Issue与1个PR”的重复口径;原始报告不追改。#10由本会话创建,不算外部独立贡献;#9仍为0评论,R0.6/H未通过。 + +## REQ-2026-09-08-064:以超过Direct SQL的EX为目标重评Forge JSON生成优化 + +### 原始表达与授权 + +> 按照我们现在的规划,包括过去的一些实验数据,从结果上来看,我们整个 Force JSON 的生成好像还是需要有一定的优化。这是我自己的感觉。 +> +> 你再去调研一下接下来的优化方向,看一下至少能让它超过 Direct SQL 生成的 EX 准确度。 + +- 状态:assessed;已完成历史证据分析、外部方法调研与零被测模型调用的离线验证。具体优化实施与新生成预算待用户接受,不把研究目标当作已实现收益。 +- 对象:按上下文将Force JSON理解为Forge JSON;目标是固定完整分母下的最终官方EX超过Direct SQL,不以结构合法、执行成功、拒绝或更换评价器替代。 +- 边界:沿用唯一主动计划15.1节和Pi唯一调度;不修改默认生成策略、Gold、评分、权限或历史报告,不启动新一轮付费生成、自动返修或部署。具体优化方案须评估后获用户接受,H与R0.6外部采用门禁独立保留。 + +### 调研评估与证据(2026-09-08) + +- **结论**:目标保留为“最终EX超过同条件Direct SQL”,但没有证据保证换成JSON即可胜出。下一切片先验证模型可见DSL语义说明与依赖顺序;准确率主攻转向有来源的答案规划,不重复叠加分母/投影/CTE范例。研究已完成,以下方案尚未获实施或调用授权。 +- **历史配对重算**:从500条保存判定重算Forge313、Direct314、双正确291、双错误164、Forge only22、Direct only23,双侧exact McNemar p=1.0。这是旧Sol候选的统计持平,不是当前Luna/Assurance v11新成绩。四个旧Forge非执行候选即使全部修为正确,理想上限也仅317/500,比旧Direct高0.6pp;不能把Compiler维护当总体突破主力。两臂Oracle并集336/500不是可实现选择器成绩。 +- **近期反证**:REQ-056分母范例Forge2/4→3/4但md-079正确回退;REQ-058 CTE范例3/4→3/4,md-199恢复但md-079改为两项计数,且每正确答案tokens/P95护栏失败。REQ-047/054分别改善日期/取值却留有最终粒度、输出或FROM绑定错误。保持既有不采纳结论,不把子错误修复累加成EX。 +- **当前代码新发现**:Benchmark实际加载静态forge/schema.json,不走动态schema_builder。真实createStrictForgeOutput运行将72条description减至0;8条紧凑Prompt约束没有补回完整DSL说明。根Schema中select第7、window第8、cte第14;OpenAI官方文档声明输出遵循Schema键序,并支持重要字段description。说明缺失/依赖后置是否影响生成是[INFERENCE],不是已证准确率根因,也不能追溯解释旧prefer Sol成绩。 +- **零调用验证**:500个旧Forge候选按定义先于引用重排JSON键,49份序列化变化,实际当前SQLite方言编译500×2次的SQL全部相同,候选值不变。另一个缺失输出引用的合成对象通过真实strict decode,编译后由当前共享Assurance拒绝,证明格式合法不等于作用域正确。没有执行新SQL、Gold或被测模型,没有新增永久测试或修改运行时代码。 +- **外部方法**:核对PICARD、RESDSQL、CHASE-SQL、CHESS、DIN-SQL及The Death of Schema Linking?六项一手研究。CHASE-SQL同Gemini 1.5 Pro/BIRD dev单候选无fixer消融57.75→63.62/63.92支持规划机制;不是Forge预期增益。DIN-SQL的GPT-4无修正73.3、温和修正74.2、强制BUGGY修正70.0说明返修可反伤。多候选、多模型、微调、Oracle列召回与不同数据集成绩不得混入当前对照。 + +### 建议顺序、风险与不做的代价 + +1. **先做工具Schema语义说明实验**:只保留scan/cte/agg/window/select等关键接口经现行Compiler核对的简短说明,旧description不能无审查全恢复;不加范例、不变SQL语义。与此独立研究CTE/window先定义再select引用的键顺序,不把两项叠为一轮。风险是额外tokens、说明过时或无收益;不做则模型可见说明缺口仍无法归因。 +2. **主攻答案规划与字段/值证据绑定**:复用ContextSnapshot/Registry/ResultContract,区分用户明示、权威定义和未确认推断,先明确对象、总体/子集分母、连接用途、时间、粒度、单位及最终列。优先一次生成内组织决策;不恢复each/per猜grain、不新增Intent真相源。Direct获得同样规划与证据,不能把信息不对称称为格式优势。可持久化计划若改变Contract需另立协议,不向当前终止工具偷加字段。 +3. **有条件才做一次诊断修正**:仅针对具体可核验的结构/作用域/类型失败,Pi原Task最多追加一次;初稿/终稿分报,Direct同预算,不按Gold选优、空结果不自动判错,权限拒绝不能返修绕过,SQL变化重新审批。现有单回合协议没有授权此路径。 +4. **表示改造后置**:若仍反复出现声明/导出/最终答案失配,再独立评估减少模型重复维护alias的生成表示;不直接新建NatSQL/第二DSL,不让Compiler猜测补列/补JOIN。不做的代价是继续承担重复绑定负担,贸然做则增加编译器及迁移成本;两者都需先量化。 +5. **不优先投入**:更多通用提示词、盲裁小库Schema、全量GraphRAG、换大模型、21候选投票、微调或无限重试。未证明当前召回/标签/调用收益,不让新平台工程挤占生成机制验证和R0.6。 + +### 可证伪实验与用户决策边界 + +- 先单独冻结关键DSL说明这一变量。可讨论8道开发题(4结构/输出目标+4跨库正确控制)×两条件×两臂×两独立重复=64次逻辑调用;这只是新提案,样本/协议/预算尚未冻结或授权,canary不得另算免费次数。 +- 新协议需预声明wire Schema差异;当前variable prompt不自动允许Schema漂移。只扩展必要冻结Contract,不关闭既有可比性门禁。键顺序、答案规划、返修各自独立对照,模型与SDK、上下文、Gold、Compiler、Assurance和评分不顺带变化。 +- 预注册交错/分块和重复,保留正确→错误与错误→正确;输入未变Direct波动是噪声对照,不能归因为Forge处理,也不追溯修改旧零回退门槛。完整分母EX为主、Contract另报,tokens/正确任务、实际调用、时延与未知成本同时约束;成本阈值在生成前由用户确认,不伪造8192输出硬上限。 +- D只筛机制,R500只做回归;候选冻结后在独立H按预注册最小业务增益/功效验证,配对差值95%区间下界大于0才宣称统计优势。业务标签/Gold就绪事先处理,不删除争议题或重跑已知超时来凑当前结论。H与R0.6仍未完成,主动计划和架构不变。 +- **证据入口**:[生成优化调研与离线复算](archive/benchmarks/forge-json-generation-research-2026-09-08.json),含原报告路径/当前公开字节hash、六项外部来源、代码发现、500候选烟测源码与范围;不替代历史报告,不计新增模型实验。 + +## REQ-2026-09-08-065:关键DSL说明的独立生成候选与零调用准备 + +- **用户原始表达**:“好的”。承接REQ-064首选方案,接受先做关键DSL说明单变量候选;不等于批准尚未冻结样本/成本的64次生成。 +- **状态**:real_experiment_completed_gate_failed_default_off;零调用准备及获批64次ABBA已完成,预注册稳定收益/零回退/控制题门槛未通过,保持off。既有研究和历史实验原结论不改写。 +- **实测证据**:45项独立SQLite正反检查、500题默认输入不变、16原候选两条件SQL/结果/EX/Contract不变;真实Pi SDK经本地合成SSE完成4派发,Python真实认证HTTP及八题Gold就绪通过。全量Python1012 passed/26 skipped、Pi226 passed/typecheck。详见[准备证据与固定实验卡](archive/benchmarks/benchmark-luna-schema-descriptions-ready-2026-09-08.json)。 +- **冻结门槛与后续决定**:原八题×双条件×双臂×2重复ABBA卡已执行;总tokens≤1.2倍、Forge每正确答案tokens不增加、生成P95≤1.25倍均通过,但无目标题两重复稳定恢复,md-052第二重复EX/Contract回退,控制7/8。不得因总EX增加而放宽门槛或补跑追分,不自动启用或扩大R500/H。原max_output_tokens=null保持不变。 +- **价值与范围**:只为scan/cte/agg/window/select五个根字段增加审核过的简短工具Schema说明,保持完整DSL、字段顺序、Prompt、两臂上下文、Compiler、Assurance、Gold和评分不变;不自动补列/关联、规划或返修。 +- **复用与职责**:沿用现有CLI freeze/validate/replay/compare和Pi Benchmark唯一Task/派发;新增参数型schema_descriptions因素,不扩大原schema确定性重放因素的权限。共享版本化说明目录同时绑定canonical hash和实际wire hash,两侧从同一目录解析,不复制严格Schema转换器。 +- **风险与替代**:说明可能过时或增加tokens而无收益;先以独立SQLite正反例验证说明语义,再以原候选/默认输入hash证明未改默认。相比全文恢复、键序重排或新IR,此切片更小且单因素可否证。Wire指纹必须由真实TypeScript转换复算,未知模式、目录/Schema漂移或未声明因素均失败关闭。 +- **原零调用准备授权边界(历史)**:当时模型预算0,64次另待确认;原说明保留在准备证据。后续授权变更及实跑见下,不将历史未授权状态继续作为当前阻塞。 +- **验收**:五条说明有独立行为预期;off wire字节与默认输入不变;候选仅增description。Python/Pi实际协议消费、漂移拒绝与重开通过,原候选SQL/EX/Contract在两条件一致;记录零真实Provider调用。新协议不跨旧冻结续跑,H与R0.6不晋级。 + +- **后续用户原始表达与授权变更(2026-09-08,Forge-20260908-02)**:先选择“64次且最多¥20”,因无法可靠证明订阅账户人民币费用上界而零调用停止;随后用户明确说“费用先不用管,当前GPT订阅制不用担心费用,继续推进”。撤销人民币20元及结算证明门禁,保留订阅OAuth、原64次ABBA、零重试/扩样,不切付费API、不购买额度。人民币成本不可核算,不承诺免费。 +- **真实实跑与验收(2026-09-08 10:10–10:14 +08:00)**:64次HTTP请求全部200、64候选、零重试/补跑;Forge两重复各5/8→6/8,合并EX/Contract10/16→12/16,Direct均10/16。新增正确为第一重复md-289、第二重复md-079/md-199,但第二重复md-052控制回退;没有同一目标题两重复稳定恢复。tokens共222015,用量未知0;处理组总tokens+3.39%,Forge每正确答案tokens−11.73%,生成P95−5.42%,成本门槛通过不抵消正确性门槛失败。 +- **真实证据边界**:64份原始SSE与Pi原候选/用量逐一匹配,64臂SQL/状态/EX/Contract离线重放一致,两重复协议可比。仅小样本机制筛查,不能宣称总体超过Direct;源码、默认值、Gold及评分未改,历史测试未复跑。详见[实跑报告](archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.json),原卡与预算失败关闭证据保留。 + +## REQ-2026-09-08-066:限定样本里程碑、优化复盘与GitHub提交 + +### 用户原始表达与授权 + +> 好的,记录一下这一次一个里程碑的突破,然后记录一下我们到底做了哪些优化的动作,并整理成文案和文档。 +> +> 接下来我们先不要发布任何版本,先 commit 和 push 到 GitHub 上 + +- **状态**:documented;技术简报、文案与公开处理记录已归档,Python81项/Pi53项聚焦回归及typecheck通过;用户在Forge节点直接派单,协调任务Forge-20260908-03。Git交付以实际commit和远端分支记录为准,不以文档落盘冒充已push;本单不恢复模型实验。 +- **里程碑定义**:仅REQ-065本轮8题×2重复的处理组Forge EX/Contract12/16(75%)高于同期Direct10/16(62.5%);两个重复分别6/8 vs5/8。记录可观察的局部突破,不称历史首次、总体或统计显著优势。 +- **价值**:把具体优化动作、可核对证据和结果边界沉淀为技术资产与可复用文案,避免只保留一句分数或重复调研。 +- **范围与复用**:复用Benchmark同名JSON/Markdown简报、devlog文案、需求池和文档导航;区分历史Structured Tool/Compiler修复、REQ-065单变量五字段description和实验完整性工程。不新增产品功能、独立调度或文档真相源。 +- **风险与替代**:总分领先不能掩盖控制题回退,16次作答不能写成16道独立题;用完整表格和失败门槛代替宣传性外推。只提交分数而不记录动作会丢失方法,扩展为全新评测则增加成本并超出授权。 +- **交付**:[技术里程碑简报](archive/benchmarks/benchmark-luna-schema-descriptions-2026-09-08.md)与[未发布文案](devlog/2026-09-08-forge-schema-descriptions-milestone.md);事实始终回链REQ-065原报告,不修改原得分/判定。 +- **Git边界**:授权在当前review/forge-engineering-evidence-2026-09-08分支commit并push origin;纳入已核对的REQ-064/065相关实现、测试、公开证据与本次文档,排除.maestri/.forge、凭证及私人资料。公开副本按既有最小脱敏规则保留原件与hash映射。 +- **不做**:不merge main、不打tag、不创建Release、不改版本、不部署安装、不分发文案;默认off,失败门槛、H/R0.6及历史500题结果不变。授权不含新增模型调用或补跑。 diff --git a/forge/accuracy_benchmark.py b/forge/accuracy_benchmark.py index c46e159..de2de69 100644 --- a/forge/accuracy_benchmark.py +++ b/forge/accuracy_benchmark.py @@ -24,7 +24,6 @@ from forge.benchmark_methods import ark_coding_plan_method, bird_execution_accuracy, run_forge_oai _ROOT = Path(__file__).resolve().parents[1] -_ACCURACY_DIR = _ROOT / "tests" / "accuracy" _LARGE_DATASET_DIR = _ROOT / "tests" / "datasets" / "large" _CASES_PATH = _LARGE_DATASET_DIR / "cases.json" _DATABASE_PATH = _LARGE_DATASET_DIR / "database.db" diff --git a/forge/assurance.py b/forge/assurance.py index 2054284..a3a8080 100644 --- a/forge/assurance.py +++ b/forge/assurance.py @@ -17,15 +17,15 @@ from config import cfg from forge.compiler import compile_query, validate_query_contract from forge.executor import validate_readonly_sql -from forge.lint import lint_conventions +from forge.lint import lint_conventions, validate_profile from registry.relationships import ( RegistryRelationship, is_fanout_from_existing, load_relationships, ) -ASSURANCE_REVISION = "query-assurance-v10" -POLICY_REVISION = "convention-policy-v9" +ASSURANCE_REVISION = "query-assurance-v11" +POLICY_REVISION = "scoped-policy-v1" INTENT_CONTRACT_REVISION = "intent-fulfillment-v3" QUERY_CANDIDATE_REVISION = "query-candidate-v1" @@ -36,6 +36,7 @@ class GateResult: status: str revision: str diagnostics: tuple[str, ...] = () + applicability: str = "applied" @dataclass(frozen=True) @@ -50,6 +51,7 @@ class QueryAssuranceReport: sql_hash: str | None = None input_kind: str = "forge_json" candidate_revision: str = QUERY_CANDIDATE_REVISION + dialect_resolution: dict[str, str] | None = None def to_dict(self) -> dict[str, Any]: return asdict(self) @@ -114,24 +116,38 @@ def assure_query( _failed_report(gates, registry_revision, model_revision) ) from exc - warnings = lint_conventions(normalized, question) - if warnings: - gates.append(GateResult("convention_policy", "failed", POLICY_REVISION, tuple(warnings))) - raise QueryAssuranceError( - _failed_report(gates, registry_revision, model_revision) - ) - gates.append(GateResult("convention_policy", "passed", POLICY_REVISION)) - + binding = registry.get("assurance_profile") try: - _validate_intent_fulfillment(normalized, question) - gates.append(GateResult("intent_fulfillment", "passed", INTENT_CONTRACT_REVISION)) + if binding is not None and ( + not isinstance(binding, dict) or set(binding) != {"id", "revision"} + ): + raise ValueError("Assurance profile must specify only id and revision.") + profile = binding["id"] if binding is not None else None + profile_revision = binding["revision"] if binding is not None else None + if binding is not None and (not profile or not profile_revision): + raise ValueError("Assurance profile id and revision are required.") + applies = validate_profile(profile, profile_revision) except ValueError as exc: - gates.append(GateResult( - "intent_fulfillment", "failed", INTENT_CONTRACT_REVISION, (str(exc),) - )) - raise QueryAssuranceError( - _failed_report(gates, registry_revision, model_revision) - ) from exc + gates.append(GateResult("convention_policy", "failed", POLICY_REVISION, (str(exc),))) + raise QueryAssuranceError(_failed_report(gates, registry_revision, model_revision)) from exc + + if applies: + warnings = lint_conventions(normalized, question, profile=profile, revision=profile_revision) + if warnings: + gates.append(GateResult("convention_policy", "failed", profile_revision, tuple(warnings))) + raise QueryAssuranceError(_failed_report(gates, registry_revision, model_revision)) + gates.append(GateResult("convention_policy", "passed", profile_revision)) + try: + _validate_intent_fulfillment(normalized, question) + gates.append(GateResult("intent_fulfillment", "passed", INTENT_CONTRACT_REVISION)) + except ValueError as exc: + gates.append(GateResult( + "intent_fulfillment", "failed", INTENT_CONTRACT_REVISION, (str(exc),) + )) + raise QueryAssuranceError(_failed_report(gates, registry_revision, model_revision)) from exc + else: + for rule_id in ("convention_policy", "intent_fulfillment"): + gates.append(GateResult(rule_id, "not_applicable", POLICY_REVISION, applicability="not_applicable")) try: sql = compile_query(normalized, dialect=dialect) diff --git a/forge/benchmark_methods.py b/forge/benchmark_methods.py index db0a09e..b185711 100644 --- a/forge/benchmark_methods.py +++ b/forge/benchmark_methods.py @@ -182,7 +182,7 @@ def run_forge_oai( continue return {"forge_json": None, "sql": None, "error_code": "invalid_json", "attempts": attempt + 1} - warnings = lint_conventions(forge_json, question) if max_compile_retries > 0 else [] + warnings = lint_conventions(forge_json, question, profile="large-benchmark", revision="large-benchmark-v1") if max_compile_retries > 0 else [] if warnings: if attempt < max_compile_retries: messages.extend( diff --git a/forge/benchmark_service.py b/forge/benchmark_service.py new file mode 100644 index 0000000..f3a0232 --- /dev/null +++ b/forge/benchmark_service.py @@ -0,0 +1,334 @@ +"""Offline benchmark business services, independent of HTTP adapters.""" +from __future__ import annotations +from dataclasses import dataclass +import json +from typing import Any + +from jsonschema import ValidationError +from agent.contracts import validate_contract +from agent.prompts import ( + STRUCTURED_BENCHMARK_PROMPT_REVISION, + build_structured_benchmark_system, +) +from forge.assurance import QueryAssuranceError, assure_compiled_sql +from forge.benchmark_v2 import RESULT_COMPARATOR_REVISION +from forge.benchmark_v2 import ResultContract, build_context_snapshot, semantic_result_compare, snapshot_dict +from forge.compiler import compile_query +from forge.hard_accuracy_benchmark import ( + _clean_sql, + _compare_results, + _database_path, + _direct_system, + _forge_context, + _json_safe, + execute_result, + structure_projection, + structure_prompt, +) + +@dataclass(frozen=True) +class CandidateEvaluation: + case_id: str + protocol_revision: str + metric_revision: str + arm: str + output: Any + context_snapshot: dict[str, Any] + +class BenchmarkCaseNotFound(ValueError): + pass + +def _case(suite: dict[str, Any], case_id: str) -> dict[str, Any]: + for item in suite["cases"]: + if item["case_id"] == case_id: + return item + raise BenchmarkCaseNotFound("Benchmark case not found") + +def _failure(stage: str, code: str, *, retryable: bool) -> dict[str, Any]: + failure = {"stage": stage, "code": code, "retryable": retryable} + validate_contract("benchmark_failure_v1", failure) + return failure + + +def _failed_evaluation( + req: CandidateEvaluation, + *, + compile_status: str | None, + execution_status: str, + stage: str, + code: str, + retryable: bool, + sql: str | None = None, + forge_json: dict[str, Any] | None = None, + assurance: dict[str, Any] | None = None, + scored: bool = True, +) -> dict[str, Any]: + failure = _failure(stage, code, retryable=retryable) + return { + "arm": req.arm, + "metric_revision": RESULT_COMPARATOR_REVISION, + "compile_status": compile_status, + "execution_status": execution_status, + "scored": scored, + "official_ea": False if scored else None, + "contract_accuracy": False if scored else None, + "failure": failure, + "error_code": code, + "sql": sql, + "forge_json": forge_json, + "assurance": assurance, + } + + +def _registry_snapshot(structure: dict[str, Any]) -> dict[str, Any]: + return { + "tables": { + str(table["name"]): { + "columns": { + str(column["name"]): {} + for column in table.get("columns", []) + } + } + for table in structure.get("tables", []) + } + } + + +def _assurance_failure_code(exc: QueryAssuranceError) -> str: + gate = exc.report.gates[-1].gate if exc.report.gates else "" + return { + "sql_safety": "readonly_violation", + "sql_parse": "sql_parse_failed", + "registry_acl": "unknown_schema_reference", + }.get(gate, "execution_failed") + + +def _execution_failure_code(exc: Exception) -> str: + message = str(exc).lower() + if "no such table" in message: + return "unknown_table" + if "no such column" in message: + return "unknown_column" + if "no such function" in message: + return "dialect_unsupported" + if "interrupted" in message or "timeout" in message or "timed out" in message: + return "execution_timeout" + return "execution_failed" + + +def check_gold_readiness(suite: dict[str, Any], case_ids: list[str]) -> list[dict[str, str]]: + """Execute all selected Gold and return only answer-safe failure identities.""" + cases = {case["case_id"]: case for case in suite["cases"]} + if any(case_id not in cases for case_id in case_ids): + raise ValueError("Gold readiness selection contains an unknown case") + failures = [] + for case_id in case_ids: + case = cases[case_id] + try: + execute_result(_database_path(case["db_id"]), str(case["SQL"])) + except Exception as exc: + failures.append({ + "case_id": case_id, + "db_id": case["db_id"], + "code": _execution_failure_code(exc), + }) + return failures + +def build_context_response( + suite: dict[str, Any], case: dict[str, Any], *, + forge_prompt_revision: str = STRUCTURED_BENCHMARK_PROMPT_REVISION, +): + structure = structure_projection(suite["tables"][case["db_id"]]) + snapshot = build_context_snapshot(case["question"], case["evidence"], structure) + selected = set(snapshot.tables) + filtered = { + **structure, + "tables": [table for table in structure["tables"] if table["name"] in selected], + "relationships": [ + relation for relation in structure["relationships"] + if relation["from"].split(".", 1)[0] in selected + and relation["to"].split(".", 1)[0] in selected + ], + } + schema_context = structure_prompt(filtered) + return { + "metric_revision": RESULT_COMPARATOR_REVISION, + "case": { + "case_id": case["case_id"], + "question_id": case["question_id"], + "db_id": case["db_id"], + "difficulty": case["difficulty"], + "question": case["question"], + "evidence": case["evidence"], + }, + "context_snapshot": snapshot_dict(snapshot), + "schema_context": schema_context, + "forge_prompt_revision": forge_prompt_revision, + "forge_instructions": build_structured_benchmark_system( + _forge_context(schema_context, case["evidence"]), prompt_revision=forge_prompt_revision, + ), + "direct_instructions": _direct_system(schema_context, case["evidence"]), + } + +def evaluate_candidate(req: CandidateEvaluation, suite: dict[str, Any]): + """Shared offline/HTTP compiler → assurance → execution → EX/Contract path.""" + case = _case(suite, req.case_id) + structure = structure_projection(suite["tables"][case["db_id"]]) + expected_context = build_context_snapshot(case["question"], case["evidence"], structure) + if json.dumps(req.context_snapshot, sort_keys=True) != json.dumps(snapshot_dict(expected_context), sort_keys=True): + raise ValueError("ContextSnapshot hash mismatch") + contract = ResultContract(**req.context_snapshot["result_contract"]) + forge_json: dict[str, Any] | None = None + sql: str | None = None + + raw_output = str(req.output or "").strip() + if not raw_output: + return _failed_evaluation( + req, + compile_status="failed" if req.arm == "forge" else "not_applicable", + execution_status="skipped", + stage="generation", + code="generation_empty", + retryable=True, + ) + + if req.arm == "forge": + try: + parsed_output = req.output if isinstance(req.output, dict) else json.loads(raw_output) + except (json.JSONDecodeError, TypeError): + return _failed_evaluation( + req, + compile_status="failed", + execution_status="skipped", + stage="parse", + code="malformed_output", + retryable=True, + ) + forge_json = parsed_output if isinstance(parsed_output, dict) else None + candidate = { + "kind": "forge_json", + "forge_json": parsed_output, + "producer_revision": "benchmark-v2", + } + compile_status = "failed" + else: + sql = _clean_sql(raw_output) + candidate = { + "kind": "direct_sql", + "sql": sql, + "producer_revision": "benchmark-v2", + } + compile_status = "not_applicable" + + try: + validate_contract("query_candidate_v1", candidate) + except ValidationError: + return _failed_evaluation( + req, + compile_status=compile_status, + execution_status="skipped", + stage="candidate_contract", + code="candidate_contract_invalid", + retryable=True, + sql=sql, + forge_json=forge_json, + ) + + if req.arm == "forge": + try: + sql = compile_query(forge_json) + compile_status = "passed" + except Exception: + return _failed_evaluation( + req, + compile_status="failed", + execution_status="skipped", + stage="compile", + code="compile_failed", + retryable=True, + forge_json=forge_json, + ) + + try: + assurance_report = assure_compiled_sql( + sql, + dialect="sqlite", + input_kind=candidate["kind"], + allowed_tables=list(expected_context.tables), + producer_revision=candidate["producer_revision"], + registry_snapshot=_registry_snapshot(structure), + ) + except QueryAssuranceError as exc: + code = _assurance_failure_code(exc) + return _failed_evaluation( + req, + compile_status=compile_status, + execution_status="skipped", + stage="assurance", + code=code, + retryable=code != "readonly_violation", + sql=sql, + forge_json=forge_json, + assurance=exc.report.to_dict(), + ) + + try: + predicted_rows, preview = execute_result(_database_path(case["db_id"]), sql) + except Exception as exc: + code = _execution_failure_code(exc) + return _failed_evaluation( + req, + compile_status=compile_status, + execution_status="failed", + stage="execution", + code=code, + retryable=code != "execution_failed", + sql=sql, + forge_json=forge_json, + assurance=assurance_report.to_dict(), + ) + + result_preview = { + "columns": preview["columns"], + "rows": [[_json_safe(value) for value in row] for row in predicted_rows[:20]], + "row_count": len(predicted_rows), + "truncated": len(predicted_rows) > 20, + } + # Gold is scoring-only; execute read-only instead of trusting historical caches. + try: + gold_rows, _ = execute_result(_database_path(case["db_id"]), str(case["SQL"])) + except Exception: + return { + **_failed_evaluation( + req, compile_status=compile_status, execution_status="passed", + stage="gold", code="gold_execution_failed", retryable=False, + sql=sql, forge_json=forge_json, assurance=assurance_report.to_dict(), + scored=False, + ), + "result": result_preview, + } + official_ea = _compare_results(predicted_rows, gold_rows) + semantic = semantic_result_compare(gold_rows, predicted_rows, contract) + if not semantic["correct"]: + failure = _failure("result_contract", semantic["failure_code"], retryable=True) + elif not official_ea: + failure = _failure("official_ea", "official_ea_mismatch", retryable=True) + else: + failure = None + return { + "arm": req.arm, + "metric_revision": RESULT_COMPARATOR_REVISION, + "compile_status": compile_status, + "execution_status": "passed", + "scored": True, + "official_ea": official_ea, + "contract_accuracy": semantic["correct"], + "semantic_verdict": semantic["verdict"], + "column_mapping": semantic["column_mapping"], + "failure": failure, + "error_code": failure["code"] if failure else None, + "sql": sql, + "forge_json": forge_json, + "assurance": assurance_report.to_dict(), + "result": result_preview, + } \ No newline at end of file diff --git a/forge/bird_benchmark.py b/forge/bird_benchmark.py index 7130fbe..b65ba87 100644 --- a/forge/bird_benchmark.py +++ b/forge/bird_benchmark.py @@ -30,8 +30,9 @@ ROOT = Path(__file__).resolve().parents[1] PROTOCOL_DIR = ROOT / ".forge" / "benchmarks" / "protocols" STANDARD_CATALOG = ROOT / "tests/datasets/bird_mini_dev_standard.json" -VERSION = "bird-protocol-v4" -FACTORS = ("model", "prompt", "compiler", "schema", "date_context", "grain_context", "value_context") +VERSION = "bird-protocol-v5" +SCHEMA_DESCRIPTIONS_CATALOG = ROOT / "agent/contracts/forge-output-descriptions-v1.json" +FACTORS = ("model", "prompt", "compiler", "schema", "date_context", "grain_context", "value_context", "schema_descriptions") _GRAIN_PATTERN = re.compile(r"(?:\b(?:each|per)\b|\bgrouped?\s+by\b|每个|各(?:个|类|项)?|按.+(?:分组|统计))") @@ -59,6 +60,32 @@ def file_hash(path: Path) -> str: return result +def schema_description_config(mode: str) -> dict[str, str]: + if mode not in ("off", "interfaces-v1"): + raise ValueError("Unknown schema_descriptions mode") + revision = file_hash(SCHEMA_DESCRIPTIONS_CATALOG) + catalog = json.loads(SCHEMA_DESCRIPTIONS_CATALOG.read_text(encoding="utf-8")) + if (not isinstance(catalog, dict) + or set(catalog) != {"schema_version", "canonical_schema_revision", "profiles"} + or catalog["schema_version"] != "forge-output-descriptions-v1" + or catalog["canonical_schema_revision"] != file_hash(ROOT / "forge/schema.json") + or not isinstance(catalog["profiles"], dict) + or set(catalog["profiles"]) != {"off", "interfaces-v1"}): + raise ValueError("Invalid schema descriptions catalog or canonical Schema drift") + for name, profile in catalog["profiles"].items(): + if (not isinstance(profile, dict) or set(profile) != {"wire_schema_revision", "descriptions"} + or not isinstance(profile["wire_schema_revision"], str) + or not re.fullmatch(r"sha256:[0-9a-f]{64}", profile["wire_schema_revision"]) + or not isinstance(profile["descriptions"], dict) + or set(profile["descriptions"]) != (set() if name == "off" else {"scan", "cte", "agg", "window", "select"}) + or any(not isinstance(text, str) or not text.strip() for text in profile["descriptions"].values())): + raise ValueError("Invalid schema descriptions profile") + if revision != file_hash(SCHEMA_DESCRIPTIONS_CATALOG): + raise ValueError("Schema descriptions catalog changed while reading") + return {"mode": mode, "catalog_revision": revision, + "wire_schema_revision": catalog["profiles"][mode]["wire_schema_revision"]} + + def _fingerprints(root: Path, paths: list[Path]) -> dict[str, str]: root = root.resolve(strict=True) result = {} @@ -82,7 +109,7 @@ def standard_files() -> dict[str, str]: def dataset_fingerprints() -> dict[str, str]: # Never use a path supplied by a client manifest. Include every official DB, # metadata file and dataset file, not just the sampled databases. - root = hard._BIRD_RUNTIME.resolve(strict=True) + root = hard.bird_runtime_root().resolve(strict=True) entries = list(root.rglob("*")) if any(path.is_symlink() for path in entries): raise ValueError("Official dataset must not contain symlinks") @@ -102,12 +129,13 @@ def source_fingerprints() -> dict[str, dict[str, str]]: groups = { "prompt": [ROOT / "agent/prompts.py"], "schema": [ROOT / "forge/schema.json", ROOT / "agent/contracts/query-candidate-v1.schema.json"], + "schema_descriptions": [SCHEMA_DESCRIPTIONS_CATALOG], "compiler": [ROOT / "forge/compiler.py"], "context": [ROOT / "forge/benchmark_v2.py", ROOT / "forge/benchmark_metadata.py"], "safety": [ROOT / "forge/executor.py", ROOT / "forge/lint.py", ROOT / "registry/relationships.py"], "official_snapshot": [STANDARD_CATALOG], "evaluator": [ROOT / "forge/hard_accuracy_benchmark.py", ROOT / "forge/benchmark_methods.py", - ROOT / "forge/assurance.py", ROOT / "web/routes/benchmark_v2.py", + ROOT / "forge/assurance.py", ROOT / "forge/benchmark_service.py", ROOT / "forge/bird_benchmark.py", ROOT / "agent/contracts/__init__.py", ROOT / "agent/contracts/benchmark-failure-v1.schema.json", ROOT / "pyproject.toml"], } @@ -250,12 +278,12 @@ def _value_audit(root: str, dataset_revision: str, audit_revision: str, def _contexts(suite: dict, case_ids: list[str], date_context: dict, grain_context: dict, value_config: dict, forge_prompt_revision: str = STRUCTURED_BENCHMARK_PROMPT_REVISION) -> dict[str, dict]: - from web.routes.benchmark_v2 import build_context_response + from forge.benchmark_service import build_context_response from forge.benchmark_metadata import date_context_evidence, render_date_context index = {c["case_id"]: c for c in suite["cases"]} audit = None if date_context["mode"] == "observed": - audit = _date_audit(str(hard._BIRD_RUNTIME.resolve()), digest(dataset_fingerprints()), + audit = _date_audit(str(hard.bird_runtime_root().resolve()), digest(dataset_fingerprints()), digest(source_fingerprints()), date_context["max_rows"]) contexts = {} value_audit = None @@ -289,7 +317,7 @@ def _contexts(suite: dict, case_ids: list[str], date_context: dict, grain_contex # Visibility is a collection boundary, not merely a projection filter. if value_audit is None: value_audit = _value_audit( - str(hard._BIRD_RUNTIME.resolve()), digest(dataset_fingerprints()), + str(hard.bird_runtime_root().resolve()), digest(dataset_fingerprints()), digest(source_fingerprints()), tuple(field), value_config["max_values"]) evidence = value_context_evidence(value_audit, index[cid]["db_id"], context["context_snapshot"]["fields"]) context["value_evidence"] = evidence @@ -316,7 +344,7 @@ def freeze(*, cohort: str, provider: str, model: str, case_ids: list[str] | None repeat: dict | None = None, gold_policy: str = "require_all", date_context: str = "off", date_max_rows: int = 100, grain_context: str = "off", value_context: str = "off", value_field: list[str] | None = None, value_max_values: int = 16, - forge_prompt_revision: str = STRUCTURED_BENCHMARK_PROMPT_REVISION, + forge_prompt_revision: str = STRUCTURED_BENCHMARK_PROMPT_REVISION, schema_descriptions: str = "off", _gold_readiness: dict | None = None) -> dict: if not provider.strip() or not model.strip() or variable not in (None, *FACTORS): raise ValueError("Nonempty provider/model and a supported single variable are required") @@ -342,12 +370,17 @@ def freeze(*, cohort: str, provider: str, model: str, case_ids: list[str] | None raise ValueError("Value observations and qualified controls require the explicit value_context factor and field") value_config = {"mode": value_context, "field": list(value_field) if value_field is not None else None, "max_values": value_max_values} + if schema_descriptions not in ("off", "interfaces-v1") or (schema_descriptions != "off" and variable != "schema_descriptions"): + raise ValueError("Schema descriptions require off/interfaces-v1 and the explicit schema_descriptions factor") before = dataset_fingerprints() sources = source_fingerprints() + description_config = schema_description_config(schema_descriptions) + if description_config["catalog_revision"] != sources["schema_descriptions"][SCHEMA_DESCRIPTIONS_CATALOG.relative_to(ROOT).as_posix()]: + raise ValueError("Schema descriptions catalog changed during freeze") suite = hard.load_suite(hard._FULL_SUITE_ID) if len(suite["cases"]) != 500: raise ValueError("Freezing requires the complete official 500-case input, including for D") - root = hard._BIRD_RUNTIME.resolve(strict=True) + root = hard.bird_runtime_root().resolve(strict=True) for db_id in {c["db_id"] for c in suite["cases"]}: if not isinstance(db_id, str) or not re.fullmatch(r"[A-Za-z0-9_-]+", db_id): raise ValueError("Invalid official database identifier") @@ -363,7 +396,7 @@ def freeze(*, cohort: str, provider: str, model: str, case_ids: list[str] | None if gold_policy not in ("require_all", "skip_unscorable"): raise ValueError("Unknown Gold readiness policy") if _gold_readiness is None: - from web.routes.benchmark_v2 import check_gold_readiness + from forge.benchmark_service import check_gold_readiness blocked = check_gold_readiness(suite, ids) if gold_policy == "skip_unscorable" else [] gold_readiness = {"policy": gold_policy, "blocked_cases": blocked} else: @@ -397,6 +430,7 @@ def freeze(*, cohort: str, provider: str, model: str, case_ids: list[str] | None "gold_readiness": gold_readiness, "variables": {"allowed_changes": [variable] if variable else []}, "date_context": date_config, "grain_context": grain_config, "value_context": value_config, + "schema_descriptions": description_config, "metric_revision": RESULT_COMPARATOR_REVISION, "official_ex_revision": hard._SCORING_STANDARD, "forge_prompt_revision": forge_prompt_revision, @@ -408,7 +442,8 @@ def freeze(*, cohort: str, provider: str, model: str, case_ids: list[str] | None "contexts": contexts, "generation": manifest["generation"], "gold_readiness": gold_readiness, "metric_revision": manifest["metric_revision"], "forge_prompt_revision": manifest["forge_prompt_revision"], - "forge_schema_revision": manifest["forge_schema_revision"]} + "forge_schema_revision": manifest["forge_schema_revision"], + "schema_descriptions": description_config} def unwrap(value: dict) -> dict: @@ -422,6 +457,9 @@ def unwrap(value: dict) -> dict: def validate(value: dict, *, allow_declared_drift: bool = False) -> dict: manifest = unwrap(value) + if (value is not manifest and "schema_descriptions" in value + and value["schema_descriptions"] != manifest.get("schema_descriptions")): + raise ValueError("Schema descriptions response differs from frozen manifest") try: selection = manifest["selection"] cohort = manifest["cohort"] @@ -438,13 +476,14 @@ def validate(value: dict, *, allow_declared_drift: bool = False) -> dict: grain_context=manifest["grain_context"]["mode"], value_context=manifest["value_context"]["mode"], value_field=manifest["value_context"]["field"], value_max_values=manifest["value_context"]["max_values"], - forge_prompt_revision=manifest["forge_prompt_revision"]) + forge_prompt_revision=manifest["forge_prompt_revision"], + schema_descriptions=manifest["schema_descriptions"]["mode"]) except (KeyError, TypeError, StopIteration, AttributeError) as exc: raise ValueError("Malformed protocol manifest") from exc # Parameter-only treatments never authorize source drift. Recompute all hashes # even in compare so a caller cannot substitute arbitrary prompt facts. source_drift = allow_declared_drift and manifest["variables"]["allowed_changes"] not in ( - ["date_context"], ["grain_context"], ["value_context"]) + ["date_context"], ["grain_context"], ["value_context"], ["schema_descriptions"]) actual = _comparison_manifest(manifest) if source_drift else manifest expected = _comparison_manifest(response["manifest"]) if source_drift else response["manifest"] if canonical(actual) != canonical(expected): @@ -482,7 +521,13 @@ def load_revision(revision: str) -> dict: def verify_case(revision: str, case_id: str) -> dict: - manifest = load_revision(revision) + manifest = unwrap(load_revision(revision)) + description_config = manifest.get("schema_descriptions") + if (not isinstance(description_config, dict) + or description_config != schema_description_config(description_config.get("mode")) + or (description_config["mode"] != "off" + and manifest.get("variables") != {"allowed_changes": ["schema_descriptions"]})): + raise ValueError("Frozen schema descriptions drift or undeclared factor") if case_id not in manifest["case_ids"]: raise ValueError("Case is outside the frozen denominator") # Stat-keyed hashing avoids repeated DB reads, but catches post-preflight drift. @@ -500,7 +545,7 @@ def preflight(*, provider: str, model: str, case_ids: list[str], confirm_model_c raise ValueError("Request does not match frozen cases/provider/model") if type(confirm_model_calls) is not int or confirm_model_calls != manifest["generation"]["max_model_calls"]: raise ValueError("Confirm exactly the frozen model-call budget after explicit Gold skips") - from web.routes.benchmark_v2 import check_gold_readiness + from forge.benchmark_service import check_gold_readiness failures = check_gold_readiness(hard.load_suite(hard._FULL_SUITE_ID), case_ids) readiness = manifest["gold_readiness"] if readiness["policy"] == "require_all" and failures: @@ -534,7 +579,7 @@ def candidate_records(value: dict) -> list[dict]: def replay(value: dict, protocol: dict | None = None, *, diagnostic: bool = False) -> dict: - from web.routes.benchmark_v2 import EvaluateRequest, evaluate_candidate, _failed_evaluation + from forge.benchmark_service import CandidateEvaluation, evaluate_candidate, _failed_evaluation records = candidate_records(value) versioned = isinstance(value.get("protocol_revision"), str) if not versioned and not diagnostic: @@ -568,7 +613,7 @@ def replay(value: dict, protocol: dict | None = None, *, diagnostic: bool = Fals try: if manifest["dataset_files"] != dataset_fingerprints() or manifest["sources"] != source_fingerprints(): raise ValueError("Inputs drifted during replay") - req = EvaluateRequest(case_id=record["case_id"], arm=record["arm"], output=record["output"], + req = CandidateEvaluation(case_id=record["case_id"], arm=record["arm"], output=record["output"], protocol_revision=revision, metric_revision=manifest["metric_revision"], context_snapshot=response["contexts"][record["case_id"]]["context_snapshot"]) if record["output"] is None and record["case_id"] in blocked_ids: @@ -608,7 +653,7 @@ def _comparison_manifest(manifest: dict) -> dict: for factor in allowed: if factor == "model": result.pop("model") - elif factor not in ("date_context", "grain_context", "value_context"): + elif factor not in ("date_context", "grain_context", "value_context", "schema_descriptions"): result["sources"].pop(factor) if factor == "prompt": result.pop("forge_prompt_revision") @@ -616,6 +661,9 @@ def _comparison_manifest(manifest: dict) -> dict: context.pop("forge") elif factor == "schema": result.pop("forge_schema_revision") + elif factor == "schema_descriptions": + result[factor].pop("mode") + result[factor].pop("wire_schema_revision") elif factor in ("date_context", "grain_context", "value_context"): result[factor].pop("mode") for context in result["context_hashes"].values(): @@ -655,11 +703,38 @@ def compare(left: dict, right: dict) -> dict: if outputs[0] != outputs[1]: reasons.append("Saved candidates changed during deterministic replay comparison") contracts = [copy.deepcopy(item.get("generation_contract")) for item in (left, right)] - if "prompt" in allowed: - for contract, manifest in zip(contracts, manifests): - if isinstance(contract, dict): - if contract.get("forge_prompt_revision") != manifest["forge_prompt_revision"]: - reasons.append("Actual Forge prompt revision differs from frozen input") + for item, contract, manifest in zip((left, right), contracts, manifests): + if "schema_descriptions" in allowed: + model = item.get("model") + if (not isinstance(contract, dict) or not isinstance(model, dict) + or any(not isinstance(model.get(key), str) or not model[key] for key in ("provider", "model", "revision")) + or {key: model[key] for key in ("provider", "model")} != manifest["model"] + or "temperature" not in model or model["temperature"] is not None + or "max_output_tokens" not in model or model["max_output_tokens"] is not None): + reasons.append("Schema descriptions comparison requires complete Pi generation/model provenance") + continue + expected = {key: manifest["generation"][key] for key in ( + "sampling", "max_output_tokens", "timeout_seconds", "provider_retries", "max_agent_turns_per_arm")} + expected.update(forge_output_mode="pi_tool_schema", provider_json_schema_request="required", + direct_output_mode="text_sql", transport="sse", isolation_revision="pi-benchmark-isolation-v1") + if (any(key not in contract or canonical(contract[key]) != canonical(value) for key, value in expected.items()) + or any(not isinstance(contract.get(key), str) or not contract[key] + for key in ("pi_runtime_revision", "pi_sdk_lock_revision"))): + reasons.append("Incomplete or mismatched Pi generation contract") + if isinstance(contract, dict): + if (contract.get("schema_descriptions") != manifest["schema_descriptions"] + or contract.get("forge_wire_schema_revision") != manifest["schema_descriptions"]["wire_schema_revision"] + or contract.get("forge_schema_revision") != manifest["forge_schema_revision"]): + reasons.append("Actual Forge schema descriptions or wire revision differs from frozen input") + if contract.get("forge_prompt_revision") != manifest["forge_prompt_revision"]: + reasons.append("Actual Forge prompt revision differs from frozen input") + if "schema_descriptions" in allowed: + contract.pop("forge_wire_schema_revision", None) + descriptions = contract.get("schema_descriptions") + if isinstance(descriptions, dict): + descriptions.pop("mode", None) + descriptions.pop("wire_schema_revision", None) + if "prompt" in allowed: contract.pop("forge_prompt_revision", None) if canonical(contracts[0]) != canonical(contracts[1]): reasons.append("Actual generation contract or Pi runtime/SDK revision changed") diff --git a/forge/cli.py b/forge/cli.py index 5712221..929c450 100644 --- a/forge/cli.py +++ b/forge/cli.py @@ -455,7 +455,7 @@ def _cmd_benchmark(args: argparse.Namespace) -> None: date_context=args.date_context, date_max_rows=args.date_max_rows, grain_context=args.grain_context, value_context=args.value_context, value_field=args.value_field, value_max_values=args.value_max_values, - forge_prompt_revision=args.forge_prompt_revision) + forge_prompt_revision=args.forge_prompt_revision, schema_descriptions=args.schema_descriptions) bird.persist(result["manifest"]) elif args.bird_command == "preflight": protocol = _read_json_input(args.input) @@ -465,10 +465,12 @@ def _cmd_benchmark(args: argparse.Namespace) -> None: protocol_manifest=manifest) result = {"ready": True, "protocol_revision": checked["protocol_revision"], "case_ids": checked["case_ids"], "gold_readiness": checked["gold_readiness"], + "schema_descriptions": checked["schema_descriptions"], "maximum_model_calls": checked["generation"]["max_model_calls"], "model_calls": 0} elif args.bird_command == "validate": frozen = bird.validate(_read_json_input(args.input)) result = {"valid": True, "protocol_revision": frozen["protocol_revision"], + "schema_descriptions": frozen["schema_descriptions"], "case_ids": frozen["case_ids"], "model_calls": 0} elif args.bird_command == "replay": protocol = _read_json_input(args.protocol) if args.protocol else None @@ -746,7 +748,7 @@ def main() -> None: freeze.add_argument("--case-ids", nargs="+") freeze.add_argument("--seed", type=int) freeze.add_argument("--size", type=int) - freeze.add_argument("--variable", choices=("model", "prompt", "compiler", "schema", "date_context", "grain_context", "value_context"), + freeze.add_argument("--variable", choices=("model", "prompt", "compiler", "schema", "date_context", "grain_context", "value_context", "schema_descriptions"), help="The sole predeclared factor allowed to vary in compare") freeze.add_argument("--out", help="New immutable JSON output path; defaults to stdout") freeze.add_argument("--previous-run", help="Terminal Pi run: carry every failed or unscored case forward") @@ -759,6 +761,8 @@ def main() -> None: help="Fixed non-NULL sample bound per date field (1..10000), not a whole-column guarantee") freeze.add_argument("--grain-context", choices=("off", "question_heuristic"), default="off", help="Explicit grain_context ablation only: unconfirmed question heuristic versus no hint") + freeze.add_argument("--schema-descriptions", choices=("off", "interfaces-v1"), default="off", + help="Explicit schema_descriptions ablation: strict output interface descriptions only") freeze.add_argument("--value-context", choices=("off", "observed"), default="off", help="Explicit value_context ablation: identical qualified-column observations for both arms") freeze.add_argument("--value-field", nargs=3, metavar=("DB", "TABLE", "COLUMN"), diff --git a/forge/compiler.py b/forge/compiler.py index 1dfbb43..efaa599 100644 --- a/forge/compiler.py +++ b/forge/compiler.py @@ -21,7 +21,7 @@ from __future__ import annotations import json -import pathlib +from importlib.resources import files import re from typing import Any @@ -30,8 +30,7 @@ from sqlglot.errors import SqlglotError # 在模块加载时一次性读取并解析 JSON Schema,避免重复 I/O -_SCHEMA_PATH = pathlib.Path(__file__).parent / "schema.json" -_SCHEMA = json.loads(_SCHEMA_PATH.read_text()) +_SCHEMA = json.loads(files("forge").joinpath("schema.json").read_text(encoding="utf-8")) # 标准 JOIN 类型到 SQL 关键字的映射;anti/semi/cross 由 _join() 单独处理 _JOIN_KEYWORDS = { diff --git a/forge/dialects.py b/forge/dialects.py new file mode 100644 index 0000000..f937175 --- /dev/null +++ b/forge/dialects.py @@ -0,0 +1,57 @@ +"""Pure SQL target selection; callers explicitly supply trusted datasource bindings.""" +from __future__ import annotations + +from dataclasses import asdict, dataclass +from urllib.parse import urlsplit + +SUPPORTED_DIALECTS = frozenset({"sqlite", "postgresql", "mysql", "bigquery", "snowflake"}) + + +@dataclass(frozen=True) +class DialectResolution: + requested: str + resolved: str + provenance: str + + def to_dict(self) -> dict[str, str]: + return asdict(self) + + +class DialectResolutionError(ValueError): + def __init__(self, code: str): + self.code = code + super().__init__(code) + + +def resolve_dialect( + requested: str | None = None, + *, + configured_dialect: str | None = None, + database_url: str | None = None, + allow_generic: bool = False, +) -> DialectResolution: + """Resolve an explicit target or a trusted binding, never inspect configuration. + + Unbound Direct SQL may use SQLGlot's generic parser (``auto``). Compilation + and execution require a concrete target; an absent binding is not SQLite. + The returned provenance contains no URL, credentials or datasource details. + """ + requested = (requested or "auto").lower() + if requested != "auto": + if requested not in SUPPORTED_DIALECTS: + raise DialectResolutionError("dialect_unsupported") + return DialectResolution(requested, requested, "explicit_request") + configured = (configured_dialect or "auto").lower() + if configured != "auto": + if configured not in SUPPORTED_DIALECTS: + raise DialectResolutionError("dialect_unsupported") + return DialectResolution(requested, configured, "configured_dialect") + if database_url: + scheme = urlsplit(database_url).scheme.lower().split("+", 1)[0] + resolved = "postgresql" if scheme == "postgres" else scheme + if resolved not in SUPPORTED_DIALECTS: + raise DialectResolutionError("dialect_unsupported") + return DialectResolution(requested, resolved, "datasource_scheme") + if allow_generic: + return DialectResolution(requested, "auto", "generic_sql_parser") + raise DialectResolutionError("dialect_required") diff --git a/forge/evaluate.py b/forge/evaluate.py index 01b707b..c5b8d01 100644 --- a/forge/evaluate.py +++ b/forge/evaluate.py @@ -20,10 +20,10 @@ ) from forge import benchmark_v2 from forge.benchmark_v2 import build_result_contract, semantic_result_compare +from forge.dialects import DialectResolutionError, resolve_dialect EVALUATE_SCHEMA_VERSION = 1 EVALUATOR_REVISION = "evaluate-v1" -SUPPORTED_DIALECTS = {"auto", "sqlite", "postgresql", "mysql", "bigquery", "snowflake"} def canonical_hash(value: Any) -> str: @@ -161,6 +161,7 @@ def _finalize( assurance_report: QueryAssuranceReport | None, result_comparison: dict[str, Any], failure: dict[str, Any] | None, + dialect_resolution: dict[str, Any] | None = None, ) -> dict[str, Any]: request_hash = canonical_hash(request) full_assurance = assurance_report.to_dict() if assurance_report is not None else None @@ -168,7 +169,9 @@ def _finalize( safe_assurance = _safe_assurance(assurance_report) if assurance_report is not None else None sql_hash = assurance_report.sql_hash if assurance_report is not None else None + resolution = dialect_resolution or {"requested": request.get("dialect") or "auto", "resolved": None, "provenance": "unresolved"} payload = { + "dialect_resolution": resolution, "schema_version": EVALUATE_SCHEMA_VERSION, "status": status, "candidate": { @@ -255,8 +258,10 @@ def evaluate_query_candidate(request: dict[str, Any]) -> dict[str, Any]: ), ) - dialect = str(request.get("dialect") or "auto") - if dialect not in SUPPORTED_DIALECTS: + try: + resolution = resolve_dialect(request.get("dialect"), allow_generic=input_kind == "direct_sql") + dialect = resolution.resolved + except DialectResolutionError as exc: return _finalize( request=request, status="failed", @@ -266,7 +271,7 @@ def evaluate_query_candidate(request: dict[str, Any]) -> dict[str, Any]: compiled_sql=None, assurance_report=None, result_comparison=not_run, - failure=_failure("assurance", "dialect_unsupported", retryable=True), + failure=_failure("assurance", exc.code, retryable=True), ) try: @@ -297,6 +302,7 @@ def evaluate_query_candidate(request: dict[str, Any]) -> dict[str, Any]: assurance_report=exc.report, result_comparison=not_run, failure=_failure(stage, code, retryable=retryable), + dialect_resolution=resolution.to_dict(), ) comparison, comparison_failure = _result_comparison(request) @@ -310,4 +316,5 @@ def evaluate_query_candidate(request: dict[str, Any]) -> dict[str, Any]: assurance_report=report, result_comparison=comparison, failure=comparison_failure, + dialect_resolution=resolution.to_dict(), ) diff --git a/forge/executor.py b/forge/executor.py index a33216b..3c5c1e8 100644 --- a/forge/executor.py +++ b/forge/executor.py @@ -1,10 +1,10 @@ """ -SQL 执行器 — 连接数据库执行 SQL 并返回格式化结果。 +SQL 执行器 — 返回结构化成功/失败、稳定错误码、数据与独立展示文本。 支持所有 SQLAlchemy 方言(SQLite / PostgreSQL / MySQL 等)。 数据库 URL 从 cfg.DATABASE_URL 读取。 -返回值:纯文本表格,直接发送给用户。 +空结果与截断是成功语义,展示文字或列名不参与领域状态判定。 """ from __future__ import annotations @@ -13,7 +13,7 @@ import logging import re import time -from typing import Any + from config import cfg @@ -120,90 +120,40 @@ def validate_readonly_sql(sql: str) -> None: raise ValueError(f"SQL 包含非只读关键字:{', '.join(forbidden)}。") -def execute(sql: str, max_rows: int = 50) -> str: - """ - 执行 SQL,返回格式化的纯文本结果。 - - Args: - sql: 要执行的 SQL 字符串 - max_rows: 最多返回的行数,超出时附加提示 - - Returns: - 格式化后的结果字符串;执行失败时返回错误说明。 - """ - if not cfg.EXECUTION_ENABLED: - return "⚠ SQL 执行已被配置禁用。" - if not cfg.DATABASE_URL: - return "⚠ 未配置数据库连接(DATABASE_URL),无法执行查询。" - - try: - from sqlalchemy import text - except ImportError: - return "⚠ 缺少依赖:请运行 pip install sqlalchemy" - - try: - validate_readonly_sql(sql) - max_rows = _bounded_max_rows(max_rows) - timeout_seconds = _bounded_timeout_seconds() - engine = _get_engine() - with engine.connect() as conn: - _apply_statement_timeout(conn, timeout_seconds) - with _sqlite_timeout_guard(conn, timeout_seconds): - result = conn.execute(text(sql)) - rows = result.fetchmany(max_rows + 1) - cols = list(result.keys()) - except Exception as exc: - logger.error("SQL execution failed: %s", exc) - return _public_execution_error(exc) - - if not rows: - return "查询完成,结果为空。" - - truncated = len(rows) > max_rows - if truncated: - rows = rows[:max_rows] - - # 计算每列宽度 - col_widths = [len(str(c)) for c in cols] - for row in rows: - for i, val in enumerate(row): - col_widths[i] = max(col_widths[i], len(str(val) if val is not None else "NULL")) - - def fmt_row(vals: list[Any]) -> str: - parts = [str(v if v is not None else "NULL").ljust(col_widths[i]) for i, v in enumerate(vals)] - return " ".join(parts) - - sep = " ".join("-" * w for w in col_widths) - lines = [fmt_row(cols), sep] + [fmt_row(list(r)) for r in rows] - - if truncated: - lines.append(f"(仅显示前 {max_rows} 行)") - - return "\n".join(lines) - - @dataclass(frozen=True) -class QueryExecutionData: +class ExecutionResult: + """Execution outcome; presentation text never determines success.""" + + success: bool text: str columns: list[str] rows: list[tuple] - truncated: bool + truncated: bool = False + error_code: str | None = None -def execute_with_metadata(sql: str, max_rows: int = 200) -> QueryExecutionData: - """Execute reviewed SQL and preserve whether the deployment row cap truncated it.""" +def _failure(code: str, message: str) -> ExecutionResult: + return ExecutionResult(False, message, [], [], error_code=code) + + +def execute(sql: str, max_rows: int = 200) -> ExecutionResult: + """Execute one reviewed read-only query with a structured, bounded outcome.""" if not cfg.EXECUTION_ENABLED: - return QueryExecutionData("⚠ SQL 执行已被配置禁用。", [], [], False) + return _failure("execution_disabled", "SQL 执行已被配置禁用。") if not cfg.DATABASE_URL: - return QueryExecutionData("⚠ 未配置数据库连接(DATABASE_URL),无法执行查询。", [], [], False) + return _failure("datasource_unconfigured", "未配置数据库连接,无法执行查询。") try: from sqlalchemy import text as sa_text except ImportError: - return QueryExecutionData("⚠ 缺少依赖:请运行 pip install sqlalchemy", [], [], False) + return _failure("execution_dependency_missing", "缺少数据库执行依赖。") try: validate_readonly_sql(sql) + except ValueError as exc: + return _failure("sql_not_readonly", str(exc)) + + try: max_rows = _bounded_max_rows(max_rows) timeout_seconds = _bounded_timeout_seconds() engine = _get_engine() @@ -214,16 +164,19 @@ def execute_with_metadata(sql: str, max_rows: int = 200) -> QueryExecutionData: rows = result.fetchmany(max_rows + 1) cols = list(result.keys()) except Exception as exc: - logger.error("SQL execution failed: %s", exc) - return QueryExecutionData(_public_execution_error(exc), [], [], False) - - if not rows: - return QueryExecutionData("查询完成,结果为空。", cols, [], False) + # Never log SQL, bound values, credentials or raw driver messages. + logger.error("SQL execution failed: %s", type(exc).__name__) + return _execution_failure(exc) truncated = len(rows) > max_rows if truncated: rows = rows[:max_rows] + return ExecutionResult(True, _render_result(cols, rows, truncated), cols, rows, truncated) + +def _render_result(cols: list[str], rows: list[tuple], truncated: bool) -> str: + if not rows: + return "查询完成,结果为空。" display_limit = _bounded_display_rows() display_rows = rows[:display_limit] col_widths = [len(str(c)) for c in cols] @@ -236,34 +189,33 @@ def fmt_row(vals): return " ".join(parts) sep = " ".join("-" * w for w in col_widths) - lines = [fmt_row(cols), sep] + [fmt_row(list(r)) for r in display_rows] + lines = [fmt_row(cols), sep] + [fmt_row(r) for r in display_rows] if truncated or len(rows) > display_limit: lines.append(f"(显示前 {len(display_rows)} 行,共 {len(rows)} 行)") + return "\n".join(lines) - return QueryExecutionData("\n".join(lines), cols, list(rows), truncated) - - -def execute_with_data( - sql: str, max_rows: int = 200 -) -> tuple[str, list[str], list[tuple]]: - """Backward-compatible tuple API used by the existing Web/Feishu path.""" - result = execute_with_metadata(sql, max_rows=max_rows) - return result.text, result.columns, result.rows - - -def _public_execution_error(exc: Exception) -> str: - """Return a bounded user-facing error while keeping raw details in server logs.""" - if isinstance(exc, ValueError): - return f"⚠ 执行失败:{exc}" - message = str(exc).lower() - if any(token in message for token in ("no such column", "no such table", "undefined column")): - return "⚠ 执行失败:SQL 引用了不存在或未绑定的表/字段,请重新生成。" - if any(token in message for token in ("timeout", "timed out", "interrupted", "canceling statement")): - return "⚠ 执行失败:查询超时,请缩小查询范围后重试。" - if any(token in message for token in ("permission denied", "readonly", "read-only", "not authorized")): - return "⚠ 执行失败:数据库拒绝了该操作,请确认只读权限和查询范围。" - return "⚠ 执行失败:数据库查询失败,请检查 SQL 或联系管理员。" +def _execution_failure(exc: Exception) -> ExecutionResult: + """Normalize driver errors to stable public codes without exposing driver details.""" + original = getattr(exc, "orig", exc) + sqlstate = getattr(original, "sqlstate", None) or getattr(original, "pgcode", None) + sqlite_code = getattr(original, "sqlite_errorcode", None) + message = str(original).lower() + if sqlstate == "57014" or sqlite_code == 9 or any( + token in message for token in ("timeout", "timed out", "interrupted", "canceling statement") + ): + return _failure("execution_timeout", "查询超时,请缩小查询范围后重试。") + if sqlstate == "42501" or sqlite_code in {8, 23} or any( + token in message for token in ("permission denied", "readonly", "read-only", "not authorized", "prohibited") + ): + return _failure("execution_permission_denied", "数据库拒绝了该操作,请确认只读权限和查询范围。") + if sqlstate in {"42703", "42P01"} or any( + token in message for token in ("no such column", "no such table", "undefined column") + ): + return _failure("execution_reference_invalid", "SQL 引用了不存在或未绑定的表/字段,请重新生成。") + if sqlstate == "42601" or "syntax error" in message or "incomplete input" in message: + return _failure("execution_syntax_invalid", "SQL 语法错误,请重新生成。") + return _failure("execution_failed", "数据库查询失败,请检查 SQL 或联系管理员。") def _bounded_max_rows(requested: int) -> int: diff --git a/forge/hard_accuracy_benchmark.py b/forge/hard_accuracy_benchmark.py index 163852c..fe8dc35 100644 --- a/forge/hard_accuracy_benchmark.py +++ b/forge/hard_accuracy_benchmark.py @@ -18,6 +18,7 @@ from concurrent.futures import ThreadPoolExecutor, as_completed from dataclasses import dataclass from datetime import datetime, timezone +from functools import lru_cache from pathlib import Path from typing import Any, Callable @@ -70,6 +71,7 @@ def _bird_runtime_is_complete(candidate: Path) -> bool: ) +@lru_cache(maxsize=4) def _resolve_bird_runtime_root(base: Path) -> Path: """Accept flattened, partial, and official ZIP Mini-Dev layouts.""" candidates = (base, base / "MINIDEV") @@ -85,12 +87,14 @@ def _resolve_bird_runtime_root(base: Path) -> Path: return candidate return base -_BIRD_RUNTIME = _resolve_bird_runtime_root( - _ROOT / ".forge" / "benchmarks" / "bird-mini-dev" / "minidev" / "MINIDEV" -) -_OFFICIAL_CASES_PATH = _BIRD_RUNTIME / "mini_dev_sqlite.json" -_OFFICIAL_TABLES_PATH = _BIRD_RUNTIME / "dev_tables.json" -_DB_ROOT = _BIRD_RUNTIME / "dev_databases" +_BIRD_RUNTIME = _ROOT / ".forge" / "benchmarks" / "bird-mini-dev" / "minidev" / "MINIDEV" + + +def bird_runtime_root() -> Path: + """Resolve an installed dataset only when a benchmark operation needs it.""" + return _resolve_bird_runtime_root(_BIRD_RUNTIME) + + _LEGACY_SUITE_ID = "bird-mini-dev-hard-v1" _FULL_SUITE_ID = "bird-mini-dev-full-v1" _TERMINAL = {"completed", "failed", "interrupted"} @@ -138,14 +142,14 @@ def _load_json(path: Path) -> Any: def _database_path(db_id: str) -> Path: - path = _DB_ROOT / db_id / f"{db_id}.sqlite" + path = bird_runtime_root() / "dev_databases" / db_id / f"{db_id}.sqlite" if not path.exists(): raise HardBenchmarkError("BIRD 官方数据库未下载。") return path def _description_dir(db_id: str) -> Path: - path = _DB_ROOT / db_id / "database_description" + path = bird_runtime_root() / "dev_databases" / db_id / "database_description" if not path.exists(): raise HardBenchmarkError("BIRD 官方 database_description 不可用。") return path @@ -162,7 +166,10 @@ def load_suite(suite_id: str = _FULL_SUITE_ID) -> dict[str, Any]: case_path = _CASES_PATH tables_path = _TABLES_PATH elif suite_id == _FULL_SUITE_ID: - official_cases = _load_json(_OFFICIAL_CASES_PATH) + root = bird_runtime_root() + case_path = root / "mini_dev_sqlite.json" + tables_path = root / "dev_tables.json" + official_cases = _load_json(case_path) cases = [ { **case, @@ -177,7 +184,7 @@ def load_suite(suite_id: str = _FULL_SUITE_ID) -> dict[str, Any]: } for index, case in enumerate(official_cases) ] - tables = _load_json(_OFFICIAL_TABLES_PATH) + tables = _load_json(tables_path) manifest = { "suite": _FULL_SUITE_ID, "title": "BIRD-SQL Mini-Dev Full", @@ -203,8 +210,6 @@ def load_suite(suite_id: str = _FULL_SUITE_ID) -> dict[str, Any]: "expected_model_calls": len(cases) * len(_METHODS), "result_boundary": "Complete official 500-case Mini-Dev across 11 databases with Oracle Evidence.", } - case_path = _OFFICIAL_CASES_PATH - tables_path = _OFFICIAL_TABLES_PATH else: raise HardBenchmarkError(f"Unknown BIRD suite: {suite_id}") diff --git a/forge/lint.py b/forge/lint.py index 7e4a3fc..c0f5c3a 100644 --- a/forge/lint.py +++ b/forge/lint.py @@ -1,21 +1,39 @@ """ Forge JSON 约定检查器(Convention Lint) -在编译前对 Forge JSON 做语义级检查,捕获模型"编译能过但业务逻辑错"的情况。 -程序化验证的覆盖率是 100%,模型注意力不是。 +历史large benchmark的语义约定,不是通用Registry或SQL安全校验。 +未显式选择受支持的profile/revision时不运行数据集规则。 用法: from forge.lint import lint_conventions - warnings = lint_conventions(forge_json, question) - # warnings 为空 → 通过;非空 → 反馈给模型修正 + warnings = lint_conventions(forge_json, question, + profile="large-benchmark", revision="large-benchmark-v1") + # warnings 非空 → 按绑定的数据集规则反馈修正 """ from __future__ import annotations import re -def lint_conventions(forge_json: dict, question: str) -> list[str]: - """检查 Forge JSON 是否违反字段使用约定,返回修复建议列表。""" +LARGE_BENCHMARK_PROFILE = "large-benchmark" +LARGE_BENCHMARK_REVISION = "large-benchmark-v1" + + +def validate_profile(profile: str | None, revision: str | None) -> bool: + """Profiles are opt-in, pinned policies, never inferred from table names.""" + if profile is None and revision is None: + return False + if (profile, revision) != (LARGE_BENCHMARK_PROFILE, LARGE_BENCHMARK_REVISION): + raise ValueError("Unknown assurance profile or revision; bind a supported policy explicitly.") + return True + + +def lint_conventions( + forge_json: dict, question: str, *, profile: str | None = None, revision: str | None = None +) -> list[str]: + """Run historical dataset conventions only under their explicit revision.""" + if not validate_profile(profile, revision): + return [] warnings: list[str] = [] q = question diff --git a/forge/poc.py b/forge/poc.py index 73093bf..cdd4f33 100644 --- a/forge/poc.py +++ b/forge/poc.py @@ -4,11 +4,10 @@ import json import shutil from datetime import datetime, timezone +from importlib.resources import as_file, files from pathlib import Path from typing import Any -ROOT = Path(__file__).resolve().parents[1] -TEMPLATE_DIR = ROOT / "customer-poc-template" REGISTRY_FILES = ( "schema.registry.json", "metrics.registry.yaml", @@ -22,7 +21,8 @@ def init_workspace(target: Path) -> dict: target = target.expanduser() if target.exists() and any(target.iterdir()): raise ValueError(f"PoC 目录已存在且非空:{target}") - shutil.copytree(TEMPLATE_DIR, target, dirs_exist_ok=True) + with as_file(files("forge").joinpath("templates", "poc")) as template: + shutil.copytree(template, target, dirs_exist_ok=True) (target / "results").mkdir(parents=True, exist_ok=True) _copy_if_missing(target / "cases.example.json", target / "cases.json") _copy_if_missing(target / "delivery_report.template.md", target / "delivery_report.md") diff --git a/forge/query_runs.py b/forge/query_runs.py index c1eda12..1829bd3 100644 --- a/forge/query_runs.py +++ b/forge/query_runs.py @@ -11,6 +11,7 @@ import json import time import uuid +from dataclasses import replace from datetime import datetime, timedelta, timezone from pathlib import Path from typing import Any, Callable @@ -259,11 +260,17 @@ def _prepare_supplied_candidate( candidate: dict[str, Any], scope_allowed_tables: list[str] | None = None, ) -> dict[str, Any]: - from agent.agent import resolve_dialect + from forge.dialects import DialectResolutionError, resolve_dialect from agent.tenant import tenants from forge.assurance import QueryAssuranceError, assure_direct_sql, assure_query - resolved_dialect = resolve_dialect(dialect) + try: + resolution = resolve_dialect( + dialect, configured_dialect=cfg.SQL_DIALECT, database_url=cfg.DATABASE_URL + ) + except DialectResolutionError as exc: + raise QueryRunError(str(exc), status_code=400, code=exc.code) from exc + resolved_dialect = resolution.resolved tenant_allowed_tables = tenants.get_allowed_tables_for_user(user_id) if tenant_allowed_tables is not None and scope_allowed_tables is not None: allowed_tables = sorted(set(tenant_allowed_tables) & set(scope_allowed_tables)) @@ -297,7 +304,7 @@ def _prepare_supplied_candidate( "forge_json": forge_json, "sql": None, "dialect": resolved_dialect, - "assurance_report": exc.report.to_dict(), + "assurance_report": replace(exc.report, dialect_resolution=resolution.to_dict()).to_dict(), "error": str(exc), } @@ -307,7 +314,7 @@ def _prepare_supplied_candidate( "forge_json": forge_json, "sql": assurance.sql, "dialect": resolved_dialect, - "assurance_report": assurance.to_dict(), + "assurance_report": replace(assurance, dialect_resolution=resolution.to_dict()).to_dict(), "error": "", } @@ -853,12 +860,12 @@ async def approve_and_execute_query_run( if claim_status == "replay": return run - from forge.executor import execute_with_metadata + from forge.executor import execute started = time.perf_counter() try: result = await asyncio.to_thread( - execute_with_metadata, + execute, run["sql"], cfg.EXECUTION_MAX_ROWS, ) @@ -870,12 +877,12 @@ async def approve_and_execute_query_run( code="execution_failed", ) from exc execution_ms = int((time.perf_counter() - started) * 1000) - if result.text.startswith("⚠"): - await fail_query_run(query_run_id, "execution_failed") + if not result.success: + await fail_query_run(query_run_id, result.error_code or "execution_failed") raise QueryRunError( - "Query execution failed", + result.text, status_code=500, - code="execution_failed", + code=result.error_code or "execution_failed", ) return await complete_query_run( diff --git a/customer-poc-template/README.md b/forge/templates/poc/README.md similarity index 100% rename from customer-poc-template/README.md rename to forge/templates/poc/README.md diff --git a/customer-poc-template/cases.example.json b/forge/templates/poc/cases.example.json similarity index 100% rename from customer-poc-template/cases.example.json rename to forge/templates/poc/cases.example.json diff --git a/customer-poc-template/delivery_report.template.md b/forge/templates/poc/delivery_report.template.md similarity index 100% rename from customer-poc-template/delivery_report.template.md rename to forge/templates/poc/delivery_report.template.md diff --git a/customer-poc-template/failure_triage.template.md b/forge/templates/poc/failure_triage.template.md similarity index 100% rename from customer-poc-template/failure_triage.template.md rename to forge/templates/poc/failure_triage.template.md diff --git a/customer-poc-template/provider-smoke.example.json b/forge/templates/poc/provider-smoke.example.json similarity index 100% rename from customer-poc-template/provider-smoke.example.json rename to forge/templates/poc/provider-smoke.example.json diff --git a/customer-poc-template/registry/disambiguations.registry.yaml b/forge/templates/poc/registry/disambiguations.registry.yaml similarity index 100% rename from customer-poc-template/registry/disambiguations.registry.yaml rename to forge/templates/poc/registry/disambiguations.registry.yaml diff --git a/customer-poc-template/registry/field_conventions.registry.yaml b/forge/templates/poc/registry/field_conventions.registry.yaml similarity index 100% rename from customer-poc-template/registry/field_conventions.registry.yaml rename to forge/templates/poc/registry/field_conventions.registry.yaml diff --git a/customer-poc-template/registry/metrics.registry.yaml b/forge/templates/poc/registry/metrics.registry.yaml similarity index 100% rename from customer-poc-template/registry/metrics.registry.yaml rename to forge/templates/poc/registry/metrics.registry.yaml diff --git a/customer-poc-template/registry/schema.registry.json b/forge/templates/poc/registry/schema.registry.json similarity index 100% rename from customer-poc-template/registry/schema.registry.json rename to forge/templates/poc/registry/schema.registry.json diff --git a/main.py b/main.py index 0a6ee9e..319f257 100644 --- a/main.py +++ b/main.py @@ -1,19 +1,8 @@ -""" -Forge Agent — FastAPI entry point. - -Endpoints: - GET / — redirect to /chat - GET /chat — chat UI (natural language → SQL) - POST /api/chat — chat API - POST /api/approve — approve pending SQL - POST /api/cancel — cancel pending SQL - POST /webhook/feishu — Feishu event subscription + card callbacks - GET /health — health check - GET /admin/* — admin web UI (registry, audit log, settings) -""" +"""Forge Trust Runtime composition root: public APIs, Pi channels and legacy rollback.""" from contextlib import asynccontextmanager import logging -from pathlib import Path +from importlib.resources import files +from functools import lru_cache import lark_oapi as lark from fastapi import FastAPI, Query, Request, Response @@ -21,25 +10,31 @@ from fastapi.staticfiles import StaticFiles from config import cfg -if cfg.FEISHU_PI_ENABLED: - from web.feishu_pi import build_event_handler - dispatcher = build_event_handler() -else: + + +@lru_cache(maxsize=1) +def _event_dispatcher(): + if cfg.FEISHU_PI_ENABLED: + from web.feishu_pi import build_event_handler + return build_event_handler() from agent.feishu import dispatcher + return dispatcher + from forge.readiness import readiness_payload from web.router import chat_router, router as admin_router from web.auth import _LoginRedirect from web.feishu_runtime import feishu_runtime - -# ── 日志配置(可通过 forge.yaml 或环境变量调整)────────────────────────────── -_log_handlers: list[logging.Handler] = [logging.StreamHandler()] -if cfg.LOG_FILE: - _log_handlers.append(logging.FileHandler(cfg.LOG_FILE, encoding="utf-8")) -logging.basicConfig( - level=getattr(logging, cfg.LOG_LEVEL.upper(), logging.INFO), - format="%(asctime)s [%(levelname)s] %(name)s: %(message)s", - handlers=_log_handlers, -) +from web.diagnostics import RequestCorrelationMiddleware + +def _configure_logging(): + handlers: list[logging.Handler] = [logging.StreamHandler()] + if cfg.LOG_FILE: + handlers.append(logging.FileHandler(cfg.LOG_FILE, encoding="utf-8")) + logging.basicConfig( + level=getattr(logging, cfg.LOG_LEVEL.upper(), logging.INFO), + format="%(asctime)s [%(levelname)s] %(name)s: %(message)s", + handlers=handlers, + ) logger = logging.getLogger("forge.startup") @@ -118,6 +113,7 @@ async def _startup_checks(): @asynccontextmanager async def _lifespan(_app: FastAPI): + _configure_logging() await _startup_checks() try: yield @@ -125,7 +121,8 @@ async def _lifespan(_app: FastAPI): feishu_runtime.stop() -app = FastAPI(title="Forge Agent", lifespan=_lifespan) +app = FastAPI(title="Forge Trust Runtime", lifespan=_lifespan) +app.add_middleware(RequestCorrelationMiddleware) # Chat + API 路由挂载到根级别(/chat, /api/*) @@ -146,12 +143,10 @@ async def root(): return RedirectResponse(url="/chat", status_code=302) # 本地静态文件服务;Product Shell 禁止依赖外部 CDN。 -_static_dir = Path(__file__).parent / "web" / "static" -_static_dir.mkdir(parents=True, exist_ok=True) +_static_dir = files("web").joinpath("static") app.mount("/static", StaticFiles(directory=str(_static_dir)), name="static") -_charts_dir = _static_dir / "charts" -_charts_dir.mkdir(parents=True, exist_ok=True) -app.mount("/charts", StaticFiles(directory=str(_charts_dir)), name="charts") +_charts_dir = _static_dir.joinpath("charts") +app.mount("/charts", StaticFiles(directory=str(_charts_dir), check_dir=False), name="charts") @app.post("/webhook/feishu") @@ -164,7 +159,7 @@ async def feishu_webhook(request: Request) -> Response: ) body = await request.body() headers = dict(request.headers) - resp = dispatcher.dispatch( + resp = _event_dispatcher().dispatch( lark.RawRequest.builder().headers(headers).body(body).build() ) return Response(content=resp.body, media_type="application/json") diff --git a/pyproject.toml b/pyproject.toml index b34145b..c032f3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools"] +requires = ["setuptools>=77"] build-backend = "setuptools.build_meta" [project] @@ -51,11 +51,14 @@ where = ["."] include = ["forge*", "registry*", "agent*", "web*"] [tool.setuptools] -py-modules = ["config", "main"] +py-modules = ["config", "main", "diagnostics"] [tool.setuptools.package-data] "agent.contracts" = ["*.json"] +"forge" = ["schema.json", "templates/poc/*", "templates/poc/registry/*"] +"web" = ["templates/**/*.html", "templates/*.html", "static/*.js", "static/*.css", "static/product/*.js", "static/product/*.css"] [tool.pytest.ini_options] +pythonpath = ["."] testpaths = ["tests"] asyncio_mode = "auto" diff --git a/scripts/package_smoke.py b/scripts/package_smoke.py new file mode 100644 index 0000000..ce523c8 --- /dev/null +++ b/scripts/package_smoke.py @@ -0,0 +1,88 @@ +"""Exercise an installed distribution outside the checkout, using synthetic data only.""" +from importlib.resources import files +import json +import os +from pathlib import Path +import subprocess +import sys +import tarfile +import tempfile +import zipfile + + +def main(): + for archive in map(Path, sys.argv[1:]): + if archive.suffix == ".whl": + with zipfile.ZipFile(archive) as bundle: + names = bundle.namelist() + else: + with tarfile.open(archive) as bundle: + names = [name.partition("/")[2] for name in bundle.getnames()] + for required in ("forge/schema.json", "forge/templates/poc/registry/schema.registry.json", "web/templates/product_base.html", "web/static/product/product-pages.js"): + assert required in names, (archive.name, required) + assert not any("/charts/" in name or name.endswith((".db", ".sqlite", "/forge.yaml", "/.env")) for name in names) + + import forge + from forge.compiler import compile_query + assert "SELECT" in compile_query({"scan": "numbers", "select": ["numbers.n"]}) + for package, name in (("forge", "schema.json"), ("web", "templates/product_base.html"), ("web", "static/product/product-pages.js")): + assert files(package).joinpath(name).is_file(), name + environment = {key: os.environ[key] for key in ("PATH", "SYSTEMROOT", "LANG", "HOME") if key in os.environ} + environment["FORGE_DISABLE_DOTENV"] = "true" + with tempfile.TemporaryDirectory(prefix="forge-installed-smoke-") as temporary: + root = Path(temporary) + assert not Path(forge.__file__).resolve().is_relative_to(root) + import_probe = """ +import sqlite3, sqlalchemy, sys +from pathlib import Path +def forbid_runtime_reads(event, args): + if event == "open" and isinstance(args[0], (str, bytes)): + path = Path(args[0].decode() if isinstance(args[0], bytes) else args[0]) + assert not set(path.parts) & {".forge", ".runtime", ".env", "forge.yaml"}, "import inspected private runtime data" +sys.addaudithook(forbid_runtime_reads) +attempts = [] +def forbidden(*args, **kwargs): + attempts.append(True) + raise AssertionError("import attempted a database connection") +sqlite3.connect = forbidden +sqlalchemy.create_engine = forbidden +import main +assert not attempts, "Web import initialized storage" +from agent.memory import memory +assert not memory.__dict__, "Web import initialized legacy memory" +print("import lifecycle passed") +""" + subprocess.run([sys.executable, "-c", import_probe], cwd=root, env=environment, check=True, timeout=30) + core_probe = """ +import sys +for name in ("web", "agent.agent", "agent.memory"): + sys.modules[name] = None +from forge.dialects import resolve_dialect +from forge.evaluate import evaluate_query_candidate +from forge.benchmark_service import CandidateEvaluation +assert resolve_dialect("auto", database_url="postgresql+psycopg2://synthetic.invalid/db").resolved == "postgresql" +result = evaluate_query_candidate({"candidate": {"kind": "forge_json", "forge_json": {"scan": "numbers", "select": ["numbers.n"]}}, "question": "List numbers"}) +assert result["failure"]["code"] == "dialect_required" +print("core dependency boundary passed") +""" + subprocess.run([sys.executable, "-c", core_probe], cwd=root, env=environment, check=True, timeout=30) + cli = str(Path(sys.executable).parent / "forge") + def run(*args, input=None): + return subprocess.run([cli, *args], cwd=root, env=environment, input=input, text=True, + check=True, capture_output=True, timeout=90) + run("--help") + compiled = run("compile", "-", input=json.dumps({"scan": "numbers", "select": ["numbers.n"]})) + assert "SELECT" in compiled.stdout + initialized = json.loads(run("poc", "init", "synthetic-poc", "--json").stdout) + validated = json.loads(run("poc", "validate", "synthetic-poc", "--json").stdout) + assert initialized["ok"] is True and validated["status"] == "ok", (initialized, validated) + result = json.loads(run("quickstart", "--yes", "--json").stdout) + assert result["status"] == "passed", result + assert result["enforce"]["status"] == "completed", result + assert result["explain"]["integrity"] == "verified", result + print(json.dumps({"distribution": str(forge.__file__), "status": result["status"], + "poc": validated["status"], "enforce": result["enforce"], "explain": result["explain"]}, ensure_ascii=False)) + + +if __name__ == "__main__": + main() diff --git a/services/pi-orchestrator/README.md b/services/pi-orchestrator/README.md index c5088f0..e470319 100644 --- a/services/pi-orchestrator/README.md +++ b/services/pi-orchestrator/README.md @@ -98,8 +98,25 @@ node --env-file=../../.env --import tsx src/server.ts Forge Web 可在设置 `PI_ORCHESTRATOR_ENABLED=true` 后访问 `/tasks`,审核 hash 绑定的 SQL 并查看只读执行结果。 +### State 与阶段恢复契约 + +- `OrchestratorApplication` 只接收一个 `OrchestratorState`:Task、Event、Artifact、Attempt、ChannelEvent、Skill Policy 与事务同属一个 adapter,禁止独立 Store 与空事务拼装。SQLite 使用嵌套 SAVEPOINT;显式内存 adapter 具有同等回滚语义。 +- 默认重试创建新 Attempt 和下游 command;显式成功 key 回放已持久结果,失败、运行中或跨阶段 key 在迁移 Task 前拒绝。用户取消 abort 活跃 signal;超时或调用方中断恢复可重试状态,迟到结果不写 Artifact。Abort 只保证停止本地等待,不宣称撤销已发生的远端 SQL 或发布副作用。 +- ExecutionPlan 是 Task 的显示进度,不是第二套调度器。失败、取消、过期恢复随 Task 在同一事务收口;不完整分析保持安全暂停,失败补查不消费子任务证据。 + +### Benchmark 生命周期与诊断 + +- Benchmark 与关联 Task 共用一个 SQLite 连接及事务:准入失败不留下半个 Task/Run;运行、完成、失败、停止和中断同步投影到 Task。case 评价、固定预算和禁止模型自动重放的规则不变。 +- 当前是单机 SQLite、单活跃 Benchmark owner,不是 HA。owner 绑定进程 ID/主机;第二个存活 owner 只能读取,不能中断或接管;仅明确释放或确认旧进程已退出后恢复。未知主机/进程权限失败关闭。`Server.close` 等待在途 Benchmark 请求和 worker 结束后释放连接;进程意外退出通过下次启动收口,不自动续跑。 +- context、evaluation 和准入 HTTP 请求统一使用 `FORGE_REQUEST_TIMEOUT_MS`;stop 将 abort 传播到挂起请求。重启把未完成的冻结运行标为 interrupted,不重放付费调用;历史未冻结运行只读。 +- `X-Request-ID` 在 Web → Pi → Forge 链路传递,默认日志只记录安全 ID、状态与耗时,不记录 SQL、请求内容、结果行或凭证。客户端遇到响应丢失应回查原 Command/Task,再沿用同一 command ID;投递结果未知不等于请求未执行。 +- Structured Artifact 由 `contracts.ts` / TypeBox 统一定义,`npm run export:structured-contracts` 导出 Python schema;共享语义语料同时覆盖行数、行宽、时间和内容边界。Stage 扩展使用明确 descriptor 与类型化执行方法,不自动获得新的审批或数据库执行权。 + + ## Channel Adapter 复制 `channel-identities.example.json` 到 `PI_CHANNEL_IDENTITY_MAP` 指定位置,并为 Bot 单独注入与 `PI_CHANNEL_SERVICE_KEYS` 匹配的 `PI_CHANNEL_SERVICE_KEY`。`POST /v1/channel-events` 必须携带 `X-Channel-Service-Key`;未知飞书 `open_id` 或钉钉 `user_id` 会失败关闭。`(channel,event_id)` 在 SQLite 中唯一,平台重试不会创建第二个 TaskRun 或重复批准。 飞书迁移由 `FEISHU_PI_ENABLED=true` 开启。设置页保存 App 凭证时会先调用飞书官方接口验证,再由受管 Runtime 热启动 `python -m web.feishu_pi` WebSocket 进程;无需重启 API。新消息和新 Pi 卡片只走 ChannelEvent → Pi Task API,旧卡片会提示失效。HTTP webhook 与 WebSocket 不能同时消费同一应用事件。个人部署可显式开启一次性首用户绑定;它只在飞书 Identity Map 为空、Adapter Service Key 已通过且收到 message 时生效一次,不是 wildcard 授权。 + +飞书的投递 receipt 位于 `QUERY_RUN_DB_PATH` 同目录的 `channel_delivery.db`,独立于 Task 真相。`GET /api/pi/tasks/{task_run_id}/deliveries` 按授权 scope 查看状态,`POST /api/pi/deliveries/{delivery_id}/retry` 仅重读原 presentation 并重送,不重提 ChannelEvent 或执行 SQL。未知投递与用量不补为成功/零;进程存活与 WebSocket 连接证据分开。公共诊断只读联查既有 Store,任何来源不可用显示 partial。 diff --git a/services/pi-orchestrator/package.json b/services/pi-orchestrator/package.json index 58a42f2..e2a1d6b 100644 --- a/services/pi-orchestrator/package.json +++ b/services/pi-orchestrator/package.json @@ -10,6 +10,7 @@ "dev": "tsx src/server.ts", "start": "node --import tsx src/server.ts", "export:product-contract": "tsx scripts/export-product-projection-schema.ts", + "export:structured-contracts": "tsx scripts/export-structured-artifact-schemas.ts", "typecheck": "tsc --noEmit", "test": "node --import tsx --test tests/*.test.ts" }, diff --git a/services/pi-orchestrator/scripts/export-structured-artifact-schemas.ts b/services/pi-orchestrator/scripts/export-structured-artifact-schemas.ts new file mode 100644 index 0000000..8109158 --- /dev/null +++ b/services/pi-orchestrator/scripts/export-structured-artifact-schemas.ts @@ -0,0 +1,8 @@ +import { writeFileSync } from "node:fs"; +import { structuredArtifactSchemas } from "../src/contracts.js"; + +for (const [name, schema] of Object.entries(structuredArtifactSchemas)) { + const target = new URL(`../../../agent/contracts/${name.replaceAll("_", "-")}-artifact.schema.json`, import.meta.url); + writeFileSync(target, `${JSON.stringify(schema, null, 2)}\n`, "utf8"); + console.log(target.pathname); +} diff --git a/services/pi-orchestrator/src/application.ts b/services/pi-orchestrator/src/application.ts index e69f52b..c49200d 100644 --- a/services/pi-orchestrator/src/application.ts +++ b/services/pi-orchestrator/src/application.ts @@ -1,4 +1,8 @@ import { createHash } from "node:crypto"; +import { setTimeout as delay } from "node:timers/promises"; +import { OrchestratorState, type StateTransactionPort } from "./orchestrator-state.js"; +import { SqliteOrchestratorState } from "./sqlite-store.js"; +import { currentRequestId } from "./request-context.js"; import type { ChannelEventStore } from "./channels/event-store.js"; import type { ChannelEventInput, ChannelIdentity, ChannelPresentation } from "./channels/contracts.js"; @@ -7,13 +11,13 @@ import { routeChannelMessage } from "./channels/intent.js"; import { buildExecutionPlan, reviseExecutionPlan, + settleExecutionPlan, type PlanCapability, type PlanStepStatus, } from "./planning.js"; import { buildChartPayload, bundleHash, type TechnicalReportPayload } from "./report-artifacts.js"; import { attemptModelStage, resolveStageModelBinding } from "./model-bindings.js"; import { - InMemoryArtifactStore, type Artifact, type ArtifactStore, } from "./artifacts.js"; @@ -48,9 +52,8 @@ import { type AdvisorySkillName, type AuthorizedSkillName, } from "./skills.js"; -import { InMemorySkillPolicyStore, type SkillPolicyStore, type TeamSkillPolicy } from "./skill-policy.js"; +import type { SkillPolicyStore, TeamSkillPolicy } from "./skill-policy.js"; import { - InMemoryTaskStore, TaskStateError, type CreateTaskInput, type TaskChannel, @@ -59,7 +62,6 @@ import { type TaskStore, } from "./task-store.js"; import { - InMemoryTaskEventStore, type TaskEvent, type TaskEventStore, } from "./task-events.js"; @@ -68,10 +70,6 @@ export interface CreateDataTaskInput extends CreateTaskInput { message: string; } -export interface StateTransactionPort { - run(operation: () => T): T; -} - export interface ForgeQueryRunPort { searchContext?( input: { orgId: string; teamId: string; userId: string; question: string; limit?: number }, @@ -122,41 +120,41 @@ export class OrchestratorApplication { readonly #skills: StructuredSkillExecutionPort; readonly #artifacts: ArtifactStore; readonly #transactions: StateTransactionPort; - readonly #attempts: StageAttemptStore | undefined; + readonly #attempts: StageAttemptStore; + readonly state: OrchestratorState; + readonly #activeStages = new Map void }>(); readonly #stageTimeoutMs: number; readonly #stageLeaseMs: number; - readonly #channelEvents: ChannelEventStore | undefined; + readonly #channelEvents: ChannelEventStore; readonly #config: OrchestratorConfig; readonly #skillPolicies: SkillPolicyStore; readonly #productProjections: ProductProjectionService; constructor(options: { config: OrchestratorConfig; - tasks?: TaskStore; - events?: TaskEventStore; - artifacts?: ArtifactStore; - transactions?: StateTransactionPort; - attempts?: StageAttemptStore; - channelEvents?: ChannelEventStore; - skillPolicies?: SkillPolicyStore; + state?: OrchestratorState; forgeClient?: ForgeQueryRunPort; skillExecutor?: StructuredSkillExecutionPort; }) { - this.#tasks = options.tasks ?? new InMemoryTaskStore(); - this.#events = options.events ?? new InMemoryTaskEventStore(); - this.#artifacts = options.artifacts ?? new InMemoryArtifactStore(); - this.#transactions = options.transactions ?? { run: (operation) => operation() }; - this.#attempts = options.attempts; + if (options.state !== undefined && !(options.state instanceof OrchestratorState)) { + throw new TypeError("Application state must be one coherent OrchestratorState adapter"); + } + this.state = options.state ?? new SqliteOrchestratorState(":memory:"); + this.#tasks = this.state.tasks; + this.#events = this.state.events; + this.#artifacts = this.state.artifacts; + this.#transactions = this.state.transactions; + this.#attempts = this.state.attempts; this.#stageTimeoutMs = options.config.stageTimeoutMs; this.#stageLeaseMs = options.config.stageLeaseMs; - this.#channelEvents = options.channelEvents; + this.#channelEvents = this.state.channelEvents; this.#config = options.config; - this.#skillPolicies = options.skillPolicies ?? new InMemorySkillPolicyStore(AUTHORIZED_SKILL_NAMES); + this.#skillPolicies = this.state.skillPolicies; this.#productProjections = new ProductProjectionService({ tasks: this.#tasks, events: this.#events, artifacts: this.#artifacts, - ...(this.#attempts === undefined ? {} : { attempts: this.#attempts }), + attempts: this.#attempts, }); this.#skills = options.skillExecutor ?? new PiStructuredSkillExecutor({ config: options.config }); @@ -205,6 +203,27 @@ export class OrchestratorApplication { }); } + transitionBenchmarkTask(input: { + taskRunId: string; + runId: string; + status: "queued" | "running" | "pausing" | "paused" | "stopping" | "completed" | "stopped" | "failed" | "interrupted"; + currentStage: string; + }): TaskRun { + return this.#transactions.run(() => { + const task = this.#tasks.get(input.taskRunId); + if (task === undefined || task.channel !== "api" || task.metadata.benchmark !== true || + task.metadata.benchmark_run_id !== input.runId) { + throw new TaskStateError("Benchmark lifecycle does not match its TaskRun"); + } + const status = input.status === "queued" ? "created" + : input.status === "running" || input.status === "paused" || input.status === "pausing" || input.status === "stopping" ? "analyzing" + : input.status === "stopped" ? "cancelled" + : input.status === "interrupted" ? "failed" : input.status; + if (task.status === status && task.current_stage === input.currentStage) return task; + return this.#transition(task, status, input.currentStage); + }); + } + getTask(taskRunId: string): TaskRun | undefined { return this.#tasks.get(taskRunId); } @@ -287,17 +306,18 @@ export class OrchestratorApplication { const task = this.#tasks.get(taskRunId); if (task === undefined) throw new TaskStateError(`TaskRun not found: ${taskRunId}`); if (input.prompt.trim().length === 0) throw new TaskStateError("prompt must not be empty"); - if (this.#skills.advise === undefined) { + const advise = this.#skills.advise; + if (advise === undefined) { throw new TaskStateError("Advisory Skill runtime is unavailable"); } if (!this.#skillPolicies.isEnabled(task.org_id, task.team_id, input.skillName)) { throw new TaskStateError(`Skill is disabled for this team: ${input.skillName}`); } - const attemptRound = (this.#attempts?.list(taskRunId) ?? []).filter( + const attemptRound = this.#attempts.list(taskRunId).filter( (attempt) => attempt.stage === `skill:${input.skillName}`, ).length + 1; const idempotencyKey = input.idempotencyKey ?? `${taskRunId}:skill:${input.skillName}:${attemptRound}`; - const existingAttempt = this.#attempts?.findByIdempotencyKey(taskRunId, idempotencyKey); + const existingAttempt = this.#attempts.findByIdempotencyKey(taskRunId, idempotencyKey); if (existingAttempt?.status === "succeeded") { const completedEvent = this.#events.list(taskRunId).find( (event) => @@ -327,7 +347,7 @@ export class OrchestratorApplication { ); } const retryStatus = task.status; - let attempt: StageAttempt | undefined; + let attempt!: StageAttempt; const running = this.#transactions.run(() => { const next = this.#transition(task, "analyzing", `skill:${input.skillName}`); attempt = this.#startAttempt( @@ -339,18 +359,18 @@ export class OrchestratorApplication { this.#events.append(taskRunId, "skill.started", { skill_name: input.skillName }); return next; }); - const stageExecution = this.#stageSignal(signal); + const stageExecution = this.#stageSignal(attempt, signal); try { const queryResults = this.#artifacts.list(taskRunId).filter( (artifact): artifact is Artifact => artifact.artifact_type === "query_result", ); - const payload = await this.#skills.advise(running, input.skillName, { + const payload = await stageExecution.wait(() => advise.call(this.#skills, running, input.skillName, { prompt: input.prompt, queryResults, ...(input.contextEvidence === undefined ? {} : { contextEvidence: input.contextEvidence }), - }, stageExecution.signal, attempt?.model_revision); + }, stageExecution.signal, attempt.model_revision)); if (stageExecution.timedOut()) throw new Error("Advisory Skill Stage timed out"); - return this.#transactions.run(() => { + return this.#commitStage(attempt, () => { const artifact = this.#artifacts.create({ artifactType: "advisory", taskRunId, @@ -362,11 +382,11 @@ export class OrchestratorApplication { payload.status === "complete" ? "completed" : "incomplete", "skill_complete", ); - this.#finishAttempt(attempt, "succeeded"); + this.#finishAttempt(attempt, "succeeded", undefined, { artifact_id: artifact.artifact_id }); this.#events.append(taskRunId, "skill.completed", { skill_name: input.skillName, artifact_id: artifact.artifact_id, - attempt_id: attempt?.attempt_id ?? null, + attempt_id: attempt.attempt_id, idempotency_key: idempotencyKey, status: payload.status, }); @@ -375,8 +395,9 @@ export class OrchestratorApplication { } catch (error) { const message = error instanceof Error ? error.message : "Unknown Skill error"; this.#transactions.run(() => { - if (stageExecution.timedOut()) { - this.#finishAttempt(attempt, "timed_out", message); + if (!this.#ownsAttempt(attempt)) { this.#releaseAttempt(attempt); return; } + if (stageExecution.timedOut() || stageExecution.interrupted()) { + this.#finishAttempt(attempt, stageExecution.timedOut() ? "timed_out" : "interrupted", message); this.#transition(running, retryStatus, `skill:${input.skillName}:retry`); } else { this.#finishAttempt(attempt, "failed", message); @@ -393,14 +414,14 @@ export class OrchestratorApplication { } getStageAttempts(taskRunId: string): StageAttempt[] { - return this.#attempts?.list(taskRunId) ?? []; + return this.#attempts.list(taskRunId); } getTaskRunIdForChannelEvent( channel: ChannelEventInput["channel"], eventId: string, ): string | null { - return this.#channelEvents?.get(channel, eventId)?.task_run_id ?? null; + return this.#channelEvents.get(channel, eventId)?.task_run_id ?? null; } getChannelPresentation(taskRunId: string): ChannelPresentation { @@ -418,9 +439,6 @@ export class OrchestratorApplication { identity: ChannelIdentity, signal?: AbortSignal, ): Promise<{ task: TaskRun; presentation: ChannelPresentation; duplicate: boolean }> { - if (this.#channelEvents === undefined) { - throw new TaskStateError("ChannelEvent Store is not configured"); - } if (event.event_type !== "message") { throw new TaskStateError(`Unsupported ChannelEvent type: ${event.event_type}`); } @@ -431,8 +449,7 @@ export class OrchestratorApplication { const route = routeChannelMessage(text); const claimed = this.#transactions.run(() => { - const claim = this.#channelEvents?.claim(event); - if (claim === undefined) throw new TaskStateError("ChannelEvent Store is not configured"); + const claim = this.#channelEvents.claim(event); if (!claim.created) return { record: claim.record, task: undefined }; const created = this.createTask({ org_id: identity.org_id, @@ -464,7 +481,7 @@ export class OrchestratorApplication { plan_revision: 1, route_kind: route.kind, }); - this.#channelEvents?.complete(event.channel, event.event_id, created.task.task_run_id); + this.#channelEvents.complete(event.channel, event.event_id, created.task.task_run_id); return { record: claim.record, task: created.task }; }); @@ -626,9 +643,6 @@ export class OrchestratorApplication { identity: ChannelIdentity, signal?: AbortSignal, ): Promise<{ task: TaskRun; presentation: ChannelPresentation; duplicate: boolean }> { - if (this.#channelEvents === undefined) { - throw new TaskStateError("ChannelEvent Store is not configured"); - } if (event.event_type !== "action" || event.task_run_id === null) { throw new TaskStateError("Channel action requires task_run_id"); } @@ -678,8 +692,7 @@ export class OrchestratorApplication { } const claim = this.#transactions.run(() => { - const claimed = this.#channelEvents?.claim(event); - if (claimed === undefined) throw new TaskStateError("ChannelEvent Store is not configured"); + const claimed = this.#channelEvents.claim(event); return claimed; }); if (!claim.created) { @@ -871,6 +884,12 @@ export class OrchestratorApplication { reason: "user_cancelled", idempotency_key: idempotencyKey, }); + for (const attempt of this.#attempts.list(taskRunId)) { + if (attempt.status !== "running") continue; + this.#activeStages.get(attempt.attempt_id)?.controller.abort(new Error("Task cancelled")); + this.#finishAttempt(attempt, "interrupted", "Task cancelled by user; remote effects may already have occurred"); + } + settleExecutionPlan(this.state, cancelled); return cancelled; }); } @@ -882,32 +901,31 @@ export class OrchestratorApplication { ): Promise<{ task: TaskRun; artifact: Artifact; events: TaskEvent[] }> { const initialTask = this.#tasks.get(taskRunId); if (initialTask === undefined) throw new TaskStateError(`TaskRun not found: ${taskRunId}`); + const commandKey = this.#commandKey(taskRunId, "requirement_clarification", input.idempotencyKey); + const replay = this.#replayStage>>(taskRunId, commandKey); + if (replay !== undefined) return replay; this.#assertSkillEnabled(initialTask, "data-requirement-clarifier"); if (initialTask.status !== "created" && initialTask.status !== "needs_input") { throw new TaskStateError(`TaskRun cannot clarify from status: ${initialTask.status}`); } const retryStatus = initialTask.status; - const round = this.#artifacts.list(taskRunId).filter( - (artifact) => artifact.artifact_type === "clarification", - ).length + 1; - let attempt: StageAttempt | undefined; + + let attempt!: StageAttempt; let task = this.#transactions.run(() => { const running = this.#transition(initialTask, "clarifying", "requirement_clarification"); attempt = this.#startAttempt( running, "requirement_clarification", retryStatus, - input.idempotencyKey ?? `${taskRunId}:clarification:${round}`, + commandKey, ); return running; }); - const stageExecution = this.#stageSignal(signal); + const stageExecution = this.#stageSignal(attempt, signal); try { - const payload = await this.#skills.clarify( - task, input.message, stageExecution.signal, attempt?.model_revision, - ); + const payload = await stageExecution.wait(() => this.#skills.clarify(task, input.message, stageExecution.signal, attempt.model_revision,)); if (stageExecution.timedOut()) throw new Error("Clarification Stage timed out"); - return this.#transactions.run(() => { + return this.#commitStage(attempt, () => { const artifact = this.#artifacts.create({ artifactType: "clarification", taskRunId, @@ -925,14 +943,15 @@ export class OrchestratorApplication { payload.status === "confirmed" ? "ready_for_query" : "needs_input", payload.status === "confirmed" ? "query_prepare" : "requirement_clarification", ); - this.#finishAttempt(attempt, "succeeded"); + this.#finishAttempt(attempt, "succeeded", undefined, { artifact_id: artifact.artifact_id }); return { task, artifact, events: this.#events.list(taskRunId) }; }); } catch (error) { const message = error instanceof Error ? error.message : "unknown Skill error"; this.#transactions.run(() => { - if (stageExecution.timedOut()) { - this.#finishAttempt(attempt, "timed_out", message); + if (!this.#ownsAttempt(attempt)) { this.#releaseAttempt(attempt); return; } + if (stageExecution.timedOut() || stageExecution.interrupted()) { + this.#finishAttempt(attempt, stageExecution.timedOut() ? "timed_out" : "interrupted", message); task = this.#transition(task, retryStatus, "clarification_retry"); } else { this.#finishAttempt(attempt, "failed", message); @@ -957,6 +976,9 @@ export class OrchestratorApplication { ): Promise<{ task: TaskRun; artifact: Artifact; events: TaskEvent[] }> { const initialTask = this.#tasks.get(taskRunId); if (initialTask === undefined) throw new TaskStateError(`TaskRun not found: ${taskRunId}`); + const commandKey = this.#commandKey(taskRunId, "metric_definition_review", input.idempotencyKey); + const replay = this.#replayStage>>(taskRunId, commandKey); + if (replay !== undefined) return replay; this.#assertSkillEnabled(initialTask, "metric-definition-reviewer"); if ( initialTask.status !== "created" && @@ -966,27 +988,23 @@ export class OrchestratorApplication { throw new TaskStateError(`TaskRun cannot review a metric from status: ${initialTask.status}`); } const retryStatus = initialTask.status; - const round = this.#artifacts.list(taskRunId).filter( - (artifact) => artifact.artifact_type === "metric_definition", - ).length + 1; - let attempt: StageAttempt | undefined; + + let attempt!: StageAttempt; let task = this.#transactions.run(() => { const running = this.#transition(initialTask, "clarifying", "metric_definition_review"); attempt = this.#startAttempt( running, "metric_definition_review", retryStatus, - input.idempotencyKey ?? `${taskRunId}:metric-review:${round}`, + commandKey, ); return running; }); - const stageExecution = this.#stageSignal(signal); + const stageExecution = this.#stageSignal(attempt, signal); try { - const payload = await this.#skills.reviewMetric( - task, input.message, stageExecution.signal, attempt?.model_revision, - ); + const payload = await stageExecution.wait(() => this.#skills.reviewMetric(task, input.message, stageExecution.signal, attempt.model_revision,)); if (stageExecution.timedOut()) throw new Error("Metric review Stage timed out"); - return this.#transactions.run(() => { + return this.#commitStage(attempt, () => { const artifact = this.#artifacts.create({ artifactType: "metric_definition", taskRunId, @@ -1004,14 +1022,15 @@ export class OrchestratorApplication { payload.status === "confirmed" ? "ready_for_query" : "needs_input", payload.status === "confirmed" ? "query_prepare" : "metric_definition_review", ); - this.#finishAttempt(attempt, "succeeded"); + this.#finishAttempt(attempt, "succeeded", undefined, { artifact_id: artifact.artifact_id }); return { task, artifact, events: this.#events.list(taskRunId) }; }); } catch (error) { const message = error instanceof Error ? error.message : "unknown Skill error"; this.#transactions.run(() => { - if (stageExecution.timedOut()) { - this.#finishAttempt(attempt, "timed_out", message); + if (!this.#ownsAttempt(attempt)) { this.#releaseAttempt(attempt); return; } + if (stageExecution.timedOut() || stageExecution.interrupted()) { + this.#finishAttempt(attempt, stageExecution.timedOut() ? "timed_out" : "interrupted", message); task = this.#transition(task, retryStatus, "metric_review_retry"); } else { this.#finishAttempt(attempt, "failed", message); @@ -1045,6 +1064,9 @@ export class OrchestratorApplication { throw new TaskStateError("question must not be empty"); } + const commandKey = this.#commandKey(taskRunId, "query_prepare", input.idempotencyKey); + const replay = this.#replayStage>>(taskRunId, commandKey); + if (replay !== undefined) return replay; if (task.status === "created" || task.status === "needs_input") { task = this.#transition(task, "ready_for_query", "query_prepare"); } else if (task.status !== "ready_for_query") { @@ -1052,40 +1074,37 @@ export class OrchestratorApplication { } let stageTask: TaskRun = task; - const prepareNumber = - (this.#attempts?.list(taskRunId).filter((candidate) => candidate.stage === "query_prepare") - .length ?? 0) + 1; - let attempt: StageAttempt | undefined; + + let attempt!: StageAttempt; this.#transactions.run(() => { attempt = this.#startAttempt( stageTask, "query_prepare", "ready_for_query", - input.idempotencyKey ?? `${taskRunId}:query-prepare:${prepareNumber}`, + commandKey, ); }); - const stageExecution = this.#stageSignal(signal); + const stageExecution = this.#stageSignal(attempt, signal); let result: QueryRunReview; try { - result = await this.#forge.createQueryRun( - { - taskRunId: stageTask.task_run_id, - orgId: stageTask.org_id, - teamId: stageTask.team_id, - userId: stageTask.user_id, - question: input.question, - idempotencyKey: `${stageTask.task_run_id}:prepare`, - ...(input.dialect === undefined ? {} : { dialect: input.dialect }), - ...(input.candidate === undefined ? {} : { candidate: input.candidate }), - }, - stageExecution.signal, - ); + result = await stageExecution.wait(() => this.#forge.createQueryRun({ + taskRunId: stageTask.task_run_id, + orgId: stageTask.org_id, + teamId: stageTask.team_id, + userId: stageTask.user_id, + question: input.question, + idempotencyKey: commandKey, + ...(input.dialect === undefined ? {} : { dialect: input.dialect }), + ...(input.candidate === undefined ? {} : { candidate: input.candidate }), + }, + stageExecution.signal,)); if (stageExecution.timedOut()) throw new Error("Query preparation Stage timed out"); } catch (error) { const message = error instanceof Error ? error.message : "unknown Forge error"; this.#transactions.run(() => { - if (stageExecution.timedOut()) { - this.#finishAttempt(attempt, "timed_out", message); + if (!this.#ownsAttempt(attempt)) { this.#releaseAttempt(attempt); return; } + if (stageExecution.timedOut() || stageExecution.interrupted()) { + this.#finishAttempt(attempt, stageExecution.timedOut() ? "timed_out" : "interrupted", message); stageTask = this.#transition(stageTask, "ready_for_query", "query_prepare_retry"); } else { this.#finishAttempt(attempt, "failed", message); @@ -1103,7 +1122,7 @@ export class OrchestratorApplication { } let finalizedTask = stageTask; - return this.#transactions.run(() => { + return this.#commitStage(attempt, () => { if (result.status === "needs_review") { finalizedTask = this.#transition(finalizedTask, "waiting_for_query_approval", "query_review"); this.#events.append(taskRunId, "query.review_requested", { @@ -1151,6 +1170,7 @@ export class OrchestratorApplication { ? "succeeded" : "failed", result.error, + { result }, ); return { task: finalizedTask, result, events: this.#events.list(taskRunId) }; }); @@ -1186,16 +1206,14 @@ export class OrchestratorApplication { ) { throw new TaskStateError("Approval does not match the TaskRun review request"); } - if ( - task.status !== "waiting_for_query_approval" && - task.status !== "querying" && - task.status !== "completed" && - task.status !== "ready_for_analysis" - ) { + const commandKey = this.#commandKey(taskRunId, "query_execution", input.idempotencyKey); + const replay = this.#replayStage>>(taskRunId, commandKey); + if (replay !== undefined) return replay; + if (task.status !== "waiting_for_query_approval") { throw new TaskStateError(`TaskRun cannot approve a query from status: ${task.status}`); } - let attempt: StageAttempt | undefined; + let attempt!: StageAttempt; let executionTask: TaskRun = task; if (executionTask.status === "waiting_for_query_approval") { let approvalTask: TaskRun = executionTask; @@ -1215,33 +1233,27 @@ export class OrchestratorApplication { ); return approvalTask; }); - } else if (executionTask.status === "querying") { - attempt = this.#attempts?.findByIdempotencyKey(taskRunId, input.idempotencyKey); - if (this.#attempts !== undefined && attempt?.status !== "running") { - throw new TaskStateError("Query execution attempt is not resumable"); - } } - const stageExecution = this.#stageSignal(signal); + const stageExecution = this.#stageSignal(attempt, signal); let result: QueryRunResult; try { - result = await this.#forge.approveQueryRun( - { - queryRunId: input.queryRunId, - approverUserId: executionTask.user_id, - sqlHash: input.sqlHash, - assuranceReportHash, - idempotencyKey: input.idempotencyKey, - }, - stageExecution.signal, - ); + result = await stageExecution.wait(() => this.#forge.approveQueryRun({ + queryRunId: input.queryRunId, + approverUserId: executionTask.user_id, + sqlHash: input.sqlHash, + assuranceReportHash, + idempotencyKey: input.idempotencyKey, + }, + stageExecution.signal,)); if (stageExecution.timedOut()) throw new Error("Query execution Stage timed out"); } catch (error) { if (executionTask.status === "querying") { const message = error instanceof Error ? error.message : "unknown Forge error"; this.#transactions.run(() => { - if (stageExecution.timedOut()) { - this.#finishAttempt(attempt, "timed_out", message); + if (!this.#ownsAttempt(attempt)) { this.#releaseAttempt(attempt); return; } + if (stageExecution.timedOut() || stageExecution.interrupted()) { + this.#finishAttempt(attempt, stageExecution.timedOut() ? "timed_out" : "interrupted", message); executionTask = this.#transition( executionTask, "waiting_for_query_approval", @@ -1263,7 +1275,7 @@ export class OrchestratorApplication { let artifact = this.#artifacts.latest(taskRunId, "query_result"); if (executionTask.status === "querying") { - this.#transactions.run(() => { + this.#commitStage(attempt, () => { artifact = this.#artifacts.create({ artifactType: "query_result", taskRunId, @@ -1321,7 +1333,7 @@ export class OrchestratorApplication { artifact_id: artifact.artifact_id, }); this.#advanceExecutionPlan(taskRunId, { query: "completed" }); - this.#finishAttempt(attempt, "succeeded"); + this.#finishAttempt(attempt, "succeeded", undefined, { artifact_id: artifact.artifact_id, result }); }); } if (artifact === undefined) { @@ -1444,6 +1456,9 @@ export class OrchestratorApplication { } return { task: parent, artifact, events: this.#events.list(taskRunId) }; } + const commandKey = this.#commandKey(taskRunId, "supplemental_analysis", input.idempotencyKey); + const replay = this.#replayStage>>(taskRunId, commandKey); + if (replay !== undefined) return replay; this.#assertSkillEnabled(parent, "business-root-cause-analysis"); if (parent.status !== "incomplete") { throw new TaskStateError(`TaskRun cannot resume analysis from status: ${parent.status}`); @@ -1483,7 +1498,7 @@ export class OrchestratorApplication { const originalMessage = parent.metadata.original_message; const question = typeof originalMessage === "string" ? originalMessage : parent.intent; - let attempt: StageAttempt | undefined; + let attempt!: StageAttempt; let stageTask: TaskRun = parent; stageTask = this.#transactions.run(() => { const running = this.#transition(stageTask, "analyzing", "supplemental_analysis"); @@ -1491,20 +1506,18 @@ export class OrchestratorApplication { running, "supplemental_analysis", "incomplete", - input.idempotencyKey, + commandKey, ); return running; }); - const stageExecution = this.#stageSignal(signal); + const stageExecution = this.#stageSignal(attempt, signal); try { const queryResults = [primaryResult, supplementResult]; - const payload = await this.#skills.analyze( - stageTask, - { question, queryResults, priorAnalysis }, - stageExecution.signal, - attempt?.model_revision, - (progress) => this.#markAttemptProgress(attempt, progress.phase), - ); + const payload = await stageExecution.wait(() => this.#skills.analyze(stageTask, + { question, queryResults, priorAnalysis }, + stageExecution.signal, + attempt.model_revision, + (progress) => this.#markAttemptProgress(attempt, progress.phase),)); if (stageExecution.timedOut()) throw new Error("Supplemental Analysis Stage timed out"); const allowedEvidenceRefs = new Set( queryResults.flatMap((result) => @@ -1520,7 +1533,7 @@ export class OrchestratorApplication { if (references.some((reference) => !allowedEvidenceRefs.has(reference))) { throw new Error("Supplement analysis evidence is absent from parent/child QueryResults"); } - return this.#transactions.run(() => { + return this.#commitStage(attempt, () => { const artifact = this.#artifacts.create({ artifactType: "analysis", taskRunId, @@ -1548,14 +1561,15 @@ export class OrchestratorApplication { suggested_queries: payload.suggested_queries, supplemental: true, }); - this.#finishAttempt(attempt, "succeeded"); + this.#finishAttempt(attempt, "succeeded", undefined, { artifact_id: artifact.artifact_id }); return { task: stageTask, artifact, events: this.#events.list(taskRunId) }; }); } catch (error) { const message = error instanceof Error ? error.message : "unknown Skill error"; this.#transactions.run(() => { - if (stageExecution.timedOut()) { - this.#finishAttempt(attempt, "timed_out", message); + if (!this.#ownsAttempt(attempt)) { this.#releaseAttempt(attempt); return; } + if (stageExecution.timedOut() || stageExecution.interrupted()) { + this.#finishAttempt(attempt, stageExecution.timedOut() ? "timed_out" : "interrupted", message); stageTask = this.#transition(stageTask, "incomplete", "supplemental_analysis_retry"); } else { this.#finishAttempt(attempt, "failed", message); @@ -1581,6 +1595,9 @@ export class OrchestratorApplication { ): Promise<{ task: TaskRun; artifact: Artifact; events: TaskEvent[] }> { let task = this.#tasks.get(taskRunId); if (task === undefined) throw new TaskStateError(`TaskRun not found: ${taskRunId}`); + const commandKey = this.#commandKey(taskRunId, "business_root_cause_analysis", input.idempotencyKey); + const replay = this.#replayStage>>(taskRunId, commandKey); + if (replay !== undefined) return replay; this.#assertSkillEnabled(task, "business-root-cause-analysis"); if (task.status !== "ready_for_analysis") { throw new TaskStateError(`TaskRun cannot analyze from status: ${task.status}`); @@ -1595,7 +1612,7 @@ export class OrchestratorApplication { const question = input.question?.trim() || (typeof originalMessage === "string" ? originalMessage : task.intent); - let attempt: StageAttempt | undefined; + let attempt!: StageAttempt; let stageTask: TaskRun = task; stageTask = this.#transactions.run(() => { const running = this.#transition(stageTask, "analyzing", "business_root_cause_analysis"); @@ -1604,19 +1621,17 @@ export class OrchestratorApplication { running, "business_root_cause_analysis", "ready_for_analysis", - input.idempotencyKey ?? `${taskRunId}:analysis:${queryResult.artifact_id}`, + commandKey, ); return running; }); - const stageExecution = this.#stageSignal(signal); + const stageExecution = this.#stageSignal(attempt, signal); try { - const payload = await this.#skills.analyze( - stageTask, - { question, queryResults: [queryResult] }, - stageExecution.signal, - attempt?.model_revision, - (progress) => this.#markAttemptProgress(attempt, progress.phase), - ); + const payload = await stageExecution.wait(() => this.#skills.analyze(stageTask, + { question, queryResults: [queryResult] }, + stageExecution.signal, + attempt.model_revision, + (progress) => this.#markAttemptProgress(attempt, progress.phase),)); if (stageExecution.timedOut()) throw new Error("Analysis Stage timed out"); const allowedEvidenceRefs = new Set( queryResult.payload.rows.map( @@ -1631,7 +1646,7 @@ export class OrchestratorApplication { throw new Error("Analysis evidence is not present in QueryResultArtifact"); } let finalizedTask = stageTask; - return this.#transactions.run(() => { + return this.#commitStage(attempt, () => { const artifact = this.#artifacts.create({ artifactType: "analysis", taskRunId, @@ -1654,16 +1669,17 @@ export class OrchestratorApplication { suggested_queries: payload.suggested_queries, }); this.#advanceExecutionPlan(taskRunId, { - analysis: payload.status === "complete" ? "completed" : "running", + analysis: payload.status === "complete" ? "completed" : "ready", }); - this.#finishAttempt(attempt, "succeeded"); + this.#finishAttempt(attempt, "succeeded", undefined, { artifact_id: artifact.artifact_id }); return { task: finalizedTask, artifact, events: this.#events.list(taskRunId) }; }); } catch (error) { const message = error instanceof Error ? error.message : "unknown Skill error"; this.#transactions.run(() => { - if (stageExecution.timedOut()) { - this.#finishAttempt(attempt, "timed_out", message); + if (!this.#ownsAttempt(attempt)) { this.#releaseAttempt(attempt); return; } + if (stageExecution.timedOut() || stageExecution.interrupted()) { + this.#finishAttempt(attempt, stageExecution.timedOut() ? "timed_out" : "interrupted", message); stageTask = this.#transition(stageTask, "ready_for_analysis", "analysis_retry"); } else { this.#finishAttempt(attempt, "failed", message); @@ -1688,6 +1704,9 @@ export class OrchestratorApplication { ): Promise<{ task: TaskRun; artifact: Artifact; events: TaskEvent[] }> { let task = this.#tasks.get(taskRunId); if (task === undefined) throw new TaskStateError(`TaskRun not found: ${taskRunId}`); + const commandKey = this.#commandKey(taskRunId, "data_analysis_report", input.idempotencyKey); + const replay = this.#replayStage>>(taskRunId, commandKey); + if (replay !== undefined) return replay; this.#assertSkillEnabled(task, "data-analysis-report-writer"); if (task.status !== "ready_for_report") { throw new TaskStateError(`TaskRun cannot render a report from status: ${task.status}`); @@ -1712,7 +1731,7 @@ export class OrchestratorApplication { comparison_baseline: "当前已审批查询结果内部对比", approach_steps: ["核验结果字段与范围", "比较主要维度", "提炼证据绑定结论"], }; - let attempt: StageAttempt | undefined; + let attempt!: StageAttempt; let stageTask: TaskRun = task; stageTask = this.#transactions.run(() => { const running = this.#transition(stageTask, "rendering", "data_analysis_report"); @@ -1721,18 +1740,16 @@ export class OrchestratorApplication { running, "data_analysis_report", "ready_for_report", - input.idempotencyKey ?? `${taskRunId}:report:${analysis.artifact_id}`, + commandKey, ); return running; }); - const stageExecution = this.#stageSignal(signal); + const stageExecution = this.#stageSignal(attempt, signal); try { - const payload = await this.#skills.writeReport( - stageTask, - { audience: input.audience, analysis }, - stageExecution.signal, - attempt?.model_revision, - ); + const payload = await stageExecution.wait(() => this.#skills.writeReport(stageTask, + { audience: input.audience, analysis }, + stageExecution.signal, + attempt.model_revision,)); if (stageExecution.timedOut()) throw new Error("Report Stage timed out"); const analysisStatements = new Set( analysis.payload.findings.map((finding) => finding.statement), @@ -1756,7 +1773,7 @@ export class OrchestratorApplication { ) { throw new Error("Report introduced findings outside AnalysisArtifact"); } - const assembled = this.#transactions.run(() => { + const assembled = this.#commitStage(attempt, () => { const artifact = this.#artifacts.create({ artifactType: "rendered_output", taskRunId, @@ -1846,10 +1863,12 @@ export class OrchestratorApplication { } return { artifact, queryResult, technical, technicalPayload, charts, bundle, reportBundlePayload }; }); - if (this.#forge.createReport === undefined || this.#forge.getReport === undefined) { + const createReport = this.#forge.createReport; + const getReport = this.#forge.getReport; + if (createReport === undefined || getReport === undefined) { throw new Error("Forge Report Service is not configured"); } - let publication = await this.#forge.createReport({ + let publication = await stageExecution.wait(() => createReport.call(this.#forge, { report_id: assembled.reportBundlePayload.report_id, task_run_id: taskRunId, org_id: stageTask.org_id, @@ -1863,14 +1882,14 @@ export class OrchestratorApplication { query_result: assembled.queryResult.payload, charts: assembled.charts.map((chart) => chart.payload), technical_report: assembled.technicalPayload, - }, input.idempotencyKey ?? `${taskRunId}:publish:${assembled.bundle.artifact_id}`, stageExecution.signal); + }, input.idempotencyKey ?? `${taskRunId}:publish:${assembled.bundle.artifact_id}`, stageExecution.signal)); while (publication.status === "publishing") { if (stageExecution.timedOut()) throw new Error("Report publication Stage timed out"); - await new Promise((resolve) => setTimeout(resolve, 500)); - publication = await this.#forge.getReport(publication.report_id, stageExecution.signal); + await stageExecution.wait(() => delay(500, undefined, { signal: stageExecution.signal })); + publication = await stageExecution.wait(() => getReport.call(this.#forge, publication.report_id, stageExecution.signal)); } if (publication.status !== "published") throw new Error("Report publication failed"); - const completedReport = this.#transactions.run(() => { + const completedReport = this.#commitStage(attempt, () => { const publicationArtifact = this.#artifacts.create({ artifactType: "publication", taskRunId, @@ -1900,7 +1919,7 @@ export class OrchestratorApplication { status: payload.status, }); this.#advanceExecutionPlan(taskRunId, { report: "completed" }); - this.#finishAttempt(attempt, "succeeded"); + this.#finishAttempt(attempt, "succeeded", undefined, { artifact_id: assembled.artifact.artifact_id }); return { task: finalizedTask, artifact: assembled.artifact, events: this.#events.list(taskRunId) }; }); await this.#persistSessionSummary( @@ -1913,8 +1932,9 @@ export class OrchestratorApplication { } catch (error) { const message = error instanceof Error ? error.message : "unknown Skill error"; this.#transactions.run(() => { - if (stageExecution.timedOut()) { - this.#finishAttempt(attempt, "timed_out", message); + if (!this.#ownsAttempt(attempt)) { this.#releaseAttempt(attempt); return; } + if (stageExecution.timedOut() || stageExecution.interrupted()) { + this.#finishAttempt(attempt, stageExecution.timedOut() ? "timed_out" : "interrupted", message); stageTask = this.#transition(stageTask, "ready_for_report", "report_retry"); } else { this.#finishAttempt(attempt, "failed", message); @@ -1946,13 +1966,41 @@ export class OrchestratorApplication { } } + #commandKey(taskRunId: string, stage: string, explicit?: string): string { + const key = explicit ?? `${taskRunId}:${stage}:${this.#attempts.list(taskRunId).filter((item) => item.stage === stage).length + 1}`; + if (key.trim().length === 0) throw new TaskStateError("idempotency_key must not be empty"); + const existing = this.#attempts.findByIdempotencyKey(taskRunId, key); + if (existing !== undefined && (existing.stage !== stage || existing.status !== "succeeded")) { + throw new TaskStateError("Stage command already exists; retry with a new idempotency key"); + } + return key; + } + + #replayStage(taskRunId: string, key: string): T | undefined { + const attempt = this.#attempts.findByIdempotencyKey(taskRunId, key); + if (attempt === undefined) return undefined; + const completed = this.#events.list(taskRunId).find((event) => + event.event_type === "stage.attempt_succeeded" && event.payload.attempt_id === attempt.attempt_id); + const response = completed?.payload.response as { artifact_id?: string; result?: unknown } | undefined; + if (response === undefined) throw new TaskStateError("Idempotent Stage response is missing"); + const artifact = response.artifact_id === undefined ? undefined : this.#artifacts.list(taskRunId) + .find((item) => item.artifact_id === response.artifact_id); + if (response.artifact_id !== undefined && artifact === undefined) throw new TaskStateError("Idempotent Stage Artifact is missing"); + return { task: this.#tasks.get(taskRunId), events: this.#events.list(taskRunId), + ...(artifact === undefined ? {} : { artifact }), + ...(response.result === undefined ? {} : { result: response.result }), + } as T; + } + #startAttempt( task: TaskRun, stage: string, retryStatus: TaskRun["status"], idempotencyKey: string, - ): StageAttempt | undefined { - if (this.#attempts === undefined) return undefined; + ): StageAttempt { + if (this.#attempts.findByIdempotencyKey(task.task_run_id, idempotencyKey) !== undefined) { + throw new TaskStateError("StageAttempt already exists; command must be checked before execution"); + } const stageBinding = resolveStageModelBinding(this.#config, attemptModelStage(stage)); const modelRevision = stageBinding?.revisionId ?? computePiModelRevision({ agentDir: this.#config.agentDir, @@ -1972,11 +2020,13 @@ export class OrchestratorApplication { timeoutMs: this.#stageTimeoutMs, modelRevision, skillPolicyVersion: this.#skillPolicies.get(task.org_id, task.team_id)?.version ?? 0, + requestId: currentRequestId() ?? task.correlation_id, }); this.#events.append(task.task_run_id, "stage.attempt_started", { attempt_id: attempt.attempt_id, stage, attempt_number: attempt.attempt_number, + request_id: attempt.request_id ?? null, deadline_at: attempt.deadline_at, lease_expires_at: attempt.lease_expires_at, progress_phase: attempt.progress_phase, @@ -1985,39 +2035,107 @@ export class OrchestratorApplication { } #markAttemptProgress( - attempt: StageAttempt | undefined, + attempt: StageAttempt, phase: Exclude, ): void { - if (attempt === undefined || this.#attempts === undefined) return; this.#attempts.markProgress(attempt.attempt_id, phase); } + #releaseAttempt(attempt: StageAttempt): void { + this.#activeStages.get(attempt.attempt_id)?.dispose(); + this.#activeStages.delete(attempt.attempt_id); + } + #finishAttempt( - attempt: StageAttempt | undefined, - status: "succeeded" | "failed" | "timed_out", + attempt: StageAttempt, + status: "succeeded" | "failed" | "timed_out" | "interrupted", error?: string, + response?: { artifact_id?: string; result?: QueryRunReview | QueryRunResult }, ): void { - if (attempt === undefined || this.#attempts === undefined) return; const finished = this.#attempts.finish(attempt.attempt_id, status, error); + this.#releaseAttempt(attempt); const eventType = status === "succeeded" ? "stage.attempt_succeeded" : status === "timed_out" ? "stage.attempt_timed_out" - : "stage.attempt_failed"; + : status === "interrupted" ? "stage.attempt_interrupted" : "stage.attempt_failed"; this.#events.append(attempt.task_run_id, eventType, { attempt_id: attempt.attempt_id, stage: attempt.stage, status: finished.status, + request_id: attempt.request_id ?? null, + ...(response === undefined ? {} : { response }), ...(error === undefined ? {} : { error: error.slice(0, 2_000) }), }); } - #stageSignal(parent?: AbortSignal): { signal: AbortSignal; timedOut: () => boolean } { - const timeoutSignal = AbortSignal.timeout(this.#stageTimeoutMs); + #commitStage(attempt: StageAttempt, operation: () => T): T { + try { + return this.#transactions.run(() => { + this.#assertAttemptOwner(attempt); + return operation(); + }); + } catch (error) { + if (this.#ownsAttempt(attempt)) { + this.#transactions.run(() => { + this.#finishAttempt(attempt, "failed", "Stage result could not be committed"); + const current = this.#tasks.get(attempt.task_run_id)!; + this.#transition(current, "failed", attempt.stage); + }); + } + throw error; + } + } + + #ownsAttempt(attempt: StageAttempt): boolean { + return this.#attempts.get(attempt.attempt_id)?.status === "running" && + this.#tasks.get(attempt.task_run_id)?.status === attempt.running_status; + } + + #assertAttemptOwner(attempt: StageAttempt): void { + if (!this.#ownsAttempt(attempt)) throw new TaskStateError("Stage result no longer owns its TaskRun"); + } + + #stageSignal(attempt: StageAttempt, parent?: AbortSignal) { + const controller = new AbortController(); + let expired = false; + const timer = setTimeout(() => { + expired = true; + controller.abort(new Error("Stage deadline exceeded")); + }, this.#stageTimeoutMs); + timer.unref(); + const abortParent = () => controller.abort(parent?.reason); + parent?.addEventListener("abort", abortParent, { once: true }); + if (parent?.aborted) abortParent(); + this.#activeStages.set(attempt.attempt_id, { + controller, + dispose: () => { clearTimeout(timer); parent?.removeEventListener("abort", abortParent); }, + }); + const signal = controller.signal; + let dispatched = false; return { - signal: parent === undefined ? timeoutSignal : AbortSignal.any([parent, timeoutSignal]), - timedOut: () => timeoutSignal.aborted, + signal, + timedOut: () => expired, + interrupted: () => signal.aborted && !expired, + wait: (operation: () => Promise): Promise => { + this.#assertAttemptOwner(attempt); + if (signal.aborted) return Promise.reject(signal.reason); + return new Promise((resolve, reject) => { + const abort = () => reject(signal.reason); + signal.addEventListener("abort", abort, { once: true }); + Promise.resolve().then(() => { + signal.throwIfAborted(); + this.#assertAttemptOwner(attempt); + if (!dispatched) { this.#attempts.markDispatched(attempt.attempt_id); dispatched = true; } + return operation(); + }).then((result) => { + signal.throwIfAborted(); + this.#assertAttemptOwner(attempt); + resolve(result); + }, reject).catch(reject).finally(() => signal.removeEventListener("abort", abort)); + }); + }, }; } @@ -2107,6 +2225,7 @@ export class OrchestratorApplication { to: updated.status, current_stage: stage, }); + settleExecutionPlan(this.state, updated); return updated; }); } diff --git a/services/pi-orchestrator/src/artifacts.ts b/services/pi-orchestrator/src/artifacts.ts index 04a0a1b..d9d2672 100644 --- a/services/pi-orchestrator/src/artifacts.ts +++ b/services/pi-orchestrator/src/artifacts.ts @@ -1,13 +1,6 @@ import { randomUUID } from "node:crypto"; -import { - validateAdvisoryPayload, - validateAnalysisPayload, - validateClarificationPayload, - validateMetricDefinitionPayload, - validateQueryResultPayload, - validateRenderedOutputPayload, -} from "./structured-artifact-tools.js"; +import { structuredArtifactContracts, type StructuredArtifactType } from "./contracts.js"; import { validateExecutionPlanPayload } from "./planning.js"; import { validateChartPayload, @@ -17,17 +10,12 @@ import { } from "./report-artifacts.js"; export type ArtifactType = - | "clarification" + | StructuredArtifactType | "execution_plan" | "chart" | "technical_report" | "report_bundle" - | "publication" - | "metric_definition" - | "query_result" - | "analysis" - | "advisory" - | "rendered_output"; + | "publication"; export interface Artifact = Record> { artifact_id: string; @@ -54,23 +42,20 @@ export interface ArtifactStore { latest(taskRunId: string, artifactType: ArtifactType): Artifact | undefined; } +const artifactValidators: Record string | undefined }> = { + ...structuredArtifactContracts, + execution_plan: { validate: validateExecutionPlanPayload }, + chart: { validate: validateChartPayload }, + technical_report: { validate: validateTechnicalReportPayload }, + report_bundle: { validate: validateReportBundlePayload }, + publication: { validate: validatePublicationPayload }, +}; + export function validateArtifactInput>( input: CreateArtifactInput, ): void { - const validators: Record string | undefined> = { - clarification: validateClarificationPayload, - execution_plan: validateExecutionPlanPayload, - chart: validateChartPayload, - technical_report: validateTechnicalReportPayload, - report_bundle: validateReportBundlePayload, - publication: validatePublicationPayload, - metric_definition: validateMetricDefinitionPayload, - query_result: validateQueryResultPayload, - analysis: validateAnalysisPayload, - advisory: validateAdvisoryPayload, - rendered_output: validateRenderedOutputPayload, - }; - const validationError = validators[input.artifactType](input.payload); + if (!Object.hasOwn(artifactValidators, input.artifactType)) throw new Error("Unknown Artifact type"); + const validationError = artifactValidators[input.artifactType].validate(input.payload); if (validationError !== undefined) { throw new Error(`Invalid ${input.artifactType} Artifact: ${validationError}`); } @@ -82,10 +67,21 @@ export function validateArtifactInput>( export class InMemoryArtifactStore implements ArtifactStore { readonly #artifacts = new Map(); + constructor(private readonly assertTask?: (taskRunId: string) => void) {} + + checkpoint(): () => void { + const snapshot = structuredClone(this.#artifacts); + return () => { + this.#artifacts.clear(); + for (const [key, value] of snapshot) this.#artifacts.set(key, value); + }; + } + create>( input: CreateArtifactInput, ): Artifact { validateArtifactInput(input); + this.assertTask?.(input.taskRunId); const artifact: Artifact = { artifact_id: `ar_${randomUUID().replaceAll("-", "")}`, artifact_type: input.artifactType, diff --git a/services/pi-orchestrator/src/benchmark-contracts.ts b/services/pi-orchestrator/src/benchmark-contracts.ts index 1b38420..a60b72a 100644 --- a/services/pi-orchestrator/src/benchmark-contracts.ts +++ b/services/pi-orchestrator/src/benchmark-contracts.ts @@ -15,6 +15,7 @@ export const BENCHMARK_FAILURE_CODES = [ "retrieval_insufficient", "context_failed", "agent_failed", "generation_empty", "malformed_output", "candidate_contract_invalid", "compile_failed", "readonly_violation", "sql_parse_failed", "unknown_table", "unknown_column", "unknown_schema_reference", "dialect_unsupported", + "dialect_required", "execution_timeout", "execution_failed", "gold_execution_failed", "result_row_count_mismatch", "result_column_count_mismatch", "result_column_alignment_ambiguous", "result_order_or_value_mismatch", "result_value_mismatch", "official_ea_mismatch", @@ -39,12 +40,19 @@ export interface BenchmarkModelSnapshot { max_output_tokens: number | null; } +export interface BenchmarkSchemaDescriptionsV2 { + mode: "off" | "interfaces-v1"; + catalog_revision: string; + wire_schema_revision: string; +} + export interface BenchmarkGenerationContractV2 { forge_output_mode: "text_json" | "pi_tool_schema"; forge_prompt_revision: string; forge_schema_revision: string | null; provider_json_schema_request: "disabled" | "prefer" | "required"; forge_wire_schema_revision: string | null; + schema_descriptions: BenchmarkSchemaDescriptionsV2 | null; direct_output_mode: "text_sql"; sampling?: "provider_default"; transport?: "sse"; diff --git a/services/pi-orchestrator/src/benchmark-runtime.ts b/services/pi-orchestrator/src/benchmark-runtime.ts index 8fc3893..3a45c0c 100644 --- a/services/pi-orchestrator/src/benchmark-runtime.ts +++ b/services/pi-orchestrator/src/benchmark-runtime.ts @@ -1,6 +1,7 @@ import { createHash, randomUUID } from "node:crypto"; -import { mkdirSync, readFileSync } from "node:fs"; -import { DatabaseSync } from "node:sqlite"; +import { readFileSync } from "node:fs"; +import type { DatabaseSync } from "node:sqlite"; +import { hostname } from "node:os"; import { dirname, extname, join, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import { @@ -21,32 +22,65 @@ import type { BenchmarkCaseProjectionV2, BenchmarkLogV2, BenchmarkGenerationContractV2, + BenchmarkSchemaDescriptionsV2, BenchmarkGoldReadinessV2, BenchmarkRunProjectionV2, BenchmarkRunStatus, ContextSnapshotV2, } from "./benchmark-contracts.js"; import { createStrictForgeOutput, requireStrictForgeApi, requireStrictForgePayload, StrictForgeOutputError } from "./strict-forge-output.js"; +import { SqliteOrchestratorState } from "./sqlite-store.js"; +import { currentRequestId } from "./request-context.js"; const moduleDir = dirname(fileURLToPath(import.meta.url)); const forgeSchemaJson = readFileSync(resolve(moduleDir, "../../../forge/schema.json"), "utf8"); const canonicalForgeSchema = JSON.parse(forgeSchemaJson); -const strictForgeOutput = createStrictForgeOutput(canonicalForgeSchema); const forgeToolSchema = canonicalForgeSchema as TSchema; -const forgeToolSchemaChars = JSON.stringify(strictForgeOutput.schema).length; - -const FORGE_SCHEMA_REVISION = `sha256:${createHash("sha256").update(forgeSchemaJson).digest("hex")}`; +const FORGE_SCHEMA_REVISION = "sha256:" + createHash("sha256").update(forgeSchemaJson).digest("hex"); +const descriptionsCatalogBytes = readFileSync(resolve(moduleDir, "../../../agent/contracts/forge-output-descriptions-v1.json")); +const descriptionsCatalogRevision = "sha256:" + createHash("sha256").update(descriptionsCatalogBytes).digest("hex"); +const strictForgeProfiles = (() => { + const catalog = JSON.parse(descriptionsCatalogBytes.toString("utf8")); + const record = (value: unknown): value is Record => + value !== null && typeof value === "object" && !Array.isArray(value); + const exactKeys = (value: unknown, keys: readonly string[]): boolean => + record(value) && Object.keys(value).length === keys.length && keys.every((key) => Object.hasOwn(value, key)); + const modes = ["off", "interfaces-v1"] as const; + if (!exactKeys(catalog, ["schema_version", "canonical_schema_revision", "profiles"]) + || catalog.schema_version !== "forge-output-descriptions-v1" + || catalog.canonical_schema_revision !== FORGE_SCHEMA_REVISION || !exactKeys(catalog.profiles, modes)) { + throw new StrictForgeOutputError("Forge descriptions catalog or canonical schema mismatch"); + } + const profiles = new Map; schemaChars: number; metadata: BenchmarkSchemaDescriptionsV2; + }>(); + for (const mode of modes) { + const profile = catalog.profiles[mode]; + const fields = mode === "off" ? [] : ["scan", "cte", "agg", "window", "select"]; + if (!exactKeys(profile, ["wire_schema_revision", "descriptions"]) || !exactKeys(profile.descriptions, fields) + || !Object.values(profile.descriptions).every((value) => typeof value === "string" && value.trim())) { + throw new StrictForgeOutputError("Invalid Forge descriptions profile"); + } + const output = createStrictForgeOutput(canonicalForgeSchema, profile.descriptions); + if (profile.wire_schema_revision !== output.revision) throw new StrictForgeOutputError("Forge descriptions wire schema mismatch"); + profiles.set(mode, { + output, schemaChars: JSON.stringify(output.schema).length, + metadata: Object.freeze({ mode, catalog_revision: descriptionsCatalogRevision, wire_schema_revision: output.revision }), + }); + } + return profiles; +})(); const PI_RUNTIME_REVISION = "sha256:" + createHash("sha256") .update("benchmark-runtime\0").update(readFileSync(fileURLToPath(import.meta.url))) .update("strict-forge-output\0").update(readFileSync(new URL("./strict-forge-output" + extname(fileURLToPath(import.meta.url)), import.meta.url))) + .update("forge-output-descriptions-v1\0").update(descriptionsCatalogBytes) .digest("hex"); const PI_SDK_LOCK_REVISION = "sha256:" + createHash("sha256") .update(readFileSync(resolve(moduleDir, "../package-lock.json"))).digest("hex"); -const structuredGenerationContract: Omit = { +const structuredGenerationContract: Omit = { forge_output_mode: "pi_tool_schema", forge_schema_revision: FORGE_SCHEMA_REVISION, provider_json_schema_request: "required", - forge_wire_schema_revision: strictForgeOutput.revision, sampling: "provider_default", transport: "sse", max_output_tokens: null, @@ -64,6 +98,7 @@ const legacyGenerationContract: BenchmarkGenerationContractV2 = { forge_schema_revision: null, provider_json_schema_request: "disabled", forge_wire_schema_revision: null, + schema_descriptions: null, direct_output_mode: "text_sql", }; @@ -76,7 +111,7 @@ interface SuiteCase { evidence: string; } interface ContextResponse { - protocol_revision: string; + protocol_revision?: string; metric_revision: string; case: SuiteCase; context_snapshot: ContextSnapshotV2; @@ -120,6 +155,9 @@ interface PersistedRun { error: string | null; } +interface RuntimeOwner { owner_id: string; host: string; pid: number } +const TERMINAL_RUN_STATUSES = new Set(["completed", "failed", "stopped", "interrupted"]); + const emptyArm = (): ArmMetricsV2 => ({ generation_ms: null, prompt_tokens: 0, @@ -201,10 +239,28 @@ function requireMetricRevision(expected: string | undefined, received: unknown): throw new MetricRevisionMismatch(`Result comparator revision mismatch: expected ${expected ?? "unknown"}, received ${received ?? "unknown"}`); } } +function descriptionProfile(value: unknown) { + const metadata = value as Partial | null | undefined; + const profile = metadata && strictForgeProfiles.get(metadata.mode as BenchmarkSchemaDescriptionsV2["mode"]); + return profile && Object.keys(metadata!).length === 3 + && metadata!.catalog_revision === profile.metadata.catalog_revision + && metadata!.wire_schema_revision === profile.output.revision ? profile : undefined; +} + +function manifestDescriptionProfile(manifest: Record | undefined) { + if (manifest?.schema_version !== "bird-protocol-v5") return undefined; + const profile = descriptionProfile(manifest.schema_descriptions); + const changes = (manifest.variables as { allowed_changes?: unknown } | undefined)?.allowed_changes; + return profile && Array.isArray(changes) + && (profile.metadata.mode === "off" || changes.includes("schema_descriptions")) ? profile : undefined; +} + function hasCurrentGenerationContract(run: PersistedRun): boolean { const contract = run.generation_contract; - return contract?.provider_json_schema_request === "required" - && contract.forge_wire_schema_revision === strictForgeOutput.revision + const profile = manifestDescriptionProfile(run.protocol_manifest); + return Boolean(profile) && descriptionProfile(contract?.schema_descriptions) === profile + && contract?.provider_json_schema_request === "required" + && contract.forge_wire_schema_revision === profile!.output.revision && contract.forge_schema_revision === FORGE_SCHEMA_REVISION && typeof run.protocol_manifest?.forge_prompt_revision === "string" && Boolean(run.protocol_manifest.forge_prompt_revision) @@ -215,8 +271,9 @@ function hasCurrentGenerationContract(run: PersistedRun): boolean { && contract.pi_runtime_revision === PI_RUNTIME_REVISION && contract.pi_sdk_lock_revision === PI_SDK_LOCK_REVISION; } -function requireGenerationContract(run: PersistedRun): void { +function requireGenerationContract(run: PersistedRun) { if (!hasCurrentGenerationContract(run)) throw new StrictForgeOutputError("Strict Forge generation contract mismatch; start a new run"); + return manifestDescriptionProfile(run.protocol_manifest)!; } @@ -225,14 +282,21 @@ export class PiBenchmarkRuntime { readonly #controllers = new Map>(); readonly #forgeHeaders: Record; #modelRuntime: ModelRuntime | undefined; + readonly #ownerId = randomUUID(); + readonly #executions = new Map>(); + readonly #forgeRequests = new Set(); + #starting: Promise | undefined; + #closing = false; + #closePromise: Promise | undefined; constructor( private readonly config: OrchestratorConfig, private readonly application: OrchestratorApplication, ) { - mkdirSync(dirname(config.stateDbPath), { recursive: true }); - this.#db = new DatabaseSync(config.stateDbPath); - this.#db.exec("PRAGMA journal_mode=WAL; PRAGMA busy_timeout=5000;"); + if (!(application.state instanceof SqliteOrchestratorState)) { + throw new Error("Benchmark requires the application SQLite state transaction boundary"); + } + this.#db = application.state.database; this.#db.exec(` CREATE TABLE IF NOT EXISTS benchmark_v2_runs ( run_id TEXT PRIMARY KEY, status TEXT NOT NULL, created_at TEXT NOT NULL, data_json TEXT NOT NULL @@ -245,21 +309,36 @@ export class PiBenchmarkRuntime { log_id INTEGER PRIMARY KEY AUTOINCREMENT, run_id TEXT NOT NULL, case_id TEXT, arm TEXT, stage TEXT NOT NULL, level TEXT NOT NULL, message TEXT NOT NULL, payload_json TEXT NOT NULL, created_at TEXT NOT NULL ); + CREATE TABLE IF NOT EXISTS benchmark_runtime_owner ( + singleton INTEGER PRIMARY KEY CHECK(singleton = 1), owner_id TEXT NOT NULL, host TEXT NOT NULL, pid INTEGER NOT NULL + ) STRICT; `); this.#forgeHeaders = { "content-type": "application/json" }; if (config.forgePiServiceKey) this.#forgeHeaders["x-pi-service-key"] = config.forgePiServiceKey; - const active = this.#db.prepare( - "SELECT data_json FROM benchmark_v2_runs WHERE status IN ('queued','running','pausing','stopping')", - ).all() as Array<{ data_json: string }>; - for (const row of active) { - const run = parse(row.data_json); - if (!run.protocol_revision) continue; - run.status = "interrupted"; - run.completed_at = now(); - run.sequence += 1; - this.#saveRun(run); - this.#log(run.run_id, null, "shared", "runtime", "warning", "Pi 服务重启:运行已中断,未自动重放模型调用。", {}); - } + application.state.transactions.run(() => { + const owner = this.#db.prepare("SELECT owner_id,host,pid FROM benchmark_runtime_owner WHERE singleton=1").get() as RuntimeOwner | undefined; + if (owner) { + // This SQLite runtime is single-host. Unknown/living owners fail closed; no lease can replay paid work. + if (owner.host !== hostname()) return; + try { process.kill(owner.pid, 0); return; } + catch (error) { if ((error as NodeJS.ErrnoException).code !== "ESRCH") return; } + } + this.#db.prepare("INSERT OR REPLACE INTO benchmark_runtime_owner VALUES(1,?,?,?)").run(this.#ownerId, hostname(), process.pid); + const active = this.#db.prepare( + "SELECT data_json FROM benchmark_v2_runs WHERE status IN ('queued','running','pausing','paused','stopping')", + ).all() as Array<{ data_json: string }>; + for (const row of active) { + const run = parse(row.data_json); + if (!run.protocol_revision) continue; + run.status = "interrupted"; + run.completed_at = now(); + run.current_case = null; + run.sequence += 1; + this.#saveRun(run); + this.#log(run.run_id, null, "shared", "runtime", "warning", "Previous owner exited: interrupted without replaying model calls.", {}); + } + this.#db.exec("CREATE UNIQUE INDEX IF NOT EXISTS benchmark_one_active_run ON benchmark_v2_runs((1)) WHERE status IN ('queued','running','pausing','paused','stopping') AND json_extract(data_json, '$.protocol_revision') IS NOT NULL"); + }); } async modelOptions(): Promise> { @@ -283,6 +362,14 @@ export class PiBenchmarkRuntime { confirmModelCalls?: number; protocolManifest?: Record; }): Promise { + this.#assertOwner(); + if (this.#starting) throw new BenchmarkInputError("A benchmark admission is already in progress"); + this.#starting = this.#start(options); + try { return await this.#starting; } + finally { this.#starting = undefined; } + } + + async #start(options: Parameters[0]): Promise { if (options.limit !== undefined && (!Number.isSafeInteger(options.limit) || options.limit <= 0)) throw new BenchmarkInputError("limit must be a positive integer"); if (options.caseIds !== undefined && (!Array.isArray(options.caseIds) || !options.caseIds.length || options.caseIds.some((id) => typeof id !== "string" || !id.trim()) @@ -325,6 +412,7 @@ export class PiBenchmarkRuntime { manifest: Record; protocol_revision: string; case_ids: string[]; metric_revision: string; forge_prompt_revision: string; forge_schema_revision: string; contexts: Record; + schema_descriptions: BenchmarkSchemaDescriptionsV2; gold_readiness: BenchmarkGoldReadinessV2; generation: { max_model_calls: number; provider_retries: number; max_agent_turns_per_arm: number; timeout_seconds: number; sampling: string; max_output_tokens: number | null }; }>("/api/internal/benchmark-v2/protocol", { @@ -338,6 +426,11 @@ export class PiBenchmarkRuntime { if (!sameGoldReadiness(goldReadiness, manifestReadiness) || !sameGoldReadiness(goldReadiness, requestedReadiness)) { throw new BenchmarkInputError("Frozen Gold readiness differs from the authorized manifest/report"); } + const profile = manifestDescriptionProfile(protocol.manifest); + if (!profile || descriptionProfile(protocol.schema_descriptions) !== profile + || (options.protocolManifest && manifestDescriptionProfile(options.protocolManifest) !== profile)) { + throw new StrictForgeOutputError("Frozen benchmark schema descriptions mismatch"); + } const blockedIds = new Set(goldReadiness.blocked_cases.map((item) => item.case_id)); if (!protocol.protocol_revision || !protocol.manifest || JSON.stringify(protocol.case_ids) !== JSON.stringify(cases.map((item) => item.case_id)) || @@ -356,100 +449,107 @@ export class PiBenchmarkRuntime { } const generationContract: BenchmarkGenerationContractV2 = { ...structuredGenerationContract, forge_prompt_revision: protocol.forge_prompt_revision, + schema_descriptions: profile.metadata, forge_wire_schema_revision: profile.output.revision, }; - const created = this.application.createTask({ - org_id: "org_benchmark", - team_id: "team_benchmark", - user_id: "benchmark_operator", - channel: "api", - intent: "pi-native rag dual-subagent benchmark", - message: `Benchmark ${cases.length} BIRD cases`, - metadata: { - benchmark: true, - suite_id: String(suite.suite.suite), - provider: options.provider, - model: options.model, - forge_output_mode: generationContract.forge_output_mode, - forge_prompt_revision: generationContract.forge_prompt_revision, - forge_schema_revision: generationContract.forge_schema_revision, - }, - }); - const revision = computePiModelRevision({ - agentDir: this.config.agentDir, - provider: options.provider, - modelId: options.model, - }) ?? `unresolved:${options.provider}/${options.model}`; - const run: PersistedRun = { - run_id: `pbr_${randomUUID().replaceAll("-", "")}`, - task_run_id: created.task.task_run_id, - status: "queued", - suite_id: String(suite.suite.suite), - metric_revision: suite.metric_revision, - model: { + this.#assertOwner(); + const run = this.application.state.transactions.run(() => { + const runId = `pbr_${randomUUID().replaceAll("-", "")}`; + const created = this.application.createTask({ + org_id: "org_benchmark", + team_id: "team_benchmark", + user_id: "benchmark_operator", + channel: "api", + intent: "pi-native rag dual-subagent benchmark", + message: `Benchmark ${cases.length} BIRD cases`, + metadata: { + benchmark: true, + benchmark_run_id: runId, + suite_id: String(suite.suite.suite), + provider: options.provider, + model: options.model, + forge_output_mode: generationContract.forge_output_mode, + forge_prompt_revision: generationContract.forge_prompt_revision, + forge_schema_revision: generationContract.forge_schema_revision, + }, + }); + const revision = computePiModelRevision({ + agentDir: this.config.agentDir, provider: options.provider, - model: options.model, - revision, - temperature: null, - max_output_tokens: null, - }, - generation_contract: generationContract, - protocol_manifest: protocol.manifest, - gold_readiness: goldReadiness, - protocol_revision: protocol.protocol_revision, - contexts: protocol.contexts, - dispatched_calls: 0, - total_cases: cases.length, - total_calls: modelCalls, - sequence: 1, - current_case: null, - created_at: now(), - started_at: null, - completed_at: null, - error: null, - }; - this.#db.prepare("INSERT INTO benchmark_v2_runs VALUES(?,?,?,?)").run( - run.run_id, - run.status, - run.created_at, - JSON.stringify(run), - ); - const insert = this.#db.prepare("INSERT INTO benchmark_v2_cases VALUES(?,?,?,?)"); - for (const item of cases) { - const projection: BenchmarkCaseProjectionV2 = { - ...item, - status: "pending", - current_stage: "queued", - context_snapshot: null, - failure: null, - forge: emptyArm(), - direct: emptyArm(), - winner: null, + modelId: options.model, + }) ?? `unresolved:${options.provider}/${options.model}`; + const run: PersistedRun = { + run_id: runId, + task_run_id: created.task.task_run_id, + status: "queued", + suite_id: String(suite.suite.suite), + metric_revision: suite.metric_revision, + model: { + provider: options.provider, + model: options.model, + revision, + temperature: null, + max_output_tokens: null, + }, + generation_contract: generationContract, + protocol_manifest: protocol.manifest, + gold_readiness: goldReadiness, + protocol_revision: protocol.protocol_revision, + contexts: protocol.contexts, + dispatched_calls: 0, + total_cases: cases.length, + total_calls: modelCalls, + sequence: 1, + current_case: null, + created_at: now(), started_at: null, completed_at: null, + error: null, }; - if (blockedIds.has(item.case_id)) { - projection.status = "failed"; - projection.current_stage = "gold_preflight"; - projection.completed_at = run.created_at; - projection.failure = { stage: "gold", code: "gold_execution_failed", retryable: false }; - for (const arm of ["forge", "direct"] as const) { - projection[arm] = { ...emptyArm(), compile_status: "not_applicable", execution_status: "skipped", - failure: projection.failure, error_code: "gold_execution_failed", - evidence: { dispatches: 0, payload_hash: null, response_output_hash: null } }; + this.#db.prepare("INSERT INTO benchmark_v2_runs VALUES(?,?,?,?)").run( + run.run_id, + run.status, + run.created_at, + JSON.stringify(run), + ); + const insert = this.#db.prepare("INSERT INTO benchmark_v2_cases VALUES(?,?,?,?)"); + for (const item of cases) { + const projection: BenchmarkCaseProjectionV2 = { + ...item, + status: "pending", + current_stage: "queued", + context_snapshot: null, + failure: null, + forge: emptyArm(), + direct: emptyArm(), + winner: null, + started_at: null, + completed_at: null, + }; + if (blockedIds.has(item.case_id)) { + projection.status = "failed"; + projection.current_stage = "gold_preflight"; + projection.completed_at = run.created_at; + projection.failure = { stage: "gold", code: "gold_execution_failed", retryable: false }; + for (const arm of ["forge", "direct"] as const) { + projection[arm] = { ...emptyArm(), compile_status: "not_applicable", execution_status: "skipped", + failure: projection.failure, error_code: "gold_execution_failed", + evidence: { dispatches: 0, payload_hash: null, response_output_hash: null } }; + } } + insert.run(run.run_id, item.case_id, projection.status, JSON.stringify(projection)); } - insert.run(run.run_id, item.case_id, projection.status, JSON.stringify(projection)); - } - this.#log( - run.run_id, - null, - "shared", - "run", - "info", - `已创建 Pi Benchmark:${cases.length} cases / ${modelCalls} Sub-Agent calls,模型 ${options.provider}/${options.model}。`, - { generation_contract: generationContract }, - ); - void this.#execute(run.run_id).catch((error: unknown) => this.#failRun(run.run_id, error)); + this.#log( + run.run_id, + null, + "shared", + "run", + "info", + `已创建 Pi Benchmark:${cases.length} cases / ${modelCalls} Sub-Agent calls,模型 ${options.provider}/${options.model}。`, + { generation_contract: generationContract }, + ); + return run; + }); + this.#launch(run.run_id); return this.get(run.run_id)!; } @@ -479,6 +579,7 @@ export class PiBenchmarkRuntime { (sum, item) => sum + (item.forge.generation_ms == null ? 0 : 1) + (item.direct.generation_ms == null ? 0 : 1), 0, ); + const writable = this.#writable; return { schema_version: 2, projection_type: "pi_benchmark_run_v2", @@ -488,9 +589,9 @@ export class PiBenchmarkRuntime { completed_cases: completed, completed_calls: run.dispatched_calls ?? calls, controls: { - can_pause: Boolean(run.protocol_revision) && run.status === "running", - can_resume: run.status === "paused" && Boolean(run.protocol_revision) && hasCurrentGenerationContract(run), - can_stop: Boolean(run.protocol_revision) && ["queued", "running", "pausing", "paused"].includes(run.status), + can_pause: writable && Boolean(run.protocol_revision) && run.status === "running", + can_resume: writable && run.status === "paused" && Boolean(run.protocol_revision) && hasCurrentGenerationContract(run), + can_stop: writable && Boolean(run.protocol_revision) && ["queued", "running", "pausing", "paused"].includes(run.status), }, dag: this.#dag(run, cases), metrics: this.#metrics(cases, run.total_cases), @@ -567,7 +668,7 @@ export class PiBenchmarkRuntime { const workers = Array.from({ length: this.config.benchmarkConcurrency }, async () => { while (true) { let current = this.#run(runId); - if (["stopping", "failed"].includes(current.status)) return; + if (current.status === "stopping" || TERMINAL_RUN_STATUSES.has(current.status)) return; if (current.status === "pausing") { current.status = "paused"; current.sequence += 1; @@ -617,17 +718,20 @@ export class PiBenchmarkRuntime { const checkedContext = await this.#forgePost( "/api/internal/benchmark-v2/context", { case_id: caseId, protocol_revision: run.protocol_revision }, + runId, ); + requireGenerationContract(run); const context = run.contexts?.[caseId]; if (!context || checkedContext.protocol_revision !== run.protocol_revision || checkedContext.forge_prompt_revision !== context.forge_prompt_revision || JSON.stringify(checkedContext.context_snapshot) !== JSON.stringify(context.context_snapshot) || + checkedContext.schema_context !== context.schema_context || checkedContext.forge_instructions !== context.forge_instructions || checkedContext.direct_instructions !== context.direct_instructions) { throw new MetricRevisionMismatch("Frozen protocol context drift"); } requireMetricRevision(run.metric_revision, checkedContext.metric_revision); requireMetricRevision(run.metric_revision, context.metric_revision); - if (this.#run(runId).status === "failed") { + if (["failed", "stopping", "stopped", "interrupted"].includes(this.#run(runId).status)) { item.status = "cancelled"; item.completed_at = now(); this.#saveCase(runId, item); @@ -707,9 +811,10 @@ export class PiBenchmarkRuntime { item.completed_at = now(); } catch (error) { const message = error instanceof Error ? error.message : "case failed"; - if (error instanceof MetricRevisionMismatch || error instanceof StrictForgeOutputError) this.#failRun(runId, error); - item.status = "failed"; - item.current_stage = "failed"; + const cancelled = ["stopping", "stopped", "interrupted"].includes(this.#run(runId).status); + if (!cancelled) this.#failRun(runId, error); + item.status = cancelled ? "cancelled" : "failed"; + item.current_stage = item.status; item.failure ??= message === "retrieval_insufficient" ? { stage: "context", code: "retrieval_insufficient", retryable: true } : { stage: "context", code: "context_failed", retryable: true }; @@ -773,6 +878,9 @@ export class PiBenchmarkRuntime { { context_snapshot_id: context.context_snapshot.content_hash }, ); try { + const profile = requireGenerationContract(run); + const strictForgeOutput = profile.output; + const forgeToolSchemaChars = profile.schemaChars; const runtime = await this.#runtime(); const model = runtime.getModel(run.model.provider, run.model.model); if (!model) throw new Error(`Model unavailable: ${run.model.provider}/${run.model.model}`); @@ -827,6 +935,7 @@ export class PiBenchmarkRuntime { const stream = session.agent.streamFunction; session.agent.streamFunction = (selected, providerContext, options) => { const current = this.#run(runId); + if (requireGenerationContract(current) !== profile) throw new StrictForgeOutputError("Benchmark schema descriptions changed before dispatch"); if (controller.signal.aborted || ["failed", "stopping", "stopped"].includes(current.status)) throw new Error("Benchmark dispatch cancelled"); if (evidence.dispatches !== 0 || (current.dispatched_calls ?? 0) >= current.total_calls) { throw new StrictForgeOutputError("A second agent turn or excess budget dispatch is forbidden"); @@ -841,6 +950,7 @@ export class PiBenchmarkRuntime { return stream(selected, providerContext, { ...options, maxRetries: 0, timeoutMs: 120000, transport: "sse" }); }; session.agent.onPayload = (payload, selected) => { + if (requireGenerationContract(this.#run(runId)) !== profile) throw new StrictForgeOutputError("Benchmark schema descriptions changed before payload"); if (++strictRequests !== 1) throw new StrictForgeOutputError("A second provider payload is forbidden"); if (controller.signal.aborted) throw new Error("Benchmark dispatch cancelled"); const effective = arm === "forge" @@ -975,6 +1085,7 @@ export class PiBenchmarkRuntime { const evaluation = await this.#forgePost( "/api/internal/benchmark-v2/evaluate", { case_id: item.case_id, arm, output, context_snapshot: context.context_snapshot, metric_revision: run.metric_revision, protocol_revision: run.protocol_revision }, + runId, ); requireMetricRevision(run.metric_revision, evaluation.metric_revision); if (evaluation.protocol_revision !== run.protocol_revision) throw new MetricRevisionMismatch("Evaluation protocol revision mismatch"); @@ -1080,21 +1191,36 @@ export class PiBenchmarkRuntime { } async #forgeGet(path: string): Promise { - const response = await fetch(this.config.forgeBaseUrl + path, { headers: this.#forgeHeaders }); - if (!response.ok) throw new Error(`Forge ${path} returned ${response.status}`); - return await response.json() as T; + return this.#forgeRequest(path, { headers: this.#forgeHeaders }); } - async #forgePost(path: string, body: unknown): Promise { - const response = await fetch(this.config.forgeBaseUrl + path, { - method: "POST", - headers: this.#forgeHeaders, - body: JSON.stringify(body), - }); - if (response.status === 409) { - throw new MetricRevisionMismatch("Benchmark evaluation revision or context mismatch (409)"); + async #forgePost(path: string, body: unknown, runId?: string): Promise { + return this.#forgeRequest(path, { method: "POST", headers: this.#forgeHeaders, body: JSON.stringify(body) }, runId); + } + async #forgeRequest(path: string, init: RequestInit, runId?: string): Promise { + const controller = new AbortController(); + if (this.#closing) throw new BenchmarkInputError("Benchmark runtime is closing"); + this.#forgeRequests.add(controller); + const controllers = runId ? this.#controllers.get(runId) ?? new Set() : undefined; + if (runId && controllers) { + controllers.add(controller); + this.#controllers.set(runId, controllers); + const run = this.#run(runId); + if (run.status === "stopping" || TERMINAL_RUN_STATUSES.has(run.status)) controller.abort(); + } + const timeout = setTimeout(() => controller.abort(new Error("Forge benchmark request timed out")), this.config.forgeTimeoutMs); + const headers = new Headers(init.headers); + const requestId = currentRequestId(); + if (requestId) headers.set("x-request-id", requestId); + try { + const response = await fetch(this.config.forgeBaseUrl + path, { ...init, headers, signal: controller.signal }); + if (response.status === 409) throw new MetricRevisionMismatch("Benchmark evaluation revision or context mismatch (409)"); + if (!response.ok) throw new Error(`Forge ${path} returned ${response.status}`); + return await response.json() as T; + } finally { + clearTimeout(timeout); + controllers?.delete(controller); + this.#forgeRequests.delete(controller); } - if (!response.ok) throw new Error(`Forge ${path} returned ${response.status}`); - return await response.json() as T; } #run(id: string): PersistedRun { const row = this.#db.prepare("SELECT data_json FROM benchmark_v2_runs WHERE run_id=?").get(id) as @@ -1111,11 +1237,13 @@ export class PiBenchmarkRuntime { return parse(row.data_json); } #saveRun(run: PersistedRun): void { - this.#db.prepare("UPDATE benchmark_v2_runs SET status=?,data_json=? WHERE run_id=?").run( - run.status, - JSON.stringify(run), - run.run_id, - ); + this.application.state.transactions.run(() => { + this.#db.prepare("UPDATE benchmark_v2_runs SET status=?,data_json=? WHERE run_id=?").run(run.status, JSON.stringify(run), run.run_id); + // Historical benchmark records may predate the linked Task contract; never fabricate a parent. + if (this.application.getTask(run.task_run_id)?.metadata.benchmark_run_id === run.run_id) { + this.application.transitionBenchmarkTask({ taskRunId: run.task_run_id, runId: run.run_id, status: run.status, currentStage: `benchmark_${run.status}` }); + } + }); } #saveCase(runId: string, item: BenchmarkCaseProjectionV2): void { this.#db.prepare( @@ -1136,6 +1264,7 @@ export class PiBenchmarkRuntime { ).run(runId, caseId, arm, stage, level, message, JSON.stringify(payload), now()); } #control(runId: string, status: BenchmarkRunStatus): BenchmarkRunProjectionV2 { + this.#assertOwner(); const run = this.#run(runId); if (!run.protocol_revision || !run.protocol_manifest) throw new Error("Historical runs without a frozen protocol are read-only"); const allowed: Record = { @@ -1158,7 +1287,7 @@ export class PiBenchmarkRuntime { } #failRun(runId: string, error: unknown): void { const run = this.#run(runId); - if (["completed", "stopped"].includes(run.status)) return; + if (TERMINAL_RUN_STATUSES.has(run.status) || run.status === "stopping") return; run.status = "failed"; run.error = error instanceof Error ? error.message : "runtime failed"; run.current_case = null; @@ -1168,6 +1297,43 @@ export class PiBenchmarkRuntime { this.#saveRun(run); this.#log(runId, null, "shared", "run", "error", run.error, {}); } + + get #writable(): boolean { + const owner = this.#db.prepare("SELECT owner_id FROM benchmark_runtime_owner WHERE singleton=1").get() as { owner_id: string } | undefined; + return !this.#closing && owner?.owner_id === this.#ownerId; + } + + #assertOwner(): void { + if (!this.#writable) throw new BenchmarkInputError("Benchmark runtime is read-only: another owner holds this SQLite database"); + } + + #launch(runId: string): void { + const execution = this.#execute(runId).catch((error: unknown) => this.#failRun(runId, error)); + this.#executions.set(runId, execution); + void execution.then(() => this.#executions.delete(runId), () => this.#executions.delete(runId)); + } + + close(): Promise { + return this.#closePromise ??= this.#shutdown(); + } + + async #shutdown(): Promise { + this.#closing = true; + for (const controller of this.#forgeRequests) controller.abort(); + for (const [runId] of this.#executions) { + const run = this.#run(runId); + if (!TERMINAL_RUN_STATUSES.has(run.status)) { + run.status = "interrupted"; + run.completed_at = now(); + run.current_case = null; + run.sequence += 1; + this.#saveRun(run); + } + for (const controller of this.#controllers.get(runId) ?? []) controller.abort(); + } + await Promise.allSettled([...this.#executions.values(), ...(this.#starting ? [this.#starting] : [])]); + this.#db.prepare("DELETE FROM benchmark_runtime_owner WHERE singleton=1 AND owner_id=?").run(this.#ownerId); + } #metrics(cases: BenchmarkCaseProjectionV2[], totalCases: number): Record { const arm = (name: BenchmarkArm) => { let scored = 0, eaObserved = 0, eaCorrect = 0, contractObserved = 0, contractCorrect = 0; diff --git a/services/pi-orchestrator/src/channels/event-store.ts b/services/pi-orchestrator/src/channels/event-store.ts index ebdff95..c57497e 100644 --- a/services/pi-orchestrator/src/channels/event-store.ts +++ b/services/pi-orchestrator/src/channels/event-store.ts @@ -1,4 +1,5 @@ import type { ChannelEventInput } from "./contracts.js"; +import { TaskStateError } from "../task-store.js"; export type ChannelEventStatus = "processing" | "completed" | "failed"; @@ -20,3 +21,54 @@ export interface ChannelEventStore { fail(channel: ChannelEventInput["channel"], eventId: string, error: string): ChannelEventRecord; get(channel: ChannelEventInput["channel"], eventId: string): ChannelEventRecord | undefined; } + +export class InMemoryChannelEventStore implements ChannelEventStore { + readonly #records = new Map(); + constructor(private readonly assertTask: (taskRunId: string) => void) {} + + checkpoint(): () => void { + const snapshot = structuredClone(this.#records); + return () => { + this.#records.clear(); + for (const [key, value] of snapshot) this.#records.set(key, value); + }; + } + + get(channel: ChannelEventInput["channel"], eventId: string): ChannelEventRecord | undefined { + const record = this.#records.get(`${channel}\0${eventId}`); + return record === undefined ? undefined : structuredClone(record); + } + + claim(input: ChannelEventInput): { record: ChannelEventRecord; created: boolean } { + const existing = this.get(input.channel, input.event_id); + if (existing !== undefined) return { record: existing, created: false }; + const taskRunId = input.event_type === "action" ? input.task_run_id : null; + if (taskRunId !== null) this.assertTask(taskRunId); + const now = new Date().toISOString(); + const record: ChannelEventRecord = { channel: input.channel, event_id: input.event_id, + event_type: input.event_type, status: "processing", task_run_id: taskRunId, + received_at: now, updated_at: now, error: null, input: structuredClone(input) }; + this.#records.set(`${input.channel}\0${input.event_id}`, record); + return { record: structuredClone(record), created: true }; + } + + complete(channel: ChannelEventInput["channel"], eventId: string, taskRunId: string): ChannelEventRecord { + return this.#finish(channel, eventId, "completed", taskRunId, null); + } + + fail(channel: ChannelEventInput["channel"], eventId: string, error: string): ChannelEventRecord { + return this.#finish(channel, eventId, "failed", null, error.slice(0, 2_000)); + } + + #finish(channel: ChannelEventInput["channel"], eventId: string, + status: "completed" | "failed", taskRunId: string | null, error: string | null): ChannelEventRecord { + const current = this.get(channel, eventId); + if (current === undefined) throw new TaskStateError(`ChannelEvent not found: ${channel}/${eventId}`); + if (current.status === status) return current; + if (current.status !== "processing") throw new TaskStateError(`ChannelEvent is already terminal: ${current.status}`); + if (taskRunId !== null) this.assertTask(taskRunId); + const updated = { ...current, status, task_run_id: taskRunId, error, updated_at: new Date().toISOString() }; + this.#records.set(`${channel}\0${eventId}`, updated); + return structuredClone(updated); + } +} diff --git a/services/pi-orchestrator/src/contracts.ts b/services/pi-orchestrator/src/contracts.ts new file mode 100644 index 0000000..b35b642 --- /dev/null +++ b/services/pi-orchestrator/src/contracts.ts @@ -0,0 +1,49 @@ +import { Type, type TSchema } from "typebox"; +import { Value } from "typebox/value"; + +import { + clarificationPayloadSchema, metricDefinitionPayloadSchema, queryResultPayloadSchema, + analysisPayloadSchema, advisoryPayloadSchema, renderedOutputPayloadSchema, + validateClarificationPayload, validateMetricDefinitionPayload, validateQueryResultPayload, + validateAnalysisPayload, validateAdvisoryPayload, validateRenderedOutputPayload, +} from "./structured-artifact-tools.js"; + +// TypeBox owns this contract family's structure. Exported JSON is consumed by +// Python; non-structural semantics are defended by one shared semantic corpus. +// Product projection has its own TypeBox owner. Governance/benchmark/reporting +// remain Python-owned schema families and are not regenerated from TS mirrors. +export const structuredArtifactContracts = { + clarification: { schema: clarificationPayloadSchema, validate: validateClarificationPayload }, + metric_definition: { schema: metricDefinitionPayloadSchema, validate: validateMetricDefinitionPayload }, + query_result: { schema: queryResultPayloadSchema, validate: validateQueryResultPayload }, + analysis: { schema: analysisPayloadSchema, validate: validateAnalysisPayload }, + advisory: { schema: advisoryPayloadSchema, validate: validateAdvisoryPayload }, + rendered_output: { schema: renderedOutputPayloadSchema, validate: validateRenderedOutputPayload }, +} as const; +export type StructuredArtifactType = keyof typeof structuredArtifactContracts; + +function envelope(artifactType: StructuredArtifactType, payload: TSchema) { + return Type.Object({ + artifact_id: Type.String({ pattern: "^ar_[A-Za-z0-9_-]+$" }), + artifact_type: Type.Literal(artifactType), + schema_version: Type.Literal(1), + task_run_id: Type.String({ pattern: "^tr_[A-Za-z0-9_-]+$" }), + producer: artifactType === "query_result" ? Type.Literal("forge") : Type.String({ minLength: 1 }), + created_at: Type.String({ format: "date-time" }), + payload, + }, { + $schema: "https://json-schema.org/draft/2020-12/schema", + $id: `https://forge.local/contracts/${artifactType.replaceAll("_", "-")}-artifact.schema.json`, + additionalProperties: false, + }); +} + +export const structuredArtifactSchemas = Object.fromEntries( + Object.entries(structuredArtifactContracts).map(([name, contract]) => [name, envelope(name as StructuredArtifactType, contract.schema)]), +) as Record; + +export function validateStructuredArtifact(artifactType: StructuredArtifactType, value: unknown): string | undefined { + if (!Object.hasOwn(structuredArtifactSchemas, artifactType)) return "unknown structured artifact contract"; + if (!Value.Check(structuredArtifactSchemas[artifactType], value)) return "artifact does not match its versioned schema"; + return structuredArtifactContracts[artifactType].validate((value as { payload: unknown }).payload); +} diff --git a/services/pi-orchestrator/src/forge/client.ts b/services/pi-orchestrator/src/forge/client.ts index 350d6b5..d553296 100644 --- a/services/pi-orchestrator/src/forge/client.ts +++ b/services/pi-orchestrator/src/forge/client.ts @@ -1,3 +1,5 @@ +import { currentRequestId } from "../request-context.js"; + export const FORGE_DIALECTS = [ "auto", "sqlite", @@ -28,6 +30,8 @@ export class ForgeClientError extends Error { constructor( message: string, readonly statusCode?: number, + readonly code: string = "forge_response_invalid", + readonly requestId: string | undefined = currentRequestId(), ) { super(message); this.name = "ForgeClientError"; @@ -96,6 +100,8 @@ export class ForgeClient { "content-type": "application/json", }; if (this.#apiKey !== undefined) headers["x-api-key"] = this.#apiKey; + const requestId = currentRequestId(); + if (requestId) headers["x-request-id"] = requestId; const signals = [AbortSignal.timeout(this.#timeoutMs)]; if (signal !== undefined) signals.push(signal); @@ -113,16 +119,11 @@ export class ForgeClient { signal: AbortSignal.any(signals), }); } catch (error) { - const message = error instanceof Error ? error.message : "unknown transport error"; - throw new ForgeClientError(`Forge prepare-query request failed: ${message}`); + throw new ForgeClientError("Forge prepare-query transport failed", undefined, "upstream_unavailable"); } if (!response.ok) { - const body = (await response.text()).slice(0, 500); - throw new ForgeClientError( - `Forge prepare-query returned HTTP ${response.status}: ${body}`, - response.status, - ); + throw new ForgeClientError(`Forge prepare-query returned HTTP ${response.status}`, response.status, "forge_request_failed"); } let body: unknown; diff --git a/services/pi-orchestrator/src/forge/query-run-client.ts b/services/pi-orchestrator/src/forge/query-run-client.ts index 83cc4e2..d673628 100644 --- a/services/pi-orchestrator/src/forge/query-run-client.ts +++ b/services/pi-orchestrator/src/forge/query-run-client.ts @@ -1,5 +1,6 @@ import type { ForgeDialect } from "./client.js"; import { ForgeClientError } from "./client.js"; +import { currentRequestId } from "../request-context.js"; export type QueryCandidateInput = | { kind: "direct_sql"; sql: string; producer_revision?: string } @@ -245,6 +246,8 @@ export class ForgeQueryRunClient { "x-pi-service-key": this.#serviceKey, }; if (idempotencyKey !== undefined) headers["idempotency-key"] = idempotencyKey; + const requestId = currentRequestId(); + if (requestId) headers["x-request-id"] = requestId; let response: Response; try { @@ -255,8 +258,7 @@ export class ForgeQueryRunClient { signal: AbortSignal.any(signals), }); } catch (error) { - const message = error instanceof Error ? error.message : "unknown transport error"; - throw new ForgeClientError(`Forge QueryRun request failed: ${message}`); + throw new ForgeClientError("Forge QueryRun transport failed", undefined, "upstream_unavailable"); } let body: unknown; @@ -267,9 +269,9 @@ export class ForgeQueryRunClient { } if (!response.ok) { const record = asRecord(body); + const code = typeof record.code === "string" && /^[a-z][a-z0-9_]{0,63}$/.test(record.code) ? record.code : "forge_request_failed"; throw new ForgeClientError( - `Forge QueryRun API returned HTTP ${response.status}: ${String(record.error ?? "error")}`, - response.status, + `Forge QueryRun API returned HTTP ${response.status}`, response.status, code, ); } return body; diff --git a/services/pi-orchestrator/src/model-bindings.ts b/services/pi-orchestrator/src/model-bindings.ts index 8286e8c..8f1e981 100644 --- a/services/pi-orchestrator/src/model-bindings.ts +++ b/services/pi-orchestrator/src/model-bindings.ts @@ -2,6 +2,7 @@ import { existsSync } from "node:fs"; import { DatabaseSync } from "node:sqlite"; import type { OrchestratorConfig } from "./config.js"; +import { ATTEMPT_DESCRIPTORS, skillDescriptor } from "./stage-descriptors.js"; export const STAGE_MODEL_SCOPES = { intent_router: "pi.intent_router", @@ -26,23 +27,21 @@ export interface StageModelBinding { gateClass: "sql_critical" | "capability"; } -const SQL_CRITICAL = new Set(["metric_definition", "query_generation", "query_repair"]); +const SQL_CRITICAL: Partial> = { + metric_definition: true, query_generation: true, query_repair: true, +}; export function skillModelStage(skillName: string): ModelStage { - if (skillName === "data-requirement-clarifier") return "clarification"; - if (skillName === "metric-definition-reviewer") return "metric_definition"; - if (skillName === "data-analysis-report-writer") return "report"; - if (skillName === "data-doc-writer") return "knowledge_answer"; - return "analysis"; + return skillDescriptor(skillName).modelStage; } export function attemptModelStage(stage: string): ModelStage { - if (stage.includes("clarif")) return "clarification"; - if (stage.includes("metric")) return "metric_definition"; - if (stage.includes("report")) return "report"; - if (stage.includes("knowledge") || stage.includes("data-doc")) return "knowledge_answer"; - if (stage.includes("query")) return "query_generation"; - return "analysis"; + if (stage.startsWith("skill:")) return skillModelStage(stage.slice("skill:".length)); + if (!Object.hasOwn(ATTEMPT_DESCRIPTORS, stage)) { + throw new Error(`Unknown attempt stage: ${stage}`); + } + const descriptor = ATTEMPT_DESCRIPTORS[stage as keyof typeof ATTEMPT_DESCRIPTORS]; + return "skillName" in descriptor ? skillModelStage(descriptor.skillName) : descriptor.modelStage; } export function resolveStageModelBinding( @@ -63,7 +62,7 @@ export function resolveStageModelBinding( config_json: string; validation_report_json: string; } | undefined; if (row === undefined) { - if (SQL_CRITICAL.has(stage)) { + if (SQL_CRITICAL[stage]) { throw new Error(`SQL-critical stage ${stage} has no validated active model binding`); } return undefined; @@ -82,7 +81,7 @@ export function resolveStageModelBinding( const capabilities = typeof modelConfig.capabilities === "object" && modelConfig.capabilities !== null ? modelConfig.capabilities as Record : {}; - const gateClass = SQL_CRITICAL.has(stage) ? "sql_critical" : "capability"; + const gateClass = SQL_CRITICAL[stage] ? "sql_critical" : "capability"; const gate = gateClass === "sql_critical" && sqlQualityGateEnabled ? report.quality_gate : report.capability_gate; diff --git a/services/pi-orchestrator/src/orchestrator-state.ts b/services/pi-orchestrator/src/orchestrator-state.ts new file mode 100644 index 0000000..60a5d30 --- /dev/null +++ b/services/pi-orchestrator/src/orchestrator-state.ts @@ -0,0 +1,79 @@ +import { InMemoryTaskStore, type TaskStore } from "./task-store.js"; +import { InMemoryTaskEventStore, type TaskEventStore } from "./task-events.js"; +import { InMemoryArtifactStore, type ArtifactStore } from "./artifacts.js"; +import { InMemoryStageAttemptStore, type StageAttemptStore, type StageAttempt } from "./stage-attempts.js"; +import { settleExecutionPlan } from "./planning.js"; +import { InMemoryChannelEventStore, type ChannelEventStore } from "./channels/event-store.js"; +import { InMemorySkillPolicyStore, type SkillPolicyStore } from "./skill-policy.js"; +import { AUTHORIZED_SKILL_NAMES } from "./skills.js"; +import { TaskStateError } from "./task-store.js"; + +export interface StateTransactionPort { + run(operation: () => T): T; +} + +/** Stores and their transaction boundary are one adapter, never independently injected. */ +export abstract class OrchestratorState { + declare private readonly stateAdapter: void; + abstract readonly tasks: TaskStore; + abstract readonly events: TaskEventStore; + abstract readonly artifacts: ArtifactStore; + abstract readonly attempts: StageAttemptStore; + abstract readonly transactions: StateTransactionPort; + abstract readonly channelEvents: ChannelEventStore; + abstract readonly skillPolicies: SkillPolicyStore; + + reconcileExpiredAttempts(now = new Date()): StageAttempt[] { + return this.transactions.run(() => { + const interrupted: StageAttempt[] = []; + for (const attempt of this.attempts.listExpired(now)) { + const finished = this.attempts.finish(attempt.attempt_id, "interrupted", "Stage lease expired before completion"); + const task = this.tasks.get(attempt.task_run_id); + let recovered = false; + if (task?.status === attempt.running_status) { + this.tasks.transition({ taskRunId: task.task_run_id, expectedStatus: task.status, + status: attempt.retry_status, currentStage: `${attempt.stage}_retry` }); + this.events.append(task.task_run_id, "task.status_changed", { from: task.status, + to: attempt.retry_status, current_stage: `${attempt.stage}_retry`, recovery: true }); + recovered = true; + } + this.events.append(attempt.task_run_id, "stage.attempt_interrupted", { attempt_id: attempt.attempt_id, + stage: attempt.stage, retry_status: attempt.retry_status, task_recovered: recovered, + request_id: attempt.request_id ?? null }); + const current = this.tasks.get(attempt.task_run_id); + if (current !== undefined) settleExecutionPlan(this, current); + interrupted.push(finished); + } + return interrupted; + }); + } +} + +export class InMemoryOrchestratorState extends OrchestratorState { + readonly tasks = new InMemoryTaskStore(); + readonly events = new InMemoryTaskEventStore((taskRunId) => this.#assertTask(taskRunId)); + readonly artifacts = new InMemoryArtifactStore((taskRunId) => this.#assertTask(taskRunId)); + readonly attempts = new InMemoryStageAttemptStore((taskRunId) => this.#assertTask(taskRunId)); + readonly channelEvents = new InMemoryChannelEventStore((taskRunId) => this.#assertTask(taskRunId)); + readonly skillPolicies = new InMemorySkillPolicyStore(AUTHORIZED_SKILL_NAMES); + + #assertTask(taskRunId: string): void { + if (this.tasks.get(taskRunId) === undefined) throw new TaskStateError(`TaskRun not found: ${taskRunId}`); + } + + readonly transactions: StateTransactionPort = { + run: (operation: () => T): T => { + const restore = [this.tasks, this.events, this.artifacts, this.attempts, this.channelEvents, this.skillPolicies].map( + (store) => store.checkpoint(), + ); + try { + const result = operation(); + if (result instanceof Promise) throw new TypeError("State transactions must be synchronous"); + return result; + } catch (error) { + for (const rollback of restore) rollback(); + throw error; + } + }, + }; +} diff --git a/services/pi-orchestrator/src/planning.ts b/services/pi-orchestrator/src/planning.ts index f3a48f0..fab1e94 100644 --- a/services/pi-orchestrator/src/planning.ts +++ b/services/pi-orchestrator/src/planning.ts @@ -1,4 +1,6 @@ import type { Artifact } from "./artifacts.js"; +import type { OrchestratorState } from "./orchestrator-state.js"; +import type { TaskRun } from "./task-store.js"; import type { ChannelIntentRoute } from "./channels/intent.js"; export const PLAN_CAPABILITIES = [ @@ -181,6 +183,37 @@ export function buildExecutionPlan(route: ChannelIntentRoute, goal: string): Exe }; } +/** Settle display progress against authoritative attempts; a plan never schedules work. */ +export function settleExecutionPlan(state: OrchestratorState, task: TaskRun): void { + const artifact = state.artifacts.latest(task.task_run_id, "execution_plan"); + if (artifact === undefined) return; + const current = artifact.payload as ExecutionPlanPayload; + const active = state.attempts.list(task.task_run_id).filter((attempt) => + attempt.status === "running" && attempt.running_status === task.status); + const capability = (stage: string): PlanCapability | undefined => { + if (stage === "query_prepare" || stage === "query_execution") return "query"; + if (stage === "business_root_cause_analysis" || stage === "supplemental_analysis") return "analysis"; + if (stage === "data_analysis_report" || stage.startsWith("skill:")) return "report"; + if (stage === "requirement_clarification" || stage === "metric_definition_review") return "clarification"; + return undefined; + }; + const terminal = ["completed", "cancelled", "failed", "expired"].includes(task.status); + const updates: Partial> = {}; + for (const step of current.steps) { + if (step.status === "running" && !active.some((attempt) => capability(attempt.stage) === step.capability)) { + updates[step.capability] = task.status === "failed" ? "failed" : terminal ? "skipped" : "ready"; + } else if (terminal && ["pending", "ready", "waiting_approval"].includes(step.status)) { + updates[step.capability] = task.status === "failed" ? "failed" : "skipped"; + } + } + if (Object.keys(updates).length === 0) return; + const payload = reviseExecutionPlan(artifact, updates); + const revised = state.artifacts.create({ artifactType: "execution_plan", taskRunId: task.task_run_id, + producer: "pi-planner", payload }); + state.events.append(task.task_run_id, "plan.revised", { artifact_id: revised.artifact_id, + supersedes_artifact_id: artifact.artifact_id, plan_revision: payload.plan_revision, status: payload.status }); +} + export function reviseExecutionPlan( artifact: Artifact, updates: Partial>, diff --git a/services/pi-orchestrator/src/product-projection-builder.ts b/services/pi-orchestrator/src/product-projection-builder.ts index 07b22fe..3e8cf7d 100644 --- a/services/pi-orchestrator/src/product-projection-builder.ts +++ b/services/pi-orchestrator/src/product-projection-builder.ts @@ -537,7 +537,17 @@ export class ProductProjectionService { const planArtifact = this.ports.artifacts.latest(task.task_run_id, "execution_plan"); const plan = planProjection(planArtifact); if (planArtifact !== undefined && plan === null) reasons.push("execution_plan_projection_invalid"); - const actions = presentation.actions.slice(0, 16).map(actionCapability); + const actions = presentation.actions.slice(0, 16).map((action) => { + const projected = actionCapability(action); + if (task.channel !== "web" || task.channel_conversation_id === null) { + projected.availability = "disabled"; + projected.reason_code = "channel_unavailable"; + } else if (action.type === "request_supplement") { + projected.availability = "disabled"; + projected.reason_code = "action_payload_unavailable"; + } + return projected; + }); if ( task.status === "waiting_for_query_approval" && !actions.some((action) => action.action_type === "approve_query") @@ -584,6 +594,10 @@ export class ProductProjectionService { attempt_id: attempt.attempt_id, stage: attempt.stage.slice(0, 256), status: attempt.status, + ...(attempt.request_id ? { request_id: attempt.request_id } : {}), + model_revision: attempt.model_revision, + skill_policy_version: attempt.skill_policy_version, + usage_status: attempt.usage_status ?? "unknown", started_at: attempt.started_at, finished_at: attempt.finished_at, elapsed_ms: Number.isFinite(elapsed) ? Math.max(0, elapsed) : 0, diff --git a/services/pi-orchestrator/src/product-projections.ts b/services/pi-orchestrator/src/product-projections.ts index f119b62..f1e3562 100644 --- a/services/pi-orchestrator/src/product-projections.ts +++ b/services/pi-orchestrator/src/product-projections.ts @@ -366,6 +366,10 @@ const attemptSummarySchema = Type.Object( finished_at: Type.Union([dateTime, Type.Null()]), elapsed_ms: Type.Integer({ minimum: 0 }), safe_error: Type.Union([Type.String({ minLength: 1, maxLength: 1_000 }), Type.Null()]), + request_id: Type.Optional(Type.String({ minLength: 1, maxLength: 256 })), + usage_status: Type.Optional(Type.Union([Type.Literal("not_started"), Type.Literal("known"), Type.Literal("unknown")])), + model_revision: Type.Optional(Type.Union([Type.String({ minLength: 1 }), Type.Null()])), + skill_policy_version: Type.Optional(Type.Integer({ minimum: 0 })), }, { additionalProperties: false }, ); diff --git a/services/pi-orchestrator/src/request-context.ts b/services/pi-orchestrator/src/request-context.ts new file mode 100644 index 0000000..2c32a44 --- /dev/null +++ b/services/pi-orchestrator/src/request-context.ts @@ -0,0 +1,27 @@ +import { AsyncLocalStorage } from "node:async_hooks"; +import { randomUUID } from "node:crypto"; +import type { IncomingMessage, ServerResponse } from "node:http"; + +const context = new AsyncLocalStorage<{ requestId: string }>(); +const SAFE_REQUEST_ID = /^[A-Za-z0-9_.:-]{1,128}$/; + +export function currentRequestId(): string | undefined { + return context.getStore()?.requestId; +} + +export function correlatedHandler( + handler: (request: IncomingMessage, response: ServerResponse) => Promise, +): (request: IncomingMessage, response: ServerResponse) => void { + return (request, response) => { + const supplied = request.headers["x-request-id"]; + const requestId = typeof supplied === "string" && SAFE_REQUEST_ID.test(supplied) ? supplied : randomUUID(); + response.setHeader("x-request-id", requestId); + const started = performance.now(); + response.once("finish", () => { + // Identifiers/status only: never log URLs, credentials, SQL, request bodies or result rows. + console.info(JSON.stringify({ event: "http.request", request_id: requestId, + method: request.method, status: response.statusCode, duration_ms: Math.round(performance.now() - started) })); + }); + context.run({ requestId }, () => { void handler(request, response); }); + }; +} diff --git a/services/pi-orchestrator/src/server.ts b/services/pi-orchestrator/src/server.ts index cd723e7..6fc1693 100644 --- a/services/pi-orchestrator/src/server.ts +++ b/services/pi-orchestrator/src/server.ts @@ -24,6 +24,8 @@ import { type TaskChannel, type TaskStatus, } from "./task-store.js"; +import { correlatedHandler, currentRequestId } from "./request-context.js"; +import { ForgeClientError } from "./forge/client.js"; const MAX_BODY_BYTES = 64 * 1024; const CHANNELS = new Set(["web", "feishu", "dingtalk", "api"]); @@ -124,7 +126,9 @@ function requireAdminAuthentication( function sendJson(response: ServerResponse, statusCode: number, body: unknown): void { response.writeHead(statusCode, { "content-type": "application/json; charset=utf-8" }); - response.end(JSON.stringify(body)); + const payload = statusCode >= 400 && body && typeof body === "object" && !Array.isArray(body) + ? { ...body, request_id: currentRequestId() } : body; + response.end(JSON.stringify(payload)); } async function readJson(request: IncomingMessage): Promise> { @@ -237,17 +241,11 @@ export function createOrchestratorServer( reconciliationTimer.unref(); application = new OrchestratorApplication({ config, - tasks: state.tasks, - events: state.events, - artifacts: state.artifacts, - attempts: state.attempts, - channelEvents: state.channelEvents, - skillPolicies: state.skillPolicies, - transactions: state.transactions, + state, }); } const benchmarkRuntime = new PiBenchmarkRuntime(config, application); - const server = createServer(async (request, response) => { + const server = createServer(correlatedHandler(async (request, response) => { try { const url = new URL( request.url ?? "/", @@ -877,17 +875,31 @@ export function createOrchestratorServer( } else if (error instanceof TaskStateError) { const statusCode = error.message.includes("not found") ? 404 : 409; sendJson(response, statusCode, { status: "task_error", error: error.message }); + } else if (error instanceof ForgeClientError) { + const statusCode = [400, 403, 404, 409].includes(error.statusCode ?? 0) ? error.statusCode! : 502; + sendJson(response, statusCode, { status: "upstream_error", code: error.code, error: "Forge request failed" }); } else { sendJson(response, 500, { status: "error", error: "internal orchestrator error" }); } } - }); - if (state !== undefined) { - server.once("close", () => { - if (reconciliationTimer !== undefined) clearInterval(reconciliationTimer); - state?.close(); + })); + const closeHttp = server.close.bind(server); + let stateClosed = false; + server.close = (callback) => { + if (reconciliationTimer !== undefined) clearInterval(reconciliationTimer); + const drained = benchmarkRuntime.close(); + closeHttp((error) => { + void drained.then(() => { + if (!stateClosed) { state?.close(); stateClosed = true; } + callback?.(error); + }, (cause: unknown) => { + if (!stateClosed) { state?.close(); stateClosed = true; } + const failure = cause instanceof Error ? cause : new Error("Benchmark shutdown failed"); + if (callback) callback(failure); else server.emit("error", failure); + }); }); - } + return server; + }; return server; } diff --git a/services/pi-orchestrator/src/skill-executor.ts b/services/pi-orchestrator/src/skill-executor.ts index 406ab2c..59ddfe4 100644 --- a/services/pi-orchestrator/src/skill-executor.ts +++ b/services/pi-orchestrator/src/skill-executor.ts @@ -12,7 +12,6 @@ import type { Artifact } from "./artifacts.js"; import { computePiModelRevision, type OrchestratorConfig } from "./config.js"; import { resolveStageModelBinding, skillModelStage } from "./model-bindings.js"; import { - EVIDENCE_REQUIRED_SKILL_NAMES, loadStageSkillResources, type AdvisorySkillName, type MvpSkillName, @@ -31,6 +30,7 @@ import { type RenderedOutputPayload, } from "./structured-artifact-tools.js"; import type { TaskRun } from "./task-store.js"; +import { skillDescriptor, STAGE_OUTPUTS } from "./stage-descriptors.js"; export class SkillExecutionError extends Error {} @@ -314,9 +314,7 @@ export class PiStructuredSkillExecutor implements StructuredSkillExecutionPort { const submission = createAdvisorySubmissionTool({ skillName, allowedEvidenceRefs, - requiresQueryEvidence: EVIDENCE_REQUIRED_SKILL_NAMES.includes( - skillName as (typeof EVIDENCE_REQUIRED_SKILL_NAMES)[number], - ), + requiresQueryEvidence: skillDescriptor(skillName).evidence === "query_result", }); await this.#runStage({ task, @@ -404,6 +402,10 @@ export class PiStructuredSkillExecutor implements StructuredSkillExecutionPort { expectedModelRevision?: string | null; onProgress?: (progress: StageExecutionProgress) => void; }): Promise { + const descriptor = skillDescriptor(options.skillName); + if (options.tool.name !== STAGE_OUTPUTS[descriptor.output].toolName) { + throw new SkillExecutionError("Skill submission tool does not match its authorized output"); + } if (options.message.trim().length === 0) { throw new SkillExecutionError("Skill input must not be empty"); } diff --git a/services/pi-orchestrator/src/skill-policy.ts b/services/pi-orchestrator/src/skill-policy.ts index 6d5b83e..89b6832 100644 --- a/services/pi-orchestrator/src/skill-policy.ts +++ b/services/pi-orchestrator/src/skill-policy.ts @@ -31,6 +31,14 @@ export class InMemorySkillPolicyStore implements SkillPolicyStore { this.#defaults = [...defaults]; } + checkpoint(): () => void { + const snapshot = structuredClone(this.#policies); + return () => { + this.#policies.clear(); + for (const [key, value] of snapshot) this.#policies.set(key, value); + }; + } + get(orgId: string, teamId: string): TeamSkillPolicy | undefined { const policy = this.#policies.get(`${orgId}\0${teamId}`); return policy === undefined ? undefined : structuredClone(policy); diff --git a/services/pi-orchestrator/src/skills.ts b/services/pi-orchestrator/src/skills.ts index 31820e7..3320425 100644 --- a/services/pi-orchestrator/src/skills.ts +++ b/services/pi-orchestrator/src/skills.ts @@ -7,47 +7,20 @@ import { type Skill, } from "@earendil-works/pi-coding-agent"; -export const AUTHORIZED_SKILL_NAMES = [ - "data-requirement-clarifier", - "metric-definition-reviewer", - "business-root-cause-analysis", - "data-analysis-report-writer", - "exploratory-data-analysis", - "funnel-analysis", - "retention-cohort-analysis", - "ab-test-analysis", - "sql-reviewer", - "data-quality-rule-generator", - "table-design-advisor", - "data-lineage-impact-analyzer", - "dashboard-reviewer", - "data-presentation-architect", - "daily-report-writer", - "weekly-monthly-report-writer", - "data-doc-writer", - "data-incident-postmortem-writer", - "data-tool-integration-planner", - "market-research-analyst", -] as const; +import { SKILL_DESCRIPTORS } from "./stage-descriptors.js"; +import type { AuthorizedSkillName, AdvisorySkillName } from "./stage-descriptors.js"; +export type { AuthorizedSkillName, AdvisorySkillName } from "./stage-descriptors.js"; -export type AuthorizedSkillName = (typeof AUTHORIZED_SKILL_NAMES)[number]; - -export type AdvisorySkillName = Exclude< - AuthorizedSkillName, - | "data-requirement-clarifier" - | "metric-definition-reviewer" - | "business-root-cause-analysis" - | "data-analysis-report-writer" ->; -export const CORE_WORKFLOW_SKILL_NAMES = AUTHORIZED_SKILL_NAMES.slice(0, 4) as readonly AuthorizedSkillName[]; -export const ADVISORY_SKILL_NAMES = AUTHORIZED_SKILL_NAMES.slice(4) as readonly AdvisorySkillName[]; - -export const EVIDENCE_REQUIRED_SKILL_NAMES = [ - "exploratory-data-analysis", - "funnel-analysis", - "retention-cohort-analysis", - "ab-test-analysis", -] as const satisfies readonly AuthorizedSkillName[]; +export const AUTHORIZED_SKILL_NAMES = Object.keys(SKILL_DESCRIPTORS) as AuthorizedSkillName[]; +export const CORE_WORKFLOW_SKILL_NAMES = AUTHORIZED_SKILL_NAMES.filter( + (name) => SKILL_DESCRIPTORS[name].output !== "advisory", +); +export const ADVISORY_SKILL_NAMES = AUTHORIZED_SKILL_NAMES.filter( + (name): name is AdvisorySkillName => SKILL_DESCRIPTORS[name].output === "advisory", +); +export const EVIDENCE_REQUIRED_SKILL_NAMES = ADVISORY_SKILL_NAMES.filter( + (name) => SKILL_DESCRIPTORS[name].evidence === "query_result", +); export const MVP_SKILL_NAMES = AUTHORIZED_SKILL_NAMES; export type MvpSkillName = AuthorizedSkillName; diff --git a/services/pi-orchestrator/src/sqlite-store.ts b/services/pi-orchestrator/src/sqlite-store.ts index 908fd16..7912d08 100644 --- a/services/pi-orchestrator/src/sqlite-store.ts +++ b/services/pi-orchestrator/src/sqlite-store.ts @@ -1,4 +1,5 @@ import { randomUUID } from "node:crypto"; +import { OrchestratorState } from "./orchestrator-state.js"; import { mkdirSync } from "node:fs"; import { dirname } from "node:path"; import { DatabaseSync, type StatementResultingChanges } from "node:sqlite"; @@ -22,6 +23,7 @@ import { type TeamSkillPolicy, } from "./skill-policy.js"; import { + validateStageAttemptInput, type StageAttempt, type StageAttemptStatus, type StageProgressPhase, @@ -593,17 +595,7 @@ class SqliteStageAttemptStore implements StageAttemptStore { constructor(private readonly database: DatabaseSync) {} start(input: StartStageAttemptInput): StageAttempt { - if (input.stage.trim().length === 0 || input.idempotencyKey.trim().length === 0) { - throw new TaskStateError("Stage and idempotency key must not be empty"); - } - if (!Number.isInteger(input.leaseMs) || input.leaseMs < 1) { - throw new TaskStateError("Stage attempt lease must be a positive integer"); - } - if (input.timeoutMs !== undefined && ( - !Number.isInteger(input.timeoutMs) || input.timeoutMs < 1 || input.timeoutMs >= input.leaseMs - )) { - throw new TaskStateError("Stage timeout must be positive and shorter than its lease"); - } + validateStageAttemptInput(input); const ownsTransaction = !this.database.isTransaction; if (ownsTransaction) this.database.exec("BEGIN IMMEDIATE"); try { @@ -648,6 +640,8 @@ class SqliteStageAttemptStore implements StageAttemptStore { tool_submitted_at: null, model_revision: input.modelRevision ?? null, skill_policy_version: input.skillPolicyVersion ?? 0, + request_id: input.requestId ?? null, + usage_status: "not_started", }; this.database .prepare( @@ -712,6 +706,18 @@ class SqliteStageAttemptStore implements StageAttemptStore { ); } + listExpired(now: Date): StageAttempt[] { + const rows = this.database.prepare("SELECT data_json FROM stage_attempts WHERE status = 'running' AND lease_expires_at <= ? ORDER BY started_at ASC") + .all(now.toISOString()) as Array<{ data_json: string }>; + return rows.map((row) => normalizeStageAttempt(parseJson(row.data_json, "StageAttempt"))); + } + + markDispatched(attemptId: string): void { + const changedRows = this.database.prepare("UPDATE stage_attempts SET data_json = json_set(data_json, '$.usage_status', 'unknown') WHERE attempt_id = ? AND status = 'running'") + .run(attemptId); + if (changed(changedRows) !== 1) throw new TaskStateError("Cannot dispatch an absent or terminal StageAttempt"); + } + markProgress( attemptId: string, phase: Exclude, @@ -746,7 +752,7 @@ class SqliteStageAttemptStore implements StageAttemptStore { finish( attemptId: string, - status: Exclude, + status: Exclude, error?: string, ): StageAttempt { const attempt = this.get(attemptId); @@ -902,7 +908,7 @@ class SqliteSkillPolicyStore implements SkillPolicyStore { } } -export class SqliteOrchestratorState { +export class SqliteOrchestratorState extends OrchestratorState { readonly tasks: TaskStore; readonly events: TaskEventStore; readonly artifacts: ArtifactStore; @@ -912,7 +918,10 @@ export class SqliteOrchestratorState { readonly transactions: { run(operation: () => T): T }; readonly #database: DatabaseSync; + get database(): DatabaseSync { return this.#database; } + constructor(databasePath: string) { + super(); if (databasePath !== ":memory:") mkdirSync(dirname(databasePath), { recursive: true }); this.#database = new DatabaseSync(databasePath); this.#database.exec("PRAGMA foreign_keys = ON"); @@ -1016,10 +1025,23 @@ export class SqliteOrchestratorState { this.skillPolicies = new SqliteSkillPolicyStore(this.#database, AUTHORIZED_SKILL_NAMES); this.transactions = { run: (operation: () => T): T => { - if (this.#database.isTransaction) return operation(); + const nested = this.#database.isTransaction; + if (nested) { + this.#database.exec("SAVEPOINT nested_state"); + try { + const result = operation(); + if (result instanceof Promise) throw new TypeError("State transactions must be synchronous"); + this.#database.exec("RELEASE nested_state"); + return result; + } catch (error) { + this.#database.exec("ROLLBACK TO nested_state; RELEASE nested_state"); + throw error; + } + } this.#database.exec("BEGIN IMMEDIATE"); try { const result = operation(); + if (result instanceof Promise) throw new TypeError("State transactions must be synchronous"); this.#database.exec("COMMIT"); return result; } catch (error) { @@ -1030,71 +1052,6 @@ export class SqliteOrchestratorState { }; } - reconcileExpiredAttempts(now = new Date()): StageAttempt[] { - return this.transactions.run(() => { - const rows = this.#database - .prepare( - `SELECT data_json FROM stage_attempts - WHERE status = 'running' AND lease_expires_at <= ? - ORDER BY started_at ASC`, - ) - .all(now.toISOString()) as Array<{ data_json: string }>; - const interrupted: StageAttempt[] = []; - for (const row of rows) { - const attempt = normalizeStageAttempt(parseJson(row.data_json, "StageAttempt")); - const finishedAt = now.toISOString(); - const updatedAttempt: StageAttempt = { - ...attempt, - status: "interrupted", - updated_at: finishedAt, - finished_at: finishedAt, - error: "Stage lease expired before completion", - }; - const attemptResult = this.#database - .prepare( - `UPDATE stage_attempts - SET status = 'interrupted', updated_at = ?, finished_at = ?, error = ?, data_json = ? - WHERE attempt_id = ? AND status = 'running' AND lease_expires_at <= ?`, - ) - .run( - finishedAt, - finishedAt, - updatedAttempt.error, - JSON.stringify(updatedAttempt), - attempt.attempt_id, - now.toISOString(), - ); - if (changed(attemptResult) !== 1) continue; - - const task = this.tasks.get(attempt.task_run_id); - let recovered = false; - if (task?.status === attempt.running_status) { - this.tasks.transition({ - taskRunId: task.task_run_id, - expectedStatus: attempt.running_status, - status: attempt.retry_status, - currentStage: `${attempt.stage}_retry`, - }); - this.events.append(task.task_run_id, "task.status_changed", { - from: attempt.running_status, - to: attempt.retry_status, - current_stage: `${attempt.stage}_retry`, - recovery: true, - }); - recovered = true; - } - this.events.append(attempt.task_run_id, "stage.attempt_interrupted", { - attempt_id: attempt.attempt_id, - stage: attempt.stage, - retry_status: attempt.retry_status, - task_recovered: recovered, - }); - interrupted.push(structuredClone(updatedAttempt)); - } - return interrupted; - }); - } - close(): void { this.#database.close(); } diff --git a/services/pi-orchestrator/src/stage-attempts.ts b/services/pi-orchestrator/src/stage-attempts.ts index 3ddec9c..ea35561 100644 --- a/services/pi-orchestrator/src/stage-attempts.ts +++ b/services/pi-orchestrator/src/stage-attempts.ts @@ -39,6 +39,8 @@ export interface StageAttempt { tool_submitted_at: string | null; model_revision: string | null; skill_policy_version: number; + request_id?: string | null; + usage_status?: "not_started" | "unknown"; } export interface StartStageAttemptInput { @@ -51,6 +53,21 @@ export interface StartStageAttemptInput { timeoutMs?: number; modelRevision?: string | null; skillPolicyVersion?: number; + requestId?: string | null; +} + +export function validateStageAttemptInput(input: StartStageAttemptInput): void { + if (input.stage.trim().length === 0 || input.idempotencyKey.trim().length === 0) { + throw new TaskStateError("Stage and idempotency key must not be empty"); + } + if (!Number.isInteger(input.leaseMs) || input.leaseMs < 1) { + throw new TaskStateError("Stage attempt lease must be a positive integer"); + } + if (input.timeoutMs !== undefined && ( + !Number.isInteger(input.timeoutMs) || input.timeoutMs < 1 || input.timeoutMs >= input.leaseMs + )) { + throw new TaskStateError("Stage timeout must be positive and shorter than its lease"); + } } export interface StageAttemptStore { @@ -58,10 +75,12 @@ export interface StageAttemptStore { get(attemptId: string): StageAttempt | undefined; findByIdempotencyKey(taskRunId: string, idempotencyKey: string): StageAttempt | undefined; list(taskRunId: string): StageAttempt[]; + listExpired(now: Date): StageAttempt[]; + markDispatched(attemptId: string): void; markProgress(attemptId: string, phase: Exclude): StageAttempt; finish( attemptId: string, - status: Exclude, + status: Exclude, error?: string, ): StageAttempt; } @@ -69,12 +88,19 @@ export interface StageAttemptStore { export class InMemoryStageAttemptStore implements StageAttemptStore { readonly #attempts = new Map(); + constructor(private readonly assertTask?: (taskRunId: string) => void) {} + + checkpoint(): () => void { + const snapshot = structuredClone(this.#attempts); + return () => { + this.#attempts.clear(); + for (const [key, value] of snapshot) this.#attempts.set(key, value); + }; + } + start(input: StartStageAttemptInput): StageAttempt { - if (input.timeoutMs !== undefined && ( - !Number.isInteger(input.timeoutMs) || input.timeoutMs < 1 || input.timeoutMs >= input.leaseMs - )) { - throw new TaskStateError("Stage timeout must be positive and shorter than its lease"); - } + validateStageAttemptInput(input); + this.assertTask?.(input.taskRunId); const attempts = this.#attempts.get(input.taskRunId) ?? []; const existing = attempts.find( (attempt) => attempt.idempotency_key === input.idempotencyKey, @@ -106,6 +132,8 @@ export class InMemoryStageAttemptStore implements StageAttemptStore { tool_submitted_at: null, model_revision: input.modelRevision ?? null, skill_policy_version: input.skillPolicyVersion ?? 0, + request_id: input.requestId ?? null, + usage_status: "not_started", }; attempts.push(attempt); this.#attempts.set(input.taskRunId, attempts); @@ -131,6 +159,23 @@ export class InMemoryStageAttemptStore implements StageAttemptStore { return (this.#attempts.get(taskRunId) ?? []).map((attempt) => structuredClone(attempt)); } + listExpired(now: Date): StageAttempt[] { + return [...this.#attempts.values()].flat().filter((attempt) => + attempt.status === "running" && attempt.lease_expires_at <= now.toISOString()) + .map((attempt) => structuredClone(attempt)); + } + + markDispatched(attemptId: string): void { + for (const attempts of this.#attempts.values()) { + const attempt = attempts.find((item) => item.attempt_id === attemptId); + if (attempt === undefined) continue; + if (attempt.status !== "running") throw new TaskStateError("Cannot dispatch a terminal StageAttempt"); + attempt.usage_status = "unknown"; + return; + } + throw new TaskStateError("StageAttempt not found"); + } + markProgress( attemptId: string, phase: Exclude, @@ -164,7 +209,7 @@ export class InMemoryStageAttemptStore implements StageAttemptStore { finish( attemptId: string, - status: Exclude, + status: Exclude, error?: string, ): StageAttempt { for (const attempts of this.#attempts.values()) { diff --git a/services/pi-orchestrator/src/stage-descriptors.ts b/services/pi-orchestrator/src/stage-descriptors.ts new file mode 100644 index 0000000..73285cf --- /dev/null +++ b/services/pi-orchestrator/src/stage-descriptors.ts @@ -0,0 +1,62 @@ +import type { ModelStage } from "./model-bindings.js"; + +// Identity, output boundary and evidence policy live here; business execution stays +// in explicit typed methods. Advisory additions only need an authorized row. +export const STAGE_OUTPUTS = { + clarification: { artifactType: "clarification", toolName: "submit_clarification_artifact" }, + metric_definition: { artifactType: "metric_definition", toolName: "submit_metric_definition_artifact" }, + analysis: { artifactType: "analysis", toolName: "submit_analysis_artifact" }, + advisory: { artifactType: "advisory", toolName: "submit_advisory_artifact" }, + report: { artifactType: "rendered_output", toolName: "submit_rendered_output_artifact" }, +} as const; + +interface SkillDescriptor { + output: keyof typeof STAGE_OUTPUTS; + modelStage: ModelStage; + evidence: "none" | "query_result" | "supplied_context" | "analysis"; +} + +export const SKILL_DESCRIPTORS = { + "data-requirement-clarifier": { output: "clarification", modelStage: "clarification", evidence: "none" }, + "metric-definition-reviewer": { output: "metric_definition", modelStage: "metric_definition", evidence: "none" }, + "business-root-cause-analysis": { output: "analysis", modelStage: "analysis", evidence: "query_result" }, + "data-analysis-report-writer": { output: "report", modelStage: "report", evidence: "analysis" }, + "exploratory-data-analysis": { output: "advisory", modelStage: "analysis", evidence: "query_result" }, + "funnel-analysis": { output: "advisory", modelStage: "analysis", evidence: "query_result" }, + "retention-cohort-analysis": { output: "advisory", modelStage: "analysis", evidence: "query_result" }, + "ab-test-analysis": { output: "advisory", modelStage: "analysis", evidence: "query_result" }, + "sql-reviewer": { output: "advisory", modelStage: "analysis", evidence: "supplied_context" }, + "data-quality-rule-generator": { output: "advisory", modelStage: "analysis", evidence: "supplied_context" }, + "table-design-advisor": { output: "advisory", modelStage: "analysis", evidence: "supplied_context" }, + "data-lineage-impact-analyzer": { output: "advisory", modelStage: "analysis", evidence: "supplied_context" }, + "dashboard-reviewer": { output: "advisory", modelStage: "analysis", evidence: "supplied_context" }, + "data-presentation-architect": { output: "advisory", modelStage: "analysis", evidence: "supplied_context" }, + "daily-report-writer": { output: "advisory", modelStage: "analysis", evidence: "supplied_context" }, + "weekly-monthly-report-writer": { output: "advisory", modelStage: "analysis", evidence: "supplied_context" }, + "data-doc-writer": { output: "advisory", modelStage: "knowledge_answer", evidence: "supplied_context" }, + "data-incident-postmortem-writer": { output: "advisory", modelStage: "analysis", evidence: "supplied_context" }, + "data-tool-integration-planner": { output: "advisory", modelStage: "analysis", evidence: "supplied_context" }, + "market-research-analyst": { output: "advisory", modelStage: "analysis", evidence: "supplied_context" }, +} as const satisfies Record; + +export type AuthorizedSkillName = keyof typeof SKILL_DESCRIPTORS; +export type AdvisorySkillName = { + [K in AuthorizedSkillName]: (typeof SKILL_DESCRIPTORS)[K]["output"] extends "advisory" ? K : never; +}[AuthorizedSkillName]; + +export function skillDescriptor(name: string): SkillDescriptor { + if (!Object.hasOwn(SKILL_DESCRIPTORS, name)) throw new Error(`Unauthorized Skill: ${name}`); + return SKILL_DESCRIPTORS[name as AuthorizedSkillName]; +} + +// Persisted attempt identities are explicit, not substring matches. Query +// execution retains the query-planning revision binding, not a model call. +export const ATTEMPT_DESCRIPTORS = { + requirement_clarification: { skillName: "data-requirement-clarifier" }, + metric_definition_review: { skillName: "metric-definition-reviewer" }, + query_prepare: { modelStage: "query_generation" }, + query_execution: { modelStage: "query_generation" }, + supplemental_analysis: { skillName: "business-root-cause-analysis" }, + business_root_cause_analysis: { skillName: "business-root-cause-analysis" }, + data_analysis_report: { skillName: "data-analysis-report-writer" }, +} as const satisfies Record; diff --git a/services/pi-orchestrator/src/strict-forge-output.ts b/services/pi-orchestrator/src/strict-forge-output.ts index 55c7b4d..0745f6d 100644 --- a/services/pi-orchestrator/src/strict-forge-output.ts +++ b/services/pi-orchestrator/src/strict-forge-output.ts @@ -23,7 +23,7 @@ const object = (value: unknown): value is Record => typeof value === "object" && value !== null && !Array.isArray(value); /** Native OpenAI strict schemas support recursive refs/unions that Pi's generic converter rejects. */ -export function createStrictForgeOutput(canonical: Schema) { +export function createStrictForgeOutput(canonical: Schema, descriptions: Readonly> = {}) { const resolve = (node: Schema): Schema => { if (!node.$ref) return node; const prefix = "#/definitions/"; @@ -79,6 +79,11 @@ export function createStrictForgeOutput(canonical: Schema) { return result; }; const schema = build(canonical); + for (const [key, description] of Object.entries(descriptions)) { + if (Object.hasOwn(schema.properties ?? {}, key) && description.trim()) { + schema.properties![key]!.description = description; + } + } const validator = Compile(schema as TSchema); const revision = `sha256:${createHash("sha256").update(JSON.stringify(schema)).digest("hex")}`; diff --git a/services/pi-orchestrator/src/structured-artifact-tools.ts b/services/pi-orchestrator/src/structured-artifact-tools.ts index 69fbc93..155b9cd 100644 --- a/services/pi-orchestrator/src/structured-artifact-tools.ts +++ b/services/pi-orchestrator/src/structured-artifact-tools.ts @@ -1,7 +1,7 @@ import { defineTool } from "@earendil-works/pi-coding-agent"; import { Type, type Static, type TSchema } from "typebox"; -import { IsDateTime } from "typebox/format"; import { Value } from "typebox/value"; +import { STAGE_OUTPUTS } from "./stage-descriptors.js"; export const clarificationPayloadSchema = Type.Object( { @@ -18,8 +18,8 @@ export const clarificationPayloadSchema = Type.Object( time_range: Type.Object( { description: Type.String({ minLength: 1 }), - start: Type.Optional(Type.Union([Type.String(), Type.Null()])), - end: Type.Optional(Type.Union([Type.String(), Type.Null()])), + start: Type.Optional(Type.Union([Type.String({ format: "date-time" }), Type.Null()])), + end: Type.Optional(Type.Union([Type.String({ format: "date-time" }), Type.Null()])), timezone: Type.Optional(Type.Union([Type.String(), Type.Null()])), granularity: Type.Optional(Type.Union([Type.String(), Type.Null()])), }, @@ -105,7 +105,7 @@ export const queryResultPayloadSchema = Type.Object( model_revision: Type.Optional(Type.String({ minLength: 1 })), assurance_registry_revision: Type.Optional(Type.String({ minLength: 1 })), execution_ms: Type.Integer({ minimum: 0 }), - executed_at: Type.String({ minLength: 1 }), + executed_at: Type.String({ minLength: 1, format: "date-time" }), result_contract: Type.Optional(Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()])), }, { additionalProperties: false }, @@ -281,12 +281,6 @@ export function validateClarificationPayload(value: unknown): string | undefined if (!Value.Check(clarificationPayloadSchema, value)) { return "payload does not match ClarificationArtifact schema"; } - for (const field of ["start", "end"] as const) { - const dateValue = value.time_range[field]; - if (typeof dateValue === "string" && !IsDateTime(dateValue)) { - return `time_range.${field} must be an RFC 3339 date-time`; - } - } return undefined; } @@ -300,7 +294,6 @@ export function validateQueryResultPayload(value: unknown): string | undefined { if (!Value.Check(queryResultPayloadSchema, value)) { return "payload does not match QueryResultArtifact schema"; } - if (!IsDateTime(value.executed_at)) return "executed_at must be an RFC 3339 date-time"; if (value.row_count !== value.rows.length) return "row_count must equal persisted rows length"; if (value.rows.some((row) => row.length !== value.columns.length)) { return "every result row must match the columns length"; @@ -428,7 +421,7 @@ function createSubmissionTool(options: { export function createClarificationSubmissionTool() { return createSubmissionTool({ - name: "submit_clarification_artifact", + name: STAGE_OUTPUTS.clarification.toolName, label: "Clarification Artifact", description: "Submit the final structured requirement clarification. This is the only valid final output for this stage.", @@ -439,7 +432,7 @@ export function createClarificationSubmissionTool() { export function createMetricDefinitionSubmissionTool() { return createSubmissionTool({ - name: "submit_metric_definition_artifact", + name: STAGE_OUTPUTS.metric_definition.toolName, label: "Metric Definition Artifact", description: "Submit the final structured metric definition review. Unconfirmed business rules must remain in open_questions.", @@ -452,7 +445,7 @@ export function createAnalysisSubmissionTool(options: { allowedEvidenceRefs?: ReadonlySet; } = {}) { return createSubmissionTool({ - name: "submit_analysis_artifact", + name: STAGE_OUTPUTS.analysis.toolName, label: "Analysis Artifact", description: "Submit evidence-bound analysis. Every finding must cite one or more supplied QueryRun evidence references; unverified causes remain hypotheses.", @@ -478,7 +471,7 @@ export function createAdvisorySubmissionTool(options: { requiresQueryEvidence?: boolean; }) { return createSubmissionTool({ - name: "submit_advisory_artifact", + name: STAGE_OUTPUTS.advisory.toolName, label: "AdvisoryArtifact", description: "Submit the bounded professional advisory result. Factual claims must cite only supplied QueryResult or Context evidence references.", schema: advisoryPayloadSchema, @@ -490,7 +483,8 @@ export function createAdvisorySubmissionTool(options: { if ( options.requiresQueryEvidence === true && payload.status === "complete" && - (payload.findings.length === 0 || payload.findings.some((item) => item.evidence_refs.length === 0)) + (payload.findings.length === 0 || payload.findings.some((item) => + !item.evidence_refs.some((ref) => ref.startsWith("qr_")))) ) { return "every finding in a complete data analysis advisory requires QueryResult evidence"; } @@ -508,7 +502,7 @@ export function createRenderedOutputSubmissionTool(options: { allowedEvidenceRefs?: ReadonlySet; } = {}) { return createSubmissionTool({ - name: "submit_rendered_output_artifact", + name: STAGE_OUTPUTS.report.toolName, label: "Rendered Output Artifact", description: "Submit the report structure derived only from the supplied AnalysisArtifact. Every key finding must preserve QueryRun evidence references. Set markdown to the exact sentinel SERVER_RENDERED; the trusted service renders Markdown deterministically.", diff --git a/services/pi-orchestrator/src/task-events.ts b/services/pi-orchestrator/src/task-events.ts index ac21f3d..68dd980 100644 --- a/services/pi-orchestrator/src/task-events.ts +++ b/services/pi-orchestrator/src/task-events.ts @@ -53,11 +53,22 @@ export interface TaskEventStore { export class InMemoryTaskEventStore implements TaskEventStore { readonly #events = new Map(); + constructor(private readonly assertTask?: (taskRunId: string) => void) {} + + checkpoint(): () => void { + const snapshot = structuredClone(this.#events); + return () => { + this.#events.clear(); + for (const [key, value] of snapshot) this.#events.set(key, value); + }; + } + append( taskRunId: string, eventType: TaskEventType, payload: Record, ): TaskEvent { + this.assertTask?.(taskRunId); const events = this.#events.get(taskRunId) ?? []; const event: TaskEvent = { event_id: `te_${randomUUID().replaceAll("-", "")}`, diff --git a/services/pi-orchestrator/src/task-store.ts b/services/pi-orchestrator/src/task-store.ts index b4c65b7..dca1dce 100644 --- a/services/pi-orchestrator/src/task-store.ts +++ b/services/pi-orchestrator/src/task-store.ts @@ -165,6 +165,16 @@ export class InMemoryTaskStore implements TaskStore { readonly #tasks = new Map(); #lastCreatedAtMs = 0; + checkpoint(): () => void { + const snapshot = structuredClone(this.#tasks); + const lastCreatedAtMs = this.#lastCreatedAtMs; + return () => { + this.#lastCreatedAtMs = lastCreatedAtMs; + this.#tasks.clear(); + for (const [key, value] of snapshot) this.#tasks.set(key, value); + }; + } + create(input: CreateTaskInput): TaskRun { for (const [field, value] of Object.entries({ org_id: input.org_id, @@ -177,6 +187,9 @@ export class InMemoryTaskStore implements TaskStore { } } + if (input.parent_task_run_id != null && !this.#tasks.has(input.parent_task_run_id)) { + throw new TaskStateError(`Parent TaskRun not found: ${input.parent_task_run_id}`); + } const timestamp = Math.max(Date.now(), this.#lastCreatedAtMs + 1); this.#lastCreatedAtMs = timestamp; const now = new Date(timestamp).toISOString(); diff --git a/services/pi-orchestrator/tests/application.test.ts b/services/pi-orchestrator/tests/application.test.ts index 578456c..25cee9e 100644 --- a/services/pi-orchestrator/tests/application.test.ts +++ b/services/pi-orchestrator/tests/application.test.ts @@ -7,7 +7,7 @@ import { } from "../src/application.js"; import { loadConfig } from "../src/config.js"; import type { QueryRunReview } from "../src/forge/query-run-client.js"; -import { InMemoryStageAttemptStore } from "../src/stage-attempts.js"; +import { InMemoryOrchestratorState } from "../src/orchestrator-state.js"; const SQL_HASH = `sha256:${"a".repeat(64)}`; @@ -53,7 +53,8 @@ const unusedAnalysisSkills = { function createApplication(result: QueryRunReview) { const calls: Array> = []; - const attempts = new InMemoryStageAttemptStore(); + const state = new InMemoryOrchestratorState(); + const attempts = state.attempts; const forgeClient: ForgeQueryRunPort = { async createQueryRun(input) { calls.push(input); @@ -89,7 +90,7 @@ function createApplication(result: QueryRunReview) { application: new OrchestratorApplication({ config: loadConfig({}), forgeClient, - attempts, + state, }), calls, attempts, @@ -98,7 +99,7 @@ function createApplication(result: QueryRunReview) { test("Pi application owns TaskRun progression and emits a review event", async () => { - const { application, calls, attempts } = createApplication(response()); + const { application, attempts } = createApplication(response()); const created = application.createTask({ org_id: "org_demo", team_id: "team_growth", @@ -114,26 +115,6 @@ test("Pi application owns TaskRun progression and emits a review event", async ( }); assert.equal(prepared.task.status, "waiting_for_query_approval"); - assert.deepEqual(calls, [{ - taskRunId: created.task.task_run_id, - orgId: "org_demo", - teamId: "team_growth", - userId: "trusted-user", - question: "查询订单 ID", - idempotencyKey: `${created.task.task_run_id}:prepare`, - dialect: "postgresql", - }]); - assert.deepEqual( - prepared.events.map((event) => event.event_type), - [ - "task.created", - "task.status_changed", - "stage.attempt_started", - "task.status_changed", - "query.review_requested", - "stage.attempt_succeeded", - ], - ); const review = prepared.events.find( (event) => event.event_type === "query.review_requested", ); @@ -219,10 +200,31 @@ test("Forge prepare timeout restores a retryable task state", async () => { assert.equal(attempts.list(created.task.task_run_id)[0]?.status, "timed_out"); }); +test("a new prepare attempt is not trapped by the remote failed command cache", async () => { + const cache = new Map(); + const app = new OrchestratorApplication({ config: loadConfig({}), + forgeClient: { + async createQueryRun(input) { + const cached = cache.get(input.idempotencyKey); + if (cached !== undefined) return cached; + const result = response({ status: cache.size === 0 ? "timed_out" : "needs_clarification", error: "Confirm time range", task_run_id: input.taskRunId }); + cache.set(input.idempotencyKey, result); + return result; + }, + async approveQueryRun() { throw new Error("Must not execute"); }, + }, + }); + const task = app.createTask({ org_id: "synthetic", team_id: "synthetic", user_id: "synthetic", + channel: "api", intent: "query", message: "orders" }).task; + assert.equal((await app.prepareQuery(task.task_run_id, { question: "orders" })).task.status, "ready_for_query"); + assert.equal((await app.prepareQuery(task.task_run_id, { question: "orders" })).task.status, "needs_input"); +}); + test("structured clarification Artifact controls TaskRun progression", async () => { - const attempts = new InMemoryStageAttemptStore(); + const state = new InMemoryOrchestratorState(); + const attempts = state.attempts; const withSkills = new OrchestratorApplication({ - attempts, + state, config: loadConfig({}), forgeClient: { async createQueryRun(input) { @@ -282,14 +284,15 @@ test("structured clarification Artifact controls TaskRun progression", async () test("Stage timeout records a timed-out Attempt and restores retry status", async () => { - const attempts = new InMemoryStageAttemptStore(); + const state = new InMemoryOrchestratorState(); + const attempts = state.attempts; const app = new OrchestratorApplication({ config: loadConfig({ FORGE_REQUEST_TIMEOUT_MS: "1", PI_STAGE_TIMEOUT_MS: "10", PI_STAGE_LEASE_MS: "100", }), - attempts, + state, forgeClient: { async createQueryRun() { throw new Error("not used"); }, async approveQueryRun() { throw new Error("not used"); }, @@ -388,9 +391,10 @@ test("application rejects a Skill payload that violates the Artifact contract", test("confirmed metric Artifact is required before query readiness", async () => { - const attempts = new InMemoryStageAttemptStore(); + const state = new InMemoryOrchestratorState(); + const attempts = state.attempts; const withSkills = new OrchestratorApplication({ - attempts, + state, config: loadConfig({}), forgeClient: { async createQueryRun(input) { @@ -444,10 +448,11 @@ test("confirmed metric Artifact is required before query readiness", async () => test("QueryResult flows through evidence-bound analysis and report Artifacts", async () => { let analysisArtifactId = ""; const memoryWrites: Array> = []; - const attempts = new InMemoryStageAttemptStore(); + const state = new InMemoryOrchestratorState(); + const attempts = state.attempts; const app = new OrchestratorApplication({ config: loadConfig({}), - attempts, + state, forgeClient: { async createQueryRun(input) { return { ...response(), task_run_id: input.taskRunId }; @@ -688,9 +693,10 @@ test("incomplete analysis pauses with suggested queries and cannot render", asyn test("one approved supplemental child QueryRun can resume parent analysis", async () => { let analysisCalls = 0; - const attempts = new InMemoryStageAttemptStore(); + const state = new InMemoryOrchestratorState(); + const attempts = state.attempts; const app = new OrchestratorApplication({ - attempts, + state, config: loadConfig({}), forgeClient: { async createQueryRun(input) { diff --git a/services/pi-orchestrator/tests/benchmark-runtime.test.ts b/services/pi-orchestrator/tests/benchmark-runtime.test.ts index bfb5d6a..e602604 100644 --- a/services/pi-orchestrator/tests/benchmark-runtime.test.ts +++ b/services/pi-orchestrator/tests/benchmark-runtime.test.ts @@ -10,7 +10,8 @@ import test from "node:test"; import { setImmediate as nextTurn } from "node:timers/promises"; import type { TestContext } from "node:test"; -import type { OrchestratorApplication } from "../src/application.js"; +import { OrchestratorApplication } from "../src/application.js"; +import { SqliteOrchestratorState } from "../src/sqlite-store.js"; import { loadConfig } from "../src/config.js"; // Replace only the model/session package; run the real persistence, workers and HTTP handoff. @@ -21,6 +22,8 @@ const pi = { recursiveCandidate: false, failure: null as "throw" | "empty" | "second-payload" | "second-turn" | "invalid-raw" | "partial-usage" | "unknown-usage" | "provider-error" | "deadline-finalization" | null, sessionsCreated: 0, + payloads: [] as Array>, + beforePayload: undefined as (() => Promise) | undefined, ModelRuntime: { create: async () => ({ getModel: () => ({ id: "fixed", api: "openai-codex-responses" }), getAvailable: async () => [{ id: "fixed" }], @@ -48,7 +51,9 @@ const pi = { const tool = options.customTools?.[0]; await session.agent.streamFunction({}, {}, {}); const payload = tool ? { tools: [{ type: "function", name: "emit_forge_query" }] } : {}; - await session.agent.onPayload?.(payload, { api: "openai-codex-responses" }); + if (tool) await pi.beforePayload?.(); + const effective = await session.agent.onPayload?.(payload, { api: "openai-codex-responses" }); + if (tool) pi.payloads.push(JSON.parse(JSON.stringify(effective))); if (pi.failure === "second-payload") await session.agent.onPayload?.(payload, { api: "openai-codex-responses" }); if (pi.failure === "second-turn") await session.agent.streamFunction({}, {}, {}); if (pi.failure === "provider-error") { @@ -429,6 +434,133 @@ test("all-blocked explicit Gold skip authorizes zero calls without creating SDK assert.equal((run.metrics.forge as Record).official_ea, null); }); +test("schema description admission rejects unknown, unbound and undeclared profiles before sessions", async (t) => { + const { runtime } = await fixture(t); + let protocol = protocolData(["a"], undefined, undefined, "interfaces-v1"); + t.mock.method(globalThis, "fetch", async (input: string) => { + if (input.endsWith("/suite")) return Response.json({ suite: { suite: "fixed" }, cases: [caseData("a")], metric_revision: revision }); + assert.ok(input.endsWith("/protocol")); + return Response.json(protocol); + }); + const mutations: Array<(value: ReturnType) => void> = [ + (value) => { Object.assign(value.schema_descriptions, { mode: "unknown" }); }, + (value) => { value.schema_descriptions.wire_schema_revision = "sha256:forged"; }, + (value) => { value.manifest.schema_descriptions.catalog_revision = "sha256:stale"; }, + (value) => { value.manifest.schema_descriptions = schemaDescriptions("off"); }, + (value) => { value.manifest.variables.allowed_changes = []; }, + (value) => { value.manifest.schema_version = "bird-protocol-v4"; }, + (value) => { Object.assign(value, { schema_descriptions: null }); }, + ]; + for (const mutate of mutations) { + protocol = protocolData(["a"], undefined, undefined, "interfaces-v1"); + mutate(protocol); + await assert.rejects(runtime.start({ provider: "test", model: "fixed", confirmModelCalls: 2 })); + assert.deepEqual(runtime.history(), []); + assert.equal(pi.sessionsCreated, 0); + } + protocol = protocolData(["a"], undefined, undefined, "interfaces-v1"); + await assert.rejects(runtime.start({ provider: "test", model: "fixed", confirmModelCalls: 2, + protocolManifest: protocolData(["a"]).manifest })); + assert.equal(pi.sessionsCreated, 0); +}); + +test("independent concurrent runs send their own cached wire profile and preserve it on reopen", { timeout: 5000 }, async (t) => { + const first = await fixture(t); + const second = await fixture(t); + let admitted = 0; + let release!: () => void; + const ready = new Promise((resolve) => { release = resolve; }); + pi.beforePayload = async () => { if (++admitted === 2) release(); await ready; }; + pi.recursiveCandidate = true; + const modeFor = (id: string) => id === "a" ? "off" as const : "interfaces-v1" as const; + t.mock.method(globalThis, "fetch", async (input: string, options?: RequestInit) => { + if (input.endsWith("/suite")) return Response.json({ suite: { suite: "fixed" }, cases: [caseData("a"), caseData("b")], metric_revision: revision }); + const body = JSON.parse(String(options?.body)); + if (input.endsWith("/protocol")) return Response.json(protocolData(body.case_ids, undefined, undefined, modeFor(body.case_ids[0]))); + if (input.endsWith("/context")) return Response.json(contextData(body.case_id)); + if (body.arm === "forge") assert.deepEqual(body.output, { scan: "filtered", select: [{ expr: "filtered.id * 1", as: "value" }], cte: [{ name: "filtered", query: { scan: "orders", select: ["orders.id"] } }] }); + return Response.json(evaluationData); + }); + const starts = await Promise.all([first.runtime.start({ provider: "test", model: "fixed", caseIds: ["a"], confirmModelCalls: 2 }), + second.runtime.start({ provider: "test", model: "fixed", caseIds: ["b"], confirmModelCalls: 2 })]); + const runs = await Promise.all(starts.map((run, index) => settled(index === 0 ? first.runtime : second.runtime, run.run_id))); + assert.equal(pi.payloads.length, 2); + for (const [index, owner] of [first, second].entries()) { + const run = runs[index]!; + const mode = index === 0 ? "off" : "interfaces-v1"; + const expected = schemaDescriptions(mode); + assert.equal(run.status, "completed"); + assert.deepEqual(run.generation_contract.schema_descriptions, expected); + assert.equal(run.generation_contract.forge_wire_schema_revision, expected.wire_schema_revision); + const log = owner.runtime.logs(run.run_id, { arm: "forge", stage: "generation.payload" }).items[0]!; + const payload = pi.payloads.find((value) => "sha256:" + createHash("sha256").update(JSON.stringify(value)).digest("hex") === log.payload.payload_hash)!; + assert.ok(payload, "The run must log its own effective onPayload result"); + const schema = payload.tools[0].parameters; + assert.equal("sha256:" + createHash("sha256").update(JSON.stringify(schema)).digest("hex"), expected.wire_schema_revision); + assert.deepEqual(Object.fromEntries(Object.entries(schema.properties as Record).filter(([, field]) => field.description).map(([key, field]) => [key, field.description])), catalog.profiles[mode].descriptions); + const session = owner.runtime.logs(run.run_id, { arm: "forge", stage: "generation.session" }).items[0]!; + assert.equal(session.payload.tool_schema_chars, JSON.stringify(schema).length); + const reopened = new PiBenchmarkRuntime(owner.config, owner.application); + try { assert.deepEqual(reopened.get(run.run_id)!.generation_contract, run.generation_contract); } + finally { await reopened.close(); } + } +}); + +test("description candidate resumes pending cases without changing the emitted wire schema", async (t) => { + const { runtime } = await fixture(t); + t.mock.timers.enable({ apis: ["setTimeout"] }); + let entered!: () => void; + let release!: () => void; + const waiting = new Promise((resolve) => { entered = resolve; }); + const gate = new Promise((resolve) => { release = resolve; }); + t.mock.method(globalThis, "fetch", async (input: string, options?: RequestInit) => { + if (input.endsWith("/suite")) return Response.json({ suite: { suite: "fixed" }, cases: [caseData("a"), caseData("b")], metric_revision: revision }); + const body = JSON.parse(String(options?.body)); + if (input.endsWith("/protocol")) return Response.json(protocolData(body.case_ids, undefined, undefined, "interfaces-v1")); + if (input.endsWith("/context")) { + if (body.case_id === "a") { entered(); await gate; } + return Response.json(contextData(body.case_id)); + } + return Response.json(evaluationData); + }); + const started = await runtime.start({ provider: "test", model: "fixed", confirmModelCalls: 4 }); + await waiting; + runtime.pause(started.run_id); + release(); + for (let attempt = 0; attempt < 200 && runtime.get(started.run_id)!.status !== "paused"; attempt++) await nextTurn(); + assert.equal(runtime.get(started.run_id)!.status, "paused"); + assert.equal(runtime.get(started.run_id)!.controls.can_resume, true); + assert.equal(runtime.get(started.run_id)!.completed_calls, 2); + runtime.resume(started.run_id); + t.mock.timers.tick(250); + const completed = await settled(runtime, started.run_id); + assert.equal(completed.status, "completed"); + assert.equal(completed.completed_calls, 4); + assert.equal(pi.payloads.length, 2); + for (const payload of pi.payloads) assert.equal("sha256:" + createHash("sha256").update(JSON.stringify(payload.tools[0].parameters)).digest("hex"), schemaDescriptions("interfaces-v1").wire_schema_revision); +}); + +test("fresh protocol and schema-context drift stop a described run before sessions", async (t) => { + const { runtime } = await fixture(t); + let drift = "protocol"; + t.mock.method(globalThis, "fetch", async (input: string) => { + if (input.endsWith("/suite")) return Response.json({ suite: { suite: "fixed" }, cases: [caseData("a")], metric_revision: revision }); + if (input.endsWith("/protocol")) return Response.json(protocolData(["a"], undefined, undefined, "interfaces-v1")); + assert.ok(input.endsWith("/context")); + const context = contextData("a"); + if (drift === "protocol") context.protocol_revision = "sha256:another-protocol"; + else context.schema_context = "changed input"; + return Response.json(context); + }); + for (drift of ["protocol", "schema-context"]) { + const started = await runtime.start({ provider: "test", model: "fixed", confirmModelCalls: 2 }); + const run = await settled(runtime, started.run_id); + assert.equal(run.status, "failed"); + assert.equal(run.completed_calls, 0); + assert.equal(pi.sessionsCreated, 0); + } +}); + hooks.deregister(); delete globals.benchmarkTestPi; @@ -436,6 +568,12 @@ const revision = "test-fixed-comparator"; const caseData = (caseId: string) => ({ case_id: caseId, question_id: 1, db_id: "fixed", difficulty: "simple", question: "List order ids", evidence: "orders.id", }); +const catalogBytes = readFileSync(new URL("../../../agent/contracts/forge-output-descriptions-v1.json", import.meta.url)); +const catalog = JSON.parse(catalogBytes.toString("utf8")); +const schemaDescriptions = (mode: "off" | "interfaces-v1") => ({ + mode, catalog_revision: "sha256:" + createHash("sha256").update(catalogBytes).digest("hex"), + wire_schema_revision: catalog.profiles[mode].wire_schema_revision as string, +}); const protocolRevision = "sha256:frozen-protocol"; const contextData = (caseId: string, promptRevision = "forge-structured-benchmark-v1") => ({ protocol_revision: protocolRevision, @@ -450,12 +588,17 @@ const contextData = (caseId: string, promptRevision = "forge-structured-benchmar result_contract: {}, }, }); -const protocolData = (ids: string[], goldReadiness: { policy: "require_all" | "skip_unscorable"; blocked_cases: Array<{ case_id: string; db_id: string; code: string }> } = { policy: "require_all", blocked_cases: [] }, promptRevision = "forge-structured-benchmark-v1") => ({ - manifest: { protocol_revision: protocolRevision, gold_readiness: goldReadiness, forge_prompt_revision: promptRevision }, protocol_revision: protocolRevision, +const protocolData = (ids: string[], goldReadiness: { policy: "require_all" | "skip_unscorable"; blocked_cases: Array<{ case_id: string; db_id: string; code: string }> } = { policy: "require_all", blocked_cases: [] }, promptRevision = "forge-structured-benchmark-v1", mode: "off" | "interfaces-v1" = "off") => ({ + manifest: { schema_version: "bird-protocol-v5", gold_readiness: goldReadiness, forge_prompt_revision: promptRevision, + variables: { allowed_changes: mode === "off" ? [] : ["schema_descriptions"] }, schema_descriptions: schemaDescriptions(mode) }, + protocol_revision: protocolRevision, schema_descriptions: schemaDescriptions(mode), gold_readiness: goldReadiness, case_ids: ids, metric_revision: revision, forge_prompt_revision: promptRevision, forge_schema_revision: "sha256:" + createHash("sha256").update(readFileSync(new URL("../../../forge/schema.json", import.meta.url))).digest("hex"), - contexts: Object.fromEntries(ids.map((id) => [id, contextData(id, promptRevision)])), + contexts: Object.fromEntries(ids.map((id) => { + const { protocol_revision, ...context } = contextData(id, promptRevision); + return [id, context]; + })), generation: { max_model_calls: (ids.length - goldReadiness.blocked_cases.length) * 2, provider_retries: 0, max_agent_turns_per_arm: 1, timeout_seconds: 120, sampling: "provider_default", max_output_tokens: null }, }); @@ -470,6 +613,8 @@ async function fixture(t: TestContext) { pi.recursiveCandidate = false; pi.failure = null; pi.sessionsCreated = 0; + pi.payloads = []; + pi.beforePayload = undefined; const directory = await mkdtemp(join(tmpdir(), "pi-benchmark-runtime-")); t.after(() => rm(directory, { recursive: true, force: true })); await writeFile(join(directory, "models.json"), JSON.stringify({ providers: {} })); @@ -479,17 +624,17 @@ async function fixture(t: TestContext) { PI_BENCHMARK_CONCURRENCY: "1", FORGE_BASE_URL: "http://benchmark.invalid", }); - // The benchmark only uses createTask; its persistence is exercised by the real runtime. - const application = { - createTask: () => ({ task: { task_run_id: "fixed-task" } }), - } as unknown as OrchestratorApplication; - return { runtime: new PiBenchmarkRuntime(config, application), config, application }; + const state = new SqliteOrchestratorState(config.stateDbPath); + const application = new OrchestratorApplication({ config, state }); + const runtime = new PiBenchmarkRuntime(config, application); + t.after(async () => { await runtime.close(); state.close(); }); + return { runtime, config, application }; } async function settled(runtime: InstanceType, runId: string) { for (let attempt = 0; attempt < 200; attempt += 1) { const run = runtime.get(runId)!; - if (["completed", "failed"].includes(run.status)) { + if (["completed", "failed", "stopped", "interrupted"].includes(run.status)) { await nextTurn(); return runtime.get(runId)!; } @@ -583,6 +728,7 @@ test("unversioned historical runs project unknown, cannot resume, and never back created_at: "2020-01-01", started_at: null, completed_at: null, error: null, }); db.prepare("INSERT INTO benchmark_v2_runs VALUES(?,?,?,?)").run("historical", "paused", "2020-01-01", raw); + assert.equal(runtime.get("historical")!.generation_contract.schema_descriptions, null); assert.equal(runtime.get("historical")!.metric_revision, null); assert.equal(runtime.get("historical")!.controls.can_resume, false); assert.throws(() => runtime.resume("historical")); @@ -600,7 +746,7 @@ test("unversioned historical runs project unknown, cannot resume, and never back assert.equal(db.prepare("SELECT data_json FROM benchmark_v2_runs").get()!.data_json, knownMetricRaw); }); -for (const drift of ["prefer", "wire-schema", "pi-runtime", "sdk-lock", "prompt"]) { +for (const drift of ["prefer", "wire-schema", "pi-runtime", "sdk-lock", "prompt", "catalog", "description-wire", "mode", "missing-descriptions", "old-protocol", "undeclared"]) { test(`paused ${drift} generation contract cannot mix with required strict output`, async (t) => { const { runtime, config } = await fixture(t); t.mock.method(globalThis, "fetch", async (input: string, options?: RequestInit) => { @@ -621,6 +767,16 @@ for (const drift of ["prefer", "wire-schema", "pi-runtime", "sdk-lock", "prompt" else if (drift === "wire-schema") stored.generation_contract.forge_wire_schema_revision = "sha256:old-wire-schema"; else if (drift === "pi-runtime") stored.generation_contract.pi_runtime_revision = "sha256:old-runtime"; else if (drift === "prompt") stored.generation_contract.forge_prompt_revision = "unbound-prompt"; + else if (drift === "catalog") stored.generation_contract.schema_descriptions.catalog_revision = "sha256:old-catalog"; + else if (drift === "description-wire") stored.generation_contract.schema_descriptions.wire_schema_revision = "sha256:old-wire"; + else if (drift === "mode") stored.generation_contract.schema_descriptions = schemaDescriptions("interfaces-v1"); + else if (drift === "missing-descriptions") delete stored.generation_contract.schema_descriptions; + else if (drift === "old-protocol") stored.protocol_manifest.schema_version = "bird-protocol-v4"; + else if (drift === "undeclared") { + stored.generation_contract.schema_descriptions = schemaDescriptions("interfaces-v1"); + stored.generation_contract.forge_wire_schema_revision = schemaDescriptions("interfaces-v1").wire_schema_revision; + stored.protocol_manifest.schema_descriptions = schemaDescriptions("interfaces-v1"); + } else stored.generation_contract.pi_sdk_lock_revision = "sha256:old-sdk-lock"; const raw = JSON.stringify(stored); db.prepare("UPDATE benchmark_v2_runs SET status=?, data_json=? WHERE run_id=?").run("paused", raw, started.run_id); @@ -818,3 +974,112 @@ test("historical false-only scores are unknown and absent case rows do not shrin assert.equal(direct.official_ea_missing_cases, 2); assert.equal(db.prepare("SELECT data_json FROM benchmark_v2_cases").get()!.data_json, raw); }); + + +test("concurrent starts admit only one benchmark before dispatch", async (t) => { + const { runtime, application } = await fixture(t); + t.mock.method(globalThis, "fetch", async (input: string, options?: RequestInit) => { + await nextTurn(); + if (input.endsWith("/suite")) return Response.json({ suite: { suite: "fixed" }, cases: [caseData("a")], metric_revision: revision }); + const body = JSON.parse(String(options?.body)); + if (input.endsWith("/protocol")) return Response.json(protocolData(body.case_ids)); + if (input.endsWith("/context")) return Response.json(contextData(body.case_id)); + return Response.json(evaluationData); + }); + const options = { provider: "test", model: "fixed", confirmModelCalls: 2 }; + const results = await Promise.allSettled([runtime.start(options), runtime.start(options)]); + for (const result of results) if (result.status === "fulfilled") await settled(runtime, result.value.run_id); + assert.equal(results.filter((result) => result.status === "fulfilled").length, 1); + assert.equal(runtime.history().length, 1); + assert.equal(runtime.history()[0]!.completed_calls, 2); + assert.equal(application.getTask(runtime.history()[0]!.task_run_id)!.status, "completed"); +}); + +test("a second owner cannot interrupt or control a live benchmark", async (t) => { + const { runtime, config, application } = await fixture(t); + let release!: () => void; + const held = new Promise((resolve) => { release = resolve; }); + t.mock.method(globalThis, "fetch", async (input: string, options?: RequestInit) => { + if (input.endsWith("/suite")) return Response.json({ suite: { suite: "fixed" }, cases: [caseData("a")], metric_revision: revision }); + const body = JSON.parse(String(options?.body)); + if (input.endsWith("/protocol")) return Response.json(protocolData(body.case_ids)); + if (input.endsWith("/context")) { await held; return Response.json(contextData(body.case_id)); } + return Response.json(evaluationData); + }); + const started = await runtime.start({ provider: "test", model: "fixed", confirmModelCalls: 2 }); + const reader = new PiBenchmarkRuntime(config, application); + try { + assert.equal(reader.get(started.run_id)!.status, "running"); + assert.throws(() => reader.stop(started.run_id)); + await assert.rejects(reader.start({ provider: "test", model: "fixed", confirmModelCalls: 2 })); + } finally { release(); await nextTurn(); } + assert.equal((await settled(runtime, started.run_id)).status, "completed"); +}); + + +test("failed case admission rolls back its Task and complete run aggregate", async (t) => { + const { runtime, application } = await fixture(t); + (application.state as SqliteOrchestratorState).database.exec("CREATE TRIGGER reject_case BEFORE INSERT ON benchmark_v2_cases BEGIN SELECT RAISE(ABORT, 'synthetic storage failure'); END"); + t.mock.method(globalThis, "fetch", async (input: string, options?: RequestInit) => { + if (input.endsWith("/suite")) return Response.json({ suite: { suite: "fixed" }, cases: [caseData("a")], metric_revision: revision }); + return Response.json(protocolData(JSON.parse(String(options?.body)).case_ids)); + }); + await assert.rejects(runtime.start({ provider: "test", model: "fixed", confirmModelCalls: 2 })); + assert.deepEqual(runtime.history(), []); + assert.deepEqual(application.state.tasks.list({ orgId: "org_benchmark", teamId: "team_benchmark", limit: 100 }), []); + assert.equal(pi.sessionsCreated, 0); +}); + +for (const stage of ["context", "evaluate"] as const) { + test("stop aborts a hung " + stage + " request and cancels the linked Task", async (t) => { + const { runtime, application } = await fixture(t); + let reached!: () => void; + const pending = new Promise((resolve) => { reached = resolve; }); + t.mock.method(globalThis, "fetch", async (input: string, options?: RequestInit) => { + if (input.endsWith("/suite")) return Response.json({ suite: { suite: "fixed" }, cases: [caseData("a"), caseData("b")], metric_revision: revision }); + const body = JSON.parse(String(options?.body)); + if (input.endsWith("/protocol")) return Response.json(protocolData(body.case_ids)); + if (input.endsWith("/" + stage)) return new Promise((_, reject) => { + const abort = () => reject(options!.signal!.reason); + if (options?.signal?.aborted) abort(); + else options?.signal?.addEventListener("abort", abort, { once: true }); + reached(); + }); + return Response.json(contextData(body.case_id)); + }); + const started = await runtime.start({ provider: "test", model: "fixed", confirmModelCalls: 4 }); + await pending; + runtime.stop(started.run_id); + const result = await settled(runtime, started.run_id); + assert.equal(result.status, "stopped"); + assert.equal(application.getTask(result.task_run_id)!.status, "cancelled"); + assert.equal(result.completed_calls, stage === "context" ? 0 : 2); + assert.equal(result.cases.find((item) => item.case_id === "a")!.status, "cancelled"); + assert.equal(result.cases.find((item) => item.case_id === "b")!.forge.evidence?.dispatches ?? 0, 0); + }); +} + +test("shutdown interrupts the linked Task and reopening cannot replay it", async (t) => { + const { runtime, config, application } = await fixture(t); + let reached!: () => void; + const pending = new Promise((resolve) => { reached = resolve; }); + t.mock.method(globalThis, "fetch", async (input: string, options?: RequestInit) => { + if (input.endsWith("/suite")) return Response.json({ suite: { suite: "fixed" }, cases: [caseData("a")], metric_revision: revision }); + const body = JSON.parse(String(options?.body)); + if (input.endsWith("/protocol")) return Response.json(protocolData(body.case_ids)); + return new Promise((_, reject) => { + options?.signal?.addEventListener("abort", () => reject(options.signal!.reason), { once: true }); + reached(); + }); + }); + const started = await runtime.start({ provider: "test", model: "fixed", confirmModelCalls: 2 }); + await pending; + await runtime.close(); + const resumed = new PiBenchmarkRuntime(config, application); + try { + assert.equal(resumed.get(started.run_id)!.status, "interrupted"); + assert.equal(application.getTask(started.task_run_id)!.status, "failed"); + assert.throws(() => resumed.resume(started.run_id)); + assert.equal(pi.sessionsCreated, 0); + } finally { await resumed.close(); } +}); diff --git a/services/pi-orchestrator/tests/channels.test.ts b/services/pi-orchestrator/tests/channels.test.ts index 0d38855..c9b6169 100644 --- a/services/pi-orchestrator/tests/channels.test.ts +++ b/services/pi-orchestrator/tests/channels.test.ts @@ -122,12 +122,7 @@ test("channel greeting completes without calling Forge or a model", async () => let forgeCalls = 0; const application = new OrchestratorApplication({ config, - tasks: state.tasks, - events: state.events, - artifacts: state.artifacts, - attempts: state.attempts, - channelEvents: state.channelEvents, - transactions: state.transactions, + state, forgeClient: { async createQueryRun() { forgeCalls += 1; throw new Error("must not query"); }, async approveQueryRun() { throw new Error("must not execute"); }, @@ -167,12 +162,7 @@ test("channel knowledge answer is bound to Forge context evidence without a Quer }]; const application = new OrchestratorApplication({ config, - tasks: state.tasks, - events: state.events, - artifacts: state.artifacts, - attempts: state.attempts, - channelEvents: state.channelEvents, - transactions: state.transactions, + state, forgeClient: { async searchContext() { return { status: "ok", question: "销售额口径", evidence: contextEvidence, @@ -293,8 +283,7 @@ test("personal memory requires an explicit channel approval and never escalates const state = new SqliteOrchestratorState(config.stateDbPath); const memoryWrites: Array> = []; const application = new OrchestratorApplication({ - config, tasks: state.tasks, events: state.events, artifacts: state.artifacts, - attempts: state.attempts, channelEvents: state.channelEvents, transactions: state.transactions, + config, state, forgeClient: { async createQueryRun() { throw new Error("not used"); }, async approveQueryRun() { throw new Error("not used"); }, @@ -385,12 +374,7 @@ test("channel cancel action is owned, persisted, and idempotent", async () => { const state = new SqliteOrchestratorState(config.stateDbPath); const application = new OrchestratorApplication({ config, - tasks: state.tasks, - events: state.events, - artifacts: state.artifacts, - attempts: state.attempts, - channelEvents: state.channelEvents, - transactions: state.transactions, + state, }); const created = application.createTask({ org_id: "org_demo", @@ -446,12 +430,7 @@ test("duplicate Feishu delivery returns one TaskRun and one Forge preparation", const approvalGate = new Promise((resolve) => { releaseApproval = resolve; }); const application = new OrchestratorApplication({ config, - tasks: state.tasks, - events: state.events, - artifacts: state.artifacts, - attempts: state.attempts, - channelEvents: state.channelEvents, - transactions: state.transactions, + state, forgeClient: { async createQueryRun(input) { prepareCalls += 1; @@ -513,8 +492,8 @@ test("duplicate Feishu delivery returns one TaskRun and one Forge preparation", }); const server = createOrchestratorServer(config, application); await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve)); - context.after(() => { - server.close(); + context.after(async () => { + await new Promise((resolve, reject) => server.close(error => error ? reject(error) : resolve())); state.close(); }); const address = server.address() as AddressInfo; diff --git a/services/pi-orchestrator/tests/model-bindings.test.ts b/services/pi-orchestrator/tests/model-bindings.test.ts index 24398d5..1b239cc 100644 --- a/services/pi-orchestrator/tests/model-bindings.test.ts +++ b/services/pi-orchestrator/tests/model-bindings.test.ts @@ -90,3 +90,12 @@ test("Pi rejects an active binding whose required gate is no longer valid", asyn const config = loadConfig({ PI_MODEL_CONTROL_DB_PATH: path }); assert.throws(() => resolveStageModelBinding(config, "analysis"), /no longer satisfies/); }); + +test("attempt scope follows authorized identity rather than report/query substrings", () => { + assert.equal(attemptModelStage("skill:daily-report-writer"), "analysis"); + assert.equal(attemptModelStage("skill:data-doc-writer"), "knowledge_answer"); + assert.equal(attemptModelStage("data_analysis_report"), "report"); + assert.throws(() => attemptModelStage("custom_query_report"), Error); + assert.throws(() => attemptModelStage("skill:unknown-report-writer"), Error); + assert.throws(() => skillModelStage("__proto__"), Error); +}); diff --git a/services/pi-orchestrator/tests/product-projections.test.ts b/services/pi-orchestrator/tests/product-projections.test.ts index 91cbe74..64bdd21 100644 --- a/services/pi-orchestrator/tests/product-projections.test.ts +++ b/services/pi-orchestrator/tests/product-projections.test.ts @@ -3,9 +3,6 @@ import { readFileSync } from "node:fs"; import test from "node:test"; import { - productDisplayStates, - productProjectionSchemas, - productProjectionV1Schema, type ProductProjectionContractName, validateProductProjection, } from "../src/product-projections.js"; @@ -14,10 +11,6 @@ const fixturesPath = new URL( "../../../agent/contracts/product-projection-fixtures.v1.json", import.meta.url, ); -const generatedSchemaPath = new URL( - "../../../agent/contracts/product-projection-v1.schema.json", - import.meta.url, -); type FixtureCase = { case_id: string; @@ -86,33 +79,11 @@ function validById(): Map { - assert.equal(fixtures.schema_version, 1); - assert.deepEqual( - Object.keys(fixtures.valid).sort(), - Object.keys(productProjectionSchemas).sort(), - ); - const serialized = JSON.stringify(fixtures.valid); - for (const state of [ - "needs_input", - "waiting_decision", - "running", - "partial", - "ready", - "failed", - "completed", - ]) { - assert.match(serialized, new RegExp(`\\b${state}\\b`), state); - } - assert.ok(productDisplayStates.includes("forbidden")); - assert.ok(productDisplayStates.includes("offline")); -}); test("Product Projection v1 accepts all shared positive fixtures", () => { for (const [contract, cases] of Object.entries(fixtures.valid) as Array< [ProductProjectionContractName, FixtureCase[]] >) { - assert.ok(cases.length > 0, contract); for (const candidate of cases) { assert.deepEqual( validateProductProjection(contract, candidate.value), @@ -125,7 +96,6 @@ test("Product Projection v1 accepts all shared positive fixtures", () => { test("Product Projection v1 rejects shared contract and semantic mutations with stable codes", () => { const valid = validById(); - assert.ok(fixtures.invalid.length >= 12); for (const candidate of fixtures.invalid) { const base = valid.get(candidate.base_case_id); assert.ok(base, candidate.base_case_id); @@ -140,20 +110,3 @@ test("Product Projection v1 rejects shared contract and semantic mutations with ); } }); - -test("Product Projection generated JSON Schema stays synchronized with TypeBox", () => { - const generated = JSON.parse(readFileSync(generatedSchemaPath, "utf8")); - assert.deepEqual(generated, productProjectionV1Schema); -}); - -test("Product Projection v1 fails closed on cross-scope, secret-like and broken-lineage fixtures", () => { - const requiredCases = new Set([ - "conversation_cross_scope_rejected", - "secret_like_field_rejected", - "presentation_artifact_must_exist", - "partial_requires_reason", - "oversized_report_title", - ]); - const actual = new Set(fixtures.invalid.map((candidate) => candidate.case_id)); - for (const caseId of requiredCases) assert.ok(actual.has(caseId), caseId); -}); diff --git a/services/pi-orchestrator/tests/server.test.ts b/services/pi-orchestrator/tests/server.test.ts index e05719b..f342ca2 100644 --- a/services/pi-orchestrator/tests/server.test.ts +++ b/services/pi-orchestrator/tests/server.test.ts @@ -8,7 +8,6 @@ import test, { type TestContext } from "node:test"; import { OrchestratorApplication } from "../src/application.js"; import { loadConfig } from "../src/config.js"; import { createOrchestratorServer } from "../src/server.js"; -import { InMemoryStageAttemptStore } from "../src/stage-attempts.js"; import { MVP_SKILL_NAMES } from "../src/skills.js"; import { createSkillFixture } from "./skill-fixture.js"; @@ -288,7 +287,6 @@ test("expanded Skill API persists a bounded Artifact and obeys team policy CAS", const config = await isolatedConfig(context, { PI_ADMIN_SERVICE_KEYS: "admin-secret" }); const application = new OrchestratorApplication({ config, - attempts: new InMemoryStageAttemptStore(), forgeClient: { async createQueryRun() { throw new Error("not used"); }, async approveQueryRun() { throw new Error("not used"); }, @@ -580,13 +578,10 @@ test("Task API returns ordered events and a non-executable review request", asyn events: Array<{ sequence: number; event_type: string; payload: Record }>; }; assert.equal(prepared.task.status, "waiting_for_query_approval"); - assert.deepEqual( - prepared.events.map((event) => event.sequence), - [1, 2, 3, 4], - ); - assert.equal(prepared.events.at(-1)?.event_type, "query.review_requested"); - assert.equal(prepared.events.at(-1)?.payload.can_execute, false); - assert.equal(prepared.events.at(-1)?.payload.input_kind, "direct_sql"); + assert.ok(prepared.events.every((event, index, events) => index === 0 || event.sequence > events[index - 1]!.sequence)); + const review = prepared.events.find((event) => event.event_type === "query.review_requested"); + assert.equal(review?.payload.can_execute, false); + assert.equal(review?.payload.input_kind, "direct_sql"); const approvalResponse = await fetch( `${baseUrl}/v1/tasks/${created.task.task_run_id}/approve-query`, @@ -606,6 +601,5 @@ test("Task API returns ordered events and a non-executable review request", asyn events: Array<{ sequence: number; event_type: string }>; }; assert.equal(approved.task.status, "completed"); - assert.equal(approved.events.length, 9); - assert.equal(approved.events.at(-1)?.event_type, "query.completed"); + assert.ok(approved.events.some((event) => event.event_type === "query.completed")); }); diff --git a/services/pi-orchestrator/tests/sqlite-store.test.ts b/services/pi-orchestrator/tests/sqlite-store.test.ts index 13bc22e..fa1858b 100644 --- a/services/pi-orchestrator/tests/sqlite-store.test.ts +++ b/services/pi-orchestrator/tests/sqlite-store.test.ts @@ -136,11 +136,7 @@ test("a new Application instance resumes a persisted SQL approval wait", async ( const firstState = new SqliteOrchestratorState(databasePath); const firstApplication = new OrchestratorApplication({ config, - tasks: firstState.tasks, - events: firstState.events, - artifacts: firstState.artifacts, - attempts: firstState.attempts, - transactions: firstState.transactions, + state: firstState, forgeClient, }); const created = firstApplication.createTask({ @@ -156,11 +152,7 @@ test("a new Application instance resumes a persisted SQL approval wait", async ( const secondState = new SqliteOrchestratorState(databasePath); const secondApplication = new OrchestratorApplication({ config, - tasks: secondState.tasks, - events: secondState.events, - artifacts: secondState.artifacts, - attempts: secondState.attempts, - transactions: secondState.transactions, + state: secondState, forgeClient, }); assert.equal( diff --git a/services/pi-orchestrator/tests/stage-lifecycle.test.ts b/services/pi-orchestrator/tests/stage-lifecycle.test.ts new file mode 100644 index 0000000..e1d49a7 --- /dev/null +++ b/services/pi-orchestrator/tests/stage-lifecycle.test.ts @@ -0,0 +1,202 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { OrchestratorApplication } from "../src/application.js"; +import { loadConfig } from "../src/config.js"; +import { InMemoryOrchestratorState, type OrchestratorState } from "../src/orchestrator-state.js"; +import { SqliteOrchestratorState } from "../src/sqlite-store.js"; +import { buildExecutionPlan, reviseExecutionPlan } from "../src/planning.js"; +import { routeChannelMessage } from "../src/channels/intent.js"; +import type { StructuredSkillExecutionPort } from "../src/skill-executor.js"; + +const clarification = { + status: "needs_input" as const, goal: "分析订单变化", known_facts: [], assumptions: [], + open_questions: ["确认周期"], dimensions: [], time_range: { description: "待确认" }, + acceptance_criteria: ["确认周期"], +}; +const unused = async (): Promise => { throw new Error("Unexpected external call"); }; +const taskInput = { org_id: "synthetic_org", team_id: "synthetic_team", user_id: "synthetic_user", + channel: "web" as const, channel_conversation_id: "synthetic_conversation", intent: "data_task", message: "分析订单变化" }; +function deferred() { + let resolve!: (value: T | PromiseLike) => void; + let reject!: (reason?: unknown) => void; + const promise = new Promise((yes, no) => { resolve = yes; reject = no; }); + return { promise, resolve, reject }; +} +function application(state: OrchestratorState, clarify: StructuredSkillExecutionPort["clarify"], timeout = 25, skills: Partial = {}) { + return new OrchestratorApplication({ state, + config: loadConfig({ FORGE_REQUEST_TIMEOUT_MS: "1", PI_STAGE_TIMEOUT_MS: String(timeout), PI_STAGE_LEASE_MS: "500" }), + forgeClient: { createQueryRun: unused, approveQueryRun: unused }, + skillExecutor: { clarify, reviewMetric: unused, analyze: unused, writeReport: unused, ...skills }, + }); +} +function runningPlan(state: OrchestratorState, taskRunId: string) { + const initial = state.artifacts.create({ artifactType: "execution_plan", taskRunId, producer: "pi-planner", + payload: buildExecutionPlan(routeChannelMessage("分析订单变化并生成报告"), "分析订单变化") }); + return state.artifacts.create({ artifactType: "execution_plan", taskRunId, producer: "pi-planner", + payload: reviseExecutionPlan(initial, { analysis: "running" }) }); +} + +for (const [name, createState] of [ + ["memory", () => new InMemoryOrchestratorState()], + ["sqlite", () => new SqliteOrchestratorState(":memory:")], +] as const) { + test(`${name}: timeout retries get a fresh attempt; explicit success replays and failed key rejects`, async (context) => { + const state = createState(); + if (state instanceof SqliteOrchestratorState) context.after(() => state.close()); + context.mock.timers.enable({ apis: ["setTimeout"] }); + const late = deferred(); + const started = deferred(); + let calls = 0; + const app = application(state, async () => { started.resolve(); return ++calls === 1 ? late.promise : clarification; }); + const task = app.createTask(taskInput).task; + // The executor ignores abort: the Application, not the cooperative fake, must bound its wait. + const timedOut = assert.rejects(app.clarifyRequirement(task.task_run_id, { message: "first" })); + await started.promise; + context.mock.timers.tick(25); + await timedOut; + assert.equal(app.getTask(task.task_run_id)?.status, "created"); + const failed = app.getStageAttempts(task.task_run_id)[0]!; + assert.equal(failed.status, "timed_out"); + await assert.rejects(app.clarifyRequirement(task.task_run_id, { message: "same", idempotencyKey: failed.idempotency_key })); + assert.equal(calls, 1); + const success = await app.clarifyRequirement(task.task_run_id, { message: "retry" }); + assert.equal(success.task.status, "needs_input"); + const succeeded = app.getStageAttempts(task.task_run_id)[1]!; + const replay = await app.clarifyRequirement(task.task_run_id, { message: "retry", idempotencyKey: succeeded.idempotency_key }); + assert.equal(replay.artifact.artifact_id, success.artifact.artifact_id); + assert.equal(calls, 2); + late.resolve(clarification); + await new Promise((resolve) => setImmediate(resolve)); + assert.deepEqual(app.getStageAttempts(task.task_run_id).map((attempt) => attempt.status), ["timed_out", "succeeded"]); + assert.equal(app.getArtifacts(task.task_run_id).length, 1); + }); + + test(`${name}: cancellation aborts the live signal and ignores late success and failure`, async (context) => { + const state = createState(); + if (state instanceof SqliteOrchestratorState) context.after(() => state.close()); + for (const lateFailure of [false, true]) { + const late = deferred(); + const started = deferred(); + const app = application(state, async (_task, _message, signal) => { started.resolve(signal!); return late.promise; }, 100); + const task = app.createTask(taskInput).task; + runningPlan(state, task.task_run_id); + const pending = app.clarifyRequirement(task.task_run_id, { message: "run" }); + const rejected = assert.rejects(pending); + const signal = await started.promise; + await app.cancelTask(task.task_run_id, "cancel"); + assert.equal(signal.aborted, true); + await rejected; + const artifactsAtCancellation = app.getArtifacts(task.task_run_id); + if (lateFailure) late.reject(new Error("Late provider failure")); else late.resolve(clarification); + await new Promise((resolve) => setImmediate(resolve)); + assert.equal(app.getTask(task.task_run_id)?.status, "cancelled"); + assert.equal(app.getStageAttempts(task.task_run_id)[0]?.status, "interrupted"); + assert.deepEqual(app.getArtifacts(task.task_run_id), artifactsAtCancellation); + const detail = app.getTaskDetailProjection({ orgId: task.org_id, teamId: task.team_id, userId: task.user_id, + channel: task.channel, taskRunId: task.task_run_id }); + assert.equal(detail?.plan?.steps.some((step) => step.status === "running"), false); + assert.equal(detail?.attempts[0]?.usage_status, "unknown"); + } + }); + + test(`${name}: invalid artifacts roll back all stores and nested transactions are savepoints`, (context) => { + const state = createState(); + if (state instanceof SqliteOrchestratorState) context.after(() => state.close()); + const app = application(state, unused); + const task = app.createTask(taskInput).task; + state.transactions.run(() => { + state.events.append(task.task_run_id, "skill.started", {}); + assert.throws(() => state.transactions.run(() => { + state.tasks.transition({ taskRunId: task.task_run_id, expectedStatus: "created", status: "clarifying", currentStage: "requirement_clarification" }); + state.attempts.start({ taskRunId: task.task_run_id, stage: "requirement_clarification", runningStatus: "clarifying", retryStatus: "created", idempotencyKey: "rollback", leaseMs: 100 }); + state.events.append(task.task_run_id, "artifact.created", {}); + state.channelEvents.claim({ event_id: "rollback-event", channel: "web", event_type: "message", + external_user_id: "synthetic_user", conversation_id: "synthetic_conversation", message_id: "synthetic_message", task_run_id: null, payload: { text: "synthetic" } }); + state.skillPolicies.configure({ orgId: task.org_id, teamId: task.team_id, enabledSkills: [], expectedVersion: 0, actor: task.user_id }); + state.artifacts.create({ artifactType: "clarification", taskRunId: task.task_run_id, producer: "skill", payload: {} }); + })); + assert.equal(state.tasks.get(task.task_run_id)?.status, "created"); + assert.deepEqual(state.attempts.list(task.task_run_id), []); + assert.deepEqual(state.artifacts.list(task.task_run_id), []); + assert.equal(state.channelEvents.get("web", "rollback-event"), undefined); + assert.equal(state.skillPolicies.get(task.org_id, task.team_id), undefined); + }); + assert.deepEqual(state.events.list(task.task_run_id).map((event) => event.event_type), ["task.created", "skill.started"]); + }); + + test(`${name}: cancellation wins a queued timeout and caller interruption remains retryable`, async (context) => { + const state = createState(); + if (state instanceof SqliteOrchestratorState) context.after(() => state.close()); + context.mock.timers.enable({ apis: ["setTimeout"] }); + const late = deferred(); + const started = deferred(); + let calls = 0; + const app = application(state, async () => { calls++; started.resolve(); return late.promise; }); + const task = app.createTask(taskInput).task; + const pending = assert.rejects(app.clarifyRequirement(task.task_run_id, { message: "race" })); + await started.promise; + context.mock.timers.tick(25); + await app.cancelTask(task.task_run_id, "cancel-at-deadline"); + await pending; + late.resolve(clarification); + await new Promise((resolve) => setImmediate(resolve)); + assert.equal(app.getTask(task.task_run_id)?.status, "cancelled"); + assert.equal(app.getStageAttempts(task.task_run_id)[0]?.status, "interrupted"); + assert.deepEqual(app.getArtifacts(task.task_run_id), []); + const undispatched = app.createTask(taskInput).task; + await assert.rejects(app.clarifyRequirement(undispatched.task_run_id, { message: "aborted before dispatch" }, AbortSignal.abort())); + assert.equal(calls, 1); + assert.equal(app.getTask(undispatched.task_run_id)?.status, "created"); + assert.equal(app.getStageAttempts(undispatched.task_run_id)[0]?.usage_status, "not_started"); + const retried = await app.clarifyRequirement(undispatched.task_run_id, { message: "retry interruption" }); + assert.equal(retried.task.status, "needs_input"); + }); + + test(`${name}: supplemental analysis failure closes plan and does not consume child evidence`, async (context) => { + const state = createState(); + if (state instanceof SqliteOrchestratorState) context.after(() => state.close()); + const started = deferred(); + const app = application(state, unused, 100, { analyze: async () => { started.resolve(); throw new Error("Synthetic analysis failure"); } }); + const parent = app.createTask(taskInput).task; + const child = app.createTask({ ...taskInput, parent_task_run_id: parent.task_run_id, intent: "analysis_supplement_query" }).task; + state.tasks.transition({ taskRunId: parent.task_run_id, expectedStatus: "created", status: "incomplete", currentStage: "analysis_incomplete" }); + state.tasks.transition({ taskRunId: child.task_run_id, expectedStatus: "created", status: "completed", currentStage: "query_complete" }); + for (const task of [parent, child]) state.artifacts.create({ artifactType: "query_result", taskRunId: task.task_run_id, producer: "forge", payload: { + query_run_id: task === parent ? "qr_primary" : "qr_child", sql_hash: "sha256:" + "a".repeat(64), columns: ["n"], rows: [[1]], row_count: 1, + truncated: false, dialect: "sqlite", registry_version: "synthetic-registry", execution_ms: 0, executed_at: "2026-09-07T00:00:00Z", + } }); + state.artifacts.create({ artifactType: "analysis", taskRunId: parent.task_run_id, producer: "skill", payload: { + status: "incomplete", summary: "Need a supplement", method_summary: { objective: "Compare", dimensions: ["n"], comparison_baseline: "primary", approach_steps: ["Compare evidence"] }, + findings: [], hypotheses: [], recommendations: [], limitations: ["Missing dimension"], suggested_queries: [{ question: "Get dimension", reason: "Complete evidence", priority: "high" }], + } }); + state.events.append(parent.task_run_id, "analysis.supplement_created", { child_task_run_id: child.task_run_id }); + runningPlan(state, parent.task_run_id); + await assert.rejects(app.resumeAnalysisWithSupplement(parent.task_run_id, { childTaskRunId: child.task_run_id, idempotencyKey: "supplement-failure" })); + await started.promise; + assert.equal(app.getTask(parent.task_run_id)?.status, "failed"); + assert.equal(app.getStageAttempts(parent.task_run_id)[0]?.status, "failed"); + const plan = state.artifacts.latest(parent.task_run_id, "execution_plan")!; + assert.equal((plan.payload.steps as Array<{ status: string }>).some((step) => step.status === "running"), false); + assert.equal(plan.payload.status, "failed"); + assert.equal(state.events.list(parent.task_run_id).some((event) => event.event_type === "analysis.supplement_consumed"), false); + }); + + test(`${name}: reconciliation closes stale plan progress and interruption allows a new command`, async (context) => { + const state = createState(); + if (state instanceof SqliteOrchestratorState) context.after(() => state.close()); + const app = application(state, async () => clarification); + const task = app.createTask(taskInput).task; + state.tasks.transition({ taskRunId: task.task_run_id, expectedStatus: "created", status: "clarifying", currentStage: "requirement_clarification" }); + runningPlan(state, task.task_run_id); + state.attempts.start({ taskRunId: task.task_run_id, stage: "requirement_clarification", runningStatus: "clarifying", retryStatus: "created", idempotencyKey: "old-owner", leaseMs: 1 }); + const recovered = state.reconcileExpiredAttempts(new Date(Date.now() + 1000)); + assert.equal(recovered[0]?.status, "interrupted"); + assert.equal(state.tasks.get(task.task_run_id)?.status, "created"); + assert.deepEqual(state.reconcileExpiredAttempts(new Date(Date.now() + 1000)), []); + const plan = state.artifacts.latest(task.task_run_id, "execution_plan")!; + assert.equal((plan.payload.steps as Array<{ status: string }>).some((step) => step.status === "running"), false); + const retried = await app.clarifyRequirement(task.task_run_id, { message: "new owner retry" }); + assert.equal(retried.task.status, "needs_input"); + assert.deepEqual(app.getStageAttempts(task.task_run_id).map((attempt) => attempt.status), ["interrupted", "succeeded"]); + }); +} diff --git a/services/pi-orchestrator/tests/strict-forge-output.test.ts b/services/pi-orchestrator/tests/strict-forge-output.test.ts index 776922e..9ebdee7 100644 --- a/services/pi-orchestrator/tests/strict-forge-output.test.ts +++ b/services/pi-orchestrator/tests/strict-forge-output.test.ts @@ -40,6 +40,29 @@ test("malformed required fields and unsupported aggregate variants fail instead assert.throws(() => strict.decode(query({ scan: "orders", select: ["n"], agg: [{ ...aggregate, fn: "unknown" }] })), StrictForgeOutputError); }); +test("description profiles preserve the exact wire constraints, recursive SQL NULL and rejection boundaries", () => { + const catalog = JSON.parse(readFileSync(new URL("../../../agent/contracts/forge-output-descriptions-v1.json", import.meta.url), "utf8")); + const candidate = createStrictForgeOutput(canonical, catalog.profiles["interfaces-v1"].descriptions); + assert.equal(strict.revision, "sha256:01f2abbe6608b33610f4106f1acf8705ffca38a4aa3c8d990bc7b6f7fe739b8d"); + assert.equal(strict.revision, catalog.profiles.off.wire_schema_revision); + assert.equal(candidate.revision, catalog.profiles["interfaces-v1"].wire_schema_revision); + const withoutDescriptions = structuredClone(candidate.schema); + const describedKeys = Object.entries(withoutDescriptions.properties!).filter(([, field]) => Object.hasOwn(field, "description")).map(([key]) => key); + assert.deepEqual(new Set(describedKeys), new Set(["scan", "cte", "agg", "window", "select"])); + for (const key of describedKeys) delete withoutDescriptions.properties![key]!.description; + assert.equal(JSON.stringify(withoutDescriptions), JSON.stringify(strict.schema), "Every constraint and property order must remain byte-identical"); + const ignored = createStrictForgeOutput(canonical, { scan: " ", nonexistent: "not a DSL field", toString: "not an own field" }); + assert.equal(JSON.stringify(ignored.schema), JSON.stringify(strict.schema)); + const nested = query({ scan: "orders", select: ["id"], filter: [predicate({})] }); + const wire = query({ scan: "filtered", select: ["id"], cte: [{ name: "filtered", query: nested, recursive: null, recursive_term: null, recursive_union: null }] }); + assert.deepEqual(candidate.decode(wire), { + scan: "filtered", select: ["id"], cte: [{ name: "filtered", query: { scan: "orders", select: ["id"], filter: [{ col: "parent_id", op: "eq", val: null }] } }], + }); + assert.throws(() => candidate.decode({ ...wire, extra: true }), StrictForgeOutputError); + assert.throws(() => candidate.decode({ ...wire, scan: null }), StrictForgeOutputError); + assert.throws(() => candidate.decode({ ...wire, cte: [{ name: "filtered", query: { ...nested, extra: true }, recursive: null, recursive_term: null, recursive_union: null }] }), StrictForgeOutputError); +}); + test("native provider payload requires strict output and only the terminating Forge function", () => { for (const api of ["openai-codex-responses", "openai-completions"]) { const definition = { name: "emit_forge_query", parameters: {}, strict: null }; diff --git a/services/pi-orchestrator/tests/structured-contracts.test.ts b/services/pi-orchestrator/tests/structured-contracts.test.ts new file mode 100644 index 0000000..14cfe28 --- /dev/null +++ b/services/pi-orchestrator/tests/structured-contracts.test.ts @@ -0,0 +1,49 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import test from "node:test"; + +import { validateStructuredArtifact, type StructuredArtifactType } from "../src/contracts.js"; +import { + ArtifactSubmissionError, createAdvisorySubmissionTool, createClarificationSubmissionTool, +} from "../src/structured-artifact-tools.js"; + +const corpus = JSON.parse(readFileSync( + new URL("../../../agent/contracts/structured-artifact-fixtures.v1.json", import.meta.url), "utf8", +)) as { cases: Array<{ id: string; contract: string; accepted: boolean; instance: Record }> }; + +for (const item of corpus.cases) { + test(`shared structured artifact semantics: ${item.id}`, () => { + const artifactType = item.contract.replace(/_artifact$/, "") as StructuredArtifactType; + assert.equal(validateStructuredArtifact(artifactType, item.instance) === undefined, item.accepted); + }); +} + +test("submission rejects invalid boundary data without terminating or retaining it", async () => { + const submission = createClarificationSubmissionTool(); + for (const id of ["clarification-invalid-date", "payload-unknown-property"]) { + const payload = corpus.cases.find((item) => item.id === id)!.instance.payload; + await assert.rejects( + () => submission.tool.execute("invalid", payload as never, undefined, undefined, {} as never), + ArtifactSubmissionError, + ); + assert.equal(submission.getSubmitted(), undefined); + } +}); + +test("query-evidence advisory cannot substitute supplied context for query rows", async () => { + const contextRef = `ctx_${"a".repeat(24)}`; + const submission = createAdvisorySubmissionTool({ + skillName: "funnel-analysis", allowedEvidenceRefs: new Set([contextRef, "qr_corpus#row:1"]), + requiresQueryEvidence: true, + }); + const base = corpus.cases.find((item) => item.id === "advisory-valid")!.instance.payload; + const payload = { ...(base as Record), skill_name: "funnel-analysis" }; + await assert.rejects( + () => submission.tool.execute("context", payload as never, undefined, undefined, {} as never), + ArtifactSubmissionError, + ); + assert.equal(submission.getSubmitted(), undefined); + const accepted = { ...payload, findings: [{ statement: "Observed value is one.", evidence_refs: ["qr_corpus#row:1"], confidence: "high" }] }; + const result = await submission.tool.execute("query", accepted as never, undefined, undefined, {} as never); + assert.equal(result.terminate, true); +}); diff --git a/services/pi-orchestrator/tests/structured-skills.test.ts b/services/pi-orchestrator/tests/structured-skills.test.ts index 4b24d5d..d373fac 100644 --- a/services/pi-orchestrator/tests/structured-skills.test.ts +++ b/services/pi-orchestrator/tests/structured-skills.test.ts @@ -98,23 +98,6 @@ test("clarification Artifact Tool accepts one schema-valid terminal submission", ); }); -test("clarification Artifact Tool rejects invalid dates and extra fields", async () => { - const invalidDate = createClarificationSubmissionTool(); - await assert.rejects( - () => - invoke(invalidDate.tool, { - ...validClarification, - time_range: { description: "指定范围", start: "yesterday" }, - }), - /RFC 3339/, - ); - - const extraField = createClarificationSubmissionTool(); - await assert.rejects( - () => invoke(extraField.tool, { ...validClarification, sql: "SELECT 1" }), - /Invalid structured artifact payload/, - ); -}); test("Pi Skill executor captures the terminating structured tool result", async () => { const executor = new PiStructuredSkillExecutor({ diff --git a/tests/test_accuracy_triage.py b/tests/test_accuracy_triage.py index ee7a40f..60ef85c 100644 --- a/tests/test_accuracy_triage.py +++ b/tests/test_accuracy_triage.py @@ -1,11 +1,6 @@ from __future__ import annotations -import sys -from pathlib import Path - -sys.path.insert(0, str(Path(__file__).parent / "accuracy")) - -from triage_failures import build_triage, render_markdown +from tools.benchmarks.accuracy.triage_failures import build_triage def test_triage_classifies_missing_topn_qualify(): @@ -91,32 +86,3 @@ def test_triage_does_not_flag_topn_when_outer_rank_filter_exists(): triage = build_triage(cases, runs, ea) assert triage["failures"][0]["root_cause"] != "topn_filter" - - -def test_triage_renders_markdown_backlog(): - triage = { - "method": "x", - "ea": 0.5, - "run_accuracy": 0.4, - "total_failures": 1, - "root_cause_counts": {"filter_semantics": 1}, - "category_root_cause_counts": {"复杂过滤": {"filter_semantics": 1}}, - "failures": [ - { - "case_id": "2", - "category": "复杂过滤", - "question": "统计已完成订单", - "root_cause_label": "复杂过滤/字段约定缺失", - "reason": "ref=10行, gen=20行", - "next_action": "把字段约定转成 lint 或 field_conventions 规则。", - "generated_sql": "SELECT * FROM orders", - } - ], - } - - md = render_markdown(triage) - - assert "Method x EA 失败归因" in md - assert "| 复杂过滤/字段约定缺失 | 1 |" in md - assert "Case 2" in md - assert "SELECT * FROM orders" in md diff --git a/tests/test_agent_runtime.py b/tests/test_agent_runtime.py index f1730ee..134bc09 100644 --- a/tests/test_agent_runtime.py +++ b/tests/test_agent_runtime.py @@ -68,6 +68,7 @@ def isolated_agent(monkeypatch, tmp_path): registry_path = tmp_path / "schema.registry.json" registry_path.write_text( __import__("json").dumps({ + "assurance_profile": {"id": "large-benchmark", "revision": "large-benchmark-v1"}, "tables": { "orders": {"columns": {"id": {}, "created_at": {}}}, "dwd_order_detail": {"columns": { @@ -563,7 +564,6 @@ def fail_call(*args, **kwargs): result = agent_mod.prepare_query("u-error", "查询订单") assert result["status"] == "error" - assert "LLM 调用失败" in result["error"] assert "upstream unavailable" not in result["error"] @@ -573,7 +573,6 @@ def test_prepare_query_rejects_unknown_dialect(isolated_agent): result = agent_mod.prepare_query("u-dialect", "查询订单", dialect="oracle") assert result["status"] == "error" - assert "dialect must be one of" in result["error"] def test_process_returns_error_when_llm_call_fails(isolated_agent, monkeypatch): @@ -587,13 +586,13 @@ def fail_call(*args, **kwargs): resp = agent_mod.process("u3", "查询订单") assert resp.action == "error" - assert "LLM 调用失败" in resp.text assert "upstream unavailable" not in resp.text def test_approve_clears_pending_sql_and_returns_sql(isolated_agent, monkeypatch): agent_mod, fake_memory = isolated_agent - monkeypatch.setattr(agent_mod.cache, "add_pending", lambda **kwargs: None) + from forge.cache import cache + monkeypatch.setattr(cache, "add_pending", lambda **kwargs: None) fake_memory.set_state("u4", "pending_sql", "SELECT 1") fake_memory.set_state("u4", "pending_forge", {"scan": "orders", "select": ["orders.id"]}) diff --git a/tests/test_api.py b/tests/test_api.py index 42ef7cc..f880deb 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -342,6 +342,7 @@ async def test_failed_execution_terminates_pending_legacy_pipeline( import web.router as router_mod from agent.agent import AgentResponse from agent.memory import memory + from forge.executor import ExecutionResult pipeline_state = {"status": "pending_approval", "stages": []} monkeypatch.setattr( @@ -353,8 +354,10 @@ async def test_failed_execution_terminates_pending_legacy_pipeline( ) monkeypatch.setattr( router_mod, - "execute_with_data", - lambda sql: ("⚠ 执行失败:SQL 引用了不存在的字段。", [], []), + "execute", + lambda sql: ExecutionResult( + False, "SQL 引用了不存在的字段。", [], [], error_code="execution_reference_invalid" + ), ) monkeypatch.setattr( memory, @@ -375,7 +378,7 @@ async def test_failed_execution_terminates_pending_legacy_pipeline( data = resp.json() assert data["action"] == "execution_failed" assert pipeline_state["status"] == "failed" - assert "Pipeline 已终止" in pipeline_state["error"] + assert data["error_code"] == "execution_reference_invalid" class TestExecuteRaw: @@ -960,7 +963,6 @@ async def test_web_chat_page_is_a_first_class_pi_channel(self, client: AsyncClie assert 'data-conversation-list' in resp.text assert 'data-conversation-feed' in resp.text assert 'data-conversation-form' in resp.text - assert '/static/product/product-pages.js?v=6' in resp.text assert " {% endblock %} diff --git a/web/templates/dashboard.html b/web/templates/dashboard.html index 0a0e909..2ead090 100644 --- a/web/templates/dashboard.html +++ b/web/templates/dashboard.html @@ -140,8 +140,8 @@

系
{{ rule_count }}
-
今日查询
-
{{ today_query_count }}
+
今日查询 · QueryRun + Legacy
+
{{ today_query_count if today_query_count is not none else "部分不可用" }}
@@ -171,7 +171,7 @@

最近查询

{% if recent_queries %}
    {% for q in recent_queries[:4] %} -
  • {{ q.question or '—' }}
    {{ q.timestamp[:19] if q.timestamp else '' }}
  • +
  • {{ q.source }} · {{ q.id }} · {{ q.status }}
    {{ q.timestamp[:19] if q.timestamp else "" }}
  • {% endfor %}
{% else %} diff --git a/web/templates/product_base.html b/web/templates/product_base.html index 45df0b5..41e8fae 100644 --- a/web/templates/product_base.html +++ b/web/templates/product_base.html @@ -5,9 +5,9 @@ {% block title %}{{ page_title | default('Forge') }} · Forge{% endblock %} - + {% block head %}{% endblock %} - + diff --git a/web/templates/product_chat.html b/web/templates/product_chat.html index ebba89e..e7250e2 100644 --- a/web/templates/product_chat.html +++ b/web/templates/product_chat.html @@ -55,4 +55,4 @@

输入要处理的问题

{% endblock %} -{% block scripts %}{% endblock %} +{% block scripts %}{% endblock %} diff --git a/web/templates/product_data.html b/web/templates/product_data.html index e4cfed6..b2fb3b8 100644 --- a/web/templates/product_data.html +++ b/web/templates/product_data.html @@ -38,4 +38,4 @@

能力边界

现有结构、指标、语义、Staging 与 Knowledge 使用真实 Store;Quality、ConflictSet、Owner 和 Policy Impact 页面只固定产品结构,不生成记录。

{% endblock %} -{% block scripts %}{% endblock %} +{% block scripts %}{% endblock %} diff --git a/web/templates/product_reports.html b/web/templates/product_reports.html index f78ace9..6b84862 100644 --- a/web/templates/product_reports.html +++ b/web/templates/product_reports.html @@ -42,4 +42,4 @@ {% endblock %} -{% block scripts %}{% endblock %} +{% block scripts %}{% endblock %} diff --git a/web/templates/product_task_detail.html b/web/templates/product_task_detail.html index b78cfb1..f6dff00 100644 --- a/web/templates/product_task_detail.html +++ b/web/templates/product_task_detail.html @@ -27,6 +27,10 @@

交付与证据

查询结果、分析与报告来源

正在读取交付…

+