Repository navigation
feat: printer profiles, access code in the config dir, both printer modes (0.5.0) - #7
Merged
Merged
Conversation
…rite and lock helpers (0.5.0 slice F)
…ess-code error (0.5.0 slice A)
…ificate serial, subnet probe, typed read results and relocation (0.5.0 slice C)
…drop relocation and derivable profile fields; review fixes
…es, identity deadline reserve, fsync, relative config dirs ignored
…s; doctor shows the profile (0.5.0 slice D)
…e exits for forget, masked serial kept in errors, UTC labels, no writes before validation
…odes; version 0.5.0 (slice E)
…est-prefix network, deadline on every pass, identity allowance, last_resolved on failure
…ment and usage line scrubbed, forget exit 3 on a failed delete, name checked first, --wait honoured, Studio import errors bounded
…sticky TLS flag documented, evals for the printer read, precise contracts
…-insensitive pin check
…n discovery wording
…d case is canonical
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On 2026-10-27 the X2D went to LAN-only mode and regenerated its LAN access code. Bambu Studio's config still held the old code, shambu had nowhere to keep an IP or a code, and every read failed until Studio's config was edited by hand. The owner wants cloud mode and LAN-only mode both supported.
The spec is
docs/specs/2026-10-27-printer-profiles.md; section 11 records the decisions taken after review.What
printers.jsonunder the config dir ($SHAMBU_CONFIG_DIR, else$XDG_CONFIG_HOME/shambu, else~/.config/shambu): name, serial, last IP, mode, TLS flag, dates. Never a code.credentials.json(mode 0600, dir 0700) behind aVaultProtocol (FileVault,MemoryVaultfor tests). Not the Keychain: a Keychain write from a non-GUI session fails or prompts.shambu printer loginin three forms (--ip IP [--serial SERIAL],--printer NAME [--ip IP],--from-studio), one verified read before anything is written, the code from--access-code-file,--access-code-stdinor a hidden prompt.printer list,printer forget [--keep-code],--printer NAMEand the code flags on every printer-reading command,--mode lan|cloud.discover, inloginwithout an IP, and for a profile without an IP; identity-checked candidates when the serial is known; the serial read from the printer's certificate forlogin --ip.printer discover,mainscrubbing codes and raw serials,--printershadowing two argparse prefixes).Review
Codex (gpt-6-astra, high) reviewed the plan over three rounds and the code over seven: the core (conf, profiles, vault, printer) reached accept on its third round; the facade and CLI went three rounds, every finding closed, and the last round's one finding (the credential key inside the login commit) is fixed in the final commit. Every finding was folded in or dismissed with a written reason in the session record. A rubric review against REVIEW-RUBRIC.md ran per slice and once over the merged branch. All 20 rubric items pass on this branch;
make checkis green (1359 passed, 9 skipped);ruff format --checkis clean.Checks
make check,uv run ruff format --check src testsrg -n '192\.168|access_code|/Users/'over the diff: only the config-key and function namespublish((thepushall); nosubprocess.outsidestudio.py,printer.py(arp, route, ifconfig) andfacade.py(open); seven documentednoqa: BLE001shambu printer discoverfound the printer through the subnet pass with nothing in the ARP table, in 2.7 s (the 27 October failure)shambu printer loginagainst the X2D with the touchscreen code, thenstatusin both modes. That is the first thing to do after merging.Deferred (spec section 11)
printer probe, SSDP mode detection (replaced by--mode), automatic relocation after a DHCP change (one explicitlogin --printer NAME --ipinstead), and thecode_source,modelandrevisionprofile fields.