Commit Graph
4396 Commits
Author SHA1 Message Date
maziggy 780d3e9b93 Paint SpoolBuddy spools with their extra colours and effect (issue #3033) 2026-09-30 16:19:09 +02:00
maziggy 0e0fad9568 Show Bambu's own HMS descriptions and the real alert level (issue #2728)
Document HMS levels, Bambu's descriptions and uncounted faults (issue #2728)
2026-09-30 16:18:53 +02:00
maziggy bc822d49ea Pist work PR #2954 2026-09-30 16:18:38 +02:00
maziggy bfde96cce4 Give the AI's own halt a name in the archive (issue #2946) (#2954) 2026-09-30 16:18:22 +02:00
maziggy 3b4b7439c6 (Post work): parked AMS drying timers and translated drying failures (issue #2896) 2026-09-30 16:18:06 +02:00
maziggy dc12cda3b4 fix(ams): show a parked drying command as not started instead of an active cycle (#3096) 2026-09-30 16:17:51 +02:00
maziggy 8c31937a5f Correct the drying settings path and the print-drying comment (issue #2518)
The changelog named Settings -> Print Queue -> Auto-Drying; the toggle
    lives in the Queue Auto-Drying card under Settings -> Workflow. The
    scheduler comment and a test docstring called print_drying a permission
    overlay rather than a trigger, but since #1816 it starts mid-print
    cycles on its own regardless of queue state.
2026-09-30 16:17:31 +02:00
maziggy 9bb2a01f9e Refuse null for number and on/off settings, and read bad rows as the default (issue #2518)
A PUT /settings with null for a number setting stored the literal
    "None". From then on int()/float() raised inside the response builder,
    and every settings read returned 503 until the row was fixed by hand.

    Explicit null for any boolean or numeric setting is now refused with a
    422 that names the keys, and nothing in that request is saved. A numeric
    row that does not parse reads back as its default with a warning, so an
    install that already stored one recovers. The typed-key lists moved to
    module constants so the save check and the read path share them.
2026-09-30 16:17:14 +02:00
maziggy 86a0d0deb7 feat: Wait for sustained AMS humidity before an ambient auto-dry starts (issue #2518) 2026-09-30 16:16:51 +02:00
maziggy 5b59d35141 Post work PR #2956
-----

    Give each test worker its own scratch folder in the #3025 and #3029 tests (issue #3025)

    Both modules wrote into one shared folder under settings.base_dir and deleted
    it after every test. Under xdist, one worker's cleanup removed files another
    worker was still serving, so tests failed at random with a 404. The folder name
    now includes the process ID.
2026-09-30 16:16:32 +02:00
maziggy 534e337c35 Let the two stock alert toggles reach the database (issue #2945) (#2956) 2026-09-30 16:16:19 +02:00
maziggy 6d42632b67 Keep the consumed-counter reset out of Spoolman's own numbers (issue #2906) (#2939) 2026-09-30 16:16:05 +02:00
maziggy bc4084b2a9 Let other applications send messages through the notification channels
POST /notifications/app-message delivers an app's message to every channel
    with the new "Messages from connected apps" switch on (off by default),
    through quiet hours, the digest and the log. API keys need the new "Send
    notifications" permission, and their owner notifications:update; plain text,
    http(s) links, 20 messages a minute per key. The electricity-price door and
    this one now share one scoped-key check. /queue?batch=<id> opens and
    highlights one batch order.
2026-09-30 16:15:43 +02:00
maziggy 5f1e5f9aa9 feat: add optional printer model to stream overlay (#3099) 2026-09-30 16:15:19 +02:00
maziggy b7853d7e63 Tell a framed external link which theme Bambuddy shows 2026-09-30 16:14:52 +02:00
maziggy e8de379fb9 Widened slicing modal 2026-09-30 16:14:35 +02:00
maziggy a6635f6783 Fix external-spool usage charged to an AMS spool (#3166)
Print commands carry the external spool as -1 in the flat ams_mapping
    (the firmware rejects 254/255 there) and the real target only in
    ams_mapping2. We captured only the flat list, so external-spool prints
    looked unmapped and the usage tracker's position-based fallback
    charged them to the first loaded AMS tray.

    - Resolve external spools from ams_mapping2 when capturing a
      project_file (dual-nozzle keeps 254/255, single-nozzle -> 254)
    - Tracker: an explicit -1 no longer falls back to a positional tray;
      a mapping naming no tray for any used slot defers to tray_now
    - Keep the #1822 H2S tray_now override working with resolved mappings
2026-09-30 16:14:15 +02:00
maziggy 50dd408383 fix(auth): let the connected-app consent page load inside Bambuddy's own frames
An app opened from the sidebar signs in inside Bambuddy's iframe, but every
    page sent frame-ancestors 'none', so the browser refused to show
    /connect/authorize there. That path now gets 'self', like the streaming
    overlay: every ancestor must be Bambuddy itself, so foreign pages still
    cannot frame it.
2026-09-30 16:13:37 +02:00
maziggy 9fb878cd3e feat(auth): connected apps - sign in to external applications with Bambuddy
Minimal OAuth 2.0 authorization-code flow with PKCE (S256): admins register
    an app with one exact callback URL (Settings > API Keys > Connected Apps);
    /connect/authorize asks for consent once and returns a single-use, 60 s code
    bound to app, callback and challenge; POST /api/v1/connect/token swaps it,
    with the client secret, for the user's identity and permissions. Codes and
    secrets stored hashed, exchanges rate-limited per client and IP, no redirect
    before the callback is validated, API keys cannot authorize, refused while
    auth is disabled. i18n for all 15 locales.

    -----

    fix(db): upgrading from 0.2.4.0 or older no longer crashes at startup

    The #2974 failure-reason conversion ran before the #1378 migration that adds
    print_log_entries.failure_reason, so older databases stopped with "no such
    column: failure_reason". It now skips a table without the column, only runs
    where a legacy label exists, and on SQLite rebuilds archive_fts first, since
    archives created before that index existed trip "database disk image is
    malformed" when updated.
2026-09-30 16:13:18 +02:00
maziggy e65852f7ac feat(queue): let a batch record the external order it fulfils
POST /queue/batches accepts external_source + external_ref; both are
    returned on every batch and filterable on GET /queue/batches. The pair is
    unique (index uq_print_batches_external), so a retried create answers 409
    instead of queueing the same order twice. Migration covers SQLite and
    PostgreSQL.
2026-09-30 16:12:54 +02:00
maziggy 029093ed4e fix(diagnostics): name the stalled step when a bundle's connection check times out (issue #3164)
The support bundle gives each printer's connection diagnostic 15 s and
    discarded the whole result on overrun, recording only "timed_out". A
    14-printer farm's bundle carried that marker for every printer and
    nothing else, so it could not say which check was slow.

    run_connection_diagnostic now keeps an optional progress dict current
    (finished checks + the step in flight). On timeout the snapshot records
    stalled_in, elapsed_s and the checks that completed.
2026-09-30 16:12:35 +02:00
maziggy 9bb597f37c fix(tests): assemble the upload batch instead of racing a sleep
The concurrent-dispatch tests went red on the Docker shard with
    "expected all 6 printers to be uploaded to concurrently, but the
    high-water mark was 4", on a scheduler that was dispatching all six
    correctly.

    peak == 6 is the claim that the sixth dispatch reaches its upload
    before the first one finishes, and the dispatches do not arrive
    together: each runs a preamble of database work first. So the
    assertion was a race between that spread and a fixed 0.15 s sleep.
    Measured here the spread is ~14 ms; on the runner it passed 150 ms.
    Padding the sleep would only move the threshold and slow every test
    that uses it.

    _UploadRecorder(assemble=True) now holds each call until every
    upload the pass launched has arrived, reading len(_inflight), which
    is filled synchronously at launch and is therefore the batch size.
    That states the property the peak assertions are about, directly and
    with no time in it, and it ends sooner than the sleep it replaces -
    the file runs 7.0s to 5.9s. _BATCH_DEADLINE_SECONDS bounds it so a
    dispatch that really has gone serial fails on its peak assertion
    instead of hanging to the pytest timeout.

    test_check_queue_returns_without_awaiting_the_uploads keeps the
    sleep, with the reason recorded next to it: it reads the rows while
    the uploads are open, and an assembled batch releases as soon as it
    is complete, which would let the dispatches flip those rows
    mid-assertion.

    The test engine also takes the application's own _set_sqlite_pragmas
    listener rather than a copy, so the file is opened the way the
    running system opens one - WAL, synchronous = NORMAL, a 15 s busy
    timeout. SQLite's defaults spend an fsync per commit and lock the
    whole file, which made a dispatch's preamble cost more than the
    upload it precedes. That is what turned the previous commit's move
    to a file-backed database into a visible failure.

    Verified in both directions rather than by a green run: with two
    printers' preambles delayed by a second, the old recorder reports
    exactly the "high-water mark was 4" the runner saw and the shared
    library test reports 3 == 4, while the assembling recorder passes
    the same scenario. Without the induced skew, ruff is clean, the full
    backend suite is green at 12224 passed, and ten consecutive runs of
    the file pinned to one core show no failures.
2026-09-30 16:11:33 +02:00
maziggy 1a80430c45 fix(tests): give each concurrent-dispatch session its own connection
The scheduler's concurrent-dispatch tests failed on CI and passed
    locally, on a commit that touched nothing but a text file. Six tests
    in tests/unit/test_scheduler_concurrent_dispatch.py went red with
    every queue item logged as "Status set to 'printing'" and four of
    them read back as "pending", alongside "cannot commit transaction -
    SQL statements in progress" and a PrintArchive that could not be
    refreshed.

    The fixtures built their farm on sqlite+aiosqlite:///:memory:, and
    SQLAlchemy backs an in-memory SQLite with a StaticPool: one DBAPI
    connection handed to every session, with nothing keeping them apart.
    That was harmless while check_queue awaited its uploads inline,
    because only one session was ever live at a time. Under the
    refillable upload pool the uploads run as concurrent background
    tasks with a session each, so their transactions interleave on that
    single connection - a sibling session's close() rolls back another's
    flushed-but-uncommitted UPDATE, and a commit() landing while another
    session still holds a cursor raises the commit error above. Whether
    the interleaving lands badly comes down to core count and
    interpreter version, which is why a 30-core box on 3.13 stayed green
    and a 4-vCPU runner on 3.11 did not.

    The four fixtures now put the database in the test's own tmp_path,
    which gets an AsyncAdaptedQueuePool and a connection per session -
    what the application itself runs with (_resolve_pool_kwargs in
    backend/app/core/database.py: pool_size 20, max_overflow 200). So
    the harness is being brought in line with production rather than
    having its assertions relaxed; nothing in the scheduler changes,
    and the concurrency under test was correct throughout.

    Checked against the failure mode rather than against a green run: an
    isolated repro of the same shape - six writer sessions and one
    reader session closing mid-transaction - yields all-pending on the
    in-memory engine and all-printing on a file. The new risk is real
    SQLite write contention on one file, so the file was run twelve
    times pinned to two cores with no failures and no lock errors.

    tests/unit/test_scheduler_busy_reasons_3018.py carries the same
    harness on an in-memory engine, but dispatches to a single printer,
    so it has no second session to race; left as is.
2026-09-30 16:11:10 +02:00
maziggy 336cb49fba Updated BACKERS 2026-09-30 16:10:47 +02:00
maziggy 5ac21d9202 feat(print-modal): show each printer slot's colour in the filament mapping (issue #3159)
The Print / Schedule dialog's filament mapping is where the colour a slice
    asked for is compared against the colour actually loaded, and only the
    left-hand side of that comparison had a swatch. The slot, and every slot in
    its dropdown, was text -- and the text cannot be trusted: a slot's colour name
    is resolved from the Color Catalog or, failing that, from hue, so a
    third-party beige is announced as "Orange". A "Color mismatch" warning then
    gives no way to tell a real mismatch from two names for the same hex without
    opening the printer card in another tab, which on a farm swapping twenty or
    thirty non-Bambu colours between machines is a check made many times a day.

    Each slot now carries its colour and its hex, and the slot whose colour is
    exactly the one the slice asked for is ticked. This works for a slot bound to
    an inventory spool and for one configured through Configure Slot or on the
    printer itself: the second kind has no inventory row behind it, and the
    printer's own tray colour is then what draws. A bound spool contributes what a
    tray record cannot -- SlotSpoolIdentity gains extra_colors and effect_type, so
    a two-tone or glittery spool draws as itself rather than as its base colour.

    The same treatment goes to the filament-override picker used for model-based
    assignment. It is the same choice on the other dispatch path, and leaving it
    text-only would have made one decision read two ways.

    Both controls stop being <select>s to do it, because an <option> renders text
    and nothing else. SlotPicker keeps what the select gave for free -- arrow,
    Home/End, Enter and Escape keys, listbox semantics, and the border colouring
    that encodes match, same-type-different-colour and not-loaded -- and is
    portaled with position:fixed so it is not clipped by the dialog's own scroll
    container, flipping above the row when there is no room below.
2026-09-30 16:10:24 +02:00
maziggy 463a0cf879 Housekeeping 2026-09-30 16:09:12 +02:00
maziggy b60cee2c9f Bumped version 2026-09-30 16:08:49 +02:00
maziggy 63e987e591 Paint SpoolBuddy spools with their extra colours and effect (issue #3033) 2026-09-28 14:27:21 +02:00
maziggy 033eff1254 Show Bambu's own HMS descriptions and the real alert level (issue #2728)
Document HMS levels, Bambu's descriptions and uncounted faults (issue #2728)
2026-09-28 13:57:02 +02:00
maziggy 6e113036c2 Pist work PR #2954 2026-09-28 13:10:57 +02:00
Kouki Ojima a6ce26205a Give the AI's own halt a name in the archive (issue #2946) (#2954) 2026-09-28 12:51:43 +02:00
maziggy b04d753186 (Post work): parked AMS drying timers and translated drying failures (issue #2896) 2026-09-28 12:35:01 +02:00
M2ABRAMSTANK 6c0292b09a fix(ams): show a parked drying command as not started instead of an active cycle (#3096) 2026-09-28 12:09:59 +02:00
maziggy 61e2841d16 Correct the drying settings path and the print-drying comment (issue #2518)
The changelog named Settings -> Print Queue -> Auto-Drying; the toggle
lives in the Queue Auto-Drying card under Settings -> Workflow. The
scheduler comment and a test docstring called print_drying a permission
overlay rather than a trigger, but since #1816 it starts mid-print
cycles on its own regardless of queue state.
2026-09-28 11:40:21 +02:00
maziggy 0cc7cf0f36 Refuse null for number and on/off settings, and read bad rows as the default (issue #2518)
A PUT /settings with null for a number setting stored the literal
"None". From then on int()/float() raised inside the response builder,
and every settings read returned 503 until the row was fixed by hand.

Explicit null for any boolean or numeric setting is now refused with a
422 that names the keys, and nothing in that request is saved. A numeric
row that does not parse reads back as its default with a warning, so an
install that already stored one recovers. The typed-key lists moved to
module constants so the save check and the read path share them.
2026-09-28 11:32:02 +02:00
M2ABRAMSTANK 568702486b feat: Wait for sustained AMS humidity before an ambient auto-dry starts (issue #2518) 2026-09-28 11:10:23 +02:00
maziggy 89c4ac5583 Post work PR #2956
-----

Give each test worker its own scratch folder in the #3025 and #3029 tests (issue #3025)

Both modules wrote into one shared folder under settings.base_dir and deleted
it after every test. Under xdist, one worker's cleanup removed files another
worker was still serving, so tests failed at random with a 404. The folder name
now includes the process ID.
2026-09-28 10:48:51 +02:00
Kouki Ojima 4fdc55b884 Let the two stock alert toggles reach the database (issue #2945) (#2956) 2026-09-28 10:21:46 +02:00
maziggy f9662a76d4 Updated CHANGELOG 2026-09-28 10:15:55 +02:00
Kouki Ojima ff07a82358 Keep the consumed-counter reset out of Spoolman's own numbers (issue #2906) (#2939) 2026-09-28 09:58:16 +02:00
maziggy 6855d65d12 Let other applications send messages through the notification channels
POST /notifications/app-message delivers an app's message to every channel
with the new "Messages from connected apps" switch on (off by default),
through quiet hours, the digest and the log. API keys need the new "Send
notifications" permission, and their owner notifications:update; plain text,
http(s) links, 20 messages a minute per key. The electricity-price door and
this one now share one scoped-key check. /queue?batch=<id> opens and
highlights one batch order.
2026-09-27 12:45:50 +02:00
maziggy 4c590a4ee0 Updated CHANGELOG 2026-09-27 12:12:14 +02:00
Adam Spice 858f8c772f feat: add optional printer model to stream overlay (#3099) 2026-09-27 12:04:05 +02:00
maziggy bdc1fc68d0 Tell a framed external link which theme Bambuddy shows 2026-09-27 10:32:09 +02:00
maziggy bda14f7533 Widened slicing modal 2026-09-27 10:11:57 +02:00
maziggy 37502719b7 Fix external-spool usage charged to an AMS spool (#3166)
Print commands carry the external spool as -1 in the flat ams_mapping
(the firmware rejects 254/255 there) and the real target only in
ams_mapping2. We captured only the flat list, so external-spool prints
looked unmapped and the usage tracker's position-based fallback
charged them to the first loaded AMS tray.

- Resolve external spools from ams_mapping2 when capturing a
  project_file (dual-nozzle keeps 254/255, single-nozzle -> 254)
- Tracker: an explicit -1 no longer falls back to a positional tray;
  a mapping naming no tray for any used slot defers to tray_now
- Keep the #1822 H2S tray_now override working with resolved mappings
2026-09-27 09:34:19 +02:00
maziggy 0a81c8641d Updated CHANGELOG 2026-09-26 16:06:30 +02:00
maziggy b9e3fdc84f Post work PR #3047
fix(#1898): keep Telegram link previews, and keep the outcome prompt's failures its own

Four follow-ups to the post-print outcome confirmation merged in #3047.

Telegram: link previews were switched off for every message rather than
only for the outcome prompt, so a print_complete template carrying
{finish_photo_url} lost its photo preview whenever the photo was too
large to attach. _send_telegram now takes link_preview, and only the
prompt turns it off, as the Slack unfurl change already did.

Archives: Reset left the new Unconfirmed filter on, so the list stayed
narrowed and the button seemed to do nothing.

Print start: when the external-print check hit a failed statement, it
rolled back the caller's whole transaction, which expired the printer
and the just-created archive; on an async session the next read of
either raises, and the start notification, energy reading and timelapse
baseline were skipped. The check's reads now run in a savepoint, and a
failed flag write reloads the archive and printer after its rollback.

Print complete: a failed outcome prompt left the notification session
needing a rollback, so the per-user print email sent on it next failed
too. The dispatch now rolls back on failure.
2026-09-26 15:59:03 +02:00
Thomansky 44c7e6fb39 Post-print outcome confirmation: good/reject verdicts, one-tap links, yield stats (#3047) 2026-09-26 15:37:19 +02:00
maziggy 4e83751f71 fix(auth): let the connected-app consent page load inside Bambuddy's own frames
An app opened from the sidebar signs in inside Bambuddy's iframe, but every
page sent frame-ancestors 'none', so the browser refused to show
/connect/authorize there. That path now gets 'self', like the streaming
overlay: every ancestor must be Bambuddy itself, so foreign pages still
cannot frame it.
2026-09-26 13:37:02 +02:00