Phase 3: move service layer, serializers and DTOs into WarpEngine + dummy-app test suite

- all catalog services (update/software/highlighted/builds/file/file-manager/
  download/image + SoftwareResponseBuilder), the SoftwareUpdater platform
  services and their concerns, Blueprinter serializers (incl. TimestampFields)
  and the 4 DTOs now live in the engine under WarpEngine::
- constantize dispatch strings use absolute names
  (WarpEngine::SoftwareUpdater::<Platform>Service)
- container paths read from WarpEngine.config everywhere (FileService,
  DownloadService, FileManagerService, ArchiveExtraction, ReleaseSerializer
  path rewriting); FileManagerService base path is now lazy
- engine requires blueprinter itself; gemspec declares blueprinter + rubyzip
- engine test suite: spec/dummy app (mysql warp_engine_test, catalog-only
  schema), rails_helper with engine-local factories; catalog model/service
  specs and factories moved from the host
- host suite keeps TTG specs and loads catalog factories from the engine

Verified: engine suite 40 green, host suite 14 green, /api/software and
/api/builds byte-identical to baselines, admin OK.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-04 19:03:58 +02:00
co-authored by Claude Fable 5
parent 7abfb89bca
commit ca25f72c76
69 changed files with 1491 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
require "rails_helper"
RSpec.describe WarpEngine::Download, type: :model do
it { should validate_presence_of(:file_path) }
it { should belong_to(:release).optional }
end
+52
View File
@@ -0,0 +1,52 @@
require "rails_helper"
RSpec.describe WarpEngine::PlatformLink, type: :model do
describe "validations" do
it { should validate_presence_of(:name) }
it { should validate_presence_of(:url) }
it { should validate_presence_of(:platform) }
it "rejects invalid platform" do
link = build(:platform_link, platform: "invalid")
expect(link).not_to be_valid
expect(link.errors[:platform]).to be_present
end
it "accepts valid platforms" do
WarpEngine::PlatformLink::SUPPORTED_PLATFORMS.each do |p|
link = build(:platform_link, platform: p)
expect(link).to be_valid
end
end
end
describe "default scope" do
it "excludes soft-deleted records" do
active = create(:platform_link)
create(:platform_link, deleted_at: Time.current)
expect(WarpEngine::PlatformLink.all).to eq([active])
end
it "orders by position" do
second = create(:platform_link, position: 2)
first = create(:platform_link, position: 1)
expect(WarpEngine::PlatformLink.all).to eq([first, second])
end
end
describe ".for_platform" do
it "returns links for given platform only" do
tic80_link = create(:platform_link, platform: "tic80")
create(:platform_link, platform: "love")
result = WarpEngine::PlatformLink.for_platform("tic80")
expect(result).to eq([tic80_link])
end
it "returns empty array for platform without links" do
expect(WarpEngine::PlatformLink.for_platform("godot")).to eq([])
end
end
end
+23
View File
@@ -0,0 +1,23 @@
require "rails_helper"
RSpec.describe WarpEngine::Release, type: :model do
it { should belong_to(:software) }
it { should have_many(:downloads) }
describe "version uniqueness" do
let(:software) { create(:software) }
it "prevents duplicate versions for same software" do
create(:release, software: software, version: "1.0.0")
dup = build(:release, software: software, version: "1.0.0")
expect(dup).not_to be_valid
end
it "allows same version across different software" do
other_sw = create(:software)
create(:release, software: software, version: "1.0.0")
other = build(:release, software: other_sw, version: "1.0.0")
expect(other).to be_valid
end
end
end
+25
View File
@@ -0,0 +1,25 @@
require "rails_helper"
RSpec.describe WarpEngine::Software, type: :model do
subject { build(:software) }
it { should validate_presence_of(:name) }
it { should validate_presence_of(:title) }
it { should validate_presence_of(:platform) }
# MySQL utf8mb4_0900_ai_ci collation: az egyediség DB-szinten case-insensitive
it { should validate_uniqueness_of(:name).case_insensitive }
# a törlést a DB-szintű ON DELETE CASCADE végzi, a modellen nincs dependent opció
it { should have_many(:releases) }
it { should have_many(:external_links) }
it { should have_many(:software_images).dependent(:destroy) }
describe "default scope" do
it "excludes soft-deleted records" do
active = create(:software)
create(:software, deleted_at: Time.current)
expect(WarpEngine::Software.all).to eq([active])
end
end
end