docs: add a datasheet-aware code-review agent skill - #73
felipebalbi wants to merge 3 commits into
Conversation
Reviewers checking this driver against the hardware have had to fetch and re-extract SBOS663A by hand, which makes every citation a section number nobody can mechanically re-check, and leaves an automated reviewer dependent on network access and on pdftotext being installed. Commit the extract instead. It is pdftotext -layout output with CRLF normalised to LF, so line numbers are stable and register tables stay on greppable lines. The directory is docs/vendor/ rather than a datasheet- specific path so application notes, errata and layout guides can join it. Cargo.toml uses an include allowlist, so the extract does not ship to crates.io. Source: https://www.ti.com/lit/ds/symlink/tmp108.pdf Revision: SBOS663A, April 2013, revised September 2019 PDF sha256: ec086250fc4331e7fc923be62173062bbf0fccedad6894c2741b73cd1c084556 Assisted-by: opencode:claude-opus-5 [pdftotext]
bc6c71d to
3ce5baf
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The datasheet reproduction requires permission or a compliant alternative, and several skill-guidance corrections remain.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 3
Open (3)
What changed in this PR
Adds an offline TMP108 datasheet extract and a repository-specific Copilot code-review skill.
Changes:
- Adds citation-ready vendor documentation.
- Adds hardware, repository-invariant, and supply-chain review guidance.
| File | Summary |
|---|---|
docs/vendor/datasheet.txt |
Adds the extracted TMP108 datasheet. |
.github/skills/code-review/SKILL.md |
Defines repository-specific review procedures and checks. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Copilot reviewed OpenDevicePartnership#73 using the skill and found three places where it describes the repository more strictly than the repository is. Each one would have made a reviewer following the skill file a finding against code that is deliberate. Autofix in 1a3e944 addressed all three; this refines two of them and keeps its hardening of the third. The crate is not unsafe-free: src/inner.rs carries 24 unsafe items, including unsafe impl Fieldset and device_driver::ops::load, covered by the scoped allow block on mod inner at src/lib.rs:54-59. Autofix corrected the claim but left the adversarial bullet telling reviewers to challenge *any* allow attribute, which is what would actually have produced the false positive. Narrow it to a widened allowance, and name the sanctioned block so it is not re-litigated on every PR. The # Examples requirement is on methods. Autofix's 'public methods and other user-facing APIs carry appropriate doctests' restates the same ambiguity that caused the finding; say methods, and record that Config and Tmp108 are correct as they stand. Keep autofix's hardened curl invocation and sha256sum --check, and add the explicit failure path: lit/ds/symlink/ is unversioned, so a regeneration that silently succeeds against a replaced revision invalidates every line anchor in this skill, in past reviews and in docs/superpowers/specs/. Also replace the CRLF-normalisation comment with the sed that actually performs it. Re-ran the seeded-malicious-diff review: all nine findings still fire, the existing scoped allow is still not reported, and the new crate-wide allow still is. Assisted-by: opencode:claude-opus-5
There was a problem hiding this comment.
Just checking: Are we sure it's legal to have this copy here? The datasheet says:
These resources are subject to change without notice. TI grants you permission to use these resources only for development of an application that uses the TI products described in the resource. Other reproduction and display of these resources is prohibited.
Though I'm no lawyer of course so dunno.
There was a problem hiding this comment.
yup, that needs to be answered :-) Asked our lawyers for comment. Keeping it as a draft for now.
GitHub Copilot code review reads agent skills from .github/skills on the head branch, and prefers review-focused directory names such as code-review. Without one it reviews this crate as generic Rust: the reviews on OpenDevicePartnership#48, OpenDevicePartnership#69 and OpenDevicePartnership#71 produced sound style comments but not a single citation of the datasheet and no supply-chain observation, even on a diff that changed the trusted-publishing workflow. The skill orients a reviewer in the crate, points every hardware claim at a line in docs/vendor/*.txt with a verbatim quote, lists the TMP108 facts worth checking against a diff, restates the invariants from AGENTS.md as things a diff can violate, and adds an adversarial pass for build scripts, workflow privilege, dependency provenance and lint suppression. A known-non-findings section records the deliberate choices -- the blocking/async duplication, the generated inner.rs, the measured 0x7FF8 reset that contradicts Table 11 -- so they are not filed as bugs. Two boundaries are drawn deliberately, because getting either wrong turns the skill into a source of false positives against code that is correct. The crate is not unsafe-free: src/inner.rs carries unsafe impl Fieldset and device_driver::ops::load under the scoped allow block on mod inner at src/lib.rs:54-59, so the adversarial pass asks about a *widened* lint allowance rather than any allowance at all. The # Examples requirement is on methods; Config and Tmp108 are documented without examples and are correct. Verified with three review runs against seeded diffs: three planted datasheet violations were all caught with line anchors, seven planted malicious constructs were all flagged, and a correct diff that trips the known non-findings drew no false positives. A fourth run confirmed the narrowed lint wording still reports a new crate-wide allow while leaving the sanctioned mod inner block alone. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Assisted-by: opencode:claude-opus-5
A TI field applications engineer reviewed the reproduction and read it as fair use, on two conditions: that the directory say plainly it is a reproduction kept for AI-based code review, and that it link to TI's official documents. Both are cheap, and both make the directory easier to understand for a human arriving at it cold. Add docs/vendor/README.md carrying that notice. It also carves the directory out of the repository's MIT license -- the extracts remain TI's copyright, which the license would otherwise appear to claim against them -- names TI's product folder, datasheet and terms of use as the authoritative sources, and records that the vendor's own notices are reproduced verbatim with nothing removed. Move the provenance and regeneration procedure there from the skill, so they live in one place. The split is the honest one: the skill governs how a reviewer cites an extract, the README how a maintainer produces one. The skill now points at it and keeps only the citation contract. The include allowlist in Cargo.toml anchors /README.md to the package root, so this file is not published either; cargo package --list reports 14 files and no docs/vendor/ content. Note the FAE asked for wording about AI-based review specifically. The README says the extracts serve automated review agents principally and the humans checking their citations, because that is what happens -- worth re-confirming with him if he wants it narrower. Assisted-by: opencode:claude-opus-5
0d6c136 to
6f8324f
Compare

GitHub Copilot code review reads agent skills from
.github/skillson thehead branch, and is more likely to use a skill whose directory name is
review-focused —
code-reviewis the name it looks for. Without one itreviews this crate as generic Rust.
The gap this closes
Copilot has already reviewed #48, #69 and #71 with no skill present. Its
comments were sound —
debug_assert!versusassert!,as i16truncation, a changelog line gone stale — but across all three reviews
there was not one citation of the datasheet and not one
supply-chain observation, including on #69, which changed the
release-plz workflow and the crates.io trusted-publishing path.
This driver's correctness is defined by SBOS663A. A reviewer that never
opens it can only check the code against taste.
What is here
docs/vendor/datasheet.txt— the TMP108 datasheet extracted withpdftotext -layout, CRLF normalised to LF, so line numbers are stableand register tables stay on greppable lines. Committing it means a
reviewer needs neither network access nor poppler installed, and every
citation becomes an anchor anyone can re-check with
grep.The directory is
docs/vendor/rather than a datasheet-specific path sothat application notes, errata, reference manuals or layout guides can
join it later; the skill globs
docs/vendor/*.txtand treats whatever itfinds as in scope.
Cargo.tomluses anincludeallowlist, so theextract does not ship to crates.io.
sha256:ec086250fc4331e7fc923be62173062bbf0fccedad6894c2741b73cd1c084556.github/skills/code-review/SKILL.md— the skill itself:AGENTS.md, then the matching spec indocs/superpowers/specs/via a topic→spec map, thentmp108.ddsl,then
mod ops. A comment that contradicts a spec is a false positive.docs/vendor/<file>.txt:<line>anchor and a verbatim quote. A factthat is not in the extract is not asserted.
address strapping, pointer values, the 12-bit MSB-first twos-complement
encoding, the configuration POR bytes,
M1/M0(continuous isM1 = 1alone, so
0b10and0b11both mean continuous), the one-shotlifecycle,
CR/HYS/POL/TM, the destructive configuration read,the comparator release band, limit POR values, the SMBus alert-response
cause bit, general call, and the bus timeout.
generated
src/inner.rs, blocking/async parity throughmod ops, theasync |t| { … }closure shape, exact feature gating, the pinnedre-export list, release-plz's ownership of the version and changelog,
README snippet extraction, and
cargo-vetcoverage for newdependencies.
ones: build scripts, workflow privilege escalation, dependency
provenance, lint suppression, unicode that does not render as it reads,
and tampering with the trusted-publishing path. Findings are framed as
risk that needs justifying in the PR, not as accusations of intent.
the blocking/async duplication, the generated
inner.rs, therust,ignoreREADME fences, the intentional pico-de-gallo minor-versionmismatch, the un-bumped
Cargo.tomlversion, and the0x7FF8T_HIGHreset that contradicts Table 11 but was confirmed on silicon.
Verification
Every one of the 42 datasheet line anchors in the skill was checked to
resolve to the text it claims.
The skill was then run against three seeded diffs by a reviewing agent:
POR_CONFIG, swapped 2 °C/4 °C hysteresis, byte-reversedt-lowresetbuild.rs,pull_request_targetwithcontents: write/id-token: writechecking out PR code, forked action pluscurl | sh, unsoundunsafebehind#![allow(unsafe_code)], host-endian decode, aserde_jsomtyposquat and a git-branch dependency, an unjustified[[trusted]]entry--lockeddropped from CI and a crate-wide pedantic allowance.Notes for reviewers
case — requesting a Copilot review here exercises the skill before it
is merged.
.github/skills/is Copilot-specific. opencode, Claude Code and GeminiCLI look in
.opencode/skills/,.claude/skills/and.agents/skills/and will not discover this. Happy to add a copy or pointer under
.agents/skills/if we want the same review protocol available tolocal agents.
existing CI matrix is unaffected.
Assisted-by: opencode:claude-opus-5 [pdftotext]