Repository navigation
feat(comply): fill TODO fields from a provider answers file - #136
Conversation
`aisbom comply --answers comply.yaml` merges a provider-maintained YAML file into the pack, so answers a scan cannot read are written once and kept across runs. `--write-answers-template PATH` writes a commented starter file with every field id and the scanned components. - Every Annex XI and Article 53 field has a stable id, derived from the builders themselves; docs/comply.md lists all 76. - Answers are tagged (provider-supplied). A scan-read value is never replaced: both are shown, scan first, and the pack README lists them. - The README index counts scan-read, provider-supplied and TODO fields separately. - FDA component-support.csv takes support_level / end_of_support_date per component (matched on name, version, purl, sha256 or bom_ref) and gains an additive support_source column. - Malformed YAML, duplicate keys, unknown ids and bad values fail with exit 1 before the scan, listing every problem. Unmatched component entries and verdict words in provider text are warnings. - The template refuses to overwrite an existing file. - Pack READMEs, the CLI closing line and the main README point users to the workflow; the template links the docs online. - PyYAML declared as a direct dependency (already installed via spdx-tools; lockfile content hash only). TEMPLATE_VERSION 2026-11-15.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 93271c3254
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if write_answers_template: | ||
| Path(write_answers_template).write_text(comply_mod.answers_template(doc)) |
There was a problem hiding this comment.
Reject template paths that collide with generated pack files
When the template path names a pack artifact that does not exist before the run, such as --output-dir pack --write-answers-template pack/sbom.json, the initial existence check passes. The command then writes the SBOM and overwrites it here with YAML, returning success with a corrupted documentation pack. The same issue affects the generated Markdown and FDA artifacts. Reject paths that resolve to pack output files before writing, or create the template exclusively so an artifact created during the run cannot be overwritten.
Useful? React with 👍 / 👎.
… files `--write-answers-template pack/sbom.json` passed the exists check before the scan, then overwrote the freshly written SBOM with YAML. An answers file sitting where the pack writes (e.g. pack/README.md) would likewise be destroyed by the run. Both paths are now resolved against every file the pack writes (VEX and CSV included) and refused with exit 1 before scanning. The template is also created exclusively, so a file that appears during the run is not overwritten. A test keeps the guarded file list equal to what the pack actually writes.
What
aisbom complypacks leave most fields asTODO (provider)because a file scan cannot read them (provider identity, release dates, training process, FDA support dates). Today a provider fills them by hand and the next run overwrites that work.This adds a provider-maintained answers file:
aisbom comply ./models --framework eu-ai-act --write-answers-template comply.yaml # fill in comply.yaml, then on every run: aisbom comply ./models --framework eu-ai-act --answers comply.yamlHow it behaves
docs/comply.md). The id registry is built from the document builders, so ids, docs and template can't drift.(provider-supplied). A value the scan read is never replaced: both appear, scan first, and the pack README lists those fields.componentsentries fillsupport_level/end_of_support_datefor every component that matches all given keys (name,version,purl,sha256,bom_ref).component-support.csvgains an additivesupport_sourcecolumn.1and list every problem. Unknown ids get a "did you mean" suggestion.--write-answers-templaterefuses to overwrite an existing file.Compatibility
--answers, a pack differs frommainonly by the template version line (2026-11-15), a new "Filling in the TODOs" section in the pack README, and the emptysupport_sourceCSV column (checked by diffing old vs new packs fordemo_data).SafeLoadersubclass.Verification
poetry run pytest --cov=aisbom --cov-fail-under=85: 1651 passed, 94.39% (aisbom/comply.py99%). 57 new tests intests/test_comply_answers.py.aisbom bypass-scorecard --checkpasses.--answersand checks the tagged value and README count.