Skip to content

♻️ Auto-compute certain need fields #1496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 18, 2025
Merged

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Aug 18, 2025

A number of need fields are actually data that is based on other data:

  • is_need / is_part are based on whether the item is a NeedItem or NeedPartItem instance
  • is_modified is based on if modifications > 0
  • id_parent / id_complete are based on the id (and part id if NeedPartItem)
  • section_name is the first item in sections
  • parent_need is the first item in the parent_needs links
  • constraints is the keys of constraints_results
  • constraints_passed is derived from constraints_results

These are mainly there for user convenience when writing filters, but are not necessary to specify independently, and could lead to inconcistencies in the data.

Therefore, these fields are now auto-computed when initialiasing/modifying the need, rather than being allowed to be specified / modified independantly.

Copy link

codecov bot commented Aug 18, 2025

Codecov Report

❌ Patch coverage is 91.54930% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.79%. Comparing base (4e10030) to head (7dd47fa).
⚠️ Report is 150 commits behind head on master.

Files with missing lines Patch % Lines
sphinx_needs/need_item.py 85.71% 5 Missing ⚠️
sphinx_needs/directives/need.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1496      +/-   ##
==========================================
+ Coverage   86.87%   88.79%   +1.91%     
==========================================
  Files          56       68      +12     
  Lines        6532     8640    +2108     
==========================================
+ Hits         5675     7672    +1997     
- Misses        857      968     +111     
Flag Coverage Δ
pytests 88.79% <91.54%> (+1.91%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chrisjsewell chrisjsewell merged commit 6f90e99 into master Aug 18, 2025
20 checks passed
@chrisjsewell chrisjsewell deleted the computed-need-fields branch August 18, 2025 13:20
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