Skip to content

fix: size_verified, leftover contracts, and extras on raised errors - #118

Merged
DLANSAMA merged 1 commit into
mainfrom
refactor/aaa-pr9-honesty
Aug 13, 2026
Merged

fix: size_verified, leftover contracts, and extras on raised errors#118
DLANSAMA merged 1 commit into
mainfrom
refactor/aaa-pr9-honesty

Conversation

@DLANSAMA

Copy link
Copy Markdown
Owner

AAA stack 9/9. Stacked on #117. Tip of the stack.

Two commits:

  1. Honesty: printer.last_size_verified when FTPS SIZE is missing; Upload/Download/JobOk carry size_verified. TOFU copy is hostile-LAN honest. --sim wording says canned printer, not a live one. cmd_upload uses ctx.printer().
  2. Wrap-up: keep extras on raised errors (download credential URLs no longer become \"Command failed (exit 5)\"). Setup, preflight, and setup --migrate-access-code emit through Contract objects. RuntimeContext.printer() uses get_printer() when it is the installed context.

Local gates on this tip: ruff, mypy, bandit, layers, schemas, pytest -W error::ResourceWarning -m \"not live\"1436 passed, 1 deselected, 88.91% (floor 83).

Stack: #110#111#112#113#114#115#116#117this

@DLANSAMA
DLANSAMA force-pushed the refactor/aaa-pr8-error-path branch from 456cd9f to 565f7e6 Compare August 13, 2026 02:45
@DLANSAMA
DLANSAMA force-pushed the refactor/aaa-pr9-honesty branch 2 times, most recently from a59c530 to 38f0351 Compare August 13, 2026 02:57
@DLANSAMA
DLANSAMA force-pushed the refactor/aaa-pr8-error-path branch from 90f218f to 308345f Compare August 13, 2026 04:12
Upload/job JSON carry size_verified. Missing SIZE is still success with
a warning; mismatch remains a retryable failure. TOFU pin copy now says
a hostile LAN can poison the pin. --sim is documented as a canned
printer, not a protocol test.
Base automatically changed from refactor/aaa-pr8-error-path to main August 13, 2026 04:21
@DLANSAMA
DLANSAMA force-pushed the refactor/aaa-pr9-honesty branch from 38f0351 to 2bb7306 Compare August 13, 2026 04:21
@DLANSAMA
DLANSAMA merged commit f179ef9 into main Aug 13, 2026
6 checks passed
@DLANSAMA
DLANSAMA deleted the refactor/aaa-pr9-honesty branch August 13, 2026 04:31
DLANSAMA added a commit that referenced this pull request Aug 14, 2026
* refactor: printer factory, MQTT/FTPS hardening, coverage to 86

Continues the boundary/error-model arc (#117/#118).

Architecture:
- RuntimeContext.printer() now uses an injectable factory registered
  downward from bambu_cli.printer (set_printer_factory); context.py no
  longer imports printer. Removes the last check_layers ALLOWED edge
  (context -> printer); ALLOWED is now empty.

Correctness / resources:
- mqtt_session: lock _pending_payload/_command_issued across the paho
  network thread; cached-complete-snapshot fast path on silent pushall.
- mqtt_tls: drop global socket.setdefaulttimeout mutation; bound connect
  via client._connect_timeout; configurable, validated MQTTS port.
- mqtt_cmd/mqtt_print/mqtt_monitor: teardown in finally (fixes leak on
  the connect-exception path).
- ftps: close the socket if connect/login/prot_p fails.
- snapshot/slice: drop unreachable safe_log_error+abort tails after
  emit_json_error (now typed NoReturn); it already logs and raises.

Tests / CI:
- +40 targeted tests for the above error paths; raise CI cov floor
  83 -> 86 (measured 91.0% Linux). Stronger docs-coverage drift guard.
- Docs: api.md support matrix; SECURITY.md residuals marked accepted
  for 1.0; scoreboard refreshed.

* test: make preflight perms test platform-aware (Windows CI)

_file_permission_check returns None on win32 by design (POSIX mode bits
don't apply — see the Windows secret ACLs residual in SECURITY.md), so
the 0o644/0o600 assertions only hold off-Windows. Assert the None path
on win32 instead.

---------

Co-authored-by: DLANSAMA <258674612+DLANSAMA@users.noreply.github.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.

1 participant