Skip to content

Validate serial and UOID independently - #14

Merged
phryneas merged 3 commits into
remove-known-image-hash-shortcutsfrom
remove-serial-uoid-prefix-check
Sep 7, 2026
Merged

phryneas merged 3 commits into
remove-known-image-hash-shortcutsfrom
remove-serial-uoid-prefix-check

Conversation

@phryneas

@phryneas phryneas commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • remove the undocumented 12-byte equality check between serial.cfg and the HWCONFIG UOID
  • keep the independent serial format, UOID format, JFFS2 CRC, firmware fingerprint, stable-read, and exact identity-preservation checks
  • remove the obsolete prefix result from analysis output and generated manifests
  • add a focused regression test proving that structurally valid identity fields with different prefixes are accepted and preserved
  • align the technical validation and regression documentation with the implemented contract

Safety rationale

The removed check compared two fields inside the same image. It did not bind the image to the physical camera or an earlier trusted backup, and an intact image from another camera would also pass it. The proprietary serial/UOID relationship is unknown, while the builder already preserves the complete HWCONFIG partition and the recovered serial independently and proves that no unintended region changed.

This is stacked on #13 because that PR edits the same validator and documentation. The diff here contains only this identity-validation change.

Decision provenance

This safety/product decision originated from explicit developer input after a user reported a physically successful repair with different serial and UOID prefixes. It was not an autonomous agent decision.

Tests

  • python -m unittest tests.test_implementation -v
  • python -m unittest discover -s tests -v (136 tests)
  • python -m compileall -q cc2flash tests
  • python -m json.tool hardware-recovery/REFERENCE_FINGERPRINTS.json
  • built a preserve-files recovery image successfully from the supplied real cc2flash-backup-v2 archive

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The regression does not verify identity preservation through generated recovery output.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Removes the unsupported serial/UOID prefix relationship while retaining independent identity and firmware validation.

Changes:

  • Removes prefix matching from validation, reports, and manifests.
  • Adds regression coverage for independently valid identities.
  • Updates recovery documentation to reflect the revised contract.
File summaries
File Description
cc2flash/image.py Removes prefix validation and result fields.
tests/test_implementation.py Adds independent identity validation test.
hardware-recovery/TECHNICAL_DETAILS.md Documents independent validation.
hardware-recovery/CC2_RECOVERY_VERIFICATION.md Updates safety and verification guidance.
hardware-recovery/TEST_RESULTS.md Records the new acceptance case.
hardware-recovery/REFERENCE_FINGERPRINTS.json Updates config validation metadata.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/test_implementation.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The regression does not verify removal of the obsolete analysis, report, and manifest outputs.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread tests/test_implementation.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The narrow contract change is consistently implemented, documented, and covered by an end-to-end regression test.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@phryneas
phryneas force-pushed the remove-serial-uoid-prefix-check branch from e567d7a to 1efed60 Compare September 7, 2026 14:40
@phryneas
phryneas force-pushed the remove-serial-uoid-prefix-check branch from 1efed60 to f17ef12 Compare September 7, 2026 15:06
@phryneas
phryneas merged commit 3f1f61e into main Sep 7, 2026
14 checks passed
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.

2 participants