Skip to content

WIP(A04): authorized history reads and bounded finance ZIP — 47 scoped checks passing - #875

Draft
LIghtJUNction wants to merge 6 commits into
wip/rust-core-go-extensionsfrom
a04/history-read-finance-export-candidate-20261012
Draft

LIghtJUNction wants to merge 6 commits into
wip/rust-core-go-extensionsfrom
a04/history-read-finance-export-candidate-20261012

Conversation

@LIghtJUNction

@LIghtJUNction LIghtJUNction commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

开发主线交接(2026-10-12)

开发默认主线现为 wip/rust-core-go-extensions;旧单体 main 与 traditional 冻结于 3948a0a1ee1cefdd016a7aa45a11851545bb4b85。分支交接不是发布、部署或验收通过。原问题、源码基线、测试与未完成项保留;旧单体路径仅作历史证据,后续先在微服务源码重新确认并按职责移植,不回灌旧数据库/权限/资金实现。

主线/S11 跟踪:#895。Extore 商品同步:#894,未验收,禁止部署,尤其禁止合并/推送 Extore main。

本 PR 的候选实现和已有验证范围保持原样;不因主线交接自动合并或标记验收完成。

A04 当前状态

任务范围。最新提交 0d2aaa2f766c77f15890f2a2b6c17aaeca84a4fa。

已完成本轮源码修复与隔离定向验收:47 项通过,0 失败、0 跳过,其中 22 项使用真实 PostgreSQL。保留 Draft;没有声称完整 A04、真实历史迁移或最终组合验收完成。

本 PR 已不是最初的 7 文件未接线版本。现有实现包含 Core 模块和 HTTP 接线、统一鉴权读取、历史金额投影、统计与分组、15 个 JSON 文档组成的财务 ZIP。完整历史来源视图仍由 A03/S11 提供;测试中的来源提供方是合成数据,不能用于生产导入。

本轮修改

  • 2fe4626:修复 ZIP/JSON 多层写入把限额误报为来源不可用的问题。文件上限、空间/配额不足保留限额类别;一般 IO、格式和数据错误不混为限额。中途失败的 writer 仍禁止输出貌似完整的部分结果。
  • 0d2aaa2:只读资格检查同时检查整表与单列 INSERT/UPDATE 权限,以及来源回执的写权限。缺失、重复或互相矛盾的来源回执一律拒绝。
  • 新增 5 项回归测试,包含多种写入阶段/错误类别、ZIP 尾部差 1 字节、异常用量、列级授权及冲突来源回执;原有测试保留。
  • 测试 runner 使用固定、已由 Cargo 生成并实测的锁文件补丁,不再每次重新解析依赖。记录输入、工具版本、补丁、测试退出码和完整源码摘要。

本轮只改变 7 个 A04 源码/测试叶文件;保留先前提交的公共接线,不回写共享 WIP、生产库或其他任务域。

实际验证

最新专用 CI · 结果及精确输入归档

测试入口 通过 真实 PostgreSQL 用例
finance_export 11 0
financial_profile 6 6
history_read 16 3
history_repository 14 13
合计 47 22

实际工具:rustc 1.99.0 (b940084d7 2026-09-28);cargo 1.99.0 (5f94df478 2026-08-27);专属 PostgreSQL 17 服务。

cargo test --locked --test history_read --test finance_export \
  --test history_repository --test financial_profile --no-fail-fast

证据范围:isolated-tested。 CI 从合并候选 abef1340db8cb9b25918ddc39d6db7335f0e9a75 检出,在一次性环境应用固定的 S11 锁文件补丁并运行 A04 文件的 rustfmt,再编译和测试。不是未修改源码树上的全仓 CI,也不是浏览器或真实历史数据验收。

  • checked-source.tar.gz SHA-256:030fd6db0ab2d1a08b83d09d5ef51164c45b014fe67a7bdd4ec4d6e61d5e0dce
  • 整个验收 ZIP SHA-256:31a6c92b24e5f3bc2de49eb09bd2423fd2596dc0943a70bbfba89c669fa4fe11
  • test-exit-code.txt 为 0;所有 47 项均无 skip/ignore。

测试使用实际持久化的 Core 会话、Key、用户/团队角色及受限数据库角色;HTTP 测试调用真实路由处理函数。来源视图及其中业务材料是合成 fixture,未执行真实服务进程/浏览器联合验收。

历史失败保留:c3fa657 为 41 通过、1 个导出限额用例失败;2fe4626 专用 CI 全部 42 项通过。没有将旧提交结果当作新输入结果。

S11 精确接入

services/core/tests/history_read/cargo-lock.patch 是锁文件的最小候选补丁。它将 Git blob e571b17a29f201e321f005eba20c2b4fa0bf3bf0 转为 b54ce5875919b916743171f6ce9b72a1d08449a7,只补所需依赖,不更新原有依赖版本。

最新 CI 归档的 generated.patch 包含相同锁文件变更和仍需落地的 A04 格式变更。S11 应先核对输入并 git apply --check,选择应用该完整补丁一次;不要再重复应用 lock-only 补丁。基线改变须重新核对,不强推或覆盖其他任务。

共享 Cargo.lock 尚未直接修改。组合 CI 的格式、锁定依赖步骤仍失败,不能用专用验收成功覆盖这些失败。最终组合仍须重新编译、检查和测试。

来源合同与未完成验收

运行时只读取 core_history.source_contract_v1、log_records_v1、quota_data_v1、finance_records_v1、finance_options_v1。精确列类型见 tests/fixtures/history_source_v1.sql,该文件仅为合成提供方,不是生产 DDL 或导入证明。每个 dataset 必须且只能有一条有效 v1/complete 回执;哈希格式合法不等于来源真实性已获证明。

A03/S11 仍需提供并核验真实归属/ID 映射、历史与 native 的去重、退款/作废规则、逐条计价基准及全部财务数据集。非零 opening 的金额证明、累计用量和每条日志美元金额不可互换;缺来源不能伪造 complete 或用空数组/零补齐。Go 不取得 Core DSN,运行时不导入或重写来源。

A10/S11 仍需验证当前前端的会话传递、分页/DTO 兼容及浏览器流程,并完成最终组合和真实历史只读对账。在这些条件满足前,不关闭 A04,不标记 MIGRATED,不合并为已完成版,不发布或部署。

Add source-only A04 read projection helpers, synthetic test fixtures,
PostgreSQL snapshot test definitions and allowlisted JSON output.
Pending S11 module wiring, dependencies, real source integration,
authorization, complete finance export and executable test evidence.
…finance ZIP

Use existing stored credential checks inside one read-only snapshot for scope,
counts, pages, totals and all export documents. Refuse missing, writable or
duplicate offline sources; preserve unknown historical money and raw quota.
Add real PostgreSQL restricted-role and HTTP integration tests, plus a scoped
read-only CI runner that retains resolved lockfile and exact tested input.

The offline A03 source-view provider and catalog integration remain required;
synthetic fixtures are not historical import or production readiness evidence.

Copy link
Copy Markdown
Collaborator Author

补充 c3fa657 的实际验收进展:专用 job已有 10+6+16 项通过,history_repository 为 9 通过、1 失败。archive_refuses_missing_documents_limits_and_runtime_writes 在 1024 字节预算下未得到 ReadError::Limit,同时出现 ZipWriter export limit 提示。

值得先检查 archive.rs 的错误映射:usage.push(...).map_err(|_| ReadError::Unavailable) 会把该写入错误统一转为 Unavailable,可能解释限额断言失败。这是源码支持的待验证定位,建议保留限额与数据不可用的区分后重跑;该测试在首个限额断言退出,后面的缺文档和运行时写入断言还不能算通过。

组合 CI另外仍受 Cargo.lock 的 --locked 校验和 rustfmt 阻断。正文“7 文件、尚未接线/编译”也建议更新为当前 18 文件及上述实际结果,避免后续集成按旧状态判断。

Keep byte limits through JSON and ZIP layers instead of converting them
into missing-source errors. Retain real IO/source failures and poison
incomplete usage exports. Follow up on PR #875 failing PG limit case.
…eipts

Check column grants on both source views and qualification receipts.
Add real PostgreSQL regressions for column grants, duplicate receipts,
ZIP footer bounds and malformed usage, plus typed sink IO tests.
Freeze the S11 lock integration patch in the isolated acceptance runner
instead of resolving a different dependency graph on each CI run.
@LIghtJUNction LIghtJUNction changed the title WIP(A04): historical usage projections and bounded finance JSON export WIP(A04): authorized history reads and bounded finance ZIP — 47 scoped checks passing Oct 12, 2026
Preserve the concurrent A04 PostgreSQL/HTTP/ZIP implementation.
Add native-only settled charge reads with strict account/key scope and
synthetic PG regressions. Add allowlisted CSV output with spreadsheet
formula protection and metadata/row validation. Bound historical
aggregate metadata processing without reporting partial money totals.

A03 legacy source completeness and full integration remain blocked.
Allow safe JSON escaping of control characters as before. Reject NUL
only for CSV, where spreadsheet readers may truncate input. Verify the
separate format policies with regression cases from the A04 CI failure.

LIghtJUNction commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

A04 v2 已推送并完成本次专项验证(2026-10-12)

提交:3fce505c3494d604b1746530f33ac714c00defed(8 个文件:原生消费只读查询、CSV 白名单导出、金额统计资源限制和合成/PG 测试);0d44fb95c1bb7d11f9e8bc74e963b936f7a0542e(JSON 允许安全转义 NUL,CSV 拒绝 NUL,并补充回归测试)。保留此前并行的 historical repository / ZIP / HTTP 实现。

专项验收:PASS。 A04 history and finance acceptance #38241490901,Rust 1.99 与合成 PostgreSQL 环境执行 A04 关联测试,工作流最终 success。初次 v2 运行 #38241058297 的唯一 finance_export 失败已由第二提交修复;当时原生及历史读取 26/26、历史 repository/ZIP 14/14、financial profile 6/6 均已通过。

整个项目尚未通过: MK-01 identity and teams 与 Microkernel implementation checks 仍报告失败,涉及共享 Cargo.lock 尚未集成(--locked)和 workflow boundary 检查等,需 S11 协调串行修改及最终组合验收。A03 的旧数据来源、ownership/计价证明及去重仍是实际历史迁移依赖。此 PR 保持 Draft,不宣称历史 MIGRATED、生产可发布或全站完成。

@LIghtJUNction

Copy link
Copy Markdown
Collaborator Author

本轮按固定 head 0d44fb95c1bb7d11f9e8bc74e963b936f7a0542e 核对了 A04 → S11 的交付边界;没有重跑远程 CI,也没有改写此 PR 的源码或原验证记录。

目前最先可收口的两项是原始 head 的交付完整性:

  1. 将 services/core/tests/history_read/cargo-lock.patch 对应锁文件更新正式交付到 services/core/Cargo.lock,并让本机验收直接测试提交内容,不依赖临时补丁。
  2. 将 A04 scoped rustfmt 改动正式提交;当前 scoped runner 会格式化临时检出,不能把处理后的输入等同于原始 head。

已有 A04 专项 PostgreSQL 记录只证明其明确输入和合成来源合同,不能补齐真实历史迁移。与 #884 / S11 的下一道接口请固定为 core_history.source_contract_v1 及 log/quota/finance/options 四个只读来源视图;验收需保留真实来源映射、历史/native 去重、退款/作废和冻结金额依据,不能填空数据或 fixture complete=true 消除 503。

自动 workflow 与仓库拓扑规则的差异交给 S11 按现有治理处理,不以放宽测试/工作流保护换取绿色。请优先完成上述锁文件和格式交付,再在本机验证固定提交。Draft/未集成状态保持,#895 不据此关闭。

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant