bootstrap: ask before updating, and name a locked folder #10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/update-consent-dialog"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The updater currently replaces workbenches silently on every launch. This asks first.
What the user sees. One dialog per startup, listing what is available, with
Update now/Not nowand a don't ask again box. Nothing to update means no dialog at all - the manifest is walked first and the whole batch is confirmed once. After applying, a transient status-bar message summarises the result and offers a restart, since the new files need a reload before they are what runs.'Don't ask again' sets
SkipUpdatePromptinUser parameter:BaseApp/Preferences/Mod/ComfacCAD/Update, the same group as the channel preference: per-user, outsideMod/, and untouched by any workbench update. Edit -> Preferences -> ComfacCAD is where it is cleared.Threading.
run_updater_asyncruns on a daemon thread and Qt widgets may only be touched from the GUI thread, so_on_gui_threadposts viaQTimer.singleShotand parks the worker on anEventwhen a modal answer is needed. Every path is wrapped: a broken dialog must never block an update or startup.Degrades safely. No Qt, or no answer within 120s, falls back to the previous silent behaviour rather than leaving an install that never updates.
Also fixed here.
shutil.rmtreeon a target that is in use raisedPermissionError, which fell through to the genericFailed downloading workbenchline - no hint that anything was locked or what to do about it. Windows holds a directory open when a terminal or editor has it as its working directory, which is common on a dev machine. The error now names the folder and says to close whatever is in it, anddownload_and_extract_wbreturns True/False so the summary reports what actually happened.Tests.
tests/updater_consent_test.py, 21 checks, offline - temp app root, local HTTP server serving purpose-built archives, stubbed FreeCAD / PySide6; no network, no live install touched. Covers decline, accept, restart accepted and declined, dont-ask persistence across a later launch, a locked folder alongside a healthy one, the git-checkout guard, and the nothing-to-do case.Caveat worth stating: the bootstrap never updates itself and is not in any manifest, so this reaches only users who install a new installer. Existing installs keep today's silent behaviour until then.
Docs:
MAINTAINING.md6.4 currently records 'failure reporting is swallowed'. That is no longer true once this ships, and 6.1's description of silent updating needs a note about the prompt. Worth folding into this PR before merge.Status: NOT FOR MERGE — prompt unverified
Held deliberately. The update flow works, but the consent prompt has never been
seen to render in a real FreeCAD, so it must not ship in this state.
What is verified and worth keeping
threading,urllib.error) is a real bug fix.run_updater_asyncruns on a daemon thread whose__globals__do not containthis module's names, so a module-level
import threadingis invisible there.This raised
NameError: name 'threading' is not defined, caught by the broadexceptand printed as a single report-view line, so the visible symptom was aprompt that silently never opened. Do not merge this branch without it.
run_updater_asyncand fails if any stdlib module is used without a localimport. Verified against history: it flags
f5377bcand778253a(the twocommits that carried the defect) and passes on the commits before them.
Failed downloading workbenchwith the folder name and what to do. Tested offline with a real held handle.
COMFAC_MANIFESTlets the whole flow be exercised without publishinganything. Also fixes
urllib.erroravailability.QTimerrefuses to deliver callbackswhile the GUI is not up — the condition the original bug depended on.
Why the prompt is not ready
run_updater_asyncis called atInitGui.pyimport, beforeapp.exec(). At thatmoment
FreeCADGui.getMainWindow()returnsNonefor tens of seconds, so:QMessageBoxqueued there is never drawn (and, when forced, renders EMPTY —parenting,
adjustSize()andraise_()do not fix it);Mod/Comfac-2Duses and is drawn inside the main window), but the readiness gate that would
reach it times out before the window exists;
not evidence that the prompt was shown or answered.
Net effect today: the update applies, and the prompt does not appear.
The way to finish it
Fire the prompt after FreeCAD owns the frame rather than racing startup: a
document observer (
slotActivateDocument) or a workbenchActivated()hook.The flow's worker/prompt split can stay; only the trigger changes. Write the test
to model FreeCAD's startup ordering first — three rounds of this were lost to
offline tests passing while the real application disagreed.
The prompt never appeared because the updater crashed before it could ask: AutoSetup Network Error: Update checking failed: name 'threading' is not defined run_updater_async runs on a daemon thread whose __globals__ do not contain this module's names -- the function's own docstring says so, and every other module it uses is imported locally for exactly that reason. hreading (used by the new GUI hop) and urllib.error were not. The NameError was caught by the broad except at the end of the function and printed one line to the report view, so the visible symptom was a dialog that silently never opened. Adds a static guard to the test suite: it parses run_updater_async and fails if any stdlib module is referenced without an import inside the function. Verified against history -- it flagsf5377bcand778253a, the two commits that carried the defect, and passes on the commits before it.Flagged not for merge (status section in the description).
Summary: the prompt has never been seen to render in a real FreeCAD, so it must not ship. The rest of the branch is verified and worth keeping -- notably the
threadingimport fix, without which the updater raisesNameErroron every launch and silently does nothing.Deferred by request; the description records what was learned and the suggested way to finish it (fire the prompt after FreeCAD owns the frame, via a document observer or workbench
Activated(), instead of racing startup).0b1ab0dbc4tof24d20a062Flagged: Can now be Merged
The prompt never appeared because the updater crashed before it could ask: AutoSetup Network Error: Update checking failed: name 'threading' is not defined run_updater_async runs on a daemon thread whose __globals__ do not contain this module's names -- the function's own docstring says so, and every other module it uses is imported locally for exactly that reason. hreading (used by the new GUI hop) and urllib.error were not. The NameError was caught by the broad except at the end of the function and printed one line to the report view, so the visible symptom was a dialog that silently never opened. Adds a static guard to the test suite: it parses run_updater_async and fails if any stdlib module is referenced without an import inside the function. Verified against history -- it flagsf5377bcand778253a, the two commits that carried the defect, and passes on the commits before it.