A correct release folder can still produce the wrong attachment
You have reviewed a PCB release folder, but the ZIP attached to the supplier email was created earlier. Its BOM has the same filename and byte count as the approved one, yet one value is different. Checking the working folder again will not inspect that attachment.
This tutorial adds an archive check to a saved SHA-256 file manifest. The Python program reads each ZIP member without extracting it, compares relative paths, byte counts and hashes, and reports missing, added or changed files. The package includes three reproducible archive examples and fifteen tests. All example files are synthetic text; they are not valid Gerbers, drill data or a manufacturing package. Development and documentation used AI assistance. No fabricated board or electrical test is claimed.
1. Set up the practice package
Download the attached AtlasPCB-PCB-ZIP-Review.zip and extract this tutorial package into a working folder. Open a terminal in pcb-zip-review. You need Python 3.9 or newer; there are no third-party Python packages and the tool makes no network requests. On Windows, use py -3 instead of python3 if that is your Python launcher.
The folder contains release_manifest.py, test_release_manifest.py, baseline.json, a demo-release folder and three small ZIP fixtures. Extracting this tutorial package is separate from the operation being tested: the verify-zip command reads the inner release ZIP directly and does not extract its contents.
2. Understand what the baseline records
The baseline contains a relative path, byte count and SHA-256 digest for every ordinary file in the reviewed folder. It includes nested and hidden files; empty directories are not recorded. It excludes no file by extension. The program does not know which manufacturing files your board needs.
Try creating a separate practice baseline:
python3 release_manifest.py create demo-release practice.json
The command refuses to overwrite an existing output and requires the manifest to be outside the scanned folder. Keep an approved baseline separately from the material being checked. Stop all file editing during scanning; this program does not create an atomic snapshot or lock your design tools.
The baseline is a comparison reference, not a digital signature. Someone who changes both the archive and its baseline can defeat this check. Its usefulness depends on choosing the intended release and controlling the reference independently.
3. Check the matching archive
python3 release_manifest.py verify-zip release-good.zip baseline.json
The supplied example returns:
MATCH: all recorded file bytes match
Comparison only; not authenticity, DFM or production approval.
The exit code is 0. Archive compression and timestamps are not compared. Instead, each member is decompressed as a stream and hashed in memory. The relative filenames and uncompressed bytes are what matter to this comparison.
This is different from hashing the entire ZIP. Two ZIPs can contain identical files but differ in packaging metadata. An archive-level hash is useful when you need to identify the exact transmitted ZIP; this member-level check answers whether its file set matches the reviewed folder.
4. Reproduce three packaging mistakes
python3 release_manifest.py verify-zip release-changed.zip baseline.json
The changed fixture replaces R1,10k with R1,20k in bom.csv, removes release-notes.txt and adds old-drawing.txt. The BOM edit keeps the same byte count. The actual output is:
MISSING: "release-notes.txt"
ADDED: "old-drawing.txt"
CHANGED: "bom.csv"
DIFFERENCES FOUND
Comparison only; not authenticity, DFM or production approval.
The exit code is 1, which is the intended result for this exercise. Review each difference against the controlled release record. A changed hash does not explain whether the change is correct. Do not regenerate the baseline simply to make an unexplained difference disappear.
5. Catch a wrapper-directory mismatch
python3 release_manifest.py verify-zip release-wrapper.zip baseline.json
This archive has unchanged file bytes but adds a release/ directory above every member. The checker reports the original paths as missing and the prefixed paths as added. It deliberately does not guess which leading directory to strip.
Agree on the intended archive layout before generating the baseline and ZIP. If a supplier expects a wrapper folder, prepare the comparison root accordingly. Renaming a file also appears as one missing path and one added path; this program does not infer rename history.
6. Read failures as failures
Exit code 2 means the input could not be checked, such as a malformed ZIP, unreadable path or unsupported record. That result must not be treated as a match. The tutorial reader rejects encrypted entries, symbolic links, duplicate names, case-colliding paths and paths containing parent-directory traversal, backslashes or drive-style colons.
It is intended for small, ordinary ZIPs from your controlled workflow: at most 5,000 entries, 50 MiB per file and 200 MiB of total declared uncompressed file data. These limits are implementation choices, not PCB requirements. Empty ZIPs and empty baseline folders are rejected. This utility is not a malware scanner or a sandbox for hostile archives.
7. Run the tests and keep a release record
python3 -m unittest -v test_release_manifest.py
All fifteen test methods passed during preparation. The checks include a known SHA-256 value, a same-size edit, missing and added files, nested and hidden files, baseline overwrite protection, malformed manifests, matching ZIP contents, wrapper directories, duplicate names, case collisions, unsafe paths, symbolic links and invalid archives. The three example ZIP commands were also run separately with expected exit codes 0, 1 and 1.
For a real handoff, save the controlled baseline, the exact ZIP being sent, the command output, the design revision and the human disposition together. Check the final attachment after packaging. Continue the separate engineering checks for layer mapping, drill units, BOM variant, placement orientation, stackup, fabrication notes and supplier requirements.
A matching archive can still contain an identically wrong design. The tool does not interpret Gerber geometry, verify a circuit, approve a component substitution or decide manufacturability.
Author and disclosure
Prepared by Diana Ren at AtlasPCB, a PCB sourcing and supply-chain partner. This project extends a folder-manifest workflow to the final ZIP handoff. The source and practice files are attached so readers can reproduce the exercise without visiting the company website.