feat(standards): Phase 1 lossless canonical standard layer + alignment audit - #14
Merged
Conversation
added 2 commits
August 20, 2026 14:02
…t audit Build the ORIGINAL classification/grading standards (finance guide Excel, shougang 关基 catalog Excel) into a lossless, auditable canonical form that restores real hierarchy depth and grading columns the legacy standards_map digests dropped. Adds Phase 0 semantics doc + Phase 1 design/migration note. - src/agent/standards: contracts (StandardCategory/CanonicalStandard, standard_data_level kept separate from sample data_level), raw xlsx readers, deterministic builders, read-only sample<->standard alignment - script/standard/cli: regenerable data/standards/*.standard.json + artifacts/generated/provenance/* (finance/shougang/infra alignments, summary) - alignment facts: finance 529 matched / 2 outliers (AMONEY, HXTRADENO) / 37 unresolved; shougang 18,393/18,393 (100%); infra 64/64; guanji_dict lost B3-6 中厚板作业计划 (documented, not fixed) - tests/standards: 26 hermetic + real-xlsx integration tests (raw missing => skip) - no training behavior change: no changes to prompts/parser/reward/SFT/RL, samples, registry/corpus, or data_level-as-target
… deterministic order Addresses the Phase-1 review blocking items without touching training code. - Blocker 1: one CanonicalStandard entry per real standard row (no fact-layer aggregation). standard_entry_id (finance L1.L2.l3.L4 / shougang code) is the true source identity; category_id is the training/registry alias; 237 finance entries project to 233 training categories via derived training_projection. The 5 same-alias 合约协议 entries are preserved with distinct 三级/path/source. - Blocker 2 (option B): committed script/standard/checksums.json; CLI verifies raw-workbook sha256 before building and refuses on mismatch; restore/checksum flow documented in phase1_canonical_standard.md. - P1: ReaderResult.issues are merged into the build report (reader_issue kind). - P1: build report reports standard_entries_out (237/234) + training_categories (233/234); level distribution over final entries. - P1: determinism now order-independent even for duplicate category_id entries (every entry preserved + sorted by standard_entry_id); tests added. - Non-blocking: alignment unresolved_evidence (status/leaf_name/candidates) for the 37 finance non-trainable samples, evidence-only. - tests/standards 37 passed; full suite 279 passed, 2 skipped (pre-existing).
Collaborator
Author
Review 修复(b20d2a0)已推送按上轮 review 的 blockers 全部落地,未触碰任何训练代码。 Blocker 1:事实层不再聚合(237 无损)
Blocker 2:分发走 Option B(restore + checksum)
P1 顺手修
验证
|
…sless grid facts) Standard sources use vertical cell merges for hierarchy/definition columns and for grid annotations (finance 备注 J). This makes both standard readers merged-range-aware and preserves the ORIGINAL scope, so group-level facts are never misread as a single anchor leaf's private info. Standards layer only. - MergedCellResolver: value + anchor_cell + merged_range + start/end row + inherited for any cell; readers drop manual carry-forward. - finance columns: B/C (L1/L2) D (L2 def) E/F (L3, L3 def) G/H/I (leaf/ desc/level) J remark K department_opinion. - shougang columns: B..G (L1-3 + definitions) H/I (leaf/leaf def) J content K level L resource. - entries gain raw_fields (inherited hierarchy definitions + resource) with source_cell/merged_range provenance (incl in fingerprint/round-trip). - finance 备注 J becomes standard-level scoped_annotations: J55->1, J93:J132->40, J168:J169->2 reproduced and tested; K (empty) routed same way. - shougang 三级定义 no longer assumed for leaf-at-三级 rows; definitions + resource kept with provenance. - fixes a stale carry-forward bug: 账户信息 branch's 5 entries now correctly have EMPTY 三级 (the standard genuinely has none there), matching data's empty level_3. - sample-source workbooks confirmed merge-free (finance sample has only the A1:A2 title merge); sample layer untouched. - tests/standards 56 passed; full suite 298 passed, 2 skipped (pre-existing).
Collaborator
Author
|
已按上轮与新发现的'merged cells 组级语义'补 commit |
Two unmerged cells with identical text (merged_range=None) were grouped into
ONE annotation spanning both rows (e.g. 55..200), which breaks the lossless
scope contract. Group by (type, text, scope_key) where scope_key is the merged
range ('J93:J132') or the cell itself ('J55') for an unmerged cell.
- _scoped_annotations(): scope_key grouping; merged_range=None kept per cell
- _push_annotation_sighting(): type annotation corrected to 8 items
- shougang reader: guard empty 分级 cell (None -> '' instead of 'None')
- regression test: J5 + J10 same text, unmerged -> 2 annotations, each its row
- tests/standards 57 passed; full suite 299 passed, 2 skipped (pre-existing)
Collaborator
Author
|
fix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
动机
把已确认的原始分类分级标准(finance 标准指南、shougang 关基目录)整理成统一、可审计、可复现的 canonical standard 事实层。不修改任何现有训练行为(prompt/parser/reward/SFT/RL、样本、registry/corpus 均不动)。
语义边界(Phase 0:docs/design/data_level_design.md)
classification / sample_data_level / standard_data_level 严格分离、不互相覆盖;field_sensitive 独立不处理;不推断 L1-L4 语义、不跨数据集假设同义;不把 level_4 槽位当作所有源都真实四层。
变更(3 commits)
src/agent/standards/:contracts(schema、指纹、训练投影)、merged-range-aware readers(MergedCellResolver + 列语义)、deterministic builders、只读对齐。script/standard/cli.py+checksums.json:可重生成 + sha256 校验(restore 流程,raw 不进 Git)。docs/design/phase1_canonical_standard.md:schema、列语义(hierarchy/leaf/scoped)、对齐统计、异常、迁移 note、restore。tests/standards/:56 个(含 merger/resolver、J 作用域、样本源零合并)。关键修复点
对齐审计
测试
pytest tests/standards→ 56 passed;全仓 298 passed, 2 skipped(skip=本地无 verl,既有)。重复构建字节级一致。未做(留给下一步)
training_categories改名建议(评审待答复,可在后续 commit 带)。