阅读、预测、破坏与修复 这条学习路径围绕一次真实执行的嵌套数组契约变更展开。先预测每个结果,再运行练习。
以下为经原始来源核验的已发布课程档案与固定版本标准,不把计划或推测中的 2026 课程列为可学资源。本 Lab 练习为原创,不是大学原作业的解答。公开阅读不等于获得注册、批改、证书或教材权限。
核验日期:2026-11-14 Asia/Shanghai · 结构化资源清单(JSON)
从可运行实验开始 生产者把嵌套 quantity 的范围从 0–8 放宽到 0–9,现有消费方仍最多接受 8。24 个无关可选属性重现旧版搜索过早截断的问题。
进入可编辑工作台 → · 合成输入包 · 下载离线练习包
解压练习包,进入解压目录,用 Node 18+ 运行以下命令。无需安装依赖、密钥、模型调用或联网。包内仅含公开练习引擎、原创练习和逐案例独立判定式。
node run.mjs all
node run.mjs U04
node run.mjs U05 --out repaired-check.json
node run.mjs replay --bundle nested-input-bundle.json --out contract-report.json --csv errors.csv 离线修改与修复:编辑 nested-input-bundle.json,把 new.schema.properties.records.items.properties["quantity/unit~"].maximum 从 9 改为 8,再执行 replay 命令。六个探针的原始输入应保持不变,它们的断言描述原题;replay 则执行你编辑的输入包。
六个学习单元 每单元把具体课程阅读或讲义与原创练习对应。运行探针检查明确预期;在工作台完成修改与修复才是学习任务。
U01 · 先识别方言,再判断契约 区分接口承诺、数据模型与校验语言。
载入“嵌套契约修复”,给 quantity 字段的 Schema 加 pattern 后运行。先预测输入错误,再删除它;DCL/1 会拒绝未知关键字。
阅读: Reading 6, Part 1: Specifications — Behavioral equivalence; Specification structure; Testing and specifications; Lecture 01: Relational Model & Algebra — Sections 3–4, PDF pages 2–3: data model, schema, domains, integrity constraints and NULL; JSON Schema Draft 2020-12 — Pinned comparison reference; DCL/1 is not an implementation of this dialect
预期观察: 未知关键字报错;没有据此声称符合 JSON Schema、Pact 或 ODCS。
node run.mjs U01 在此运行探针 U02 · 划分缺失、null 与有类型的值 分别测试存在性与值约束。SQL NULL 是背景概念,JSON 属性缺失是另一种状态。
把新契约数组项中 quantity 的 type 改为 ["integer","null"] 后运行:null 获准,缺键行仍失败。再从该项的 required 列表移除 quantity 字段名,重跑比较。
阅读: Lecture 01: Relational Model & Algebra — Sections 3–4, PDF pages 2–3: data model, schema, domains, integrity constraints and NULL; Reading 3: Testing — Choosing Test Cases by Partitioning; Blackbox and Whitebox Testing; Automated Testing and Regression Testing; Understanding JSON Schema: object — Required Properties; Additional Properties; Understanding JSON Schema: null — null is a present value, distinct from an absent property
预期观察: 必填且可空允许 null、拒绝缺失;可选且不可空在这两种状态上的结果相反。
node run.mjs U02 在此运行探针 U03 · 预测两个兼容性方向 用值集合包含关系解释为什么放宽生产者输出会破坏现有消费方。
重新载入嵌套场景,运行并展开反例。新生产者允许 9,旧消费方最多允许 8;定位 /records/0/quantity~1unit~0。
阅读: Reading 7: Designing Specifications — Stronger vs. weaker specs; RFC 6901: JavaScript Object Notation (JSON) Pointer — Section 3: ~0 and ~1 escaping
预期观察: 新 → 旧有已验证反例;旧 → 新已证明包含。包含关系提示中的数组通配符与回放诊断中的具体下标含义不同。
node run.mjs U03 在此运行探针 U04 · 构造独立判定的反例集 沿着失败的嵌套分支构造反例,避免被无关兄弟属性的样例截断。
离线运行 U04,查看 exercises/oracle.mjs:它使用逐案例判定式,不调用引擎校验器。复制一个案例,逆序排列属性后重跑。
阅读: Reading 3: Testing — Choosing Test Cases by Partitioning; Blackbox and Whitebox Testing; Automated Testing and Regression Testing; Reading 16: Recursive Data Types — Introduction; Part 1: Recursive Data Types
预期观察: 15 个已知小反例均可找到;相同契约对照已证明;兼容枚举对照及超预算反例仍为尚未证明。有限案例不能证明搜索完备。
node run.mjs U04 在此运行探针 U05 · 修复承诺,用相同行回放 区分生产者接受、消费方接受与真实集成测试。
重新载入,把新契约数组项 quantity 的 maximum 从 9 改回 8,重跑。另做一次协商实验:重新载入,只把消费方 maximum 改为 9。本练习不执行消费方应用。
阅读: Reading 6, Part 1: Specifications — Behavioral equivalence; Specification structure; Testing and specifications; How Pact works — Consumer testing; Provider verification; Non-HTTP testing (Message Pact)
预期观察: 生产者修复后,新 → 消费方已证明;但五行历史样例仍违反两版生产者契约。初始“已修复行”只表示新生产者接受,该行仍破坏旧消费方。
node run.mjs U05 在此运行探针 U06 · 导出证据,核对来源语义 记录实际检查的契约,区分结构合法与事实正确。
生产者修复后导出 JSON、CSV 与可读 HTML,核对摘要与路径,原始 batch ID 不应出现。运行 U06:原创抽取案例结构合法地输出 5,但原始来源是 6。
阅读: Reading 3: Testing — Choosing Test Cases by Partitioning; Blackbox and Whitebox Testing; Automated Testing and Regression Testing; Pact Specification — File metadata and specification versions; this Lab does not emit Pact files or run Pact verification; ODCS v3.1.0: Fundamentals — Definitions: apiVersion; version
预期观察: JSON 往返保留修复结果,CSV 诊断与报告一致。结构通过不能证明抽取忠实度;这是离线语义反例,不是 LLM 评测。
node run.mjs U06 在此运行探针 运行并检查 运行六个探针 保存本次运行
点击后在本浏览器实际计算,不读取预存结果。U06 的离线抽取案例演示“结构合法、来源事实错误”,不评测任何模型。
已实跑的回归与边界 已保存基线(引擎 1.0.0)漏掉 7 个已知小反例;引擎 1.1.0 在这组 18 个案例中找到全部 15 个小反例。兼容但未证明、超预算两个对照仍为尚未证明。独立 oracle 是逐案例判定式;这组人工有限案例不能证明搜索完备或生产安全。
脱敏实跑证据
检索已核验资料 学校、课程、主题、版本或资源 ID 显示全部资源
Massachusetts Institute of Technology · 6.005 Software Construction Spring 2016 · mit-6005-s16 · published-archive
2016 年经典课程;规格与测试方法适用,Java/Eclipse 安装说明属于历史环境。
官方课程档案
先修: No numbered prerequisite was found on the checked OCW syllabus. The Getting Started page requires quickly learning basic Java. Basic programming, JSON, functions, recursion; Node 18+ for the optional offline exercises. 来源
OCW readings, calendar and assignment statements; selected readings require no login.
阅读与注册条件: Reading the selected OCW material is free and requires no registration. This is an archive, not MIT enrollment or a credential. Original course grading and institutional services are not provided by this Lab.
核验于 2026-11-14
Carnegie Mellon University · 15-445/645 Intro to Database Systems Fall 2025 · cmu-15445-f25 · published-archive
已发布的 2025 年课程档案。只选相关数据模型章节;本 Lab 不教授或实现 BusTub。
官方课程档案
先修: CMU 15-213/513; the syllabus also requires C++17 programming for the full course projects. For Lecture 01 here: basic data types, sets and constraints. The full systems prerequisite is not required for our small JSON exercise. 来源
Archived schedule, lecture slides and lecture notes; selected PDF notes are readable without login. Textbook chapters are not redistributed here.
阅读与注册条件: The selected archived notes are public without payment or registration. University enrollment, grading, course services and textbook purchase are separate; this page offers none of them and quotes no tuition price.
核验于 2026-11-14
mit-spec · mit-6005-s16 · reading
Behavioral equivalence; Specification structure; Testing and specifications
· published-archive · 核验于 2026-11-14
mit-testing · mit-6005-s16 · reading
Choosing Test Cases by Partitioning; Blackbox and Whitebox Testing; Automated Testing and Regression Testing
· published-archive · 核验于 2026-11-14
mit-strength · mit-6005-s16 · reading
Stronger vs. weaker specs
· published-archive · 核验于 2026-11-14
mit-recursion · mit-6005-s16 · reading
Introduction; Part 1: Recursive Data Types
· published-archive · 核验于 2026-11-14
cmu-model · cmu-15445-f25 · lecture-notes
Sections 3–4, PDF pages 2–3: data model, schema, domains, integrity constraints and NULL
· published-archive · 核验于 2026-11-14
cmu-schedule · cmu-15445-f25 · schedule
Lecture 01, August 25; confirms the lecture identity and public notes
· published-archive · 核验于 2026-11-14
json-schema-version · JSON Schema · standard
Pinned comparison reference; DCL/1 is not an implementation of this dialect
Draft 2020-12; specification documents published 2022-06-16 · published · 核验于 2026-11-14
json-object · JSON Schema · official-tutorial
Required Properties; Additional Properties
· published · 核验于 2026-11-14
json-null · JSON Schema · official-tutorial
null is a present value, distinct from an absent property
· published · 核验于 2026-11-14
pointer · IETF / RFC Editor · standard
Section 3: ~0 and ~1 escaping
April 2013 · published · 核验于 2026-11-14
pact-how · Pact Foundation · official-tutorial
Consumer testing; Provider verification; Non-HTTP testing (Message Pact)
· published · 核验于 2026-11-14
pact-spec · Pact Foundation · specification
File metadata and specification versions; this Lab does not emit Pact files or run Pact verification
V4 reference; per-language support must be checked separately · published · 核验于 2026-11-14
pact-v4-release · Pact Foundation · release-note
V4 Pact Specification
V4 already announced in May 2022 · published · 核验于 2026-11-14
odcs · Bitol · standard
Schema, quality, responsibilities and service commitments exceed this Lab's value-schema scope
v3.1.0 (pinned, not a claim of latest) · published · 核验于 2026-11-14
odcs-fundamentals · Bitol · standard-section
Definitions: apiVersion; version
apiVersion v3.1.0 vs. a data contract's own version · published · 核验于 2026-11-14
DCL/1 保持自有受限方言,没有换成标准校验库。JSON Schema Draft 2020-12、Pact V4 与 ODCS v3.1.0 是格式和迁移要求各不相同的参考资料。