Skip to content

fix(manifest): reject a manifest that is not a mapping - #1185

Merged
yakew7 merged 1 commit into
yakew7:mainfrom
bfs2021:fix/1177-non-mapping-manifest
Oct 25, 2026
Merged

yakew7 merged 1 commit into
yakew7:mainfrom
bfs2021:fix/1177-non-mapping-manifest

Conversation

@bfs2021

@bfs2021 bfs2021 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Problem

faircode benchmark with an empty manifest, or with a file passed by mistake (a CSV), reached data.get(...) on None or on a string and died with AttributeError and a full traceback:

$ : > m.yaml; python3 -m faircode benchmark m.yaml
AttributeError: 'NoneType' object has no attribute 'get'

Fixes #1177.

Fix

load_manifest checks that the parsed document is a mapping and raises the same ValueError the other schema errors use:

error: m.yaml: the manifest must be a mapping of keys to values, got NoneType

The CLI's existing ValueError handling then prints one error: line and exits 2. run_benchmark's path prefix does not double up because the message already starts with the path.

Testing

  • tests/test_manifest.py: empty file and non-mapping document both raise ValueError with "must be a mapping".
  • tests/test_cli.py: both inputs exit 2, print one error: line with the path, and no Traceback.
  • All four new tests fail on the previous manifest.py (verified by reverting it only).
  • pytest tests/test_manifest.py → 53 passed; pytest tests/test_cli.py -k benchmark → 23 passed.
  • ruff check on the three files → clean.

An empty file parses to None and a CSV passed by mistake parses to a
string; both reached data.get() and died with AttributeError and a
traceback. load_manifest now raises the same ValueError the other schema
errors use, so the CLI prints one error line and exits 2.
@vercel

vercel Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

@bfs2021 is attempting to deploy a commit to the yashkewlani2020-gmailcom's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown

@yakew7 @ahmdkaml - new PR touching a path you own, please review.

@yakew7
yakew7 merged commit d792049 into yakew7:main Oct 25, 2026
18 of 19 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.

faircode benchmark crashes with a traceback when the manifest is empty or not a mapping

2 participants