starbash 0.3.8__tar.gz → 0.3.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. {starbash-0.3.8 → starbash-0.3.9}/PKG-INFO +1 -1
  2. {starbash-0.3.8 → starbash-0.3.9}/pyproject.toml +2 -2
  3. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/analytics.py +15 -0
  4. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/commands/publish.py +6 -1
  5. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/doit.py +16 -31
  6. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/fits.py +25 -0
  7. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/processing.py +13 -3
  8. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/publish/github_publish.py +14 -2
  9. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/publish/github_service.py +9 -1
  10. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/tool/graxpert.py +12 -0
  11. {starbash-0.3.8 → starbash-0.3.9}/LICENSE +0 -0
  12. {starbash-0.3.8 → starbash-0.3.9}/README.md +0 -0
  13. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/__init__.py +0 -0
  14. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/aliases.py +0 -0
  15. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/app.py +0 -0
  16. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/assets/__init__.py +0 -0
  17. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/assets/check.png +0 -0
  18. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/assets/favicon.ico +0 -0
  19. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/assets/icon.png +0 -0
  20. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/assets/icon.svg +0 -0
  21. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/assets/starbash.desktop.in +0 -0
  22. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/check_version.py +0 -0
  23. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/commands/__init__.py +0 -0
  24. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/commands/gui.py +0 -0
  25. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/commands/info.py +0 -0
  26. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/commands/process.py +0 -0
  27. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/commands/repo.py +0 -0
  28. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/commands/select.py +0 -0
  29. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/commands/user.py +0 -0
  30. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/database.py +0 -0
  31. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/defaults/__init__.py +0 -0
  32. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/defaults/starbash.toml +0 -0
  33. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/doit_types.py +0 -0
  34. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/dwarf3.py +0 -0
  35. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/events.py +0 -0
  36. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/exception.py +0 -0
  37. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/filtering.py +0 -0
  38. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/interaction.py +0 -0
  39. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/linux.py +0 -0
  40. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/main.py +0 -0
  41. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/os.py +0 -0
  42. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/parameters.py +0 -0
  43. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/paths.py +0 -0
  44. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/preferences.py +0 -0
  45. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/processed_target.py +0 -0
  46. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/processing_like.py +0 -0
  47. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/publish/__init__.py +0 -0
  48. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/publish/credentials.py +0 -0
  49. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/publish/github.py +0 -0
  50. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/recipes/README.md +0 -0
  51. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/recipes/__init__.py +0 -0
  52. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/recipes/crop.py +0 -0
  53. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/recipes/osc.py +0 -0
  54. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/recipes/report_registration.py +0 -0
  55. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/report.py +0 -0
  56. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/rich.py +0 -0
  57. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/run_state.py +0 -0
  58. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/safety.py +0 -0
  59. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/score.py +0 -0
  60. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/selection.py +0 -0
  61. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/sim_siril/__init__.py +0 -0
  62. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/sim_siril/connection.py +0 -0
  63. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/sim_siril/enums.py +0 -0
  64. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/sim_siril/utility.py +0 -0
  65. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/siril/import_registration.py +0 -0
  66. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/stage_utils.py +0 -0
  67. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/stages.py +0 -0
  68. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/__init__.py +0 -0
  69. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/repo/master.toml +0 -0
  70. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/repo/processed.toml +0 -0
  71. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/report/Gemfile +0 -0
  72. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/report/README.md.jinja +0 -0
  73. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/report/__init__.py +0 -0
  74. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/report/_config.yml +0 -0
  75. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/report/default.html +0 -0
  76. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/report/index.md.jinja +0 -0
  77. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/report/target.md.jinja +0 -0
  78. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/target/master.toml +0 -0
  79. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/target/processed/about.toml +0 -0
  80. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/target/processed/main.toml +0 -0
  81. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/target/processed/sessions.toml +0 -0
  82. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/templates/userconfig.toml +0 -0
  83. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/toml.py +0 -0
  84. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/tool/__init__.py +0 -0
  85. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/tool/base.py +0 -0
  86. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/tool/context.py +0 -0
  87. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/tool/python.py +0 -0
  88. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/tool/ranges.py +0 -0
  89. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/tool/rcastro.py +0 -0
  90. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/tool/siril.py +0 -0
  91. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/tool/starnet.py +0 -0
  92. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/__init__.py +0 -0
  93. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/cli.py +0 -0
  94. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/cli_events.py +0 -0
  95. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/__init__.py +0 -0
  96. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/app.py +0 -0
  97. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/bridge.py +0 -0
  98. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/desktop.py +0 -0
  99. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/interaction.py +0 -0
  100. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/jobs.py +0 -0
  101. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/launcher.py +0 -0
  102. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/main_window.py +0 -0
  103. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/models.py +0 -0
  104. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/pages/__init__.py +0 -0
  105. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/pages/base.py +0 -0
  106. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/pages/dashboard.py +0 -0
  107. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/pages/masters.py +0 -0
  108. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/pages/processing.py +0 -0
  109. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/pages/publish.py +0 -0
  110. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/pages/repositories.py +0 -0
  111. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/pages/sessions.py +0 -0
  112. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/pages/settings.py +0 -0
  113. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/pages/targets.py +0 -0
  114. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/pages/wizard.py +0 -0
  115. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/services.py +0 -0
  116. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/theme.py +0 -0
  117. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/widgets/__init__.py +0 -0
  118. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/widgets/busy_indicator.py +0 -0
  119. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/widgets/file_links.py +0 -0
  120. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/widgets/github_login.py +0 -0
  121. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/widgets/hover_preview.py +0 -0
  122. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/widgets/image_viewer.py +0 -0
  123. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/widgets/log_view.py +0 -0
  124. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/widgets/master_picker.py +0 -0
  125. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/widgets/selection_panel.py +0 -0
  126. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/widgets/stat_card.py +0 -0
  127. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/widgets/tool_warning.py +0 -0
  128. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/ui/qt/workers.py +0 -0
  129. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/url.py +0 -0
  130. {starbash-0.3.8 → starbash-0.3.9}/src/starbash/windows.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: starbash
3
- Version: 0.3.8
3
+ Version: 0.3.9
4
4
  Summary: A tool for automating/standardizing/sharing astrophotography workflows.
5
5
  License-File: LICENSE
6
6
  Author: Kevin Hester
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "starbash"
3
- version = "0.3.8"
3
+ version = "0.3.9"
4
4
  description = "A tool for automating/standardizing/sharing astrophotography workflows."
5
5
  authors = ["Kevin Hester <kevinh@geeksville.com>"]
6
6
  readme = "README.md"
@@ -32,7 +32,6 @@ toml-repo = "^0.1.7"
32
32
 
33
33
  # Note: to use graxpert from the local tree rather than pypi use:
34
34
  # graxpert = {path = "GraXpert", extras = ["cpuonly"], develop = true}
35
- graxpert = {version = "^3.2.0a3", extras = ["cpuonly"]}
36
35
 
37
36
  # The following two libs are only needed for the (temporary) experiment of running siril scripts directly...
38
37
  # experimenting with siril-scripts/processing/VeraLux_HyperMetric_Stretch.py
@@ -43,6 +42,7 @@ pyqt6 = "^6.10.1"
43
42
  # The desktop GUI (`sb gui`) binding. A normal dependency: the GUI is a first-class
44
43
  # way to drive Starbash. "Optional" only means users may keep using the CLI instead.
45
44
  pyside6 = "^6.11.2"
45
+ graxpert = {version = "^3.2.0a3", extras = ["cpuonly"]}
46
46
 
47
47
  [tool.poetry.group.dev.dependencies]
48
48
  pytest = ">=8.4.2,<10.0.0"
@@ -2,6 +2,7 @@ import logging
2
2
  import os
3
3
  import platform
4
4
  import types
5
+ from importlib.metadata import PackageNotFoundError, version
5
6
  from typing import Any
6
7
 
7
8
  from sentry_sdk.integrations.excepthook import ExcepthookIntegration
@@ -56,6 +57,19 @@ def analytics_include_user(repo: Any) -> bool:
56
57
  return bool(repo.get("analytics.include_user", DEFAULT_ANALYTICS_INCLUDE_USER))
57
58
 
58
59
 
