Skip to content

Conversation

@Ludy87
Copy link
Collaborator

@Ludy87 Ludy87 commented Jan 1, 2026

Description of Changes

What was changed

  • Added a configurable request_timeout for the Cucumber/Behave step I send the API request to the endpoint "{endpoint}".
  • The step now uses requests.post(..., timeout=request_timeout) with a default of 60 seconds if context.request_timeout is not set.

Why the change was made

  • The Docker-Compose test run could hang indefinitely on scenarios like split-pdf-by-sections because the step previously performed a blocking requests.post(...) without a timeout.
  • If the /api/v1/general/split-pdf-by-sections endpoint stalls or takes excessively long in the container, the test never progresses and the CI eventually aborts the whole job (e.g., “The operation was canceled.”). With a timeout, failures become deterministic and provide actionable error output instead of a stuck pipeline.

Checklist

General

Documentation

Translations (if applicable)

UI Changes (if applicable)

  • Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR)

Testing (if applicable)

  • I have tested my changes locally. Refer to the Testing Guide for more details.

Copilot AI review requested due to automatic review settings January 1, 2026 12:46
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines ignoring generated files. label Jan 1, 2026
@Ludy87 Ludy87 added the Priority: High Issues or pull requests with high priority label Jan 1, 2026
@dosubot dosubot bot added the Bugfix Pull requests that fix bugs label Jan 1, 2026
@stirlingbot stirlingbot bot added the Test Testing-related issues or pull requests label Jan 1, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a configurable request timeout to the Cucumber/Behave API POST step to prevent test runs from hanging indefinitely when the backend takes excessively long to respond. The change addresses a specific issue where Docker-Compose test runs could hang on certain scenarios like split-pdf-by-sections, causing CI pipeline failures.

  • Added configurable request_timeout parameter to the POST request step with a 60-second default
  • The timeout can be customized via context.request_timeout or defaults to 60 seconds if not set
  • Uses getattr() for safe attribute access with a default fallback

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dosubot dosubot bot added size:S This PR changes 10-29 lines ignoring generated files. and removed size:XS This PR changes 0-9 lines ignoring generated files. labels Jan 1, 2026
@Ludy87 Ludy87 marked this pull request as draft January 1, 2026 14:23
@stirlingbot stirlingbot bot added Java Pull requests that update Java code Back End Issues related to back-end development API API-related issues or pull requests labels Jan 1, 2026
@Ludy87 Ludy87 requested a review from Copilot January 1, 2026 16:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

+ " Input:PDF Output:ZIP-PDF Type:SISO")
public ResponseEntity<StreamingResponseBody> splitPdf(
@ModelAttribute SplitPdfBySectionsRequest request) throws Exception {
public ResponseEntity<?> splitPdf(@ModelAttribute SplitPdfBySectionsRequest request)
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

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

The return type has been changed from ResponseEntity<StreamingResponseBody> to ResponseEntity<?>. While this is more flexible, using a wildcard ? is less specific and doesn't provide type safety. Consider using a concrete return type like ResponseEntity<byte[]> or ResponseEntity<Resource> to maintain type safety and make the API contract clearer.

Suggested change
public ResponseEntity<?> splitPdf(@ModelAttribute SplitPdfBySectionsRequest request)
public ResponseEntity<byte[]> splitPdf(@ModelAttribute SplitPdfBySectionsRequest request)

Copilot uses AI. Check for mistakes.
Comment on lines +77 to +79
try (PDDocument mergedDoc =
pdfDocumentFactory.createNewDocumentBasedOnOldDocument(
sourceDocument);
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

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

The document creation method has changed from pdfDocumentFactory.createNewDocument() to pdfDocumentFactory.createNewDocumentBasedOnOldDocument(sourceDocument). This change could affect the behavior of the merged document by potentially inheriting metadata, document catalog settings, or other properties from the source document. Please verify that this change is intentional and that it doesn't introduce unwanted side effects. If the old behavior of creating a completely fresh document is required, consider reverting to createNewDocument().

Suggested change
try (PDDocument mergedDoc =
pdfDocumentFactory.createNewDocumentBasedOnOldDocument(
sourceDocument);
try (PDDocument mergedDoc = pdfDocumentFactory.createNewDocument();

Copilot uses AI. Check for mistakes.
from PIL import Image, ImageDraw

API_HEADERS = {"X-API-KEY": "123456789"}
TIMEOUT = 80 # seconds
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

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

The timeout value is set to 80 seconds, but the PR description states "a default of 60 seconds". This inconsistency between the code and documentation should be resolved. Either update the constant to 60 seconds to match the PR description, or update the PR description to reflect the actual 80-second timeout.

Suggested change
TIMEOUT = 80 # seconds
TIMEOUT = 60 # seconds

Copilot uses AI. Check for mistakes.
Replaces getPagesToSplit with getCustomPagesToSplit and introduces shouldSplitPage to centralize split mode logic. This refactor improves code readability and maintainability by separating custom page selection from split mode handling.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@stirlingbot
Copy link
Contributor

stirlingbot bot commented Jan 1, 2026

🚀 V2 Auto-Deployment Complete!

Your V2 PR with the new frontend/backend split architecture has been deployed!

🔗 Direct Test URL (non-SSL) http://185.252.234.121:5378

🔐 Secure HTTPS URL: https://5378.ssl.stirlingpdf.cloud

This deployment will be automatically cleaned up when the PR is closed.

🔄 Auto-deployed for approved V2 contributors.

@Ludy87 Ludy87 closed this Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API API-related issues or pull requests Back End Issues related to back-end development Bugfix Pull requests that fix bugs Java Pull requests that update Java code Priority: High Issues or pull requests with high priority size:S This PR changes 10-29 lines ignoring generated files. Test Testing-related issues or pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants