mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-11 14:07:40 +01:00
|
Some checks are pending
file-length / file length <= 250 lines (push) Waiting to run
pre-commit / pre-commit (push) Waiting to run
Tests / test (3.10) (push) Waiting to run
Tests / test (3.11) (push) Waiting to run
Tests / test (3.12) (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
Two independent costs in the background tick, both pure waste.
`list_directory` was called four times per tick -- once by the log pull and
once by each of the three bank syncs. It is the single most expensive call
in a tick at ~445ms mirrored (the GitHub half alone is ~360ms), so that was
~1.3s spent asking the same question four times. It is now listed once in
`run_sync` and passed down.
The curated-bank loop was worse: 17s and 62 requests to fetch *zero* useful
bytes. Firebase returns None for every peer's `food_bank_manual.json`, so
`MirrorSyncClient.get_file_text` treated each miss as "this device has not
migrated yet" and fell through to GitHub, which answers `{}` after ~320ms.
`_primary_only_text` skips that per-peer fallthrough for this one artifact.
Checked before narrowing rather than assumed, because CLAUDE.md requires
both halves of the food bank to sync: reading every peer's curated bank
straight off the mirror found 23 absent, 2 empty, and zero non-empty. No
curated food exists on the mirror alone. The probe is written into the
docstring so it can be re-run before anyone widens this again.
Measured end to end: manual-bank loop 17.0s -> 3.4s, full tick ~27s -> 15.2s,
log/bank/peer state unchanged (441 entries, 117 foods, 22 peers).
`_pull_remote_logs` now returns the revisions it saw instead of mutating a
caller-supplied dict, which keeps it under the argument limit and makes the
data flow visible at the call site.
Deliberately NOT done: revision-skipping the derived food bank. `run_sync`
rebuilds that bank from the merged log immediately before syncing it, so
unlike the log the peer records are not durably held locally -- skipping a
peer would drop its counts from the pushed bank and oscillate under
max-count-wins. Verified empirically: the on-disk bank and a pure log-derived
rebuild are identical (117 foods, 0 differing counts), and the 2 foods peers
know that the local bank lacks are discarded by the existing `if name in
local` filter anyway. The loop is off every interactive path now, so the
remaining cost is background-only.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJ5YnA3CERitQ57HjMu2Qz
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| _gate_fixtures.py | ||
| _gate_focus_probe.py | ||
| _gate_keyboard_probe.py | ||
| _gate_layout_probe.py | ||
| _gate_measurement.py | ||
| _sync_fakes.py | ||
| _tk_fakes_canvas.py | ||
| _tk_fakes_containers.py | ||
| _tk_fakes.py | ||
| conftest.py | ||
| test_averages_report.py | ||
| test_averages.py | ||
| test_budget_history_io.py | ||
| test_budget_history.py | ||
| test_budget.py | ||
| test_calendar_averages.py | ||
| test_calendar_view.py | ||
| test_cli_averages.py | ||
| test_cli_gate.py | ||
| test_cli_sync.py | ||
| test_cli.py | ||
| test_daystatus.py | ||
| test_estimator.py | ||
| test_foodbank_manual.py | ||
| test_foodbank_rebuild.py | ||
| test_foodbank.py | ||
| test_fuzzy.py | ||
| test_gate_layout_fits.py | ||
| test_gate_tk_modules.py | ||
| test_gate.py | ||
| test_gatelock_calendar.py | ||
| test_gatelock_dashboard.py | ||
| test_gatelock_fanout.py | ||
| test_gatelock_form.py | ||
| test_gatelock_groups.py | ||
| test_gatelock_keyboard.py | ||
| test_gatelock_mealflow.py | ||
| test_gatelock_scheduleedit.py | ||
| test_gatelock.py | ||
| test_main.py | ||
| test_mcp_averages.py | ||
| test_mcp.py | ||
| test_meal_schedule_store.py | ||
| test_meal_schedule.py | ||
| test_portions.py | ||
| test_resolve.py | ||
| test_slots.py | ||
| test_state_redirect.py | ||
| test_state_sync.py | ||
| test_state_today.py | ||
| test_state.py | ||
| test_sync_backend.py | ||
| test_sync_banks_mirror.py | ||
| test_sync_banks.py | ||
| test_sync_budget.py | ||
| test_sync_device_id.py | ||
| test_sync_events.py | ||
| test_sync_merge_banks.py | ||
| test_sync_merge_budget.py | ||
| test_sync_merge_schedule.py | ||
| test_sync_merge.py | ||
| test_sync_pull.py | ||
| test_sync_refresh.py | ||
| test_sync.py | ||
| test_test_guard.py | ||