Skip to content

Remove orphaned Lua filter entry points (quarto-pre.lua, crossref-standalone.lua)#14704

Merged
cderv merged 2 commits into
quarto-dev:mainfrom
cderv:claude/remove-orphaned-lua-filters
Jul 17, 2026
Merged

Remove orphaned Lua filter entry points (quarto-pre.lua, crossref-standalone.lua)#14704
cderv merged 2 commits into
quarto-dev:mainfrom
cderv:claude/remove-orphaned-lua-filters

Conversation

@cderv

@cderv cderv commented Jul 17, 2026

Copy link
Copy Markdown
Member

@cscheid does it seems ok to remove to you ? I believe so

🤖 analysis ⬇️

Description

Removes two standalone pandoc --lua-filter entry points that are dead code — nothing in the codebase invokes them, and one can no longer even load. Removing them prevents a future maintainer from resurrecting a broken entry point.

src/resources/filters/quarto-pre/quarto-pre.lua

  • The pre/post filter passes were consolidated into the custom-AST main.lua pipeline in PR Feature: custom AST nodes #3694 "Feature: custom AST nodes" (commit 56888bb9, 2022-12-19). That commit removed the filters.ts invocations of both quarto-pre/quarto-pre.lua and quarto-post/quarto-post.lua, and deleted quarto-post/quarto-post.lua from disk — but left quarto-pre.lua behind. (quarto-post.lua had first been removed as unused in 2020, commit b58522fc, then briefly reintroduced.)
  • Zero references outside itself since then.
  • Additionally non-loadable: line 51 does import("code.lua"), but src/resources/filters/quarto-pre/code.lua has never existed at that path. Later mechanical Lua refactors edited the file without noticing the dangling import — because nothing ever executes it.

src/resources/filters/crossref/crossref-standalone.lua

  • Created in commit 80548e60 "recreate quarto-init and crossref for IDE support" (2023-01-02) but never wired up: the string crossref-standalone appears in no other file in the entire history. IDE crossref support uses crossref/crossref.lua (src/command/editor-support/crossref.ts), not this file.

Verification

  • Confirmed zero references to either basename across all files at HEAD (.ts, .lua, build configs, workspace files).
  • Built the dev bundle and confirmed removal breaks nothing: quarto render to html/typst and quarto editor-support crossref all succeed unchanged.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR — n/a (internal dead-code removal, not user-facing)
  • ensured the present test suite passes — smoke-verified render + editor-support paths against a built bundle
  • added new tests — n/a (pure deletion of unreferenced code)
  • created a separate documentation PR
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: local clone; full git history analysis; built dev bundle for runtime verification
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

…ndalone.lua)

These two standalone pandoc `--lua-filter` entry points are dead code: nothing
in the codebase invokes them, and one can no longer even load. Removing them
prevents future maintainers from mistakenly resurrecting a broken entry point.

## Provenance

`src/resources/filters/quarto-pre/quarto-pre.lua`
- The pre/post filter passes were consolidated into the custom-AST `main.lua`
  pipeline in PR quarto-dev#3694 "Feature: custom AST nodes" (commit 56888bb,
  2022-12-19). That commit removed the `filters.ts` invocations of BOTH
  `quarto-pre/quarto-pre.lua` and `quarto-post/quarto-post.lua`, and deleted
  `quarto-post/quarto-post.lua` from disk -- but left `quarto-pre.lua` behind.
  (`quarto-post.lua` had first been removed as unused back in 2020, commit
  b58522f, then briefly reintroduced.)
- It has had zero references outside itself since then.
- It is additionally non-loadable: line 51 does `import("code.lua")`, but
  `src/resources/filters/quarto-pre/code.lua` has never existed at that path.
  Subsequent mechanical Lua refactors edited the file without noticing the
  dangling import -- because nothing ever executes it.

`src/resources/filters/crossref/crossref-standalone.lua`
- Created in commit 80548e6 "recreate quarto-init and crossref for IDE
  support" (2023-01-02) but never wired up: the string "crossref-standalone"
  appears in no other file in the entire history. IDE crossref support uses
  `crossref/crossref.lua` (src/command/editor-support/crossref.ts), not this
  file.

## Verification

- Confirmed zero references to either basename across all files at HEAD
  (`.ts`, `.lua`, build configs, workspace files).
- Built the dev bundle and confirmed removal breaks nothing: `quarto render`
  to html/typst and `quarto editor-support crossref` all succeed unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014YbHWoK9NL6ms3BLQkC3Xe
@posit-snyk-bot

posit-snyk-bot commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv
cderv requested a review from cscheid July 17, 2026 11:22
@cscheid

cscheid commented Jul 17, 2026

Copy link
Copy Markdown
Member

I think they're not ok to remove. Have Claude check quarto-dev/quarto for standalone filter usage from the visual editor and extensions.

@cderv

cderv commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

I think they're not ok to remove. Have Claude check quarto-dev/quarto for standalone filter usage from the visual editor and extensions.

Oh cross project usage !! Tricky - I'll definitely add a note somewhere in the file that this could happen and it would avoid future claude to tell me it could deleted them 😅 I was glad to verify this - I'll check and report.

@cscheid

cscheid commented Jul 17, 2026

Copy link
Copy Markdown
Member

Yeah, I've made that mistake before too :)

We have cross-project dependencies on quarto-dev/quarto and rstudio/rstudio (though I think not applicable in this particular case). It would be great to coordinate and write those down.

The visual editor (quarto-dev/quarto) and RStudio (rstudio/rstudio) invoke
Quarto's crossref/xref filters standalone against the installed share tree, so
"no in-repo reference" does not prove a shipped filter is dead code. Record the
touch-points and a removal checklist:

- .claude/rules/filters/cross-project-consumers.md -- path-scoped guardrail that
  surfaces automatically when editing src/resources/filters/** or the packaging
  inline list.
- dev-docs/cross-project-dependencies.md -- coordination reference listing the
  quarto-dev/quarto and rstudio/rstudio touch-points on quarto-cli.

Context: verified crossref-standalone.lua and quarto-pre.lua were safe to remove
(never in the packaging inline list, so never shipped; both consumers load
crossref.lua/quarto-init.lua instead).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01337kruURGowoAH9pzVA3rf
@cderv

cderv commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

So I had 🤖 checked the cross-project usage, and it turns out the two files are safe to remove.

The standalone-filter concern is real, but it points at crossref.lua, not the files this PR removes. The visual editor and RStudio both run our crossref filter standalone (a bare pandoc --defaults/--lua-filter pass, outside quarto render) to build the xref autocomplete index. They load:

  • filters/quarto-init/quarto-init.lua
  • filters/crossref/crossref.lua
  • filters/qmd-reader.lua

Consumers:

  • Visual editor (quarto-dev/quarto): packages/editor-server/src/core/xref.ts (indexSourceFile)
  • RStudio (rstudio/rstudio): src/cpp/session/modules/quarto/SessionQuartoXRefs.cpp

Neither references crossref-standalone.lua or quarto-pre.lua (nor does any renamed/vendored copy — checked a GitHub-wide code search too).

The decisive check: what actually ships. package/src/common/prepare-dist.ts doesn't ship src/resources/filters/ verbatim — it wipes share/filters and rebuilds it via inlineFilters() from a fixed list (main, pagebreak, quarto-init, crossref, customwriter, qmd-reader, llms, leveloneanalysis) + modules/, inlining each -- [import]. So:

  • The three consumer-referenced filters are all in that list → present in every installed Quarto. ✅
  • crossref-standalone.lua and quarto-pre.lua are not in the list and nothing else copies them → never shipped in any release. No external consumer could have loaded them from the share path.
  • The installed crossref/crossref.lua is itself the fully-inlined standalone bundle — the build auto-generates the standalone crossref filter, which is why the hand-written crossref-standalone.lua was a redundant orphan.

Writing it down: added on this branch —

  • .claude/rules/filters/cross-project-consumers.md — path-scoped, surfaces automatically on any edit under src/resources/filters/** or the packaging inline list, with a removal checklist.
  • dev-docs/cross-project-dependencies.md — the broader list of quarto-dev/quarto + rstudio/rstudio touch-points on quarto-cli.

So future 🤖 gets warned before assuming a filter is dead.

@cscheid cscheid 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.

This is great!

@cderv
cderv merged commit bf9160a into quarto-dev:main Jul 17, 2026
51 checks passed
@cderv
cderv deleted the claude/remove-orphaned-lua-filters branch July 17, 2026 18:26
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.

4 participants