Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ docs/evaluation/** -text whitespace=cr-at-eol

# The self-contained example carries byte-bound CAD/library/source receipts.
examples/gpio-indicator/** -text
examples/** -text whitespace=cr-at-eol
docs/demos/** -text whitespace=cr-at-eol
# These captured Rover inputs are already LF in Git. Keep their checkout bytes
# stable on Windows without rewriting existing CAD or archived source content.
projects/rover-pdb/buck-motor.kicad_sch text eol=lf
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@ jobs:
tests/test_package_smoke.py tests/test_toolchain.py tests/test_doctor.py
tests/test_cli_encoding.py tests/test_demo.py tests/test_demo_change.py tests/test_project.py
tests/test_evaluate.py tests/test_media_evidence.py tests/test_media_publication.py tests/test_check_readme.py
tests/test_check_examples.py
tests/test_state.py tests/test_status_cli.py tests/test_update_guard.py
tests/test_transaction.py tests/test_cleanup.py tests/test_release.py
tests/test_stock.py tests/test_sch_io_multiline.py
tests/evidence/test_archive.py tests/evidence/test_index.py
tests/evidence/test_git_archive.py tests/evidence/test_checks.py
tests/review/test_signoff.py tests/review/test_registry.py
tests/review/test_report.py tests/review/test_report_html.py tests/review/test_commands.py
tests/review/test_views.py
tests/schematic/test_intent.py tests/layout/test_layout_intent.py
tests/layout/test_official_footprint_provenance.py
- name: Build both wheels and verify clean external installation
Expand All @@ -50,5 +53,13 @@ jobs:
run: uv run --locked python tools/check_readme.py
- name: Disposable fault evaluation without native tools
run: uv run --locked python tools/evaluate.py
- name: Example sources, exact-part coverage and recorded native artifacts
run: uv run --locked python tools/check_examples.py
- name: Verify all four offline handovers against saved sources
run: |
uv run --locked pcb-copilot verify-report docs/demos/gpio-review --project examples/gpio-indicator
uv run --locked pcb-copilot verify-report docs/demos/i2c-review --project examples/i2c-sensor
uv run --locked pcb-copilot verify-report docs/demos/rs485-review --project examples/rs485-interface
uv run --locked pcb-copilot verify-report docs/demos/usb-c-review --project examples/usb-c-power
- name: Media encoding failure and source-change recovery
run: uv run --locked --group media pytest -q tests/test_media_renderers.py
250 changes: 122 additions & 128 deletions README.md

Large diffs are not rendered by default.

40 changes: 27 additions & 13 deletions docs/EVALUATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ The quick mode needs no KiCad executable and should finish quickly on a normal
development machine. Measured durations belong to individual runs; the harness
does not establish performance superiority or a guaranteed runtime.

To exercise a real native preview before invalidating its candidate:
To exercise real native previews before changing a candidate, saved schematic
or saved rule file:

```sh
uv run pcb-copilot doctor
uv run python tools/evaluate.py --native
```

Native mode requires the supported KiCad 10 toolchain. It may take longer.
If native mode is not requested, its two cases are explicitly skipped. If it is
If native mode is not requested, its six cases are explicitly skipped. If it is
requested but cannot run, that is an execution error, not a passed case.

Both commands print the retained external directory containing `report.md`,
Expand All @@ -35,18 +36,22 @@ An existing directory is rejected; the harness does not overwrite owner files.

## Recorded Windows run

The [2026-10-29 run](evaluation/2026-10-29/report.md) observed all **9 enabled
expectations** in **14.72 seconds**, using Python 3.13.14 and KiCad 10.0.6 on
Windows. Two archive/footprint controls and one native-preview control passed;
six deliberately invalid requests were rejected with their expected diagnostics.
The [2026-10-29 run](evaluation/2026-10-29/report.md) observed all **13 enabled
expectations** in **38.15 seconds**, using Python 3.13.14 and KiCad 10.0.6 on
Windows 11. Five valid controls passed: archive verification, footprint resolution
and three independent native previews. Eight deliberately invalid requests were
rejected with their expected diagnostics, including candidate, saved-schematic
and saved-rule changes after their respective successful previews.
All 42 declared source input entries and the evaluated implementation stayed
unchanged. This is one run of the declared cases below, not a general accuracy
or speed claim.

The published [machine-readable record](evaluation/2026-10-29/evaluation.json)
includes exact commands, source/implementation hashes, injected-fault details,
process timings and environment. Its adjacent `logs/` retain the raw output
bytes. Disposable CAD copies and generated preview trees remain external; rerun
process timings and environment. Its adjacent `logs/` retain all **26 raw output
streams**, including empty streams as zero-byte files. Candidate and snapshot
input hashes were preserved after each deliberate injection. Disposable CAD
copies and generated preview trees remain external; rerun
the command to obtain a complete local packet for inspection.

## Declared cases
Expand All @@ -62,11 +67,17 @@ the command to obtain a complete local packet for inspection.
| Changed native MPN | `resolve_footprint` | Selected native part and receipt identity disagree |
| Native preview control, optional | `pcb-copilot update-schematic --candidate …` | A genuine successful unapplied native preview and binding are returned |
| Candidate changed after preview, optional | Same public command with `--apply` | Matching-preview guard rejects the changed candidate; exit 2 |

Each independent quick case starts from a fresh exact snapshot. The native
preview and subsequent invalidation case deliberately share one disposable
workspace. The candidate change adds one trailing newline after the actual
preview: it demonstrates byte-bound authorization, not a circuit mistake.
| Saved-schematic preview control, optional | A new independent native snapshot and preview | Successful preview binds the exact saved source, candidate and options |
| Saved schematic changed after preview, optional | Same public command with `--apply` | Matching-preview guard rejects the later saved source bytes; exit 2 |
| Saved-rule preview control, optional | A new independent native snapshot and preview | Successful preview binds the exact saved source, candidate and options |
| Saved `.kicad_dru` changed after preview, optional | Same public command with `--apply` | Matching-preview guard rejects the later companion-rule bytes; exit 2 |

Each independent quick case starts from a fresh exact snapshot. Each native
control and its dependent stale-input trial share one disposable workspace;
the three pairs use separate snapshots and candidates. A dependent rejection
is skipped if its own real successful matching preview was not obtained.
All three faults append one trailing newline after the actual preview. They
demonstrate byte-bound authorization without changing circuit or rule semantics.
No preview authorization or human sign-off record is fabricated.

The direct API cases are explicitly labeled `validator-api`. They establish
Expand All @@ -83,6 +94,9 @@ fault target, environment and before/after input hashes. It also fingerprints
the evaluated Python implementation. Source inputs and implementation are
checked again at the end; a changed source or implementation invalidates the run.
The checker must preserve each snapshot's inputs after the deliberate injection.
Native controls and rejections must also preserve every declared input of their
separate candidate project. Candidate and fault-target hashes are checked after
the command; a matching rejection diagnostic cannot conceal a candidate write.

Harness exits are:

Expand Down
64 changes: 64 additions & 0 deletions docs/HANDOVER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Portable review handover

Make a source-bound inspection packet from saved KiCad CAD:

```sh
uv run pcb-copilot report examples/gpio-indicator --output /path/to/new/handover
```

Use a new directory outside the source project. On Windows, for example,
`--output C:/work/gpio-handover`. Existing directories and symlinks/junctions
are rejected. Save the current design first: unsaved KiCad buffers cannot be
captured. Native generation requires the toolchain described in
[Quickstart](QUICKSTART.md).

Open `index.html` in a browser. It works offline and includes every exported
schematic page, assembly, top copper and mirrored underside, plus the complete
review findings and captured source ledger. Search checks, filter their result
or kind, enlarge a native view, or download the embedded vector schematic PDF.
The views, findings and hashes remain readable with JavaScript disabled.

The report runs the registered review on an isolated copy and exports images
from a separate input-identical snapshot. It rechecks the source before and
after publication. It applies no CAD changes and creates no human decisions.
A blocked review still produces an inspectable packet and returns **1**.
Generation errors return **2**. A report with no registered blocker returns
**0**, which is not fabrication approval.

## Verify a received packet

Verification needs the Python package, without KiCad or a browser:

```sh
uv run pcb-copilot verify-report /path/to/handover
uv run pcb-copilot verify-report /path/to/handover --project examples/gpio-indicator
```

The first command checks the complete artifact inventory, byte counts and
SHA-256 values, plus agreement between source and review records. The second
also compares the current saved project's entire declared input ledger.
It returns **1** if that saved project differs; an invalid or incomplete packet
returns **2**. Integrity verification can return **0** for a report whose
engineering review is blocked: these are separate results in the JSON output.

`index.html` is self-contained; the whole directory additionally retains the
original vector PDF, full-resolution PNGs, `review.json`, `source.json` and
`manifest.json`. Keep the entire directory for command-line verification.
The manifest is published last. A forcibly terminated process can leave a
partial directory; a missing/invalid manifest must not be treated as complete.
Handled failures remove only unchanged files created by that operation. A
concurrent owner file is retained and its directory is identified in the error.

These hashes establish recorded byte identities. They do not attest who ran
the checks, prove that a reviewer inspected correctly, or qualify the hardware.
Source paths identify evidence available in the design; the packet does not
redistribute every source document or live-update when CAD changes. See
[Limitations](LIMITATIONS.md) and the [review workflow](WORKFLOW.md#4-review-and-record-human-decisions).

## Recorded example

The [GPIO review packet](demos/gpio-review/index.html) contains a real native
KiCad capture and current review findings. Download `index.html` to inspect it
offline; GitHub's source viewer does not execute it. Its
[manifest](demos/gpio-review/manifest.json) and [review JSON](demos/gpio-review/review.json)
make the captured scope inspectable. The board remains an unbuilt DRAFT.
6 changes: 6 additions & 0 deletions docs/QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ a Python interpreter that can import KiCad's `pcbnew` bindings. `uv sync`
installs this repository's Python dependencies; it does not install KiCad or
its Python bindings.

For an offline visual handover after setup, run
`uv run pcb-copilot report examples/gpio-indicator --output NEW_EXTERNAL_DIRECTORY`.
Open its `index.html` to inspect native views and filter actual review findings.
The [handover guide](HANDOVER.md) explains generation, blocked results and
verification without KiCad.

The current development environment is Windows with KiCad 10. Linux and macOS
tool discovery exists, but an end-to-end platform test matrix is still pending.

Expand Down
15 changes: 14 additions & 1 deletion docs/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Next work:
Done when a fresh environment can follow one documented path to current review
artifacts, with expected review blockers distinguished from environment failures.

## 2. Qualify the small reference project
## 2. Qualify the reference projects

Implemented: [the four-channel GPIO indicator](../examples/gpio-indicator/README.md)
has its own requirements, exact source evidence, editable native schematic and
Expand All @@ -43,6 +43,14 @@ Resolve assembly rotation contracts and the project's human decisions against
the exact design being reviewed. Add a clean-environment reproduction of the
documented change proof.

Implemented next examples: [USB-C power](../examples/usb-c-power/README.md),
[I²C temperature](../examples/i2c-sensor/README.md) and
[RS-485](../examples/rs485-interface/README.md) each retain native CAD, exact
part evidence, routed copper, full-page visual review and hashed native outputs.
The USB-C footprint exposes eight unresolved manufacturing-geometry findings;
the other two have clean native ERC/DRC and parity. These are still unbuilt
prototypes with open supplier assembly and human decisions.

Done when the procedure reproduces offline from the archived inputs and the
remaining engineering results have measured evidence. Owner boards and frozen
regression fixtures retain their existing scope; demo runs keep release
Expand All @@ -68,6 +76,11 @@ the published inputs, procedure and results.

## 4. Make agent-assisted changes easier to inspect

Implemented: [portable offline handovers](HANDOVER.md) keep every native sheet
and board view together with scoped findings and the captured source ledger.
The verifier checks packet bytes, embedded native images/review consistency,
and optional current-project identity without requiring KiCad.

Use the existing CLI and native-candidate workflow as the integration boundary.
Document one complete agent-assisted task: read requirements and source
evidence, prepare a scoped candidate, inspect the check results and rendered
Expand Down
13 changes: 13 additions & 0 deletions docs/WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@ Each result names its scope. A failed check does not hide later results.
Optional `--output` creates a new JSON/Markdown report
under `.pcb-copilot/reports/` without overwriting earlier reports.

For a portable visual handover, `pcb-copilot report PROJECT --output NEW_DIRECTORY`
runs current review and captures native schematic/assembly/copper views on
isolated copies. The self-contained `index.html` keeps findings, check scopes
and source hashes together. `verify-report DIRECTORY --project PROJECT`
checks both packet integrity and whether the current saved inputs still match.
See [the handover guide](HANDOVER.md). Viewing a packet records no approval.

`prepare-signoff` creates an unsigned `review-signoff.yaml` only when absent.
The shared policy always adds `shared.schematic-readability` and
`shared.layout-handover` to the local profile. These require actual inspection
Expand Down Expand Up @@ -268,6 +275,12 @@ review. Missing rotation coverage/models or missing/stale supplier review blocks
release. The file is included in source and sign-off fingerprints. See
[the assembly workflow](JLCPCB_ASSEMBLY.md) for editing and review instructions.

Publication directories, their ancestors and the operation workspace must be
ordinary contained paths. Symlinks and Windows junctions are rejected so a
preview or release cannot redirect replacement into an unrelated owner folder.
Source hashes are checked before returning a blocked result as well as before
publication. A concurrent source edit requires rerunning on the saved design.

Review independently runs the dated JLCPCB two-layer / 1 oz / green-mask geometry
baseline on a disposable copy. It cannot be weakened by project exclusions or
ignored manufacturing errors. The normal project DRC also runs. Release includes
Expand Down
Binary file added docs/demos/gpio-review/assembly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/demos/gpio-review/bottom-copper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading