Skip to content

refactor: remove deprecated source code linker cache - #803

Open
AlexanderLanin wants to merge 2 commits into
eclipse-score:mainfrom
AlexanderLanin:cleanup/remove-deprecated-source-linker-cache
Open

refactor: remove deprecated source code linker cache#803
AlexanderLanin wants to merge 2 commits into
eclipse-score:mainfrom
AlexanderLanin:cleanup/remove-deprecated-source-linker-cache

Conversation

@AlexanderLanin

@AlexanderLanin AlexanderLanin commented Sep 3, 2026

Copy link
Copy Markdown
Member

Why

PR #358 introduced the Bazel-generated sourcelinks_json input and deprecated the extension-generated score_source_code_linker_cache.json path. The deprecated path left duplicate source-linking logic in the extension and made it unclear which component owns source scanning. This change simplifies the extension around the current Bazel-generated input.

Open question

PR #358 retained the old path for compatibility, although I cannot think of any reason to do so. As its only used internally no-one can notice whether the compatibility layer even exists. So was there a reason? Was there doubt that the bazel way is better? Is it? We can also remove the other way of parsing. But having two parsing paths increases complexity for follow-up work significantly.

What changed

  • Remove extension-side workspace scanning and generation of score_source_code_linker_cache.json.
  • Move the source-file parser into scripts_bazel, where its only consumer lives.
  • Resolve the pre-generated source-links input once during the combine step, supporting both bazel run and needs_json.
  • Update integration fixtures and documentation for the current flow.

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.

🟡 Changes recommended

The new combine-step input resolution can fail with an unhelpful FileNotFoundError when misconfigured, and should provide a clearer, actionable error message.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR removes the deprecated extension-side workspace scanning path for source links and consolidates the source-link generation/parsing flow around the Bazel-generated sourcelinks_json input, simplifying ownership and reducing duplicated logic in the Sphinx extension.

Changes:

  • Remove extension-generated score_source_code_linker_cache.json generation and related live-preview cleanup.
  • Update the Sphinx extension to consume pre-generated source links via SCORE_SOURCELINKS / score_sourcelinks_json, and continue gracefully when no input is provided.
  • Move the source-file parsing helper into scripts_bazel and update integration tests/docs to match the new flow.
File summaries
File Description
src/incremental.py Removes live-preview deletion of the deprecated source-linker cache file.
src/extensions/score_source_code_linker/init.py Drops extension-side scanning/generation and resolves pre-generated source links during combine.
src/extensions/score_source_code_linker/generate_source_code_links_json.py Removes the deprecated extension-side source scanning/generation module.
src/extensions/score_source_code_linker/tests/test_source_code_link_integration.py Updates integration fixture setup to provide pre-generated source links via env var.
src/extensions/score_source_code_linker/tests/test_repo_source_link_integration.py Adds a pre-generated source_links.json fixture and wires it into the Sphinx app setup.
src/extensions/score_source_code_linker/tests/test_codelink.py Adjusts unit tests for the new cache/input expectations and adds coverage for “no source links provided”.
src/extensions/docs/source_code_linker.md Updates documentation to reflect the parser move into scripts_bazel.
scripts_bazel/source_code_link_parser.py New shared parser module used by the Bazel source-links generator.
scripts_bazel/generate_sourcelinks_cli.py Switches to the new parser module instead of importing private extension helpers.
scripts_bazel/BUILD Adds the new parser module to the Bazel py_binary sources.
Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 1
  • Review effort level: Lite

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

Comment thread src/extensions/score_source_code_linker/__init__.py
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

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

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.

🟡 Changes recommended

Live preview can retain stale derived caches and ignore newly generated source links.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 1
  • Review effort level: Balanced

"Generating new one"
)
build_and_save_combined_file(app.outdir)
build_and_save_combined_file(app.outdir, app)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We investigated this behavior in detail. The stale-cache observation is technically valid, but it predates this pull request and is unrelated to removing the deprecated source-code-linker cache.

In live preview, incremental.py sets skip_rescanning_via_source_code_linker=1. The existing guards in both setup_combined_linker() and setup_repo_linker() then retain score_scl_grouped_cache.json and score_repo_grouped_scl_cache.json whenever those files already exist. Since _build persists between live-preview runs, changed source-links input can therefore remain unapplied.

Those guards are unchanged on the base branch. PR #803 only removes the extension-side generation/deletion of score_source_code_linker_cache.json; that old file was separate from both derived caches and its deletion never invalidated them. The Bazel-provided SCORE_SOURCELINKS flow was already in place before this PR.

So this is a real cache-lifecycle issue, but not a regression introduced by this cleanup. It would be better handled as a separate follow-up, either by removing the derived JSON handoff entirely and keeping the grouped data in memory, or by adding explicit invalidation for the derived caches.

@AlexanderLanin AlexanderLanin changed the title Remove deprecated source code linker cache refactor: remove deprecated source code linker cache Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants