Skip to content

Fork Sync Branch 19.0 - #15

Merged
btl-bot merged 10 commits into
BTLzdravtech:19.0from
ingadhoc:19.0
Sep 3, 2026
Merged

btl-bot merged 10 commits into
BTLzdravtech:19.0from
ingadhoc:19.0

Conversation

@btl-bot

@btl-bot btl-bot commented Sep 3, 2026

Copy link
Copy Markdown

No description provided.

nicomacr and others added 10 commits September 1, 2026 08:56
The reaper computed its cutoff as `tools.config.get("limit_time_real_cron") or 0`.
With the core default (-1, meaning "use --limit-time-real") that yields a cutoff
one second in the future, and with 0 a cutoff of now: in both cases every running
job was marked failed (and the rest of its batch canceled) on each reaper run.

Resolve the limit the way the running server does — prefork: 0/unset means no
limit and -1 delegates to --limit-time-real (PreforkServer.__init__); threaded:
the value only applies when > 0, anything else falls back to --limit-time-real
(ThreadedServer.process_limit). And when no limit applies, keep the orphan sweep
running instead of skipping the reaper entirely: a stuck running job whose
records are gone can never finish on its own and would block its batch forever.
When the reaper gave up on a timed-out job, the user got two DMs: one from
_handle_job_error -> _give_up -> fail() ("Job X failed: Job timed out") and a
second one from the reaper loop itself ("Job X timed out").

Drop the loop's re-notification and keep fail()'s single message, which also
carries the related-record links. To preserve the one thing the loop message
added — a clickable reference to the job — fail() now renders the job name as
its html link.
fail() interpolated the job name and error message with plain % into a string
that _notify_user then wrapped in Markup(): an error_message with angle
brackets (any traceback with an object repr) broke the message render, and a
crafted job name was stored HTML injected into the user's DM (XSS).

Build the failure message as Markup with escaped interpolations (the job link
and the related-record links, already safe, pass through), and make
_notify_user escape its input: a plain-string result is now rendered inert,
while methods that mean HTML keep working by returning a Markup with its own
interpolations escaped. Document the contract in the README's Usage section;
the bg-enqueued methods that build HTML are aligned to it in the follow-up
commits.
The background reconciliation result interpolated the statement line name and
the exception text with plain % before wrapping in Markup(), injecting user
data as HTML into the DM that base_bg posts. Interpolate through the Markup
template instead, which escapes the values.

Also align the fail() override with the new base signature (notify keyword),
so a registry call passing notify= does not TypeError with both modules
installed.
… import DM

The background import result built its HTML with an f-string interpolating the
statement name before wrapping in Markup(), injecting user data as HTML into
the DM that base_bg posts. Interpolate through the Markup template instead,
which escapes the values, and mark the message translatable while at it.
Making the orphan sweep independent of the time limit also made it independent
of any lower bound: the reaper now looks at every running job, so a job whose
records are deleted mid-run is canceled while another worker is still executing
it. That job then finishes: `finish()` overwrites the `canceled` with `done` and
re-enqueues the `next_job_id` the sweep had just canceled, leaving the batch
half canceled and churning through states. Before, only jobs already past the
limit could be swept.

Give the sweep a floor of its own: the configured limit when there is one (the
pre-existing bound — past it the worker would have been killed anyway, so the
job is genuinely presumed dead), and ORPHAN_SWEEP_GRACE when there is none. A
running job with no start_time is stuck by definition and is still swept on
sight.
Updated by "Update PO files to match POT (msgmerge)" add-on in Weblate.

Translation: miscellaneous-19.0/miscellaneous-19.0-base_bg
Translate-URL: https://translation.dev-adhoc.com/projects/miscellaneous-19-0/miscellaneous-19-0-base_bg/
Updated by "Update PO files to match POT (msgmerge)" add-on in Weblate.

Translation: miscellaneous-19.0/miscellaneous-19.0-account_statement_import_sheet_file_bg
Translate-URL: https://translation.dev-adhoc.com/projects/miscellaneous-19-0/miscellaneous-19-0-account_statement_import_sheet_file_bg/

@sireko sireko left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto approved

@btl-bot
btl-bot merged commit c1318ff into BTLzdravtech:19.0 Sep 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants