openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

Paginate takes a use_repr argument it never uses, and TableList exists only in the database

Open MohitSAGAR11 opened this issue 2 weeks ago • 2 comments

Feature Request

Problem / Opportunity

Two leftovers found while doing #14387, both verified against the 31 Oct other dump with the query in this comment.

1. macros/Paginate.html takes a use_repr argument it never uses.

$def with (path="", limit=50, use_repr=False)

use_repr appears in the signature and nowhere else in the body — unlike PageList, where it at least selected a branch. It is dead in the macro itself, not merely unpassed.

Nothing passes it either. The dump has 0 {{Paginate(...)}} invocations; the six records mentioning the name are two db copies of the macro source, a JS file, and three stale /upstream/templates/*.tmpl shadows. In the repo the only caller is openlibrary/templates/type/homepage/view.html:26 — $:macros.Paginate(), with no arguments.

2. /macros/TableList exists only in the database.

There is no openlibrary/macros/TableList.html. The dump's only record for the name is /type/macro /macros/TableList, the macro source itself, and there are 0 invocations of it. It carries the same unused use_repr parameter, which is how it surfaced.

Proposal

  • Drop use_repr from macros/Paginate.html. One line, no behaviour change, since nothing reads it and nothing passes it.
  • TableList is a db record rather than repo code, so it needs someone with db access to confirm and delete it — not a PR. Flagging rather than proposing.

path and limit stay. Nothing passes those either, but unlike use_repr the body actually uses them, so they are working defaults rather than dead code — removing a working parameter is a separate question.

Paginate is also a future #14387 candidate: it reads query_param and changequery, both Templetor request globals that docs/core/fastapi-pages.md says cannot stay in a template served from FastAPI. Removing the dead argument now makes that port marginally smaller.

Breakdown

Implementation Details (for maintainers)

Related files

  • openlibrary/macros/Paginate.html — line 1, the use_repr parameter
  • openlibrary/templates/type/homepage/view.html — line 26, the only caller, passes nothing

Requirements Checklist

  • [ ] use_repr removed from macros/Paginate.html
  • [ ] grep -rn "use_repr" openlibrary/ finds nothing
  • [ ] Decide whether /macros/TableList should be deleted from the database

Stakeholders

@RayBB — you led #14387, where both of these turned up.

MohitSAGAR11 avatar Nov 18 '26 17:11 MohitSAGAR11

Thank you @MohitSAGAR11 for submitting this issue!

⚠️ Contributors, this issue will be ready to work on once:

  • [ ] Triage — maintainers will add Priority: * and Lead: @*
  • [ ] Needs: Staff Decision — whether /macros/TableList should be deleted from the database

Context

  • openlibrary/macros/Paginate.html confirms the claim: use_repr is in the $def with signature and not referenced anywhere in the body. https://github.com/internetarchive/openlibrary/blob/cc9681e99daef5505892083457e718aca1b54d44/openlibrary/macros/Paginate.html#L1
  • By contrast, openlibrary/macros/PageList.html shows why this is worth flagging specifically for Paginate: its own use_repr parameter is actually read at an $if use_repr: branch, so it's a working (if unpassed) argument, not dead code. https://github.com/internetarchive/openlibrary/blob/cc9681e99daef5505892083457e718aca1b54d44/openlibrary/macros/PageList.html#L1-L13
  • The only in-repo caller of Paginate is confirmed at openlibrary/templates/type/homepage/view.html, calling with no arguments. https://github.com/internetarchive/openlibrary/blob/cc9681e99daef5505892083457e718aca1b54d44/openlibrary/templates/type/homepage/view.html#L26
  • No openlibrary/macros/TableList.html exists in the repo (find/grep both come back empty) — consistent with the report that it's a database-only /type/macro record with no corresponding file.
  • The parent issue, #14387 (open, Lead: @RayBB), is the FastAPI-port cleanup thread these two leftovers surfaced from. Paginate.html itself is not one of the three macros in that issue's scope (PageList, SubjectSearch, iframe).
  • No open or merged PR touching openlibrary/macros/Paginate.html or removing use_repr was found, and no related GitHub Discussion exists.

Issue Assessment

Open questions

  • [x] Does removing use_repr depend on #14387's Jinja conversion work? (Answer: No — Paginate.html isn't one of the three macros in that issue's scope, and the removal doesn't touch query_param/changequery, so it can proceed independently.)

Action items

  • [ ] A maintainer with database access needs to confirm and act on whether /macros/TableList should be deleted — this isn't a code change, it can't be done via PR.
  • [x] Confirm PageList.html's identical-looking parameter isn't also dead code (Answer: it isn't — PageList.html actually branches on use_repr at line 12, so only Paginate.html's copy is unused; PageList.html is out of scope here).

🔔 Stakeholders

@RayBB — Lead on #14387, the issue this cleanup was surfaced from during.


Full triage checklist
  • [x] Triage — correct labels applied or removed
  • [x] Problem / opportunity — problem is clear, audience identified, actionable
  • [x] Scope — issue is well-scoped; does not try to do too many things
  • [x] Justification — reasoning and impact stated; sufficient for leads to prioritize
  • [x] Success & testing criteria — defines what "done" looks like, verifiable by a contributor
  • [x] Proposal & breakdown — concrete plan present; checklist actionable for a contributor
  • [ ] If bug: environment & repro steps — not applicable; this is a dead-code report, not a bug repro
  • [x] Risks, concerns, open questions — identified and surfaced
  • [x] Richy context — relevant code, commits, PRs reviewed; no duplicate found
  • [x] References — screenshots, designs, docs, and links present where needed

[!NOTE] This comment was automatically generated by Richy, Open Library's issue enrichment assistant, on behalf of @mekarpeles. This is NOT a sign-off. This issue needs lead review before work begins.

openlibrary-bot avatar Nov 18 '26 17:11 openlibrary-bot

Go for it!

On Wed, Nov 18, 2026, 9:15 AM Open Library Bot @.***> wrote:

openlibrary-bot left a comment (internetarchive/openlibrary#14570) https://github.com/internetarchive/openlibrary/issues/14570#issuecomment-6985932087

Thank you @MohitSAGAR11 https://github.com/MohitSAGAR11 for submitting this issue!

⚠️ Contributors, this issue will be ready to work on once:

  • Triage — maintainers will add Priority: * and Lead: @*
  • Needs: Staff Decision — whether /macros/TableList should be deleted from the database

Context

  • openlibrary/macros/Paginate.html confirms the claim: use_repr is in the $def with signature and not referenced anywhere in the body. https://github.com/internetarchive/openlibrary/blob/cc9681e99daef5505892083457e718aca1b54d44/openlibrary/macros/Paginate.html#L1
  • By contrast, openlibrary/macros/PageList.html shows why this is worth flagging specifically for Paginate: its own use_repr parameter is actually read at an $if use_repr: branch, so it's a working (if unpassed) argument, not dead code. https://github.com/internetarchive/openlibrary/blob/cc9681e99daef5505892083457e718aca1b54d44/openlibrary/macros/PageList.html#L1-L13
  • The only in-repo caller of Paginate is confirmed at openlibrary/templates/type/homepage/view.html, calling with no arguments. https://github.com/internetarchive/openlibrary/blob/cc9681e99daef5505892083457e718aca1b54d44/openlibrary/templates/type/homepage/view.html#L26
  • No openlibrary/macros/TableList.html exists in the repo (find/grep both come back empty) — consistent with the report that it's a database-only /type/macro record with no corresponding file.
  • The parent issue, #14387 https://github.com/internetarchive/openlibrary/issues/14387 (open, Lead: @RayBB), is the FastAPI-port cleanup thread these two leftovers surfaced from. Paginate.html itself is not one of the three macros in that issue's scope (PageList, SubjectSearch, iframe).
  • No open or merged PR touching openlibrary/macros/Paginate.html or removing use_repr was found, and no related GitHub Discussion exists.

Issue Assessment

Open questions

  • Does removing use_repr depend on #14387 https://github.com/internetarchive/openlibrary/issues/14387's Jinja conversion work? (Answer: No — Paginate.html isn't one of the three macros in that issue's scope, and the removal doesn't touch query_param /changequery, so it can proceed independently.)

Action items

  • A maintainer with database access needs to confirm and act on whether /macros/TableList should be deleted — this isn't a code change, it can't be done via PR.
  • Confirm PageList.html's identical-looking parameter isn't also dead code (Answer: it isn't — PageList.html actually branches on use_repr at line 12, so only Paginate.html's copy is unused; PageList.html is out of scope here).

🔔 Stakeholders

@RayBB https://github.com/RayBB — Lead on #14387 https://github.com/internetarchive/openlibrary/issues/14387, the issue this cleanup was surfaced from during.

Full triage checklist

  • Triage — correct labels applied or removed
  • Problem / opportunity — problem is clear, audience identified, actionable
  • Scope — issue is well-scoped; does not try to do too many things
  • Justification — reasoning and impact stated; sufficient for leads to prioritize
  • Success & testing criteria — defines what "done" looks like, verifiable by a contributor
  • Proposal & breakdown — concrete plan present; checklist actionable for a contributor
  • If bug: environment & repro steps — not applicable; this is a dead-code report, not a bug repro
  • Risks, concerns, open questions — identified and surfaced
  • Richy context — relevant code, commits, PRs reviewed; no duplicate found
  • References — screenshots, designs, docs, and links present where needed

Note

This comment was automatically generated by Richy https://github.com/internetarchive/openlibrary/blob/master/.github/workflows/issue_enrichment.md, Open Library's issue enrichment assistant, on behalf of @mekarpeles https://github.com/mekarpeles. This is NOT a sign-off. This issue needs lead review before work begins.

— Reply to this email directly, view it on GitHub https://github.com/internetarchive/openlibrary/issues/14570?email_source=notifications&email_token=AAHA5AJOMJ5LBWSINIILRUT5ZXKMLA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMOJYGU4TGMRQHA32M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-6985932087, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHA5ALHFZEH3LPLQ5YQ2V35ZXKMLAVCNFSNUABBKJSXA33TNF2G64TZHM3DSNRQHE5US43TOVSTWNRUG4ZDKOBYGM3DLILWAI . You are receiving this because you were mentioned.Message ID: @.***>

RayBB avatar Nov 18 '26 17:11 RayBB