Просмотр исходного кода

Skip the manual K calibration the way the automatic one is skipped

Bambuddy already recognises the printer's automatic pressure-advance run,
auto_pa_line_calib_mode, and leaves no archive and sends no notification
for it. Started by hand rather than automatically before a print, the
same calibration reports under a different name: it prints a pattern
where the automatic one prints a line, and carries no auto_ prefix, so
pa_pattern_calib_mode matched nothing.

It arrives exactly the way the automatic one does -- a bare subtask name
with no /usr/ path -- so it hit the same outcome the module was written
to prevent: an FTP sweep for a 3MF that cannot exist, six candidate names
across five directories with retries, and then a no-3MF archive named
after the calibration, on a printer in the middle of calibrating.

One entry on INTERNAL_JOB_NAMES covers it. That set is the single place
both the print-start and print-complete callbacks consult, so archiving,
the 3MF sweep and the notifications are all handled by the one line.

Matching stays exact after normalising path, suffix and case. The
negative cases are extended alongside the positive ones, so a file
somebody deliberately named pa_pattern_calib_mode_v2.3mf is still
archived as the print it is.

The manual PA *line* method, if it reports its own name, is not covered
here -- the list is deliberately limited to names that have actually been
observed rather than ones that seem likely.
maziggy 1 неделя назад
Родитель
Сommit
a4a1f4c58b
3 измененных файлов с 28 добавлено и 0 удалено
  1. 1 0
      CHANGELOG.md
  2. 7 0
      backend/app/utils/print_jobs.py
  3. 20 0
      backend/tests/unit/test_internal_printer_jobs.py

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
CHANGELOG.md


+ 7 - 0
backend/app/utils/print_jobs.py

@@ -29,10 +29,17 @@ print-complete callbacks can share one answer.
 # ``auto_pa_line_calib_mode`` is the pressure-advance (K profile) line. This one
 # is reported as a *subtask name* with no ``/usr/`` path at all, which is why
 # the path rule alone was never enough.
+#
+# ``pa_pattern_calib_mode`` is the same calibration started by hand rather than
+# automatically before a print -- the manual flow-dynamics run prints a pattern
+# where the automatic one prints a line, and it carries its own name with no
+# ``auto_`` prefix. It reaches Bambuddy exactly the way the automatic one does,
+# so leaving it off the list produced the same no-3MF archive.
 INTERNAL_JOB_NAMES = frozenset(
     {
         "auto_cali_for_user",
         "auto_pa_line_calib_mode",
+        "pa_pattern_calib_mode",
     }
 )
 

+ 20 - 0
backend/tests/unit/test_internal_printer_jobs.py

@@ -11,6 +11,10 @@ a no-3MF archive named after itself in the user's history.
 The same name is already known to the completion guard: #2829's capture of
 queue item 649 has ``auto_pa_line_calib_mode`` arriving as the subtask name of a
 completion that had to be refused against a running job.
+
+The manual flow-dynamics run reaches Bambuddy the same way under a different
+name -- ``pa_pattern_calib_mode``, a pattern rather than a line and with no
+``auto_`` prefix -- so the automatic entry never covered it.
 """
 
 from unittest.mock import AsyncMock, MagicMock, patch
@@ -29,6 +33,16 @@ class TestTheCalibrationIsRecognised:
         """Both fields are tested, because which one carries it is not fixed."""
         assert is_internal_printer_job("auto_pa_line_calib_mode", None)
 
+    def test_the_manual_pressure_advance_pattern_by_subtask_name(self):
+        """The same calibration run by hand rather than before a print. It
+        prints a pattern where the automatic one prints a line, and carries its
+        own name with no ``auto_`` prefix -- so the automatic entry never
+        covered it and it left the same no-3MF archive."""
+        assert is_internal_printer_job("", "pa_pattern_calib_mode")
+
+    def test_the_manual_pressure_advance_pattern_by_filename(self):
+        assert is_internal_printer_job("pa_pattern_calib_mode", None)
+
     def test_the_levelling_run_by_its_system_path(self):
         assert is_internal_printer_job("/usr/etc/print/auto_cali_for_user.gcode", "auto_cali_for_user")
 
@@ -45,6 +59,10 @@ class TestTheCalibrationIsRecognised:
             "auto_pa_line_calib_mode.gcode.3mf",
             "AUTO_PA_LINE_CALIB_MODE",
             "/data/auto_pa_line_calib_mode.gcode.3mf",
+            "pa_pattern_calib_mode",
+            "pa_pattern_calib_mode.gcode.3mf",
+            "PA_Pattern_Calib_Mode",
+            "/data/pa_pattern_calib_mode.gcode",
         ],
     )
     def test_however_the_name_is_dressed_up(self, reported):
@@ -72,6 +90,8 @@ class TestItLeavesRealPrintsAlone:
             "auto_pa_line_calib_mode_v2.3mf",
             "my_auto_pa_line_calib_mode.3mf",
             "auto_cali_for_user_test.gcode.3mf",
+            "pa_pattern_calib_mode_v2.3mf",
+            "my_pa_pattern_calib_mode.3mf",
         ],
     )
     def test_a_users_file_that_merely_contains_the_name(self, reported):

Некоторые файлы не были показаны из-за большого количества измененных файлов