mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-15 06:31:58 +00:00
e15e94f93e
- 新增口径结构化语义定义、分批解析与 SQL 生成管道(semantic / semantic_import / semantic_sql) - 支持起草断点续跑恢复、指标自动匹配对齐与存量口径语义迁移面板(MigrationPanel / SemanticPanel) - 口径草稿与变更流程接入候选本体边提议、审阅确认与一键修改保护,同步更新可移植 SQLite 基线校验
18 lines
740 B
Python
18 lines
740 B
Python
"""Compare SQLite golden bytes across runtimes without changing stored artifacts."""
|
|
from __future__ import annotations
|
|
|
|
import hashlib
|
|
import sqlite3
|
|
from pathlib import Path
|
|
|
|
|
|
def baseline_file_hash(path: Path, *, writer_version: int) -> str:
|
|
data = bytearray(path.read_bytes())
|
|
assert data[:16] == b"SQLite format 3\x00"
|
|
major, minor, patch = sqlite3.sqlite_version_info
|
|
# Offset 96 is the SQLite library version that last wrote the file. All other
|
|
# bytes, including page layout, schema and data, remain part of the assertion.
|
|
assert int.from_bytes(data[96:100], "big") == major * 1_000_000 + minor * 1_000 + patch
|
|
data[96:100] = writer_version.to_bytes(4, "big")
|
|
return hashlib.sha256(data).hexdigest()
|