Skip to content

fix: resolve links in templates after Needs are frozen - #982

Merged
antonkri merged 1 commit into
mainfrom
fix/linked-needs-after-freeze
Oct 20, 2026
Merged

antonkri merged 1 commit into
mainfrom
fix/linked-needs-after-freeze

Conversation

@antonkri

Copy link
Copy Markdown
Contributor

Fixes a docs build crash seen in eclipse-score/baselibs#672 with docs-as-code main:

Handler <function _process_report_pies> for event 'doctree-resolved' threw an exception
(exception: Needs have already been post-processed and frozen.)

Cause: since #949 the module report pies count through the score_metrics filter
functions and pass the module version. Those functions run in doctree-resolved, after
Sphinx-Needs has frozen the Needs. With a version set, req_in_report_version resolves
derived_from of a comp_req without valid_from through _get_available_needs(), which
always called get_needs_mutable() and raises in the write phase. Reports without a version
(e.g. reference_integration) never reach that path, which is why it went unnoticed.

Fix: _get_available_needs() uses the read-only get_needs_view() once the Needs are
post-processed, and get_needs_mutable() before (calling get_needs_view() earlier would
freeze them prematurely).

A new test covers both states; it fails with the same RuntimeError without the fix.

get_needs_mutable() raises once Sphinx-Needs has post-processed the Needs.
The score-report-pie handler runs in doctree-resolved, where the status and
coverage filter functions call req_in_report_version for a scoped report. For
a comp_req without valid_from that follows derived_from through
_get_available_needs() and crashed the build. Use the read-only view once the
Needs are frozen.
@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-982: https://eclipse-score.github.io/docs-as-code/pr-982/

@antonkri
antonkri merged commit 1f9452a into main Oct 20, 2026
36 checks passed
@antonkri
antonkri deleted the fix/linked-needs-after-freeze branch October 20, 2026 10:31
antonkri added a commit to eclipse-score/persistency that referenced this pull request Oct 20, 2026
Pin score_docs_as_code via git_override to docs-as-code main at
1f9452a270d238f7504c7a053b3886536234a650, which includes
eclipse-score/docs-as-code#982 (fixes the "Needs have already been
post-processed and frozen" crash of the version-scoped report pies).

Bump score_process_description to 2.2.1 to match the resolved version
and update MODULE.bazel.lock accordingly.
antonkri added a commit to eclipse-score/lifecycle that referenced this pull request Oct 20, 2026
Pin score_docs_as_code via git_override to docs-as-code main at
1f9452a270d238f7504c7a053b3886536234a650, which includes
eclipse-score/docs-as-code#982 (fixes the "Needs have already been
post-processed and frozen" crash of the version-scoped report pies).

Bump score_process_description to 2.2.1 and score_tooling to 2.2.2 to
match the resolved versions and update MODULE.bazel.lock accordingly.
antonkri added a commit to eclipse-score/logging that referenced this pull request Oct 20, 2026
Pin score_docs_as_code via git_override to docs-as-code main at
1f9452a270d238f7504c7a053b3886536234a650, which includes
eclipse-score/docs-as-code#982 (fixes the "Needs have already been
post-processed and frozen" crash of the version-scoped report pies).

Bump score_process_description to 2.2.1 to match the resolved version
and update MODULE.bazel.lock accordingly.
etas-contrib-automation Bot pushed a commit to etas-contrib/score_persistency that referenced this pull request Oct 20, 2026
…lipse-score#537)

* docs: use mod_ver_report need type for module verification report

* chore: pin score_docs_as_code to docs-as-code main

Pin score_docs_as_code via git_override to docs-as-code main at
1f9452a270d238f7504c7a053b3886536234a650, which includes
eclipse-score/docs-as-code#982 (fixes the "Needs have already been
post-processed and frozen" crash of the version-scoped report pies).

Bump score_process_description to 2.2.1 to match the resolved version
and update MODULE.bazel.lock accordingly.
rmaddikery pushed a commit to eclipse-score/logging that referenced this pull request Oct 21, 2026
Pin score_docs_as_code via git_override to docs-as-code main at
1f9452a270d238f7504c7a053b3886536234a650, which includes
eclipse-score/docs-as-code#982 (fixes the "Needs have already been
post-processed and frozen" crash of the version-scoped report pies).

Bump score_process_description to 2.2.1 to match the resolved version
and update MODULE.bazel.lock accordingly.
cameron-craig-etas pushed a commit to etas-contrib/score_lifecycle that referenced this pull request Oct 21, 2026
…lipse-score#820)

* docs: use mod_ver_report need type for module verification report

* chore: pin score_docs_as_code to docs-as-code main

Pin score_docs_as_code via git_override to docs-as-code main at
1f9452a270d238f7504c7a053b3886536234a650, which includes
eclipse-score/docs-as-code#982 (fixes the "Needs have already been
post-processed and frozen" crash of the version-scoped report pies).

Bump score_process_description to 2.2.1 and score_tooling to 2.2.2 to
match the resolved versions and update MODULE.bazel.lock accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants