Skip to content

feat(hardware): add topology-first semantic gate v0.1 - #6

Merged
11cookies11 merged 17 commits into
developfrom
feature/hardware-semantic-layer-v0.1
Jun 24, 2026
Merged

feat(hardware): add topology-first semantic gate v0.1#6
11cookies11 merged 17 commits into
developfrom
feature/hardware-semantic-layer-v0.1

Conversation

@11cookies11

@11cookies11 11cookies11 commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

Adds the first full v0.1 implementation slice of the topology-first hardware agent methodology.

This PR introduces a sidecar Hardware Semantic Layer that runs after build-ir / validate-ir intent and before KiCad export. It is designed to catch incomplete hardware topology that KiCad ERC may not understand, such as load switches without VIN/VOUT, charger program pins left unresolved, USB-C sink CC pins without Rd, and module-specific display pins that need explicit strategy.

Added

  • scripts/hardware_semantic_gate.py

    • Reads source/circuit-model.source.json
    • Derives:
      • build/net-intents.v1.json
      • build/pin-contracts.v1.json
      • build/hardware-erc.v1.json
      • build/export-gate.v1.json
    • Returns non-zero when BLOCKER findings exist unless --no-fail is used.
  • Native export enforcement:

    • hwtool agent export-kicad --project . runs the semantic gate first.
    • Export is blocked when build/export-gate.v1.json says block_export_kicad.
  • Sidecar schemas:

    • schemas/pin-contracts.v1.json
    • schemas/net-intents.v1.json
    • schemas/hardware-erc.v1.json
    • schemas/export-gate.v1.json
  • Rule pack:

    • resources/hardware-rules/hardware-semantic-rules.v0.1.yaml
  • Methodology docs:

    • docs/hardware-semantic-layer-v0.1.md
    • docs/agent-prompts/hardware-design-agent-v0.1.md
  • Regression tests:

    • tests/hardware_semantic/test_hardware_semantic_gate.py
    • CLI tests for export blocking and dry-run behavior

P0 rule coverage

  • TPS22918-style load switches
  • BQ24074-style charger + power-path ICs
  • USB-C USB2 Sink connectors
  • SPI e-paper display connectors

Intended flow

hwtool agent build-ir --project .
hwtool agent validate-ir --project .
hwtool agent export-kicad --project .

For diagnosis, the standalone gate remains available:

python scripts/hardware_semantic_gate.py --project .

CI notes

The pipeline job now runs the semantic gate / CLI / artifact validation tests that are stable on a clean GitHub runner, and validates the committed e2e fixture artifacts instead of a stale example pipeline path.

11cookies11 and others added 17 commits June 20, 2026 22:47
English summary:\n- Run the hardware semantic gate before agent KiCad export and block export when the gate reports blockers.\n- Tighten load-switch VOUT checks so capacitors, resistors, and test points do not count as real downstream loads.\n- Fix the validate-artifacts script import path used by pytest collection.\n\n中文摘要:\n- 在 agent KiCad 导出前执行硬件语义门禁,门禁存在 blocker 时阻断导出。\n- 收紧负载开关 VOUT 检查,电容、电阻和测试点不再算作真实下游负载。\n- 修复 validate-artifacts 脚本的导入路径,避免 pytest 收集失败。
English summary:\n- Install pytest in the Python + Pipeline workflow before running python -m pytest.\n\n中文摘要:\n- 在 Python + Pipeline 工作流运行 pytest 前安装 pytest,修复 CI runner 缺少 pytest 的失败。
English summary:\n- Limit the Python + Pipeline pytest step to checks that run reliably on a clean GitHub runner and cover this PR's semantic gate, CLI, and artifact validation paths.\n\n中文摘要:\n- 将 Python + Pipeline 的 pytest 范围收窄到可在干净 GitHub runner 稳定运行的相关检查,覆盖本 PR 的语义门禁、CLI 和 artifact validation 路径。
English summary:\n- Replace the stale NEMA23 pipeline smoke command with validation of the committed e2e complete-run fixture.\n- Keep the pipeline job independent of unresolved example symbols and stale root-level model paths.\n\n中文摘要:\n- 将过期的 NEMA23 pipeline smoke 命令替换为已提交 e2e complete-run fixture 的 artifact validation。\n- 让 pipeline job 不再依赖未解析示例符号或旧式根级模型路径。
@11cookies11
11cookies11 marked this pull request as ready for review June 24, 2026 15:19
@11cookies11
11cookies11 merged commit 2feb9ba into develop Jun 24, 2026
4 checks passed
@11cookies11
11cookies11 deleted the feature/hardware-semantic-layer-v0.1 branch June 24, 2026 15:25
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