Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package openQA for openSUSE:Factory checked 
in at 2026-11-21 21:46:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/openQA (Old)
 and      /work/SRC/openSUSE:Factory/.openQA.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "openQA"

Sat Nov 21 21:46:48 2026 rev:910 rq:1399534 version:5.1795190948.0362803c

Changes:
--------
--- /work/SRC/openSUSE:Factory/openQA/openQA.changes    2026-11-20 
14:51:19.107041203 +0100
+++ /work/SRC/openSUSE:Factory/.openQA.new.1340718/openQA.changes       
2026-11-21 21:48:22.158095381 +0100
@@ -1,0 +2,22 @@
+Fri Nov 20 16:09:23 UTC 2026 - [email protected]
+
+- Update to version 5.1795190948.0362803c:
+  * feat(dump-db): add folder and retention flags
+  * fix(dump-db): write dumps atomically
+  * test(bugs): Describe repeated implicit insert accurately
+  * feat(container): upgrade LLM server to gemma-4-26B-A4B-it MoE
+
+-------------------------------------------------------------------
+Fri Nov 20 12:54:20 UTC 2026 - [email protected]
+
+- Update to version 5.1795177469.dc135093:
+  * feat(munin): Add plugin for DB table sizes
+
+-------------------------------------------------------------------
+Fri Nov 20 11:26:35 UTC 2026 - [email protected]
+
+- Update to version 5.1795173981.28f5c976:
+  * fix(mcp): use plain text comments in openqa_get_job_info
+  * fix(db): avoid duplicate key error on bugs_bugid
+
+-------------------------------------------------------------------

Old:
----
  openQA-5.1795089075.1f7748a4.obscpio

New:
----
  openQA-5.1795190948.0362803c.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ openQA-client-test.spec ++++++
--- /var/tmp/diff_new_pack.ZemecQ/_old  2026-11-21 21:48:25.384230611 +0100
+++ /var/tmp/diff_new_pack.ZemecQ/_new  2026-11-21 21:48:25.388230778 +0100
@@ -18,7 +18,7 @@
 
 %define         short_name openQA-client
 Name:           %{short_name}-test
-Version:        5.1795089075.1f7748a4
+Version:        5.1795190948.0362803c
 Release:        0
 Summary:        Test package for %{short_name}
 License:        GPL-2.0-or-later

++++++ openQA-test.spec ++++++
--- /var/tmp/diff_new_pack.ZemecQ/_old  2026-11-21 21:48:25.450233377 +0100
+++ /var/tmp/diff_new_pack.ZemecQ/_new  2026-11-21 21:48:25.451233419 +0100
@@ -18,7 +18,7 @@
 
 %define         short_name openQA
 Name:           %{short_name}-test
-Version:        5.1795089075.1f7748a4
+Version:        5.1795190948.0362803c
 Release:        0
 Summary:        Test package for openQA
 License:        GPL-2.0-or-later

++++++ openQA-worker-test.spec ++++++
--- /var/tmp/diff_new_pack.ZemecQ/_old  2026-11-21 21:48:25.515236102 +0100
+++ /var/tmp/diff_new_pack.ZemecQ/_new  2026-11-21 21:48:25.516236144 +0100
@@ -18,7 +18,7 @@
 
 %define         short_name openQA-worker
 Name:           %{short_name}-test
-Version:        5.1795089075.1f7748a4
+Version:        5.1795190948.0362803c
 Release:        0
 Summary:        Test package for %{short_name}
 License:        GPL-2.0-or-later

++++++ openQA.spec ++++++
--- /var/tmp/diff_new_pack.ZemecQ/_old  2026-11-21 21:48:25.605239875 +0100
+++ /var/tmp/diff_new_pack.ZemecQ/_new  2026-11-21 21:48:25.607239959 +0100
@@ -104,7 +104,7 @@
 %define devel_requires %devel_no_selenium_requires chromedriver
 
 Name:           openQA
-Version:        5.1795089075.1f7748a4
+Version:        5.1795190948.0362803c
 Release:        0
 Summary:        Framework for automated system-level testing (web-frontend, 
scheduler and tools)
 Group:          Development/Tools/Other
@@ -336,6 +336,7 @@
 Requires:       munin-node
 Requires:       curl
 Requires:       perl
+Requires:       perl(DBD::Pg)
 
 %description munin
 Use this package to install munin scripts that allow to monitor some openQA
@@ -480,8 +481,10 @@
 %if %{with munin_package}
 install -d -m 755 %{buildroot}/%{_prefix}/lib/munin/plugins
 install -m 755 contrib/munin/plugins/minion 
%{buildroot}/%{_prefix}/lib/munin/plugins/openqa_minion_
+install -m 755 contrib/munin/plugins/table_sizes 
%{buildroot}/%{_prefix}/lib/munin/plugins/table_sizes_
 install -d -m 755 %{buildroot}/%{_sysconfdir}/munin/plugin-conf.d
 install -m 644 contrib/munin/config/minion.config 
%{buildroot}/%{_sysconfdir}/munin/plugin-conf.d/openqa-minion
+install -m 644 contrib/munin/config/table_sizes.config 
%{buildroot}/%{_sysconfdir}/munin/plugin-conf.d/openqa-table-sizes
 install -m 755 contrib/munin/utils/munin-mail 
%{buildroot}/%{_datadir}/openqa/script/munin-mail
 %endif
 
@@ -947,14 +950,17 @@
 %files munin
 %defattr(-,root,root)
 %doc contrib/munin/config/minion.config
+%doc contrib/munin/config/table_sizes.config
 %dir %{_datadir}/openqa/script
 %dir %{_prefix}/lib/munin
 %dir %{_prefix}/lib/munin/plugins
 %dir %{_sysconfdir}/munin
 %dir %{_sysconfdir}/munin/plugin-conf.d
 %{_prefix}/lib/munin/plugins/openqa_minion_
+%{_prefix}/lib/munin/plugins/table_sizes_
 %{_datadir}/openqa/script/munin-mail
 %config(noreplace) %{_sysconfdir}/munin/plugin-conf.d/openqa-minion
+%config(noreplace) %{_sysconfdir}/munin/plugin-conf.d/openqa-table-sizes
 %endif
 
 %files mcp

++++++ openQA-5.1795089075.1f7748a4.obscpio -> 
openQA-5.1795190948.0362803c.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/openQA-5.1795089075.1f7748a4/container/systemd/openqa-llm-server.container 
new/openQA-5.1795190948.0362803c/container/systemd/openqa-llm-server.container
--- 
old/openQA-5.1795089075.1f7748a4/container/systemd/openqa-llm-server.container  
    2026-11-19 12:51:15.000000000 +0100
+++ 
new/openQA-5.1795190948.0362803c/container/systemd/openqa-llm-server.container  
    2026-11-20 17:09:08.000000000 +0100
@@ -7,7 +7,7 @@
 ContainerName=openqa-llm-server
 Volume=/opt/llm/models:/models
 PublishPort=8080:8080
-Exec=-hf unsloth/gemma-4-E4B-it-GGUF:UD-IQ2_M --no-mmproj --temp 1.0 --top-p 
0.95 --top-k 64 --ctx-size 65536
+Exec=-hf unsloth/gemma-4-26B-A4B-it-GGUF:UD-Q4_K_M --no-mmproj --temp 1.0 
--top-p 0.95 --top-k 64 --ctx-size 65536 --cache-ram 65536 -ctk q8_0 -ctv q8_0 
-fa on
 Environment=HF_HOME=/models
 Environment=LLAMA_CACHE=/models
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/openQA-5.1795089075.1f7748a4/contrib/munin/config/table_sizes.config 
new/openQA-5.1795190948.0362803c/contrib/munin/config/table_sizes.config
--- old/openQA-5.1795089075.1f7748a4/contrib/munin/config/table_sizes.config    
1970-01-01 01:00:00.000000000 +0100
+++ new/openQA-5.1795190948.0362803c/contrib/munin/config/table_sizes.config    
2026-11-20 17:09:08.000000000 +0100
@@ -0,0 +1,6 @@
+[table_sizes_openqa]
+#user root
+#env.db_host 127.0.0.1
+#env.db_port 5432
+#env.db_user user
+#env.db_pass pass
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/openQA-5.1795089075.1f7748a4/contrib/munin/plugins/table_sizes 
new/openQA-5.1795190948.0362803c/contrib/munin/plugins/table_sizes
--- old/openQA-5.1795089075.1f7748a4/contrib/munin/plugins/table_sizes  
1970-01-01 01:00:00.000000000 +0100
+++ new/openQA-5.1795190948.0362803c/contrib/munin/plugins/table_sizes  
2026-11-20 17:09:08.000000000 +0100
@@ -0,0 +1,162 @@
+#!/usr/bin/perl
+package table_sizes;
+use strict;
+use warnings;
+use DBI;
+use v5.26;
+use experimental qw(signatures);
+
+# Munin multigraph plugin to monitor PostgreSQL table sizes (total, data-only, 
and index-only)
+# in the 'openqa' database.
+#
+# Usage
+#
+# To measure tables in the openqa db, add this to
+# /etc/munin/plugin-conf.d/openqa-table-sizes
+#
+#   [table_sizes_openqa]
+#   user root
+#   env.db_host 127.0.0.1
+#   env.db_host /var/run/postgresql
+#   env.db_port 5432
+#   env.db_user user
+#   env.db_pass pass
+#
+# Put script into /usr/lib/munin/plugins/table_sizes_ (or symlink)
+#
+# Create a symlink in /etc/munin/plugins:
+# table_sizes_openqa -> /usr/lib/munin/plugins/table_sizes_
+
+my ($db_name) = $0 =~ m/table_sizes_(\w+)/;
+$db_name ||= $ENV{db_name} || 'openqa';
+my $db_host = $ENV{db_host} // '';
+my $db_port = $ENV{db_port} // '';
+my $db_user = $ENV{db_user} // 'postgres';
+my $db_pass = $ENV{db_pass} // '';
+
+my $dsn = "dbi:Pg:dbname=$db_name";
+$dsn .= ";host=$db_host" if $db_host ne '';
+$dsn .= ";port=$db_port" if $db_port ne '';
+
+my @graphs = (
+    {
+        name  => "${db_name}_table_sizes",
+        title => "$db_name PostgreSQL table sizes (including indices)",
+        info  => "Total disk space used by each table and its associated 
indexes in the $db_name database.",
+        key   => 'total_bytes',
+    },
+    {
+        name  => "${db_name}_table_data_sizes",
+        title => "$db_name PostgreSQL table sizes (data only)",
+        info  => "Disk space used by table data and TOAST (excluding indexes) 
in the $db_name database.",
+        key   => 'data_bytes',
+    },
+    {
+        name  => "${db_name}_table_index_sizes",
+        title => "$db_name PostgreSQL index sizes (per table)",
+        info  => "Total disk space used by all indexes per table in the 
$db_name database.",
+        key   => 'index_bytes',
+    },
+);
+
+sub fetch_data () {
+    my $dbh = DBI->connect(
+        $dsn,
+        $db_user,
+        $db_pass,
+        { RaiseError => 1, AutoCommit => 1, PrintError => 0 }
+    );
+
+    # Fetch user tables in the public schema along with:
+    # - total_bytes: table + toast + indexes
+    # - data_bytes:  table + toast (excluding indexes)
+    # - index_bytes: all indexes associated with the table
+    my $sql = <<~'EOM';
+        SELECT
+            relname AS table_name,
+            pg_total_relation_size(C.oid) AS total_bytes,
+            pg_table_size(C.oid)          AS data_bytes,
+            pg_indexes_size(C.oid)        AS index_bytes
+        FROM pg_class C
+        LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
+        WHERE nspname = 'public'
+          AND relkind = 'r'
+        ORDER BY relname ASC;
+        EOM
+
+    my $sth = $dbh->prepare($sql);
+    $sth->execute();
+
+    my @tables;
+    while (my $row = $sth->fetchrow_hashref) {
+        # Sanitize table names to valid Munin field names ([a-zA-Z0-9_])
+        my $fieldname = $row->{table_name};
+        $fieldname =~ s/[^a-zA-Z0-9_]/_/g;
+        $fieldname = "t_$fieldname" if $fieldname =~ /^[0-9]/;
+
+        push @tables, {
+            field       => $fieldname,
+            label       => $row->{table_name},
+            total_bytes => $row->{total_bytes},
+            data_bytes  => $row->{data_bytes},
+            index_bytes => $row->{index_bytes},
+        };
+    }
+
+    $sth->finish();
+    $dbh->disconnect();
+
+    return \@tables;
+}
+
+sub main () {
+    if (defined $ARGV[0] && $ARGV[0] eq 'config') {
+        my $tables = fetch_data();
+        config($tables);
+    }
+    else {
+        my $tables = fetch_data();
+        data($tables);
+    }
+}
+
+sub config ($tables) {
+    for my $g (@graphs) {
+        my $key = $g->{key};
+        # Sort tables from largest to smallest for this specific graph's legend
+        my @sorted = sort {
+            $b->{$key} <=> $a->{$key} || $a->{label} cmp $b->{label}
+        } @$tables;
+
+        print <<~"EOM";
+            multigraph $g->{name}
+            graph_title $g->{title}
+            graph_args --base 1024 -l 0
+            graph_vlabel Bytes
+            graph_category db
+            graph_info $g->{info}
+            EOM
+
+        foreach my $t (@sorted) {
+            print <<~"EOM";
+                $t->{field}.label $t->{label}
+                $t->{field}.type GAUGE
+                $t->{field}.min 0
+                EOM
+        }
+        print "\n";
+    }
+}
+
+sub data ($tables) {
+    for my $g (@graphs) {
+        say "multigraph $g->{name}";
+        my $key = $g->{key};
+        foreach my $t (@$tables) {
+            say "$t->{field}.value $t->{$key}";
+        }
+        print "\n";
+    }
+}
+
+main() unless caller;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openQA-5.1795089075.1f7748a4/dist/rpm/openQA.spec 
new/openQA-5.1795190948.0362803c/dist/rpm/openQA.spec
--- old/openQA-5.1795089075.1f7748a4/dist/rpm/openQA.spec       2026-11-19 
12:51:15.000000000 +0100
+++ new/openQA-5.1795190948.0362803c/dist/rpm/openQA.spec       2026-11-20 
17:09:08.000000000 +0100
@@ -337,6 +337,7 @@
 Requires:       munin-node
 Requires:       curl
 Requires:       perl
+Requires:       perl(DBD::Pg)
 
 %description munin
 Use this package to install munin scripts that allow to monitor some openQA
@@ -481,8 +482,10 @@
 %if %{with munin_package}
 install -d -m 755 %{buildroot}/%{_prefix}/lib/munin/plugins
 install -m 755 contrib/munin/plugins/minion 
%{buildroot}/%{_prefix}/lib/munin/plugins/openqa_minion_
+install -m 755 contrib/munin/plugins/table_sizes 
%{buildroot}/%{_prefix}/lib/munin/plugins/table_sizes_
 install -d -m 755 %{buildroot}/%{_sysconfdir}/munin/plugin-conf.d
 install -m 644 contrib/munin/config/minion.config 
%{buildroot}/%{_sysconfdir}/munin/plugin-conf.d/openqa-minion
+install -m 644 contrib/munin/config/table_sizes.config 
%{buildroot}/%{_sysconfdir}/munin/plugin-conf.d/openqa-table-sizes
 install -m 755 contrib/munin/utils/munin-mail 
%{buildroot}/%{_datadir}/openqa/script/munin-mail
 %endif
 
@@ -948,14 +951,17 @@
 %files munin
 %defattr(-,root,root)
 %doc contrib/munin/config/minion.config
+%doc contrib/munin/config/table_sizes.config
 %dir %{_datadir}/openqa/script
 %dir %{_prefix}/lib/munin
 %dir %{_prefix}/lib/munin/plugins
 %dir %{_sysconfdir}/munin
 %dir %{_sysconfdir}/munin/plugin-conf.d
 %{_prefix}/lib/munin/plugins/openqa_minion_
+%{_prefix}/lib/munin/plugins/table_sizes_
 %{_datadir}/openqa/script/munin-mail
 %config(noreplace) %{_sysconfdir}/munin/plugin-conf.d/openqa-minion
+%config(noreplace) %{_sysconfdir}/munin/plugin-conf.d/openqa-table-sizes
 %endif
 
 %files mcp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openQA-5.1795089075.1f7748a4/docs/Installing.md 
new/openQA-5.1795190948.0362803c/docs/Installing.md
--- old/openQA-5.1795089075.1f7748a4/docs/Installing.md 2026-11-19 
12:51:15.000000000 +0100
+++ new/openQA-5.1795190948.0362803c/docs/Installing.md 2026-11-20 
17:09:08.000000000 +0100
@@ -1539,7 +1539,9 @@
 systemctl enable --now openqa-dump-db.timer
 ```
 
-Backups are stored at `/var/lib/openqa/backup`.
+Backups are stored at `/var/lib/openqa/backup`. Destination folder and 
retention
+period can be customized via environment variables or CLI flags (see
+`openqa-dump-db --help`).
 
 ## Auditing - tracking openQA changes
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/openQA-5.1795089075.1f7748a4/lib/OpenQA/Schema/ResultSet/Bugs.pm 
new/openQA-5.1795190948.0362803c/lib/OpenQA/Schema/ResultSet/Bugs.pm
--- old/openQA-5.1795089075.1f7748a4/lib/OpenQA/Schema/ResultSet/Bugs.pm        
2026-11-19 12:51:15.000000000 +0100
+++ new/openQA-5.1795190948.0362803c/lib/OpenQA/Schema/ResultSet/Bugs.pm        
2026-11-20 17:09:08.000000000 +0100
@@ -7,12 +7,26 @@
 use OpenQA::App;
 
 # inserts the bug if it is new, returns the bug if it has been refreshed, 
undef otherwise
-sub get_bug ($self, $bugid = undef, %attrs) {
+sub get_bug ($self, $bugid = undef) {
     return undef unless $bugid;
-    my $bug = $self->find_or_new({bugid => $bugid, %attrs});
-    return ($bug->refreshed && $bug->existing) ? $bug : undef if 
$bug->in_storage;
-    $bug->insert;
-    OpenQA::App->singleton->emit_event(openqa_bug_create => {id => $bug->id, 
bugid => $bug->bugid, implicit => 1});
+    # bugs are re-referenced by many jobs and comments, so a lookup usually 
hits an existing row and the
+    # common case must stay a plain read instead of an insert attempt that 
consumes a transaction ID
+    my $bug = $self->find({bugid => $bugid}) // 
$self->_insert_implicit($bugid);
+    return ($bug && $bug->refreshed && $bug->existing) ? $bug : undef;
+}
+
+sub _insert_implicit ($self, $bugid) {
+    my $dbh = $self->result_source->schema->storage->dbh;
+    my $sth = $dbh->prepare_cached(<<~'END_SQL');
+        INSERT INTO bugs (bugid, t_created, t_updated)
+                    VALUES (?, now(), now())
+        ON CONFLICT (bugid) DO NOTHING RETURNING id
+        END_SQL
+    $sth->execute($bugid);
+    my ($id) = $sth->fetchrow_array;
+    $sth->finish;
+    return $self->find({bugid => $bugid}) unless $id;
+    OpenQA::App->singleton->emit_event(openqa_bug_create => {id => $id, bugid 
=> $bugid, implicit => 1});
     return undef;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/openQA-5.1795089075.1f7748a4/lib/OpenQA/WebAPI/Plugin/MCP.pm 
new/openQA-5.1795190948.0362803c/lib/OpenQA/WebAPI/Plugin/MCP.pm
--- old/openQA-5.1795089075.1f7748a4/lib/OpenQA/WebAPI/Plugin/MCP.pm    
2026-11-19 12:51:15.000000000 +0100
+++ new/openQA-5.1795190948.0362803c/lib/OpenQA/WebAPI/Plugin/MCP.pm    
2026-11-20 17:09:08.000000000 +0100
@@ -111,7 +111,7 @@
     my $schema = _get_schema($tool);
     return $tool->text_result('Job does not exist', 1)
       unless my $job = $schema->resultset('Jobs')->find(int $job_id);
-    my @comments = map { $_->extended_hash } $job->search_related(comments => 
{})->all;
+    my @comments = map { $_->extended_hash(0) } $job->search_related(comments 
=> {})->all;
 
     my $info = $job->to_hash(assets => 1, check_assets => 1, deps => 1, 
details => 1, parent_group => 1);
     return _render_from_data_section('openqa_get_job_info.txt.ep', {job => 
$info, comments => \@comments});
@@ -200,7 +200,7 @@
 Comments:
 % if (@$comments) {
   % for my $comment (@$comments) {
-  - <%= $comment->{userName} %> (<%= $comment->{created} %>): <%= 
$comment->{renderedMarkdown} %>
+  - <%= $comment->{userName} %> (<%= $comment->{created} %>): <%= 
$comment->{text} %>
   % }
 % }
 % else {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openQA-5.1795089075.1f7748a4/script/dump-db 
new/openQA-5.1795190948.0362803c/script/dump-db
--- old/openQA-5.1795089075.1f7748a4/script/dump-db     2026-11-19 
12:51:15.000000000 +0100
+++ new/openQA-5.1795190948.0362803c/script/dump-db     2026-11-20 
17:09:08.000000000 +0100
@@ -1,8 +1,87 @@
 #!/bin/bash
 set -euo pipefail
+
 DUMP_FOLDER=${DUMP_FOLDER:-"/var/lib/openqa/backup"}
 DAYS_TO_KEEP=${DAYS_TO_KEEP:-"7"}
-[[ ${1-} = '-h' ]] || [[ ${1-} = '--help' ]] && echo "Dump the openQA 
postgresql database to ${DUMP_FOLDER} and clean-up backups older than 
${DAYS_TO_KEEP} days." && exit
 
-ionice -c3 nice -n19 pg_dump -Fc -c openqa -f "${DUMP_FOLDER}/$(date 
-Idate).dump"
-find -L "${DUMP_FOLDER}" -type f -mtime "+${DAYS_TO_KEEP}" -print0 -delete
+usage() {
+    cat << EOF
+Usage: $(basename "$0") [OPTIONS]
+
+Dump the openQA PostgreSQL database to DUMP_FOLDER and clean up backups older 
than DAYS_TO_KEEP days.
+
+Options:
+  -f, --folder PATH   Target backup directory (default: \$DUMP_FOLDER or 
/var/lib/openqa/backup)
+  -d, --days DAYS     Number of days to keep backups (default: \$DAYS_TO_KEEP 
or 7)
+  -h, --help          Show this help message and exit
+
+Environment variables:
+  DUMP_FOLDER         Fallback path if --folder is omitted
+  DAYS_TO_KEEP        Fallback retention in days if --days is omitted
+  PG*                 Standard PostgreSQL libpq connection variables (e.g. 
PGHOST, PGPORT)
+EOF
+}
+
+while [[ $# -gt 0 ]]; do
+    case "$1" in
+        -h | --help)
+            usage
+            exit 0
+            ;;
+        -f | --folder)
+            [[ $# -lt 2 ]] && {
+                echo "Error: $1 requires an argument" >&2
+                exit 1
+            }
+            DUMP_FOLDER="$2"
+            shift 2
+            ;;
+        --folder=*)
+            DUMP_FOLDER="${1#*=}"
+            shift
+            ;;
+        -d | --days)
+            [[ $# -lt 2 ]] && {
+                echo "Error: $1 requires an argument" >&2
+                exit 1
+            }
+            DAYS_TO_KEEP="$2"
+            shift 2
+            ;;
+        --days=*)
+            DAYS_TO_KEEP="${1#*=}"
+            shift
+            ;;
+        *)
+            echo "Error: Unknown option: $1" >&2
+            usage >&2
+            exit 1
+            ;;
+    esac
+done
+
+[[ "$DAYS_TO_KEEP" =~ ^[0-9]+$ ]] || {
+    echo "Error: DAYS_TO_KEEP must be a non-negative integer" >&2
+    exit 1
+}
+
+DUMP_DATE=$(date -Idate)
+TMP_FILE="${DUMP_FOLDER}/.${DUMP_DATE}.dump.tmp.$$"
+cleanup() {
+    if [[ -n "${TMP_FILE:-}" && -f "${TMP_FILE}" ]]; then
+        rm -f "${TMP_FILE}"
+    fi
+}
+trap cleanup EXIT
+trap 'exit 130' INT
+trap 'exit 143' TERM
+
+FINAL_DUMP="${DUMP_FOLDER}/${DUMP_DATE}.dump"
+
+ionice -c3 nice -n19 pg_dump -Fc -c openqa -f "${TMP_FILE}"
+mv -f "${TMP_FILE}" "${FINAL_DUMP}"
+TMP_FILE=""
+
+# Stale temp files are left behind by killed runs, prune them after one day
+find -L "${DUMP_FOLDER}" -maxdepth 1 -name ".*.dump.tmp.*" -type f -mtime +0 
-delete
+find -L "${DUMP_FOLDER}" -maxdepth 1 -name "*.dump" -type f -mtime 
"+${DAYS_TO_KEEP}" -delete
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openQA-5.1795089075.1f7748a4/t/25-bugs.t 
new/openQA-5.1795190948.0362803c/t/25-bugs.t
--- old/openQA-5.1795089075.1f7748a4/t/25-bugs.t        2026-11-19 
12:51:15.000000000 +0100
+++ new/openQA-5.1795190948.0362803c/t/25-bugs.t        2026-11-20 
17:09:08.000000000 +0100
@@ -50,4 +50,11 @@
     ok $bugs->find({bugid => 'poo#202'}), 'Bug poo#202 not cleaned up due to 
reference from comment';
 };
 
+subtest 'implicit insert of a bug that was inserted meanwhile' => sub {
+    is $bugs->_insert_implicit('poo#300'), undef, 'nothing returned for a bug 
that did not exist yet';
+    my $bug = $bugs->_insert_implicit('poo#300');
+    is $bug->bugid, 'poo#300', 'existing bug returned on repeated implicit 
insert';
+    is $bugs->search({bugid => 'poo#300'})->count, 1, 'bug not inserted twice';
+};
+
 done_testing();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openQA-5.1795089075.1f7748a4/t/45-dump-db.t 
new/openQA-5.1795190948.0362803c/t/45-dump-db.t
--- old/openQA-5.1795089075.1f7748a4/t/45-dump-db.t     1970-01-01 
01:00:00.000000000 +0100
+++ new/openQA-5.1795190948.0362803c/t/45-dump-db.t     2026-11-20 
17:09:08.000000000 +0100
@@ -0,0 +1,202 @@
+# Copyright SUSE LLC
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+use Test::Most;
+use Mojo::Base -signatures;
+use Test::Warnings ':report_warnings';
+
+use FindBin '$Bin';
+use lib "$FindBin::Bin/lib", 
"$FindBin::Bin/../external/os-autoinst-common/lib";
+use OpenQA::Test::TimeLimit '30';
+use IPC::Run qw(run timeout);
+use Mojo::File qw(tempdir);
+use POSIX qw(strftime);
+use Time::Seconds;
+
+my $dump_script = "$Bin/../script/dump-db";
+ok -x $dump_script, 'script/dump-db is executable';
+
+sub run_dump ($args = [], $env = {}) {
+    my ($in, $out, $err);
+    local %ENV = (%ENV, %$env);
+    my $success = eval { run [$dump_script, @$args], \$in, \$out, \$err, 
timeout(10); };
+    return ($success, $out, $err, $? >> 8);
+}
+
+sub leftover_tmp ($dir) {
+    return [grep { /^\.\d{4}-\d{2}-\d{2}\.dump\.tmp\./ } map { $_->basename } 
@{$dir->list({hidden => 1})}];
+}
+
+subtest 'Help and argument validation' => sub {
+    my ($success, $out, $err, $exit) = run_dump(['--help']);
+    ok $success, 'dump-db --help succeeds';
+    is $exit, 0, 'dump-db --help exits with 0';
+    like $out, qr/Usage: dump-db/, 'help output displays usage';
+    like $out, qr/--folder/, 'help output displays folder option';
+    like $out, qr/--days/, 'help output displays days option';
+
+    ($success, $out, $err, $exit) = run_dump(['-h']);
+    ok $success, 'dump-db -h succeeds';
+    is $exit, 0, 'dump-db -h exits with 0';
+
+    ($success, $out, $err, $exit) = run_dump(['--invalid-flag']);
+    ok !$success, 'dump-db with unknown flag fails';
+    is $exit, 1, 'dump-db with unknown flag exits with 1';
+    like $err, qr/Unknown option: --invalid-flag/, 'error message mentions 
unknown flag';
+
+    ($success, $out, $err, $exit) = run_dump(['--folder']);
+    ok !$success, 'dump-db --folder without value fails';
+    is $exit, 1, 'dump-db --folder without value exits with 1';
+    like $err, qr/requires an argument/, 'error message mentions missing 
argument';
+
+    ($success, $out, $err, $exit) = run_dump(['--days']);
+    ok !$success, 'dump-db --days without value fails';
+    is $exit, 1, 'dump-db --days without value exits with 1';
+    like $err, qr/requires an argument/, 'error message mentions missing 
argument';
+
+    ($success, $out, $err, $exit) = run_dump(['--days', 'invalid']);
+    ok !$success, 'dump-db --days with non-integer value fails';
+    is $exit, 1, 'dump-db --days with non-integer value exits with 1';
+    like $err, qr/must be a non-negative integer/, 'error message mentions 
non-negative integer requirement';
+};
+
+my $mock_bin = tempdir;
+my $mock_pg_dump = $mock_bin->child('pg_dump');
+$mock_pg_dump->spurt(<<'SH');
+#!/bin/bash
+target=""
+while [[ $# -gt 0 ]]; do
+    if [[ "$1" == "-f" ]]; then
+        target="$2"
+        shift 2
+    else
+        shift
+    fi
+done
+
+if [[ -n "${MOCK_PG_DUMP_FAIL:-}" ]]; then
+    [[ -n "$target" ]] && echo "corrupted-in-flight-dump" > "$target"
+    exit 1
+fi
+
+if [[ -n "${MOCK_PG_DUMP_SIGNAL:-}" ]]; then
+    [[ -n "$target" ]] && echo "signal-in-flight-dump" > "$target"
+    target_pid="${target##*.}"
+    kill -TERM "$target_pid"
+    exit 1
+fi
+
+[[ -n "$target" ]] && echo "valid-dump-content" > "$target"
+exit 0
+SH
+chmod 0755, "$mock_pg_dump";
+
+my $test_env = {PATH => "$mock_bin:$ENV{PATH}"};
+my $today_dump = strftime('%Y-%m-%d.dump', localtime);
+
+subtest 'Atomic success creates final dump and leaves no temp file' => sub {
+    my $dump_dir = tempdir;
+    my ($success, $out, $err, $exit) = run_dump(['--folder', "$dump_dir"], 
$test_env);
+    ok $success, 'dump-db succeeds with mock pg_dump';
+    is $exit, 0, 'dump-db exits with 0 on success';
+
+    my $final_file = $dump_dir->child($today_dump);
+    ok -f $final_file, "dump file $today_dump exists";
+    is $final_file->slurp, "valid-dump-content\n", 'dump file contains 
expected content';
+
+    is scalar @{leftover_tmp($dump_dir)}, 0, 'no hidden temporary dump files 
remain after success';
+};
+
+subtest 'Atomic failure preserves existing dump and cleans up temp file' => 
sub {
+    my $dump_dir = tempdir;
+    my $final_file = $dump_dir->child($today_dump);
+    $final_file->spurt("original-intact-dump\n");
+
+    my $fail_env = {%$test_env, MOCK_PG_DUMP_FAIL => '1'};
+    my ($success, $out, $err, $exit) = run_dump(['--folder', "$dump_dir"], 
$fail_env);
+    ok !$success, 'dump-db fails when pg_dump fails';
+    isnt $exit, 0, 'dump-db exits with non-zero when pg_dump fails';
+
+    ok -f $final_file, "pre-existing $today_dump still exists";
+    is $final_file->slurp, "original-intact-dump\n", 'original dump remains 
byte-identical after failed run';
+
+    is scalar @{leftover_tmp($dump_dir)}, 0, 'temporary in-flight dump was 
removed by trap on failure';
+};
+
+subtest 'Signal termination triggers cleanup and exits with signal exit code' 
=> sub {
+    my $dump_dir = tempdir;
+    my $sig_env = {%$test_env, MOCK_PG_DUMP_SIGNAL => '1'};
+    my ($success, $out, $err, $exit) = run_dump(['--folder', "$dump_dir"], 
$sig_env);
+    ok !$success, 'dump-db fails on SIGTERM';
+    is $exit, 143, 'dump-db exits with 143 on SIGTERM';
+
+    is scalar @{leftover_tmp($dump_dir)}, 0, 'temporary in-flight dump was 
removed by trap on signal';
+};
+
+subtest 'Pruning removes dumps older than retention and stale tmp files' => 
sub {
+    my $dump_dir = tempdir;
+
+    my $old_dump = $dump_dir->child('old.dump');
+    $old_dump->spurt("old-dump\n");
+    my $old_time = time - (10 * ONE_DAY);
+    utime $old_time, $old_time, "$old_dump";
+
+    my $recent_dump = $dump_dir->child('recent.dump');
+    $recent_dump->spurt("recent-dump\n");
+    my $recent_time = time - (2 * ONE_DAY);
+    utime $recent_time, $recent_time, "$recent_dump";
+
+    my $stale_tmp = $dump_dir->child('.stale.dump.tmp.999');
+    $stale_tmp->spurt("stale-tmp\n");
+    my $stale_time = time - (ONE_DAY + ONE_HOUR);
+    utime $stale_time, $stale_time, "$stale_tmp";
+
+    my $active_tmp = $dump_dir->child('.active.dump.tmp.111');
+    $active_tmp->spurt("active-tmp\n");
+    my $active_time = time - ONE_HOUR;
+    utime $active_time, $active_time, "$active_tmp";
+
+    my $non_dump = $dump_dir->child('notes.txt');
+    $non_dump->spurt("important-notes\n");
+    utime $old_time, $old_time, "$non_dump";
+
+    my ($success, $out, $err, $exit) = run_dump(['-f', "$dump_dir", '-d', 
'5'], $test_env);
+    ok $success, 'dump-db with short option flags succeeds';
+    is $exit, 0, 'dump-db exits with 0';
+
+    ok !-f $old_dump, 'dump older than DAYS_TO_KEEP was pruned';
+    ok -f $recent_dump, 'dump newer than DAYS_TO_KEEP was preserved';
+    ok !-f $stale_tmp, 'stale temporary file older than 1 day was pruned';
+    ok -f $active_tmp, 'active temporary file newer than 1 day was preserved';
+    ok -f $non_dump, 'non-dump file was not pruned even if older than 
DAYS_TO_KEEP';
+    ok -f $dump_dir->child($today_dump), 'new daily dump was successfully 
created';
+};
+
+subtest 'Environment variables fallback and CLI precedence' => sub {
+    my $dump_dir = tempdir;
+    my $env = {
+        %$test_env,
+        DUMP_FOLDER => "$dump_dir",
+        DAYS_TO_KEEP => '3',
+    };
+    my ($success, $out, $err, $exit) = run_dump([], $env);
+    ok $success, 'dump-db succeeds reading DUMP_FOLDER and DAYS_TO_KEEP from 
environment';
+    is $exit, 0, 'dump-db exits with 0';
+
+    my $final_file = $dump_dir->child($today_dump);
+    ok -f $final_file, 'dump file created in DUMP_FOLDER path from 
environment';
+
+    my $override_dir = tempdir;
+    ($success, $out, $err, $exit) = run_dump(['--folder', "$override_dir", 
'--days', '5'], $env);
+    ok $success, 'dump-db succeeds with CLI arguments overriding environment 
variables';
+    is $exit, 0, 'dump-db with overrides exits with 0';
+    ok -f $override_dir->child($today_dump), 'explicit --folder argument takes 
precedence over DUMP_FOLDER';
+
+    my $equals_dir = tempdir;
+    ($success, $out, $err, $exit) = run_dump(["--folder=$equals_dir", 
'--days=5'], $env);
+    ok $success, 'dump-db succeeds with --folder=... and --days=... syntax';
+    is $exit, 0, 'dump-db with equals-syntax exits with 0';
+    ok -f $equals_dir->child($today_dump), 'dump file created via --folder=... 
option';
+};
+
+done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openQA-5.1795089075.1f7748a4/t/46-munin.t 
new/openQA-5.1795190948.0362803c/t/46-munin.t
--- old/openQA-5.1795089075.1f7748a4/t/46-munin.t       2026-11-19 
12:51:15.000000000 +0100
+++ new/openQA-5.1795190948.0362803c/t/46-munin.t       2026-11-20 
17:09:08.000000000 +0100
@@ -10,12 +10,10 @@
 use OpenQA::Test::TimeLimit '5';
 use Test::Output qw( stdout_from );
 
-my $script = "$Bin/../contrib/munin/plugins/minion";
-my $url = "file://$Bin/data/46-contrib-minion.html";
-
-require $script;
-
 subtest minion_influx => sub {
+    my $script = "$Bin/../contrib/munin/plugins/minion";
+    my $url = "file://$Bin/data/46-contrib-minion.html";
+    require $script;
     local $ENV{url} = $url;
 
     my $out = stdout_from {
@@ -74,4 +72,70 @@
     is $out, $exp_minion_jobs_hook_rc_failed_config, 
'minion_jobs_hook_rc_failed config';
 };
 
+subtest table_sizes => sub {
+    my $script = "$Bin/../contrib/munin/plugins/table_sizes";
+    require $script;
+    my $tables = [
+        {
+            field => 'jobs',
+            label => 'jobs',
+            total_bytes => 23,
+            data_bytes => 22,
+            index_bytes => 1,
+        },
+    ];
+    my $exp = <<~'EOM';
+    multigraph openqa_table_sizes
+    graph_title openqa PostgreSQL table sizes (including indices)
+    graph_args --base 1024 -l 0
+    graph_vlabel Bytes
+    graph_category db
+    graph_info Total disk space used by each table and its associated indexes 
in the openqa database.
+    jobs.label jobs
+    jobs.type GAUGE
+    jobs.min 0
+
+    multigraph openqa_table_data_sizes
+    graph_title openqa PostgreSQL table sizes (data only)
+    graph_args --base 1024 -l 0
+    graph_vlabel Bytes
+    graph_category db
+    graph_info Disk space used by table data and TOAST (excluding indexes) in 
the openqa database.
+    jobs.label jobs
+    jobs.type GAUGE
+    jobs.min 0
+
+    multigraph openqa_table_index_sizes
+    graph_title openqa PostgreSQL index sizes (per table)
+    graph_args --base 1024 -l 0
+    graph_vlabel Bytes
+    graph_category db
+    graph_info Total disk space used by all indexes per table in the openqa 
database.
+    jobs.label jobs
+    jobs.type GAUGE
+    jobs.min 0
+
+    EOM
+    my $out = stdout_from {
+        table_sizes::config($tables);
+    };
+    is $out, $exp, 'config output';
+
+    $exp = <<~'EOM';
+    multigraph openqa_table_sizes
+    jobs.value 23
+
+    multigraph openqa_table_data_sizes
+    jobs.value 22
+
+    multigraph openqa_table_index_sizes
+    jobs.value 1
+
+    EOM
+    $out = stdout_from {
+        table_sizes::data($tables);
+    };
+    is $out, $exp, 'data output';
+};
+
 done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openQA-5.1795089075.1f7748a4/t/api/17-mcp.t 
new/openQA-5.1795190948.0362803c/t/api/17-mcp.t
--- old/openQA-5.1795089075.1f7748a4/t/api/17-mcp.t     2026-11-19 
12:51:15.000000000 +0100
+++ new/openQA-5.1795190948.0362803c/t/api/17-mcp.t     2026-11-20 
17:09:08.000000000 +0100
@@ -88,7 +88,11 @@
 
     subtest 'Passed job' => sub {
         subtest 'Add comment to test job' => sub {
-            $t->post_ok('/api/v1/jobs/99764/comments' => form => {text => 
'Just a test comment'})->status_is(200);
+            $t->post_ok(
+                '/api/v1/jobs/99764/comments' => form => {text => 'Just a test 
comment with poo#99999 and *markdown*'})
+              ->status_is(200);
+            $t->app->schema->resultset('Comments')
+              ->create({job_id => 99764, user_id => 99902, text => 'Direct 
comment with poo#88888'});
         };
 
         my $result = $client->call_tool('openqa_get_job_info', {job_id => 
99764});
@@ -106,7 +110,11 @@
         like $text, qr/No test results available yet/s, 'no test results yet';
         like $text, qr/DISTRI: opensuse/, 'settings are present';
         like $text, qr/VERSION: 13\.1/, 'settings are present';
-        like $text, qr/lance.+Just a test comment/, 'has comments';
+        like $text, qr/lance.+Just a test comment with poo#99999 and 
\*markdown\*/, 'has comments in plain text';
+        like $text, qr/lance.+Direct comment with poo#88888/, 'has direct 
comments';
+        unlike $text, qr/<(span|p|em)\b/, 'comments are not rendered as HTML';
+        is $t->app->schema->resultset('Bugs')->find({bugid => 'poo#88888'}), 
undef,
+          'read-only tool does not insert bugs';
     };
 
     subtest 'Input validation failed' => sub {

++++++ openQA.obsinfo ++++++
--- /var/tmp/diff_new_pack.ZemecQ/_old  2026-11-21 21:48:37.247727890 +0100
+++ /var/tmp/diff_new_pack.ZemecQ/_new  2026-11-21 21:48:37.250728016 +0100
@@ -1,5 +1,5 @@
 name: openQA
-version: 5.1795089075.1f7748a4
-mtime: 1795089075
-commit: 1f7748a4d2f59c9173010d5cc77e887ea0069509
+version: 5.1795190948.0362803c
+mtime: 1795190948
+commit: 0362803c0fe4683d019c4d1e1972c9e1be891918
 

Reply via email to