• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

GrottoCenter / grottocenter-api / 40732589200
91%

Build:
DEFAULT BRANCH: develop
Ran 28 Oct 2026 05:10PM UTC
Jobs 1
Files 532
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

28 Oct 2026 05:06PM UTC coverage: 89.477% (+0.09%) from 89.39%
40732589200

push

github

web-flow
feat(document): support PDF page offsets for URL identifiers and attached files (#1936)

## 🤔 What

- One optional signed PDF page offset per PDF source: `t_document.identifier_pdf_page_offset` for the PDF URL in `identifier`, and `t_file.pdf_page_offset` for each attached file (migration `sql/9_27_2026_10_26_pdf_page_offset.sql`; `h_document` keeps the identifier offset in the history).
- Convention: `PDF position = printed page number + offset` (printed page 29 at PDF position 30 gives `+1`). Bibliographic `pages` are unchanged.
- Write: `identifierPdfPageOffset`, `newFilesMetadata[i][pdfPageOffset]` and `modifiedFiles[i][pdfPageOffset]` on `POST /documents` and `PUT /documents/{id}`; `identifierPdfPageOffset` on `PUT /documents/{id}/new-entities`.
- Read: `identifierPdfPageOffset` on documents and on the embedded `parent`, `pdfPageOffset` on files, as an integer or `null`, in details and in `?requireUpdate=true` previews. An article's details carry its parent's identifier and file offsets, with no extra request.
- OpenAPI updated (request fields, `Document`, `ParentDocument`, `File`, new `NewFileMetadata`, 400 cases).

Closes #1936

## 🤷‍♂️ Why

Printed page numbers often differ from positions in the PDF (cover, front matter, extract of a larger publication). The frontend (GrottoCenter/grottocenter-front#1588) must open the right PDF page while citations keep the printed numbers.

## 🔍 How

- `api/utils/parsePdfPageOffset.js`: omitted (`undefined`) → unchanged; `null` or `""` (multipart) → explicit clear; integer or integer string between -2147483647 and 2147483647 → offset, `0` included; anything else → 400.
- `DocumentService.resolveIdentifierPdfPageOffset` / `readNewFileOffsets` / `readChangedFiles`, called by the controllers **before** the document is created or any file is uploaded:
  - the identifier offset needs an effective `url` identifier. The URL itself is not inspected, since many PDF URLs have no `.pdf` extension;
  - a file offset nee... (continued)

6327 of 7377 branches covered (85.77%)

Branch coverage included in aggregate %.

132 of 137 new or added lines in 6 files covered. (96.35%)

1 existing line in 1 file now uncovered.

11615 of 12675 relevant lines covered (91.64%)

258570.66 hits per line

Uncovered Changes

Lines Coverage ∆ File
5
89.25
-0.73% api/services/DocumentService.js

Coverage Regressions

Lines Coverage ∆ File
1
97.86
-0.71% api/utils/redactLogArgs.js
Jobs
ID Job ID Ran Files Coverage
1 40732589200.1 28 Oct 2026 05:10PM UTC 532
89.48
GitHub Action Run
Source Files on build 40732589200
  • Tree
  • List 532
  • Changed 12
  • Source Changed 10
  • Coverage Changed 9
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #40732589200
  • 753d3d34 on github
  • Prev Build on develop (#40621636880)
  • Next Build on develop (#40742698328)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc