8000 Rudimentary validation of parsed citations by danielhollas · Pull Request #547 · aiidalab/aiidalab · GitHub
[go: up one dir, main page]

Skip to content

Rudimentary validation of parsed citations - #547

Merged
danielhollas merged 6 commits into
mainfrom
validate-citations
Oct 5, 2026
Merged

danielhollas merged 6 commits into
mainfrom
validate-citations

Conversation

@danielhollas
@danielhollas danielhollas commented Oct 5, 2026 •
Copy link
Copy Markdown
Contributor

Utilize the exiting SimpleCitation and StandardCitation dataclasses as a very rudimentary validation of the citations data parsed from setup.cfg. This at the very least ensures that all mandatory fields are present.

I originally wanted to convert the types to these dataclasses as well, but that doesn't quite work, as the bots have pointed out (see Copilot comments below)

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.

Copilot review overview

🟡 Changes recommended

Valid non-list JSON can crash parsing, and serialized application citations do not match the new dataclass annotations.

Review effort: Balanced
Findings: 3 Medium severity

Open (3)
What changed in this PR

Converts parsed citation dictionaries into existing citation dataclasses for validation.

Changes:

  • Instantiates typed citation objects during metadata parsing.
  • Updates citation type annotations.
  • Adds tests for valid, minimal, and invalid citations.
File Description
aiidalab/​metadata.py Parses citations into dataclasses.
aiidalab/​app.py Updates the application citation annotation.
tests/​test_metadata.py Expands citation parsing tests.

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

Comment thread aiidalab/app.py Resolved
Comment thread aiidalab/metadata.py Resolved
Comment thread aiidalab/metadata.py Resolved
@danielhollas
danielhollas marked this pull request as draft October 5, 2026 01:22
danielhollas and others added 2 commits October 5, 2026 02:23
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@danielhollas
danielhollas requested a balanced review from Copilot October 5, 2026 01:42
8000
@danielhollas
danielhollas marked this pull request as ready for review October 5, 2026 01:42
@danielhollas danielhollas changed the title Convert parsed citations into dataclasses Rudimentary validation of parsed citations Oct 5, 2026
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.

Copilot review overview

🔵 Needs a closer look

The top-level citation shape check inspects the wrong variable, allowing valid non-list JSON to fail or crash.

Review effort: Balanced
Findings: None

Resolved since last review (3)

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.

Copilot review overview

🟡 Changes recommended

Newly added validation can emit misleading diagnostics for rejected citations.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Previously missed (2)

In code that hasn't changed since last review

Medium severity Simple citation validation errors are discarded

aiidalab/​metadata.py:167

The SimpleCitation exception is discarded, so every malformed simple citation is diagnosed using the unrelated StandardCitation failure. For the new test's second entry, the actual unsupported invalid field is hidden and the log instead claims that text is unexpected. Dispatch using the citation-shape marker or include both validation failures so the warning identifies the real problem.

Low severity Remove redundant duplicate assertion

tests/​test_metadata.py:285

This repeats the assertion already made on line 281, so it does not add coverage and can be removed.

Comment thread aiidalab/metadata.py Resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@edan-bainglass edan-bainglass left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @danielhollas. LGTM!

@codecov
codecov Bot commented Oct 5, 2026 •
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.27%. Comparing base (ee680e1) to head (8b817c4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #547      +/-   ##
==========================================
+ Coverage   76.06%   76.27%   +0.21%     
==========================================
  Files          18       18              
  Lines        1763     1779      +16     
==========================================
+ Hits         1341     1357      +16     
  Misses        422      422              
Flag Coverage Δ
py-3.12 76.27% <100.00%> (+0.21%) ⬆️
py-3.14 76.17% <100.00%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danielhollas
danielhollas merged commit acbd7b7 into main Oct 5, 2026
9 checks passed
@danielhollas
danielhollas deleted the validate-citations branch October 5, 2026 12:21
@danielhollas danielhollas added the enhancement New feature or request label Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0