Commit Graph
22 Commits
Author SHA1 Message Date
125666f59d fix(pdf-vision): render PDFs with poppler-utils + surface a concrete admin failure reason (#3275)
* Fix PDF vision path failing when poppler-utils is missing

The Docker image omitted poppler-utils, so the OpenAI PDF vision path
(which renders pages with pdftoppm before sending them upstream) always
failed and the admin AI status page surfaced a generic "request failed"
code rather than a useful reason.

- install poppler-utils in the Docker base image (pdftoppm for the
  vision render path)
- add an optional failure_code to Provider::Error, so probe errors can
  carry a machine-readable reason
- in Provider::Openai::PdfProcessor#convert_pdf_to_images, check
  pdftoppm's return value and -- when the binary is genuinely missing,
  raise a Provider::Openai::Error with failure_code :render_missing_binary
  while preserving the existing [] fallback for other render failures
- register the :render_missing_binary code in the admin locale so the AI
  status page shows a concrete, actionable message instead of "request
  failed"
- AiHealth::Probe#failure_code now falls through to the default codes
  when an error's failure_code is nil, instead of returning nil
- regression tests covering both the missing-binary and the
  present-but-fails cases

Fixes the "PDF vision/native path" system check on instances where the
image is built from the checked-in Dockerfile.

* Fix missing-binary detection and preserve failure_code across the error boundary

- convert_pdf_to_images: Kernel#system returns nil (not false) when the executable is absent; raise the coded error on rendered.nil? so a missing pdftoppm yields :render_missing_binary instead of a blank conversion. - Provider::Error#as_json + default_error_transformer: carry failure_code through serialization and error re-wrapping. - Drop the binary_missing? helper (nil result is the authoritative signal) and update regression tests to stub the real nil return value. - Add coverage for failure_code serialization/transformation.

* Fix Provider::Error transformer syntax error and cover Faraday branch

Addresses jjmata's blocking change-request: app/models/provider.rb:54
used a postfix `if` modifier inside a hash-argument/method-call argument
list, which is not valid Ruby. `ruby -c` failed to parse the file, so the
base class every provider inherits from could not autoload and the whole
app (boot, requests, jobs, tests) was down.

Rewrite default_error_transformer to build the optional failure_code
keyword once (only when the error exposes a truthy code) and splat it, so
both the Faraday::Error branch and the generic branch carry the code with
no syntax error and no nil kwarg.

Also add the two Faraday-branch regression tests that were missing
(failure_code preservation + response-body-to-details extraction),
guarding this exact class of broken-argument bug with real assertions.

Verification: ruby -c passes on provider.rb, pdf_processor.rb, probe.rb,
and both test files; plus a behavioral harness against the real
provider.rb source covering the coded/plain/nil-code, Faraday-coded,
Faraday-no-code, nil-response, and generic-error paths (19/19 pass).

Ref: we-promise/sure#3275

* Document the methods added or changed by this PR

* Add poppler-utils to devcontainer image

---------

Co-authored-by: hermes-on-behalf-of-jon <hermes@nousresearch.com>
Co-authored-by: jaysbeekay <jaysbeekay@users.noreply.github.com>
Co-authored-by: sure-admin <sure-admin@splashblot.com>
2026-08-31 23:27:04 +02:00
Juan José MataandClaude 27501cb64c Update Ruby to 3.4.9 (#2360)
Bump the pinned Ruby version from 3.4.7 to 3.4.9 across .ruby-version,
the application/preview/devcontainer Dockerfiles, and Gemfile.lock.

https://claude.ai/code/session_01C6t7JgroFSe2Xswqma3EdL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-15 23:29:36 +02:00
Abhinav Dhiman 0988e2d9d6 perf: use jemalloc as the default allocator (#1910)
* feat(docker): add jemalloc to reduce memory fragmentation

Install libjemalloc2 in the base image and preload it via LD_PRELOAD in
docker-entrypoint when available. Reduces RSS growth from glibc's default
allocator fragmentation under Rails workloads.

* feat(docker): add DISABLE_JEMALLOC env var + preserve existing LD_PRELOAD

* feat(docker): add jemalloc status logging to entrypoint

* refactor(docker): simplify jemalloc logging to warn-only when disabled/missing
2026-05-24 14:02:50 +02:00
LPWandJuan José Mata f98858cffc Upgrade Ruby version to 3.4.7 (#305)
* Upgrade Ruby version to 3.4.7

* Update Dockerfile as well

---------

Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
2025-11-09 21:10:51 +01:00
J4kerandJuan José Mata 749bcda871 Update Dockerfile - procps (#286)
* Update Dockerfile - procps

install procps for worker container healthcheck - pgrep

Signed-off-by: J4ker <56275036+J4ker@users.noreply.github.com>

* Good idea, adding it to dev container

---------

Signed-off-by: J4ker <56275036+J4ker@users.noreply.github.com>
Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
2025-11-04 19:09:49 +01:00
Himank Dave d162c58732 build(docker): ensure build-stage packages installed with fresh apt metadata (#114)
* quick fix for failing image build

* build: optimize Dockerfile for smaller image and perms

- combine apt-get update and cleanup into single layer
- combine bundle install and bootsnap into one RUN
- copy build artifacts with --chown to set ownership
- create non-root rails user before copying files
2025-08-15 06:16:06 +02:00
Zach Gollwitzer caf35701ef Fix Docker builds after package updates 2025-05-20 14:00:31 -04:00
Zach Gollwitzer dd605a577e Bump ruby to 3.4.4 2025-05-20 09:09:10 -04:00
Zach Gollwitzer 5b2fa3d707 Fix commit resolution for Docker builds 2025-03-04 07:50:21 -05:00
Zach Gollwitzer 4e96ca8376 Add manual Docker publishing trigger in GH action workflow 2025-03-03 14:34:56 -05:00
Zach Gollwitzer cc11fec08a Add git to Dockerfile for self hosted versioning info
Signed-off-by: Zach Gollwitzer <zach@maybe.co>
2025-02-21 13:40:16 -05:00
Zach Gollwitzer 8e339dcbe0 Dockerfile fixes
Signed-off-by: Zach Gollwitzer <zach@maybe.co>
2025-02-13 17:24:24 -05:00
Zach Gollwitzer 366862fee1 Fix bootsnap hanging in CI 2025-02-13 15:32:51 -05:00
Zach Gollwitzer 73f826fdf2 Split Dockerfile build commands for more clarity in CI 2025-02-13 15:04:15 -05:00
Zach Gollwitzer d428a1f954 Bump to Ruby 3.4.1 (#1721) 2025-01-27 19:59:16 -05:00
Zach Gollwitzer 0b4e314f58 Bump bundler version, address Docker build failures 2025-01-27 16:29:30 -05:00
Luis Ezcurdia 18266c3352 Bump ruby version to 3.3.5 (#1402) 2024-11-05 11:05:08 -05:00
Zach Gollwitzer 9dda2606d5 Bump Dockerfile to 3.3.4
Signed-off-by: Zach Gollwitzer <zach@maybe.co>
2024-08-15 13:23:40 -04:00
Zach Gollwitzer 4f508cd151 Bump to Ruby 3.3.1 (#709)
* Bump to Ruby 3.3.1

* Update Dockerfile versions

* Omit system tests in CI

* Use `:test` adapter in test

* Remove redundant config
2024-05-03 08:22:19 -04:00
Dave Corson-KnowlesandZach Gollwitzer 0e77bab00b Keep .ruby_version file in Docker (#523)
* Use our .ruby-version file in Bundler so it is managed in only 1 place

See: https://gorails.com/episodes/bundler-ruby-version-file

* Copy Ruby Version file into Docker

* Update Dockerfile

Signed-off-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>

---------

Signed-off-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
Co-authored-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
2024-03-07 10:43:18 -05:00
Achmad Chun Chun ffc33cbb40 Speedup docker build time (#463) 2024-02-17 09:47:57 -05:00
Josh Pigford 99de24ac70 Initial commit 2024-02-02 09:05:04 -06:00