Skip to content

Keep the person's own files safe, and finish the terminal polish - #106

Merged
AdamXweb merged 2 commits into
mainfrom
fix/data-safety-and-terminal-polish
Nov 10, 2026
Merged

AdamXweb merged 2 commits into
mainfrom
fix/data-safety-and-terminal-polish

Conversation

@adamXbot

@adamXbot adamXbot commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Follows #105, which is merged; rebased onto main after that squash merge, with no change in content.

Data safety (first commit)

Seven ways install, upgrade, adopt and uninstall could lose or overwrite something that was not fxcss's to touch. The four checked against 0.25.0 (original backup, hook, pins, OS litter) happen there too.

  • The original chrome/ backup could be pruned. Install over your own chrome/, install again, upgrade three times: the backup holding your files was deleted and uninstall restored the first theme instead. The origin is now carried through repeat installs and rollbacks, and manifests 0.25 already mis-recorded are followed back to the real original when read.
  • customChrome.css. fxcss recorded its own placeholder as a theme file, so a filled-in hook blocked upgrades and --force replaced it with a new placeholder. A hook you have written in is now yours and is carried across.
  • --ref pins. A bare fxcss upgrade re-downloaded and reinstalled the same ref and made a backup each time. It now says it is pinned and does nothing; --ref and --commit still move it.
  • OS litter. .DS_Store, Thumbs.db and desktop.ini no longer stop uninstall restoring the original.
  • adopt. Files the matched version does not ship are recorded as yours and survive upgrades, instead of being dropped by the next one.
  • user.js. A stray BEGIN marker can no longer claim a later block's END and take your lines with it.
  • Pref listing. Every pref fxcss will write is named before you confirm, user_pref ("x", …) is recognised, and control characters are escaped.

Behaviour change: --keep prunes only backups that hold an fxcss install record. A hand-made chrome.backup-* folder is never deleted or counted.

Terminal polish and README (second commit)

  • A menu whose prompt wraps is redrawn in place. The same keystrokes in a 62-column terminal left 86 screen lines before and 30 now.
  • upgrade, rollback, adopt, uninstall and init open and close the way install does. upgrade --no-colour holds for the whole command.
  • fxcss doctor outside a theme folder reports on Firefox alone instead of exiting 2.
  • A console code page with no arrow or tick gets ASCII stand-ins instead of a UnicodeEncodeError.
  • Colour on a Windows console enables VT processing first. Not run on Windows.
  • init warns about an unpublished pin only when fxcss was not installed from PyPI.
  • Wording: "1 element matches", "1 token out of reach", no empty audit heading, no "0 KB".
  • README: seven sample outputs are real 0.26 output; the notes on pins, hooks, backups and doctor match what now happens.

How it was tested

  • Unit tests: 864 pass on Python 3.9, 3.12, 3.14 and 3.15, under FORCE_COLOR=1, at 40 and 60 columns, and inside a terminal. The first commit alone passes 845.
  • tests/test_data_safety.py (38 tests) fails 31 ways on main.
  • Each data-safety case was reproduced in a scratch profile before the fix and re-run after.
  • Live Firefox 158 on macOS: doctor, theme layouts, startup, audio, variants, capture, determinism, real-change, audit and inspect pass. Determinism differed in one view on one run while the machine was busy and was identical on a clean re-run.
  • The website's docs build from this README: 48 pages, site tests pass.

Not covered

  • Windows and Linux were not run locally.
  • rollback with no --to still takes the newest chrome.backup-* by name, which can be a hand-made folder.
  • Symlinked user.js or chrome/, flat layouts with asset folders used only by optional sheets, and fetch tracebacks on truncated downloads are unchanged.

🤖 Generated with Claude Code

Base automatically changed from fix/release-blockers-0.26 to main November 10, 2026 12:46
adamXbot and others added 2 commits November 10, 2026 23:47
Seven ways install, upgrade, adopt and uninstall could lose or overwrite
something that was not fxcss's to touch. The four checked against
0.25.0 (the original backup, the hook, pins and OS litter) happen there
too, so these are not regressions.

- A second `fxcss install` recorded the previous theme's backup as the
  original, so three upgrades later the real original was pruned and
  `uninstall` restored a theme. The origin is now carried from the
  install being replaced, followed back to the real original when an
  older manifest names a theme's backup, and repaired after a rollback
  renames it. Only backups holding an fxcss manifest are ever pruned.
- The customChrome.css placeholder was recorded as a theme file. Once
  filled in it blocked upgrades, and --force wrote a fresh placeholder
  over it. A filled-in hook is now the person's file and is carried.
- A bare `upgrade` on a --ref pin re-downloaded and reinstalled the same
  ref and spent a backup doing it. It now says it is pinned and stops.
- .DS_Store, Thumbs.db and desktop.ini in chrome/ stopped `uninstall`
  restoring the original.
- After `adopt`, files the matched version does not ship were recorded
  as the theme's and dropped by the next upgrade. They are recorded as
  the person's own.
- A stray BEGIN marker in user.js claimed a later block's END and took
  the lines between with it.
- The pref names shown before confirming stopped at five, missed
  `user_pref ("x", …)` written with a space, and passed control
  characters to the terminal.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Menus, output and wording left over from the terminal work, and the
README samples that still showed the old format.

- A menu whose prompt wraps is redrawn where it was. The way back to the
  top was counted in rows, not terminal lines, so a 60-column terminal,
  or a dozen typed characters at 80, left every earlier frame on screen.
- upgrade, rollback, adopt, uninstall and init open with a title and
  aligned rows and close with a tick, as install does. `upgrade
  --no-colour` now holds for the whole command.
- `fxcss doctor` outside a theme folder reports on Firefox alone instead
  of stopping with "no userChrome.css anywhere"; the installer and the
  docs send people to it first.
- Output in a code page with no arrow or tick in it gets an ASCII
  stand-in instead of a UnicodeEncodeError.
- Colour on a Windows console first asks it to act on the codes, and is
  left off where it will not.
- `init` warns that its pin must be published on PyPI only when this
  copy did not come from PyPI.
- "1 element matches", "1 token out of reach", no heading over nothing
  in the audit, "under 1 KB" rather than "0 KB", and a yes/no question
  no longer sits a column to the right when it opens with a blank line.
- Tests no longer depend on FORCE_COLOR being unset.
- README: the try, version prompt, profiles, adopt, upgrade, rollback
  and audit samples are real 0.26 output, and the notes on pins, hooks,
  backups and doctor describe what now happens.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@adamXbot
adamXbot force-pushed the fix/data-safety-and-terminal-polish branch from 5f9c620 to 49f77d3 Compare November 10, 2026 12:48
@AdamXweb
AdamXweb merged commit a30d220 into main Nov 10, 2026
21 checks passed
@AdamXweb
AdamXweb deleted the fix/data-safety-and-terminal-polish branch November 10, 2026 13:03
adamXbot added a commit that referenced this pull request Nov 10, 2026
…nner

The Windows unit tests failed on main after #106 with a timeout in
test_draw_failure_releases_snapshot_and_dismisses_prompt. The test runs a
short script under Node and allowed it ten seconds. The script itself
takes milliseconds; the time is Node starting, and this test is the first
in the job to start it. That first start takes a little over two seconds
on the Windows runner normally. On that run every later start was ten
times slower than usual as well, and the first one passed the limit.

The same tree had passed the same job on the pull request minutes
earlier. The limit is now 120 seconds: still an end to a real hang, no
longer a measure of the runner.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
AdamXweb pushed a commit that referenced this pull request Nov 10, 2026
…nner (#108)

The Windows unit tests failed on main after #106 with a timeout in
test_draw_failure_releases_snapshot_and_dismisses_prompt. The test runs a
short script under Node and allowed it ten seconds. The script itself
takes milliseconds; the time is Node starting, and this test is the first
in the job to start it. That first start takes a little over two seconds
on the Windows runner normally. On that run every later start was ten
times slower than usual as well, and the first one passed the limit.

The same tree had passed the same job on the pull request minutes
earlier. The limit is now 120 seconds: still an end to a real hang, no
longer a measure of the runner.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
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.

2 participants