Compare commits

...
Author SHA1 Message Date
notplants 5033cf2b2c loomio: declare the 5.2.1 db-config upgrade boundary
continuous-integration/drone/push Build is failing
2026-11-26 03:17:58 +00:00
notplants cd30c0ec0d loomio tests: unwrap AMS collection-shaped root
continuous-integration/drone/push Build is failing
2026-11-26 02:54:53 +00:00
notplants f6cf16a220 loomio tests: reproduce entrypoint env for the Rails console
continuous-integration/drone/push Build is failing
2026-11-26 02:50:48 +00:00
notplants d35e3265e3 Enroll loomio CI tests and bridge polling
continuous-integration/drone/push Build is failing
2026-11-26 02:42:13 +00:00
autonomic-bot 8c04c08f97 Merge pull request 'Update lasuite-drive CI tests for RustFS storage' (#53) from fix/lasuite-rustfs-tests into main
continuous-integration/drone/push Build is failing
Merge verified RustFS test correction
2026-11-23 23:02:15 +00:00
7 changed files with 298 additions and 1 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ let
# admin-registered push optimization deduped against the poller (§4.1). Enrollment = add
# the repo to POLL_REPOS (csv) + ensure tests/<recipe>/ exists.
- POLL_INTERVAL=30
- POLL_REPOS=recipe-maintainers/cc-ci,recipe-maintainers/custom-html,recipe-maintainers/custom-html-tiny,recipe-maintainers/keycloak,recipe-maintainers/cryptpad,recipe-maintainers/matrix-synapse,recipe-maintainers/lasuite-docs,recipe-maintainers/lasuite-meet,recipe-maintainers/n8n,recipe-maintainers/hedgedoc,recipe-maintainers/uptime-kuma,recipe-maintainers/bluesky-pds,recipe-maintainers/discourse,recipe-maintainers/ghost,recipe-maintainers/immich,recipe-maintainers/lasuite-drive,recipe-maintainers/mailu,recipe-maintainers/mattermost-lts,recipe-maintainers/mumble,recipe-maintainers/plausible,recipe-maintainers/drone,recipe-maintainers/gitea,recipe-maintainers/wordpress,recipe-maintainers/rustdesk-server
- POLL_REPOS=recipe-maintainers/cc-ci,recipe-maintainers/custom-html,recipe-maintainers/custom-html-tiny,recipe-maintainers/keycloak,recipe-maintainers/cryptpad,recipe-maintainers/matrix-synapse,recipe-maintainers/lasuite-docs,recipe-maintainers/lasuite-meet,recipe-maintainers/n8n,recipe-maintainers/hedgedoc,recipe-maintainers/uptime-kuma,recipe-maintainers/bluesky-pds,recipe-maintainers/discourse,recipe-maintainers/ghost,recipe-maintainers/immich,recipe-maintainers/lasuite-drive,recipe-maintainers/mailu,recipe-maintainers/mattermost-lts,recipe-maintainers/mumble,recipe-maintainers/plausible,recipe-maintainers/drone,recipe-maintainers/gitea,recipe-maintainers/wordpress,recipe-maintainers/rustdesk-server,recipe-maintainers/loomio
- HMAC_FILE=/run/secrets/webhook_hmac
- DRONE_TOKEN_FILE=/run/secrets/drone_token
- GITEA_TOKEN_FILE=/run/secrets/gitea_token
+38
View File
@@ -0,0 +1,38 @@
# loomio — parity & coverage map
## P2 — Parity port
The recipe-maintainer corpus has **no** `recipe-info/loomio/` directory, so there is no parity
corpus to port. Coverage is delivered by the generic lifecycle tiers (install/upgrade/backup/restore)
plus the recipe-specific tests below.
## Lifecycle (generic tiers)
Loomio ships no `test_<op>.py` overlays, so the generic install/upgrade/backup/restore tiers run.
The stack bundles postgres (`pgautoupgrade`) and redis in-compose, so no external deps are needed.
Backup/restore is asserted by the generic tiers (the `db` service carries backupbot labels and a
`pg_backup.sh` pre/post hook).
## P3 — Recipe-specific functional tests (≥2 non-vacuous)
| cc-ci file | what's verified | why non-vacuous |
|---|---|---|
| `custom/test_api_health.py` | `GET /api/v1/boot/version` → 200 JSON with a release `version`. | Proves the Rails stack booted through DB setup/migrations and the JSON API is live, not just a served page. |
| `custom/test_group_roundtrip.py` | User + **open/public** group created via the Rails console; group read back **anonymously** over `GET /api/v1/groups/<key>`; name + handle round-trip. | Exercises the group write path, the public-visibility ability rule, FriendlyId key lookup and serialization. A broken DB/API layer fails. |
| `custom/test_discussion_roundtrip.py` | User + group + **public discussion** created via `DiscussionService`; discussion read back **anonymously** over `GET /api/v1/discussions/<key>`; title + unique body marker round-trip. | The recipe's defining object; exercises privacy validation, `DiscussionService` event publication and the anonymous visibility query. |
## Why the console (STYLE §1)
Loomio has no unauthenticated write API: account creation is email/login-token based and the REST
API is session-authenticated (Devise + CSRF). The tests therefore create state through the app's own
console (`bundle exec rails runner`) using the same models/services the controllers use — STYLE §1
option 2 — and read it back over public HTTP, a different path. Identifiers are `ccci-`-prefixed with
`.example.com` emails and are run-scoped, so leftover state is attributable and re-runs are safe.
## Deferred
- Session-auth write flow through `POST /api/v1/registrations` + `POST /api/v1/sessions` (needs CSRF
token + cookie jar); the console path already covers the write services, so this would only add
controller-level coverage.
- The separate `channels` service (`loomio_channel_server`, served at `channels.<domain>`) is not
exercised because the harness gates the single app domain.
+135
View File
@@ -0,0 +1,135 @@
"""Shared loomio test helpers.
Loomio is a Rails app. There is no unauthenticated write API (account creation is email/login-token
based and the REST API is session-authenticated), so state is created through the app's own console
(`bundle exec rails runner`) using the same models/services the API controllers use — STYLE §1 option
2. Each test then reads its object back through the PUBLIC HTTP API, a different path, so a broken
DB/serializer/routing layer is named rather than hidden.
Every helper is idempotent: it looks the user/group/discussion up by a run-scoped identifier first.
Identifiers carry the `ccci-` prefix and use `.example.com` (§8) so state left behind on a warm
canonical is attributable.
"""
from __future__ import annotations
import json
import os
import sys
import uuid
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "runner"))
from harness import lifecycle # noqa: E402
RUN_ID = uuid.uuid4().hex[:10]
ADMIN_EMAIL = f"ccci-loomio-{RUN_ID}@ccci.example.com"
ADMIN_PW = "Ccci-Loomio-Test-2026!"
GROUP_NAME = f"ccci loomio {RUN_ID}"
GROUP_HANDLE = f"ccci-loomio-{RUN_ID}"
DISCUSSION_TITLE = f"ccci discussion {RUN_ID}"
DISCUSSION_MARKER = f"ccci-marker-{RUN_ID}-roundtrip"
_EMAIL = json.dumps(ADMIN_EMAIL) # JSON string literals are valid Ruby double-quoted strings
_PW = json.dumps(ADMIN_PW)
_GROUP_NAME = json.dumps(GROUP_NAME)
_GROUP_HANDLE = json.dumps(GROUP_HANDLE)
_DISCUSSION_TITLE = json.dumps(DISCUSSION_TITLE)
_DISCUSSION_MARKER = json.dumps(DISCUSSION_MARKER)
# Creates a verified user + an OPEN, public, explore-listed group owned by that user. Prints the
# group key on its own line so the caller can read it back through the public API.
_GROUP_RUNNER = f"""
email = {_EMAIL}
user = User.find_by(email: email)
unless user
user = User.new(name: "ccci loomio", email: email, email_verified: true,
password: {_PW}, password_confirmation: {_PW})
user.save!
end
user.update!(email_verified: true) unless user.email_verified?
group = Group.find_by(handle: {_GROUP_HANDLE})
unless group
group = Group.new(name: {_GROUP_NAME}, handle: {_GROUP_HANDLE},
group_privacy: "open", listed_in_explore: true)
group.save!
group.add_admin!(user)
end
puts "GROUP_KEY=" + group.reload.key.to_s
"""
# Same, plus a public discussion in that group. Prints both keys.
_DISCUSSION_RUNNER = (
_GROUP_RUNNER
+ f"""
discussion = Discussion.find_by(group_id: group.id, title: {_DISCUSSION_TITLE})
unless discussion
discussion = Discussion.new(title: {_DISCUSSION_TITLE}, description: {_DISCUSSION_MARKER},
group: group, private: false)
DiscussionService.create(discussion: discussion, actor: user)
end
puts "DISCUSSION_KEY=" + discussion.reload.key.to_s
"""
)
# The app's entrypoint exports these from the mounted secrets and derives DATABASE_URL before
# puma starts; a bare `docker exec` does not inherit them (the image ships no config/database.yml),
# so reproduce the entrypoint env here. `$1` carries the Ruby program (passed as an argv element, so
# no quoting of the program itself is needed).
_ENTRYPOINT_ENV = """
export DEVISE_SECRET="$(cat /run/secrets/devise_secret)"
export SECRET_COOKIE_TOKEN="$(cat /run/secrets/secret_cookie_token)"
export POSTGRES_PASSWORD="$(cat /run/secrets/db_password)"
export DB_HOST=db
export DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db/${POSTGRES_DB}"
exec bundle exec rails runner "$1"
"""
def _rails(domain: str, code: str) -> str:
"""Run Ruby through the app's Rails console (the same process the API controllers run in)."""
return lifecycle.exec_in_app(
domain,
["sh", "-c", _ENTRYPOINT_ENV, "loomio-runner", code],
service="app",
timeout=300,
)
def _key(out: str, prefix: str) -> str:
for line in out.splitlines():
if line.startswith(prefix):
return line.split("=", 1)[1].strip()
raise AssertionError(
f"rails runner did not report {prefix} (last 800 chars of output: {out[-800:]!r})"
)
def ensure_group(domain: str) -> str:
"""Create (or reuse) the run's user + public group; return the group key."""
return _key(_rails(domain, _GROUP_RUNNER), "GROUP_KEY=")
def ensure_discussion(domain: str) -> tuple[str, str]:
"""Create (or reuse) the run's user + public group + public discussion; return (group, discussion) keys."""
out = _rails(domain, _DISCUSSION_RUNNER)
return _key(out, "GROUP_KEY="), _key(out, "DISCUSSION_KEY=")
def unwrap(body: object, root: str) -> dict:
"""Unwrap an AMS response.
`respond_with_collection` serializes even a single resource as an array under the root key, so
the shapes seen are `{"groups": [{...}]}`, `{"discussions": [{...}]}`, or (bare) `{...}`.
"""
if isinstance(body, dict) and root in body:
value = body[root]
if isinstance(value, list):
assert value, f"empty {root!r} collection in API response: {body!r}"
value = value[0]
if isinstance(value, dict):
return value
assert isinstance(body, dict), f"expected a JSON object, got {type(body).__name__}: {body!r}"
return body
+25
View File
@@ -0,0 +1,25 @@
"""loomio — health/liveness of the Rails app through its own JSON API.
`GET /api/v1/boot/version` is served by Api::V1::BootController#version (anonymous) and returns the
running release. It proves the Rails stack booted past DB migrations and is answering — not just that
Traefik served a static page. The generic install tier already asserts real HTTPS serving.
"""
from __future__ import annotations
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "runner"))
from harness import http as harness_http # noqa: E402
def test_api_boot_version_serves(live_app):
url = f"https://{live_app}/api/v1/boot/version"
status, body = harness_http.retry_http_get(url, expect_status=200, max_wait=120, interval=5)
assert status == 200, f"GET {url} HTTP {status}"
assert isinstance(body, dict), f"GET {url} did not return a JSON object: {body!r}"
version = body.get("version")
assert isinstance(version, str) and version.strip(), (
f"GET {url} returned no version string: {body!r}"
)
@@ -0,0 +1,38 @@
"""loomio — create a discussion and read its body back through the public API.
Loomio's core object is a discussion. This creates a user + open group + public discussion through the
app's Rails console (`DiscussionService.create`, the same service the API controller calls), then reads
the discussion back ANONYMOUSLY at `GET /api/v1/discussions/<key>`, asserting the title and the unique
body marker survive.
Non-vacuous: it exercises the discussion write path (privacy validation against the group, author
assignment, event publication) and the anonymous visibility rule (`DiscussionQuery.visible_to` includes
public discussions). A read-back of a different path means a stale/echoed setup cannot pass.
"""
from __future__ import annotations
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "runner"))
import _loomio # noqa: E402
from harness import http as harness_http # noqa: E402
def test_public_discussion_roundtrip(live_app):
_group_key, discussion_key = _loomio.ensure_discussion(live_app)
url = f"https://{live_app}/api/v1/discussions/{discussion_key}"
status, body = harness_http.retry_http_get(url, expect_status=200, max_wait=60, interval=3)
assert status == 200, f"anonymous GET {url} HTTP {status} (public discussion not readable)"
discussion = _loomio.unwrap(body, "discussions")
assert discussion.get("title") == _loomio.DISCUSSION_TITLE, (
f"discussion title did not round-trip: sent {_loomio.DISCUSSION_TITLE!r}, "
f"got {discussion.get('title')!r}"
)
assert _loomio.DISCUSSION_MARKER in str(discussion.get("description")), (
f"discussion body marker missing: sent {_loomio.DISCUSSION_MARKER!r}, "
f"got {discussion.get('description')!r}"
)
@@ -0,0 +1,35 @@
"""loomio — §4.3 create-an-object + read-it-back for a group.
Creates a verified user and a public/open group through the app's own Rails console (the same
`Group`/`Membership` path the API controller uses — STYLE §1 option 2), then reads the group back
ANONYMOUSLY through the public HTTP API (`GET /api/v1/groups/<key>`), a different path.
Non-vacuous: if DB persistence, the public-group ability rule (`Ability::Group#show` requires
`is_visible_to_public`), FriendlyId key lookup, or group serialization is broken, this fails even
though the landing page and health endpoint still answer. The group name/handle are run-scoped.
"""
from __future__ import annotations
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "runner"))
import _loomio # noqa: E402
from harness import http as harness_http # noqa: E402
def test_public_group_roundtrip(live_app):
group_key = _loomio.ensure_group(live_app)
url = f"https://{live_app}/api/v1/groups/{group_key}"
status, body = harness_http.retry_http_get(url, expect_status=200, max_wait=60, interval=3)
assert status == 200, f"anonymous GET {url} HTTP {status} (public group not readable)"
group = _loomio.unwrap(body, "groups")
assert group.get("handle") == _loomio.GROUP_HANDLE, (
f"group handle did not round-trip: sent {_loomio.GROUP_HANDLE!r}, got {group.get('handle')!r}"
)
assert group.get("name") == _loomio.GROUP_NAME, (
f"group name did not round-trip: sent {_loomio.GROUP_NAME!r}, got {group.get('name')!r}"
)
+26
View File
@@ -0,0 +1,26 @@
# Per-recipe harness config for loomio (collaborative decision-making; Rails app + sidekiq
# worker + postgres (pgautoupgrade) + redis, with a separate loomio_channel_server).
#
# `/` redirects into the SPA/dashboard (302 for an anonymous visitor, 200 once it settles), so the
# serving gate accepts both. The real liveness signal is the Rails JSON API under /api/v1.
#
# Boot is heavy: every app start runs `apt install postgresql-client`, `bundle install`, then
# `db:setup`/`db:migrate` before puma. The recipe's healthcheck start_period is only 2m, so give
# the deploy a generous ceiling (DB init + first-boot schema load + asset boot).
HEALTH_PATH = "/"
HEALTH_OK = (200, 302)
DEPLOY_TIMEOUT = 1800
HTTP_TIMEOUT = 900
# Structural upgrade boundary: 5.2.1 added a `pg_backup` config + backupbot labels to the `db`
# service. Swarm therefore RECREATES the db task during a 5.2.0 -> 5.2.1 stack update, and the app
# task (which restarts in parallel and runs `db:setup` against host `db`) dies with
# `PG::ConnectionBad: could not translate host name "db"` before the db task is back — swarm then
# pauses/rolls back the app update. In-place 5.2.0 -> 5.2.1 is consequently not supported; bases
# below 5.2.1 are excluded from upgrade-base resolution. From 5.2.1 onward the db service config is
# unchanged between releases, so later upgrades are app-only and do run.
UPGRADE_BASE_FLOOR = "5.2.1+v3.0.20"
# canon §2.B: enroll as a DATA-WARM canonical (all recipes enrolled — operator 2026-06-17).
# The weekly sweep promotes this recipe's canonical to its latest green RELEASE TAG.
WARM_CANONICAL = True