60
+ def _starbash_version() -> str | None:
61
+ """Return the installed starbash version, or None if it isn't installed.
62
+
63
+ Mirrors the lookup used in ``app.py`` / ``check_version.py``. It can fail
64
+ when running from an uninstalled source checkout or a bare source bundle, so
65
+ we never let a missing distribution stop analytics from initialising.
66
+ """
67
+ try:
68
+ return version("starbash")
69
+ except PackageNotFoundError:
70
+ return None
71
+
72
+
59
73
  def analytics_setup(allowed: bool = False, user_email: str | None = None) -> None:
60
74
  global analytics_allowed
61
75
  analytics_allowed = allowed
@@ -72,6 +86,7 @@ def analytics_setup(allowed: bool = False, user_email: str | None = None) -> Non
72
86
  )
73
87
  sentry_sdk.init(
74
88
  dsn="https://e9496a4ea8b37a053203a2cbc10d64e6@o209837.ingest.us.sentry.io/4510264204132352",
89
+ release=_starbash_version(),
75
90
  data_collection={},
76
91
  enable_logs=True,
77
92
  traces_sample_rate=1.0,
@@ -212,8 +212,13 @@ def _publish_github(dry_run: bool, login: bool) -> None:
212
212
  if not dry_run:
213
213
  assert credential is not None
214
214
  service = _credential_service(credential)
215
- owner = str(service.user()["login"])
215
+ # Rotate an expired token *before* the first API call. Asking GitHub for
216
+ # the account first would 401 an expired token, make the service
217
+ # auto-refresh - consuming the stored refresh token - and then leave
218
+ # refresh_if_needed below to reuse the now-dead token, which GitHub
219
+ # rejects as incorrect_client_credentials.
216
220
  refresh_if_needed(service, credential, client_id=CLIENT_ID)
221
+ owner = str(service.user()["login"])
217
222
 
218
223
  site = _rewrite(owner) if owner else _rewrite()
219
224
  files = collect_site_files(site)
@@ -22,7 +22,7 @@ from starbash import InputDef, events
22
22
  from starbash.database import ImageRow
23
23
  from starbash.doit_types import TaskDict
24
24
  from starbash.exception import FilesystemUnavailableError, UserHandledError
25
- from starbash.fits import FITS_VARIANT_SUFFIXES, resolve_fits_variant
25
+ from starbash.fits import resolve_fits_variant
26
26
  from starbash.os import symlink_or_copy
27
27
  from starbash.paths import get_user_cache_dir
28
28
  from starbash.tool.base import Tool
@@ -174,41 +174,26 @@ def cleanup_temporaries(stage: Any, context: dict[str, Any]) -> None:
174
174
 
175
175
 
176
176
  def _normalize_declared_outputs(task_dict: TaskDict) -> None:
177
- """Rename on-disk FITS siblings to the declared output spelling.
177
+ """Record declared outputs under the FITS spelling that actually exists.
178
178
 
179
179
  Siril appends its *saved* extension (``.fit``/``.fits``) to an
180
180
  extension-less ``-out`` path, so a recipe declaring ``master.fit`` gets
181
181
  ``master.fits`` on machines whose preference is ``.fits``. Doit checks its
182
- ``targets`` by exact path; a spelling mismatch makes every run look
183
- out-of-date (or, for masters, makes ``add_image`` index a file that was
184
- never created). After the tool runs, bring the on-disk file to the
185
- declared spelling.
182
+ ``targets`` by exact path, and downstream lookups key on the recorded
183
+ abspath; both must point at the file that really exists. We deliberately
184
+ do *not* rename the on-disk file to the declared spelling: other tools and
185
+ workflows may reference either suffix (they are sometimes mixed), so
186
+ starbash accepts whichever Siril wrote and just re-points its own records
187
+ at it.
188
+
189
+ Accepts either a full task dict (with a ``meta`` key) or the meta dict
190
+ itself -- the shape ``ToolAction`` holds (``self.task.meta``) -- so the
191
+ production call site and the unit tests both work.
186
192
  """
187
- context = (task_dict.get("meta", {}) or {}).get("context", {})
188
- output = context.get("output")
189
- rows: list[ImageRow] = []
190
- if isinstance(output, FileInfo):
191
- rows = list(output.image_rows or [])
192
- candidates = [Path(img["abspath"]) for img in rows if img.get("abspath")]
193
- if output.full is not None and not rows:
194
- candidates = [Path(output.full)]
195
- else:
196
- candidates = []
197
- for declared in candidates:
198
- if declared.suffix.lower() not in FITS_VARIANT_SUFFIXES or declared.exists():
199
- continue
200
- sibling = declared.with_suffix(".fits" if declared.suffix.lower() == ".fit" else ".fit")
201
- if sibling.exists():
202
- try:
203
- sibling.rename(declared)
204
- except OSError:
205
- logging.warning(
206
- "FITS sibling %s exists but could not be renamed to declared %s",
207
- sibling,
208
- declared,
209
- )
210
- else:
211
- logging.debug("Renamed %s to declared output %s", sibling, declared)
193
+ meta = task_dict.get("meta")
194
+ if not isinstance(meta, dict):
195
+ meta = task_dict
196
+ output = (meta.get("context") or {}).get("output")
212
197
  if isinstance(output, FileInfo) and output.image_rows:
213
198
  for img in output.image_rows:
214
199
  resolved = resolve_fits_variant(img.get("abspath", ""))
@@ -10,6 +10,7 @@ __all__ = [
10
10
  "canonical_fits_path",
11
11
  "read_dimensions",
12
12
  "read_fits_header",
13
+ "resolve_declared_outputs",
13
14
  "resolve_fits_variant",
14
15
  "signal_scale",
15
16
  ]
@@ -55,6 +56,30 @@ def canonical_fits_path(path: str | Path) -> str:
55
56
  return text
56
57
 
57
58
 
59
+ def resolve_declared_outputs(paths: list[str]) -> list[str]:
60
+ """Map declared output paths onto whichever FITS spelling exists on disk.
61
+
62
+ Siril appends its *saved* extension (``.fit`` or ``.fits``, per its
63
+ config) to extension-less ``-out`` paths, so a repo/recipe that declares
64
+ ``...master_flat_None_gain100.fit`` may find Siril wrote
65
+ ``...master_flat_None_gain100.fits``. Doit checks its ``targets`` by exact
66
+ path, so a spelling mismatch makes every run look out-of-date -- and, for
67
+ a master flat, the flat (then light calibration, then stacking) is
68
+ regenerated with each run. Resolving each declared target to the spelling
69
+ that actually exists lets doit treat either suffix as the output being
70
+ present; when neither exists (a genuine first generation) the declared
71
+ path is kept so the task still runs.
72
+
73
+ Args:
74
+ paths: Declared (already context-expanded) output paths.
75
+
76
+ Returns:
77
+ The declared paths, each replaced by its on-disk variant when the
78
+ other spelling of the file exists. Non-FITS paths pass through.
79
+ """
80
+ return [str(resolve_fits_variant(p)) for p in paths]
81
+
82
+
58
83
  def _json_safe(value: Any) -> Any:
59
84
  """Convert an astropy header value into a plain JSON-serializable Python value.
60
85
 
@@ -45,7 +45,7 @@ from starbash.exception import (
45
45
  raise_missing_repo,
46
46
  )
47
47
  from starbash.filtering import FallbackToImageException, filter_by_requires
48
- from starbash.fits import canonical_fits_path
48
+ from starbash.fits import canonical_fits_path, resolve_declared_outputs
49
49
  from starbash.preferences import auto_reindex_enabled
50
50
  from starbash.processed_target import ProcessedTarget
51
51
  from starbash.processing_like import ProcessingLike
@@ -630,7 +630,7 @@ class Processing(ProcessingLike):
630
630
  continue
631
631
  label = pt.run_label(meta.get("context") or {})
632
632
  outputs_by_label.setdefault(label, set()).update(
633
- os.path.realpath(str(p)) for p in targets
633
+ canonical_fits_path(os.path.realpath(str(p))) for p in targets
634
634
  )
635
635
 
636
636
  # Culling can only help when there is more than one master run to choose
@@ -1275,11 +1275,21 @@ class Processing(ProcessingLike):
1275
1275
 
1276
1276
  targets = self._stage_output_files(stage)
1277
1277
 
1278
+ # Resolve declared output paths to the on-disk FITS variant so doit's
1279
+ # exact-path target check accepts either ".fit" or ".fits" (Siril
1280
+ # appends its saved extension to extension-less -out paths, so a repo
1281
+ # declaring master_flat_None_gain100.fit may be written as
1282
+ # master_flat_None_gain100.fits by the installed Siril). Without this,
1283
+ # an existing master in the other spelling looks "missing" and the
1284
+ # stage -- then everything that consumes its output (light
1285
+ # calibration, stacking, ...) -- is regenerated on every run.
1286
+ declared_targets = resolve_declared_outputs(expand_context_list(targets, self.context))
1287
+
1278
1288
  task_dict: TaskDict = {
1279
1289
  "name": task_name,
1280
1290
  "file_dep": expand_context_list(file_deps, self.context),
1281
1291
  # FIXME, we should probably be using something more structured than bare filenames - so we can pass base source and confidence scores
1282
- "targets": expand_context_list(targets, self.context),
1292
+ "targets": declared_targets,
1283
1293
  "meta": {
1284
1294
  "context": _clone_context(self.context),
1285
1295
  "stage": stage, # The stage we came from - used later in culling/handling conflicts
@@ -118,10 +118,22 @@ def refresh_if_needed(
118
118
  happened (already persisted by the service's ``on_token_refresh``), otherwise
119
119
  ``credential`` unchanged. Callers that want to store anything beside the token
120
120
  (the account name, say) must save what they get back, not the stale argument.
121
+
122
+ A request made before this call may already have rotated the credential: the
123
+ service auto-refreshes on a 401 and *consumes* the stored refresh token while
124
+ doing so. Reusing ``credential.refresh_token`` then would make GitHub reject
125
+ the already-used token (``incorrect_client_credentials``), so when the service
126
+ already holds a newer token this function returns the credential from that
127
+ earlier rotation instead of refreshing again.
121
128
  """
122
129
  if credential.needs_refresh() and credential.refresh_token:
123
- value = service.refresh_access_token(client_id, credential.refresh_token)
124
- service.apply_token_response(value)
130
+ if service.token == credential.access_token:
131
+ value = service.refresh_access_token(client_id, credential.refresh_token)
132
+ service.apply_token_response(value)
133
+ else:
134
+ value = service.last_token_response
135
+ if value is None:
136
+ return credential
125
137
  return replace(GitHubCredential.from_token_response(value), login=credential.login)
126
138
  return credential
127
139
 
@@ -68,6 +68,9 @@ class GitHubService:
68
68
  self.refresh_token = refresh_token
69
69
  self.client_id = client_id
70
70
  self.on_token_refresh = on_token_refresh
71
+ #: The most recent token response applied, kept so callers can reconstruct
72
+ #: the credential in effect after an automatic 401 refresh.
73
+ self.last_token_response: dict[str, Any] | None = None
71
74
  self._refresh_lock = threading.Lock()
72
75
 
73
76
  @staticmethod
@@ -360,7 +363,12 @@ class GitHubService:
360
363
  raise GitHubError("GitHub returned an unexpected token refresh response")
361
364
 
362
365
  def apply_token_response(self, value: dict[str, Any]) -> None:
363
- """Replace the in-memory token and persist the rotated credentials."""
366
+ """Replace the in-memory token and persist the rotated credentials.
367
+
368
+ The raw response is remembered so a caller can reconstruct the credential
369
+ that an automatic 401 refresh put in effect (see ``refresh_if_needed``).
370
+ """
371
+ self.last_token_response = value
364
372
  self.token = str(value["access_token"])
365
373
  self.refresh_token = (
366
374
  str(value["refresh_token"]) if value.get("refresh_token") else self.refresh_token
@@ -113,6 +113,18 @@ class GraxpertBuiltinTool(Tool):
113
113
  cwd=cwd,
114
114
  log_out=log_out,
115
115
  ):
116
+ # GraXpert's ``denoise`` keeps the last result in a module-global
117
+ # ``cached_denoised_image`` so its GUI can re-blend when the strength
118
+ # slider moves, and resets it only on GUI events (load image /
119
+ # calculate) that the cmdline/API path never emits. A later denoise
120
+ # task on a differently-sized frame in the same process (several
121
+ # targets in one run) would then hit
122
+ # ``np.where(input, cached, input)`` with mismatched shapes and die
123
+ # with a numpy broadcast ValueError. A one-shot tool call gains
124
+ # nothing from the cross-call cache, so reset it before every run.
125
+ from graxpert.denoising import reset_cached_denoised_image
126
+
127
+ reset_cached_denoised_image(None)
116
128
  api_run(args, prefs)
117
129
 
118
130
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes