Commit graph

1426 commits

Author SHA1 Message Date
81b87f2cc3 Record git revision in build and update deploy Makefile 2026-09-05 13:15:29 +02:00
7fff0a6dbf Bump schema version for constraint migration 2026-09-04 21:57:48 +02:00
c5cd77e9ee Stop concurrent imports from racing on package names
Production imports kept aborting with
ActiveRecord::RecordNotUnique on packages_name_key and - on
environments that never got the constraint - silently created
duplicate packages. Root cause: overlapping update_from_deb_repos
runs (scheduled + manual) both do find-by-name then insert; whichever
wins the race aborts the whole run, whichever loses gets a
duplicate if the constraint was missing.

Three things so the mechanism stops being the problem:

- An advisory lock serializes update_from_deb_repos runs. A second
  run that finds the lock held simply skips with a warning instead
  of racing the first one. The lock is session-scoped, so it is
  released automatically when the process exits.
- A per-package rescue for ActiveRecord::RecordNotUnique. If a
  create still races (e.g. a package being created by a web upload),
  the package is re-fetched and updated instead of aborting the run.
- A real migration for packages_name_key, which previously only
  existed where it had been added by hand. From now on db:migrate
  creates it everywhere, new databases included.

Also verified with a reproduction: a single sequential run of the
deployed importer against a fresh database (both architectures,
~54k packages) creates zero duplicates.
2026-09-04 21:57:35 +02:00
3f37e2d857 Remove packages not found in any configured source
Tracks every package name seen across all repositories/components/
architectures during update_from_deb_repos and, once the run
completes, destroys database packages that were not among them (e.g.
ones Debian has dropped entirely, or ones from a since-unconfigured
suite/architecture).

Deliberately opt-in (REMOVE_ORPHANED_PACKAGES = false by default),
unlike REMOVE_BLACKLISTED_PACKAGE: a package looking 'orphaned' can
also just mean a mirror had a transient fetch problem, so the removal
refuses to run at all if any component/architecture failed to fetch,
or if no packages were seen this run at all.
2026-08-24 22:47:03 +02:00
8d26873bae Widen transitional/dummy package description blacklist
Add 'dummy package' and 'dependency package', the other phrases the
Debian Developer's Reference (6.9.7) documents as convention and that
deborphan --guess-dummy looks for. Deliberately skip bare 'dummy' and
'empty package': both have real false positives in production data
(xserver-xorg-video-dummy, a bridge card 'double dummy solver'
library, python3-roscreate's 'empty package template creator').

Verified against production data: 266 combined matches, still zero
with screenshots.
2026-08-24 22:23:04 +02:00
33fc169591 Blacklist transitional/dummy stub packages from import
Their short description reliably says so (e.g. 'transitional
package', 'transitional dummy package for foo'). Verified against
production package data: 190 matches, none of them ever had a
screenshot.
2026-08-24 22:11:05 +02:00
fd5747c6ab Deduplicate search results by package name
If the database ever contains duplicate-name rows again, users should
not see the same package twice in the results.
2026-08-23 21:25:28 +02:00
07be9eadcc Remove the temporary show=libs inspection view
The libs-section blacklist is confirmed safe; the review view has
served its purpose.
2026-08-23 14:13:53 +02:00
a98398f7a1 Limit show=libs inspection view to packages with screenshots 2026-08-23 12:33:28 +02:00
3a1de72efe Add temporary show=libs inspection view
Lets you browse exactly the packages that the libs section blacklist
would remove on the next import, to review them visually before
running it.
2026-08-23 11:20:36 +02:00
e3dff44f73 Blacklist the libs section from package imports
Libraries never produce useful screenshots. Excluding by Debian
archive section instead of a lib* name pattern keeps applications
with lib-prefixed names (libreoffice, librecad, ...) importable.
With REMOVE_BLACKLISTED_PACKAGE set, the next import also removes
previously imported libs-section packages and their screenshots.
2026-08-23 11:03:05 +02:00
0aebb74b9b Document search result sources and show_sources param 2026-08-23 10:51:37 +02:00
4c736096ae Show search source badges only with show_sources param
The badges are a debugging aid - render them only when explicitly
requested via ?show_sources=1 instead of on every search.
2026-08-23 10:49:32 +02:00
323b7004ed Expose which search strategy produced each result
query_packages now assigns @search_sources - a hash mapping package
ids to the matching strategy that put them into the results: :exact,
:name_prefix, :name_contains, :semantic or :fulltext. The grid and
list views render a small badge with a humanized label per result,
making the search tiers observable. semantic_results() was folded
into search_packages() so each branch tags its own source. Adds the
rails-controller-testing gem for assigns() in tests.
2026-08-23 10:39:50 +02:00
61b64fae25 Log the failing SQL statement in vectorization task
Unique violations on packages_name_key happen on a statement that
cannot logically touch name - log the exact query and a longer
backtrace to identify what really fails.
2026-08-23 00:31:04 +02:00
bada261841 Skip packages without description text in vectorization
Packages with neither description nor long description cannot be
embedded at all; they used to fail on every run. Exclude them from
the scope instead.
2026-08-23 00:20:30 +02:00
2b79470feb Simplify vectorization task to sequential processing
Drop the threaded worker pool (queue, mutexes, connection pooling).
The task now processes packages one by one via find_each - plenty
fast since the external embedding service dominates latency, and
much easier to reason about.
2026-08-23 00:13:50 +02:00
3550a4e2e2 Harden vectorization task against per-package failures
A single failing package used to kill its whole worker thread silently
because only Vectorizer::Error was rescued per package. Now every
StandardError is caught and logged with class and backtrace, and the
embedding write is narrowed to update_column(:embedding) so the task
only ever issues a minimal UPDATE - it cannot touch any other column
or fire model callbacks. Progress stats no longer serialize database
writes through the mutex.
2026-08-23 00:11:52 +02:00
4d07f43a2e Show related packages based on description embeddings
Package pages get a "Related packages" section: a nearest neighbor
query against the package's own stored embedding (no external service
call), excluding the package itself. Packages without an embedding
render no section.
2026-08-22 23:47:42 +02:00
fdf3289f54 Remove lograge configuration from Docker image and production 2026-08-22 22:08:05 +02:00
4948fe50e3 Add semantic package search via pgvector embeddings
Package text search now combines several strategies: exact name match,
name prefix promotion, compound word splitting ("sqlite browser" finds
"sqlitebrowser") and semantic nearest neighbor search over description
embeddings computed by an external embedding service (all-MiniLM-L6-v2,
384 dims) stored with the pgvector extension. Classic PostgreSQL
full-text search remains as fallback when the vector service is
unreachable. Gibberish queries without lexical overlap with the package
data return empty results instead of random matches.

Embeddings can be backfilled with bin/rails debshots:compute_vectors.

Also drops the unused lograge gem from the Gemfile.
2026-08-22 22:07:56 +02:00
c7e8109bbd Add manual Forgejo action to promote :latest → :prod
All checks were successful
Build and Push Docker Image / build-and-push-image (push) Successful in 1m14s
2026-05-28 00:33:26 +02:00
cf29664f0a Add wget for Coolify health checks
All checks were successful
Build and Push Docker Image / build-and-push-image (push) Successful in 9m16s
2026-05-28 00:10:52 +02:00
a58adf8149 Shrink Docker image: remove node/bun from runtime, exclude test/dev gems, strip bundle cache/doc/build_info
All checks were successful
Build and Push Docker Image / build-and-push-image (push) Successful in 8m58s
2026-05-27 23:14:16 +02:00
7472b737e5 Update dependencies: bump Ruby gems, JS packages, remove unused jquery/webpack
All checks were successful
Build and Push Docker Image / build-and-push-image (push) Successful in 7m25s
2026-05-27 21:45:41 +02:00
9faf4aeada /json/ URL should work with dots in the package name now
All checks were successful
Build and Push Docker Image / build-and-push-image (push) Successful in 7m49s
2026-05-27 21:33:40 +02:00
e3ecd96c99 Upgrade Ruby from 3.2.4 to 3.4.7
All checks were successful
Build and Push Docker Image / build-and-push-image (push) Successful in 10m43s
2026-05-21 22:58:42 +02:00
1465733d64 Update gems and npm packages 2026-05-21 22:32:32 +02:00
d0402a3497 Switch from yarn to bun 2026-05-21 22:26:22 +02:00
237077c153 add simage_data to make test pass 2026-05-21 22:21:40 +02:00
0bb09dbbd8 fix package comparison
All checks were successful
Build and Push Docker Image / build-and-push-image (push) Successful in 8m45s
2026-05-21 00:40:22 +02:00
aacd2a7794 Optimize Docker build caching for CI: add BuildKit cache mounts for apt, bundler, and yarn; use registry-based cache in CI pipeline
All checks were successful
Build and Push Docker Image / build-and-push-image (push) Successful in 1m22s
2026-04-13 00:05:10 +02:00
86c1d8ae5a copy/paste mistake
Some checks failed
Build and Push Docker Image / build-and-push-image (push) Has been cancelled
2026-04-12 23:36:13 +02:00
9340529d3f Merge branch 'main' of ssh://forgejo/chaas/debshots
Some checks failed
Build and Push Docker Image / build-and-push-image (push) Failing after 3m13s
2026-04-12 23:30:57 +02:00
35d9f0b263 trying to build 2026-04-12 23:30:43 +02:00
8deed9ffd3 Update .forgejo/workflows/playing-around._yaml_ 2026-04-12 11:09:07 +00:00
a88c156174 Merge branch 'main' of salsa.debian.org:debian/debshots 2026-03-01 22:12:34 +01:00
c9248c0af4 fix typo 2026-03-01 22:11:43 +01:00
609acc6db8 ignore test files 2026-03-01 22:11:38 +01:00
Christoph Haas
834403f448 Merge branch 'minor-spellcheck' into 'main'
fix: minor spellcheck

See merge request debian/debshots!1
2026-03-01 21:09:51 +00:00
9adce56098 fixed webhook URL for stage 2026-02-26 20:23:27 +01:00
cf7178fb34 real fix for the UDD import problems – it was looking for /json/screenshots and large_image_url 2026-02-26 20:21:19 +01:00
0e18dd19bb Set up git-crypt to encrypt .env files 2026-02-26 01:45:03 +01:00
784ce73adb Add .env.example template for required environment variables 2026-02-26 01:42:15 +01:00
66e2c8c7f1 Add Makefile for building and deploying container images 2026-02-26 01:40:19 +01:00
b42d99022b typo - fixes https://salsa.debian.org/debian/debshots/-/issues/87 2026-02-26 01:15:22 +01:00
8e95e4f9fd re-add large_image_url attribute that the UDD expects 2026-02-26 01:03:54 +01:00
0669198233 safety check 2026-02-26 00:28:00 +01:00
d5e0f83c54 remove the counting of images because it counts the dummy image as well 2026-02-26 00:23:49 +01:00
f872bd011b disabled minitest/reporters so that RubyMine is happy 2026-02-26 00:23:25 +01:00