brainlayer 1.6.9__tar.gz → 1.6.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {brainlayer-1.6.9 → brainlayer-1.6.11}/PKG-INFO +1 -1
- {brainlayer-1.6.9 → brainlayer-1.6.11}/pyproject.toml +1 -1
- brainlayer-1.6.11/scripts/launchd/com.brainlayer.t3-audit.plist +24 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/install.sh +11 -5
- {brainlayer-1.6.9 → brainlayer-1.6.11}/server.json +2 -2
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/__init__.py +1 -1
- brainlayer-1.6.11/src/brainlayer/_build.py +1 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/backup_daily.py +176 -9
- brainlayer-1.6.11/src/brainlayer/backup_heavy_gate.py +227 -0
- brainlayer-1.6.11/src/brainlayer/backup_sleep.py +94 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/brainbar_hybrid_helper.py +124 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/cli/__init__.py +25 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/dedupe.py +77 -22
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/drain.py +2 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/health_check.py +71 -2
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/ingest/codex_manifest.py +15 -4
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/ingest/t3.py +66 -12
- brainlayer-1.6.11/src/brainlayer/ingest/t3_audit.py +202 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/ingest/t3_bookmark.py +2 -1
- brainlayer-1.6.11/src/brainlayer/ingest/t3_ownership.py +111 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/job_alerts.py +6 -2
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/observability_backup.py +18 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/classify.py +15 -1
- brainlayer-1.6.11/src/brainlayer/queued_messages.py +21 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/t3_thread_tables.py +4 -2
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/vector_store.py +2 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/watcher.py +5 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/watcher_bridge.py +20 -2
- brainlayer-1.6.9/src/brainlayer/_build.py +0 -1
- {brainlayer-1.6.9 → brainlayer-1.6.11}/.gitignore +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/LICENSE +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/README.md +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/brainlayer-version-check.sh +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/hotlane_brainbar_daemon.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/backup-daily.sh +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/brainlayer-env-run.sh +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/brainlayer.env.example +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.backup-daily.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.daemon.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.decay.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.drain.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.health-check.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.hotlane-brainbar.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.index.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.jsonl-backup.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.log-cap.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.maintenance-nightly.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.maintenance-weekly.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.maintenance.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.observability.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.p0-counter.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.repair-fts.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.t3-ingest.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.throughput-watchdog.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.tier0-watchdog.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.wal-checkpoint.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.brainlayer.watch.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/com.etanhey.brainlayer-fleet-watchdog.plist +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/fleet-watchdog.sh +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/jsonl-backup.sh +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/launchd/throughput-watchdog.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/release-verify-signatures.sh +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/scripts/tier0-watchdog.sh +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/__main__.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/_helpers.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/agent_census.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/agent_profiles.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/agent_provenance.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/agy_attribution.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/alarm.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/archive_collapse.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/archive_lifecycle.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/backup_retention_invariant.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/badge_state.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/bitemporal.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/brainbar_activation.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/brainbar_auto_activation.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/brainbar_identity.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/cachedelete_purge.swift +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/calibrate.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/chunk_origin.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/chunk_origin_backfill.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/chunk_origin_wipe.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/chunk_write.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/classify.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/claude_paths.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/cli/wizard.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/cli_jobs.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/cli_new.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/cloud_backfill.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/clustering.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/codex_zst.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/component_jobs.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/config.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/consolidation_plan.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/content_class.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/content_hash_repair.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/correction_judge.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/data/agents_registry.yaml +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/data/sandbox_seeds/skill-eval-baseline.json +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/db_shrink.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/decay.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/decay_backfill.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/decay_job.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/dedupe_merge.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/deploy_drift.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/disk_space.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/doctor.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/drain_liveness.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/drive_credentials.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/embeddings.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/engine.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/enrichment_replay.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/__init__.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/abcde_enrich_runner.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/abcde_variants.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/abcde_variants.yaml +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/benchmark.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/enrichment_gold.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/enrichment_graders.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/enrichment_judge.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/enrichment_llm_judge.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/enrichment_quality_benchmark.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/experiment_store.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/fixtures/README.md +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/labeling/enrichment-labeler.html +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/phoenix_gate/__init__.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/phoenix_gate/__main__.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/phoenix_gate/baseline_store.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/phoenix_gate/cli.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/phoenix_gate/models.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/phoenix_gate/phoenix_client.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/phoenix_gate/regression_gate.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/phoenix_gate/triggers.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/eval/pilot_artifact_report.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/fallback_replay.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/git_learning.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/health_facts.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/health_verdict.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/hook_python.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/hooks/__init__.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/hooks/indexer.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/hotlane_budget.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/import_sweep.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/index_admission.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/index_budget.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/index_completeness.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/index_new.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/index_watchdog.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/ingest/__init__.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/ingest/codex.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/ingest_denylist.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/ingest_guard.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/isolation_proof.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/job_lifecycle_health.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/jobs.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/jsonl_backup.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/kg/__init__.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/kg_cleanup.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/kg_judge.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/kg_promotion.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/kg_repo.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/kg_review_session.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/kg_session_finish.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/kg_session_harvest.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/launchd_consolidation.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/launchd_install.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/launchd_primitive.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/launchd_revert.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/launcher_policy_reconcile.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/lexical_defense.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/lexical_defense_dictionary.json +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/linkedin_import.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/log_cap.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/maintenance.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/maintenance_calendar.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/maintenance_control.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/maintenance_upload_recovery.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/mcp/__init__.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/mcp/_format.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/mcp/_shared.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/mcp/enrich_handler.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/mcp/entity_handler.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/mcp/palette.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/mcp/search_handler.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/mcp/store_handler.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/mcp/tags_handler.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/mcp_socket_config.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/mcp_stdio_bridge.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/memory_types.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/migrate.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/migration_custody.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/migration_journal.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/migration_runtime.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/notification_policy.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/observability_indexes.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/observability_surface.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/observability_transport.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/p0_longitudinal_count.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/parent_death.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/paths.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pause.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/phonetic.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/__init__.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/agent_enrichment.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/analyze_communication.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/batch_extraction.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/brain_graph.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/chat_tags.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/chunk.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/cloud_scrub.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/cluster_sampling.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/code_intelligence.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/correction_detection.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/correction_mining.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/digest.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/enrichment_prompts.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/enrichment_results.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/enrichment_tiers.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/entity_extraction.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/entity_resolution.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/extract.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/extract_claude_desktop.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/extract_corrections.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/extract_markdown.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/extract_whatsapp.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/frustration_mining.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/git_overlay.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/kg_extraction.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/kg_extraction_groq.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/longitudinal_analyzer.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/obsidian_export.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/operation_grouping.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/plan_linking.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/rate_limiter.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/relation_backfill.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/relation_verification.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/sanitize.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/secret_scrub.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/semantic_style.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/sentiment.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/session_history.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/style_embed.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/style_index.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/tag_entity_promotion.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/temporal_chains.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/time_batcher.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/unified_timeline.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/pipeline/write_queue.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/policy_reconcile.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/provenance.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/provenance_autosupersede.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/provenance_integration.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/queue_io.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/queue_merge.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/readonly_snapshot.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/reembed_backfill.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/retired_services.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/runtime_store.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/sandbox_db.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/schema_ddl_ledger.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/scoping.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/scrub_at_rest.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/search_fanout.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/search_profile.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/search_repo.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/search_response.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/service_supervisor.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/session_repo.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/setup.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/socket_hygiene.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/source_class_migration.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/source_visibility.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/spotlight.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/storage.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/store.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/supervisor_adapters.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/supervisor_child.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/supervisor_diagnostics.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/supervisor_guard.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/supervisor_jobs.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/system_prompt_guard.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/t3_linkage_alarm.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/t3_provenance.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/t3_sources.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/tag_normalization.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/taxonomy.json +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/telemetry.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/timestamp_iso.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/types.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/wal_checkpoint.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/writer_policy.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/writer_telemetry.py +0 -0
- {brainlayer-1.6.9 → brainlayer-1.6.11}/src/brainlayer/zstd_stream.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: brainlayer
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.11
|
|
4
4
|
Summary: Persistent local memory for AI agents — 16 BrainBar MCP tools, semantic search, knowledge graph, SQLite
|
|
5
5
|
Project-URL: Homepage, https://brainlayer.etanheyman.com
|
|
6
6
|
Project-URL: Repository, https://github.com/EtanHey/brainlayer
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0"><dict>
|
|
4
|
+
<key>Label</key><string>com.brainlayer.t3-audit</string>
|
|
5
|
+
<key>AssociatedBundleIdentifiers</key><array><string>com.brainlayer.brainbar</string></array>
|
|
6
|
+
<key>ProgramArguments</key><array>
|
|
7
|
+
<string>__BRAINLAYER_ENV_RUN__</string><string>__BRAINLAYER_BIN__</string><string>t3-audit</string>
|
|
8
|
+
</array>
|
|
9
|
+
<key>StartInterval</key><integer>86400</integer>
|
|
10
|
+
<key>Nice</key><integer>15</integer>
|
|
11
|
+
<key>ExitTimeOut</key><integer>1800</integer>
|
|
12
|
+
<key>SoftResourceLimits</key><dict><key>NumberOfFiles</key><integer>4096</integer></dict>
|
|
13
|
+
<key>ProcessType</key><string>Background</string>
|
|
14
|
+
<key>LowPriorityIO</key><true/>
|
|
15
|
+
<key>StandardOutPath</key><string>__HOME__/Library/Logs/brainlayer/t3-audit.out.log</string>
|
|
16
|
+
<key>StandardErrorPath</key><string>__HOME__/Library/Logs/brainlayer/t3-audit.err.log</string>
|
|
17
|
+
<key>EnvironmentVariables</key><dict>
|
|
18
|
+
<key>PATH</key><string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:__HOME__/.local/bin</string>
|
|
19
|
+
<key>PYTHONUNBUFFERED</key><string>1</string>
|
|
20
|
+
<key>BRAINLAYER_REPO_ROOT</key><string>__BRAINLAYER_DIR__</string>
|
|
21
|
+
<key>BRAINLAYER_ENV_FILE</key><string>__BRAINLAYER_ENV_FILE__</string>
|
|
22
|
+
<key>BRAINLAYER_LAUNCHD_SERVICE</key><string>t3-audit</string>
|
|
23
|
+
</dict>
|
|
24
|
+
</dict></plist>
|
|
@@ -240,7 +240,7 @@ launchd_install_usage() {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
case "$BRAINLAYER_INSTALL_ACTION" in
|
|
243
|
-
consolidate|consolidation-rollback|index|t3-ingest|watch|decay|drain|hotlane|hotlane-brainbar|repair-fts|load|unload|checkpoint|backup|jsonl|jsonl-backup|maintenance|maintenance-nightly|maintenance-weekly|health-check|log-cap|observability|tier0|tier0-watchdog|throughput-watchdog|fleet|fleet-watchdog|fleet-watchdog-quiesce|fleet-watchdog-resume|p0-counter|all|remove)
|
|
243
|
+
consolidate|consolidation-rollback|index|t3-ingest|t3-audit|watch|decay|drain|hotlane|hotlane-brainbar|repair-fts|load|unload|checkpoint|backup|jsonl|jsonl-backup|maintenance|maintenance-nightly|maintenance-weekly|health-check|log-cap|observability|tier0|tier0-watchdog|throughput-watchdog|fleet|fleet-watchdog|fleet-watchdog-quiesce|fleet-watchdog-resume|p0-counter|all|remove)
|
|
244
244
|
;;
|
|
245
245
|
*)
|
|
246
246
|
launchd_install_usage
|
|
@@ -467,6 +467,7 @@ job_display_name() {
|
|
|
467
467
|
p0-counter) echo "BrainLayer P0 Counter" ;;
|
|
468
468
|
repair-fts) echo "BrainLayer FTS Repair" ;;
|
|
469
469
|
t3-ingest) echo "BrainLayer T3 Ingest" ;;
|
|
470
|
+
t3-audit) echo "BrainLayer T3 Audit" ;;
|
|
470
471
|
throughput-watchdog) echo "BrainLayer Throughput Watchdog" ;;
|
|
471
472
|
wal-checkpoint) echo "BrainLayer WAL Checkpoint" ;;
|
|
472
473
|
watch) echo "BrainLayer Watcher" ;;
|
|
@@ -956,7 +957,7 @@ if state:
|
|
|
956
957
|
if version:
|
|
957
958
|
plist["ProgramArguments"] += ["--projection-version", version]
|
|
958
959
|
plist["ProgramArguments"] += ["--db", destination, "--health-path", health]
|
|
959
|
-
if interval is not None:
|
|
960
|
+
if interval is not None and "t3-audit" not in plist["ProgramArguments"]:
|
|
960
961
|
plist.pop("StartCalendarInterval", None)
|
|
961
962
|
plist["StartInterval"] = int(interval)
|
|
962
963
|
with path.open("wb") as handle:
|
|
@@ -1009,7 +1010,7 @@ install_plist() {
|
|
|
1009
1010
|
-e "s|__HOTLANE_BRAINBAR_DAEMON__|$HOTLANE_BRAINBAR_DST|g" \
|
|
1010
1011
|
"$src" > "$rendered_plist" || return 1
|
|
1011
1012
|
|
|
1012
|
-
if [ "$name" = "t3-ingest" ]; then
|
|
1013
|
+
if [ "$name" = "t3-ingest" ] || [ "$name" = "t3-audit" ]; then
|
|
1013
1014
|
render_t3_ingest_selection "$rendered_plist" || return 1
|
|
1014
1015
|
fi
|
|
1015
1016
|
install_rendered_plist "$rendered_plist" "$dst" || return 1
|
|
@@ -1499,7 +1500,11 @@ case "${1:-all}" in
|
|
|
1499
1500
|
install_plist p0-counter
|
|
1500
1501
|
;;
|
|
1501
1502
|
t3-ingest)
|
|
1502
|
-
|
|
1503
|
+
echo "Installing T3 ingestion and its daily read-only t3-audit coverage check."
|
|
1504
|
+
install_many t3-ingest t3-audit
|
|
1505
|
+
;;
|
|
1506
|
+
t3-audit)
|
|
1507
|
+
install_plist t3-audit
|
|
1503
1508
|
;;
|
|
1504
1509
|
all)
|
|
1505
1510
|
remove_plist enrichment
|
|
@@ -1508,7 +1513,7 @@ case "${1:-all}" in
|
|
|
1508
1513
|
verify_config_file
|
|
1509
1514
|
verify_gemini_env_file
|
|
1510
1515
|
failures=0
|
|
1511
|
-
if ! install_many index t3-ingest drain watch hotlane-brainbar; then
|
|
1516
|
+
if ! install_many index t3-ingest t3-audit drain watch hotlane-brainbar; then
|
|
1512
1517
|
failures=1
|
|
1513
1518
|
fi
|
|
1514
1519
|
if ! install_many decay wal-checkpoint repair-fts; then
|
|
@@ -1543,6 +1548,7 @@ case "${1:-all}" in
|
|
|
1543
1548
|
remove)
|
|
1544
1549
|
remove_plist index
|
|
1545
1550
|
remove_plist t3-ingest
|
|
1551
|
+
remove_plist t3-audit
|
|
1546
1552
|
remove_plist enrich
|
|
1547
1553
|
remove_plist enrichment
|
|
1548
1554
|
remove_plist watch
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "io.github.etanhey/brainlayer",
|
|
4
4
|
"title": "BrainLayer",
|
|
5
5
|
"description": "Persistent local memory for AI agents \u2014 semantic search, knowledge graph, and 16 BrainBar MCP tools with ToolAnnotations over SQLite.",
|
|
6
|
-
"version": "1.6.
|
|
6
|
+
"version": "1.6.11",
|
|
7
7
|
"websiteUrl": "https://brainlayer.etanheyman.com",
|
|
8
8
|
"repository": {
|
|
9
9
|
"url": "https://github.com/EtanHey/brainlayer",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"registryType": "pypi",
|
|
15
15
|
"registryBaseUrl": "https://pypi.org",
|
|
16
16
|
"identifier": "brainlayer",
|
|
17
|
-
"version": "1.6.
|
|
17
|
+
"version": "1.6.11",
|
|
18
18
|
"runtimeHint": "pipx",
|
|
19
19
|
"transport": {
|
|
20
20
|
"type": "stdio"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
__version__ = "1.6.
|
|
5
|
+
__version__ = "1.6.11"
|
|
6
6
|
# Git sha the distributed package was built from; stamped by the release build, None in a source tree.
|
|
7
7
|
# scripts/sprint_gate.py reads it in "keg" mode to prove the served package is the code under test.
|
|
8
8
|
# No runtime `str | None` annotation: launchd/install.sh imports this under /usr/bin/python3 (3.9).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
BUILD_SHA = "ce9086e9bcf7cee722be6dbf6fb7bd1ec240f516"
|
|
@@ -42,7 +42,7 @@ from xml.parsers.expat import ExpatError
|
|
|
42
42
|
|
|
43
43
|
import requests
|
|
44
44
|
|
|
45
|
-
from . import disk_space, drive_credentials
|
|
45
|
+
from . import backup_sleep, disk_space, drive_credentials
|
|
46
46
|
from .paths import get_db_path, resolve_db_path
|
|
47
47
|
from .socket_hygiene import refuse_production_brainbar_socket
|
|
48
48
|
|
|
@@ -191,6 +191,9 @@ class SQLiteBackupArtifact:
|
|
|
191
191
|
raw_sha256: str | None = None
|
|
192
192
|
reclaim_basis: str | None = None
|
|
193
193
|
chunk_stage_seconds: dict[str, Any] | None = None
|
|
194
|
+
snapshot_wall_seconds: float | None = None
|
|
195
|
+
snapshot_slept_seconds: float = 0
|
|
196
|
+
snapshot_sleep_intervals: list[dict] | None = None
|
|
194
197
|
|
|
195
198
|
@property
|
|
196
199
|
def archive_path(self) -> Path:
|
|
@@ -500,9 +503,18 @@ class BackupStoppedError(BaseException):
|
|
|
500
503
|
class DriveUploadStalledError(RuntimeError):
|
|
501
504
|
error_code = "drive_upload_stalled"
|
|
502
505
|
|
|
503
|
-
def __init__(
|
|
506
|
+
def __init__(
|
|
507
|
+
self,
|
|
508
|
+
*,
|
|
509
|
+
bytes_confirmed: int,
|
|
510
|
+
total_bytes: int,
|
|
511
|
+
attempts: int,
|
|
512
|
+
session_url: str | None = None,
|
|
513
|
+
checkpoint_observed: bool = True,
|
|
514
|
+
):
|
|
504
515
|
self.bytes_confirmed = bytes_confirmed
|
|
505
516
|
self.session_url = session_url
|
|
517
|
+
self.checkpoint_observed = checkpoint_observed
|
|
506
518
|
super().__init__(
|
|
507
519
|
f"{self.error_code}: confirmed {bytes_confirmed}/{total_bytes} bytes after {attempts} stalled attempts"
|
|
508
520
|
)
|
|
@@ -1818,6 +1830,7 @@ def create_sqlite_backup_artifact(
|
|
|
1818
1830
|
capacity_status_callback: Callable[[int, int | None, int, int], None] | None = None,
|
|
1819
1831
|
integrity_full: bool | None = None,
|
|
1820
1832
|
integrity_status_callback: Callable[[str, str, float], None] | None = None,
|
|
1833
|
+
snapshot_telemetry_callback: Callable[[dict[str, Any]], None] | None = None,
|
|
1821
1834
|
) -> SQLiteBackupArtifact:
|
|
1822
1835
|
"""Create an integrity-tested archive (.db.zst by default, .db.gz with
|
|
1823
1836
|
BRAINLAYER_BACKUP_COMPRESSOR=gzip). Unsupported filesystems retain the legacy raw on failure;
|
|
@@ -1827,6 +1840,14 @@ def create_sqlite_backup_artifact(
|
|
|
1827
1840
|
caller compatibility; they cannot authorize retaining duplicates or pruning only copies.
|
|
1828
1841
|
"""
|
|
1829
1842
|
snapshot_started = time.monotonic()
|
|
1843
|
+
sleep_tracker = backup_sleep.SleepTracker()
|
|
1844
|
+
|
|
1845
|
+
def observe_sleep() -> dict[str, Any]:
|
|
1846
|
+
metrics = sleep_tracker.tick(prefix="snapshot", action="snapshot continued after wake")
|
|
1847
|
+
if snapshot_telemetry_callback is not None:
|
|
1848
|
+
snapshot_telemetry_callback(metrics)
|
|
1849
|
+
return metrics
|
|
1850
|
+
|
|
1830
1851
|
db_path = Path(db_path).expanduser()
|
|
1831
1852
|
output_dir = Path(output_dir).expanduser()
|
|
1832
1853
|
date_stamp = date_stamp or _today()
|
|
@@ -1925,6 +1946,7 @@ def create_sqlite_backup_artifact(
|
|
|
1925
1946
|
flush=True,
|
|
1926
1947
|
)
|
|
1927
1948
|
if raw_free_bytes < required_bytes:
|
|
1949
|
+
observe_sleep()
|
|
1928
1950
|
reason = purge_error or (
|
|
1929
1951
|
"important-usage capacity unavailable or below required"
|
|
1930
1952
|
if important_free_bytes is None or important_free_bytes < required_bytes
|
|
@@ -1988,6 +2010,7 @@ def create_sqlite_backup_artifact(
|
|
|
1988
2010
|
retry_capacity_check=require_retry_capacity,
|
|
1989
2011
|
expected_db_path=db_path,
|
|
1990
2012
|
)
|
|
2013
|
+
observe_sleep()
|
|
1991
2014
|
if isinstance(promoted, os.stat_result):
|
|
1992
2015
|
owned_raw = (promoted.st_dev, promoted.st_ino)
|
|
1993
2016
|
_require_raw_floor(output_dir)
|
|
@@ -2004,6 +2027,7 @@ def create_sqlite_backup_artifact(
|
|
|
2004
2027
|
except sqlite3.Error as exc:
|
|
2005
2028
|
integrity = f"{type(exc).__name__}: {exc}"
|
|
2006
2029
|
integrity_duration = time.monotonic() - integrity_started
|
|
2030
|
+
observe_sleep()
|
|
2007
2031
|
if integrity_status_callback is not None:
|
|
2008
2032
|
integrity_status_callback(integrity, pragma, integrity_duration)
|
|
2009
2033
|
# Past this point a raw is either verified or retained on purpose; the existing
|
|
@@ -2052,10 +2076,12 @@ def create_sqlite_backup_artifact(
|
|
|
2052
2076
|
_remove_raw_with_verified_archive(output_dir, final_raw, own_run=True, archive_name=final_archive.name)
|
|
2053
2077
|
deleted.append(final_raw.name)
|
|
2054
2078
|
except BaseException:
|
|
2079
|
+
observe_sleep()
|
|
2055
2080
|
if orphan_cleanup and not raw_settled and owned_raw is not None:
|
|
2056
2081
|
_remove_owned_raw(final_raw, owned_raw)
|
|
2057
2082
|
raise
|
|
2058
2083
|
|
|
2084
|
+
sleep_metrics = observe_sleep()
|
|
2059
2085
|
return SQLiteBackupArtifact(
|
|
2060
2086
|
gzip_path=final_archive,
|
|
2061
2087
|
uncompressed_path=None,
|
|
@@ -2071,6 +2097,9 @@ def create_sqlite_backup_artifact(
|
|
|
2071
2097
|
local_integrity=integrity,
|
|
2072
2098
|
local_integrity_pragma=pragma,
|
|
2073
2099
|
snapshot_duration_seconds=time.monotonic() - snapshot_started,
|
|
2100
|
+
snapshot_wall_seconds=sleep_metrics["snapshot_wall_seconds"],
|
|
2101
|
+
snapshot_slept_seconds=sleep_metrics["snapshot_slept_seconds"],
|
|
2102
|
+
snapshot_sleep_intervals=sleep_metrics["sleep_intervals"],
|
|
2074
2103
|
integrity_duration_seconds=integrity_duration,
|
|
2075
2104
|
compressor=compressor,
|
|
2076
2105
|
compressor_fallback=compressor_fallback,
|
|
@@ -2549,6 +2578,7 @@ def upload_file_to_drive_raw(
|
|
|
2549
2578
|
policy_callback: Callable[[dict[str, Any]], None] | None = None,
|
|
2550
2579
|
telemetry_callback: Callable[[dict[str, Any]], None] | None = None,
|
|
2551
2580
|
run_deadline: float | None = None,
|
|
2581
|
+
sleep_observer: backup_sleep.SleepTracker | None = None,
|
|
2552
2582
|
) -> dict[str, Any]:
|
|
2553
2583
|
"""Upload unchanged bytes; probe ambiguous writes before retransmitting them."""
|
|
2554
2584
|
file_path = Path(file_path)
|
|
@@ -2577,6 +2607,7 @@ def upload_file_to_drive_raw(
|
|
|
2577
2607
|
_drive_upload_stall_max_attempts() if os.environ.get(DRIVE_UPLOAD_STALL_MAX_ATTEMPTS_ENV) else max_attempts
|
|
2578
2608
|
)
|
|
2579
2609
|
sent = stalled_attempts = 0
|
|
2610
|
+
checkpoint_observed = resume_session_url is None
|
|
2580
2611
|
slept = 0.0
|
|
2581
2612
|
stall_started: float | None = None
|
|
2582
2613
|
probe = resume_session_url is not None
|
|
@@ -2584,6 +2615,9 @@ def upload_file_to_drive_raw(
|
|
|
2584
2615
|
session = requests.Session()
|
|
2585
2616
|
started = time.monotonic()
|
|
2586
2617
|
rate_base = retries = probes = deadlines = requests_started = bytes_attempted = 0
|
|
2618
|
+
sleep_tracker = sleep_observer
|
|
2619
|
+
if sleep_tracker is None and telemetry_callback is not None:
|
|
2620
|
+
sleep_tracker = backup_sleep.SleepTracker()
|
|
2587
2621
|
|
|
2588
2622
|
def report_progress() -> None:
|
|
2589
2623
|
elapsed = time.monotonic() - started
|
|
@@ -2592,6 +2626,7 @@ def upload_file_to_drive_raw(
|
|
|
2592
2626
|
{
|
|
2593
2627
|
"upload_updated_at": dt.datetime.now(dt.UTC).isoformat(),
|
|
2594
2628
|
"upload_elapsed_seconds": round(elapsed, 3),
|
|
2629
|
+
**sleep_tracker.tick(prefix="upload", action="upload resumed after wake"),
|
|
2595
2630
|
"upload_rate_bps": max(0, sent - rate_base) / elapsed if elapsed > 0 else 0.0,
|
|
2596
2631
|
"retries": retries,
|
|
2597
2632
|
"upload_probes": probes,
|
|
@@ -2600,7 +2635,7 @@ def upload_file_to_drive_raw(
|
|
|
2600
2635
|
"upload_bytes_attempted": bytes_attempted,
|
|
2601
2636
|
}
|
|
2602
2637
|
)
|
|
2603
|
-
if progress_callback is not None:
|
|
2638
|
+
if progress_callback is not None and checkpoint_observed:
|
|
2604
2639
|
progress_callback(upload_url, sent)
|
|
2605
2640
|
|
|
2606
2641
|
def backoff() -> None:
|
|
@@ -2608,7 +2643,11 @@ def upload_file_to_drive_raw(
|
|
|
2608
2643
|
elapsed = max(slept, time.monotonic() - stall_started) if stall_started is not None else slept
|
|
2609
2644
|
if stalled_attempts >= stall_limit or elapsed >= budget:
|
|
2610
2645
|
raise DriveUploadStalledError(
|
|
2611
|
-
bytes_confirmed=sent,
|
|
2646
|
+
bytes_confirmed=sent,
|
|
2647
|
+
total_bytes=total,
|
|
2648
|
+
attempts=stalled_attempts,
|
|
2649
|
+
session_url=upload_url,
|
|
2650
|
+
checkpoint_observed=checkpoint_observed,
|
|
2612
2651
|
)
|
|
2613
2652
|
delay = min(300, 30 * 2 ** min(max(0, stalled_attempts - 1), 4), budget - elapsed, request_deadline(budget))
|
|
2614
2653
|
print(
|
|
@@ -2686,6 +2725,7 @@ def upload_file_to_drive_raw(
|
|
|
2686
2725
|
if response.status_code in {200, 201}:
|
|
2687
2726
|
completed = response.json()
|
|
2688
2727
|
sent = total
|
|
2728
|
+
checkpoint_observed = True
|
|
2689
2729
|
if not bytes_attempted:
|
|
2690
2730
|
rate_base = total # A completed resume probe transferred no new file bytes.
|
|
2691
2731
|
report_progress()
|
|
@@ -2705,6 +2745,8 @@ def upload_file_to_drive_raw(
|
|
|
2705
2745
|
raise RuntimeError(
|
|
2706
2746
|
f"Drive returned invalid confirmed offset {confirmed}; expected {sent}..{total}"
|
|
2707
2747
|
)
|
|
2748
|
+
first_observation = not checkpoint_observed
|
|
2749
|
+
checkpoint_observed = True
|
|
2708
2750
|
if confirmed > sent:
|
|
2709
2751
|
if resume_session_url is not None and not bytes_attempted:
|
|
2710
2752
|
rate_base = confirmed # Existing remote bytes are not this invocation's rate.
|
|
@@ -2712,6 +2754,8 @@ def upload_file_to_drive_raw(
|
|
|
2712
2754
|
report_progress()
|
|
2713
2755
|
stalled_attempts, slept, stall_started = 0, 0.0, None
|
|
2714
2756
|
print(f"drive upload progress: {sent}/{total} bytes", flush=True)
|
|
2757
|
+
elif first_observation:
|
|
2758
|
+
report_progress() # A real zero from Drive replaces any older saved offset too.
|
|
2715
2759
|
elif not is_probe or confirmed == total:
|
|
2716
2760
|
raise _DriveUploadNeedsProbe("Drive upload returned no newly confirmed bytes")
|
|
2717
2761
|
elif recovering:
|
|
@@ -3755,6 +3799,25 @@ def run_backup(
|
|
|
3755
3799
|
if re.fullmatch(r"[0-9a-f]{32}", invocation):
|
|
3756
3800
|
result["backup_invocation_id"] = invocation # This body runs only after staging-lock admission.
|
|
3757
3801
|
|
|
3802
|
+
run_sleep_tracker: backup_sleep.SleepTracker | None = None
|
|
3803
|
+
historical_sleep_intervals: list[dict] = []
|
|
3804
|
+
|
|
3805
|
+
def record_run_sleep() -> None:
|
|
3806
|
+
if run_sleep_tracker is None:
|
|
3807
|
+
return
|
|
3808
|
+
upload_sleep = result.get("upload_slept_seconds", 0)
|
|
3809
|
+
action = "backup continued after wake"
|
|
3810
|
+
if isinstance(upload_sleep, (int, float)) and upload_sleep > 0:
|
|
3811
|
+
action = "uploaded the rest after wake" if result["uploaded"] else "upload resumed after wake"
|
|
3812
|
+
metrics = run_sleep_tracker.tick(prefix="run", action=action)
|
|
3813
|
+
result.update({key: value for key, value in metrics.items() if key not in {"sleep_intervals", "sleep_note"}})
|
|
3814
|
+
result["sleep_intervals"] = historical_sleep_intervals + metrics["sleep_intervals"]
|
|
3815
|
+
note = backup_sleep.sleep_note(result["sleep_intervals"], action=action)
|
|
3816
|
+
if note:
|
|
3817
|
+
result["sleep_note"] = note
|
|
3818
|
+
else:
|
|
3819
|
+
result.pop("sleep_note", None)
|
|
3820
|
+
|
|
3758
3821
|
def record_reclamation_status(status: str, error: str | None) -> None:
|
|
3759
3822
|
result["attempt_reclamation"] = status
|
|
3760
3823
|
result["writer_probe_error"] = error
|
|
@@ -3788,6 +3851,7 @@ def run_backup(
|
|
|
3788
3851
|
return result
|
|
3789
3852
|
|
|
3790
3853
|
try:
|
|
3854
|
+
run_sleep_tracker = backup_sleep.SleepTracker()
|
|
3791
3855
|
resolved_machine_id = _validate_machine_id(machine_id) if machine_id is not None else resolve_machine_id()
|
|
3792
3856
|
resolved_folder_parts = (
|
|
3793
3857
|
list(folder_parts) if folder_parts is not None else default_drive_folder_parts(resolved_machine_id)
|
|
@@ -3887,6 +3951,13 @@ def run_backup(
|
|
|
3887
3951
|
local_resume = local is not None and not (local.get("uploaded") and local.get("verified"))
|
|
3888
3952
|
candidate = local if local_resume else candidate
|
|
3889
3953
|
|
|
3954
|
+
def record_snapshot_sleep(metrics: dict[str, Any]) -> None:
|
|
3955
|
+
result.update(
|
|
3956
|
+
{key: value for key, value in metrics.items() if key not in {"sleep_intervals", "sleep_note"}}
|
|
3957
|
+
)
|
|
3958
|
+
result["snapshot_sleep_intervals"] = metrics["sleep_intervals"]
|
|
3959
|
+
record_run_sleep()
|
|
3960
|
+
|
|
3890
3961
|
def prepare_artifact(resume: dict[str, Any] | None) -> SQLiteBackupArtifact:
|
|
3891
3962
|
if resume is not None:
|
|
3892
3963
|
raw_deleted, _ = _cleanup_raw_snapshots(Path(staging_dir))
|
|
@@ -3905,6 +3976,9 @@ def run_backup(
|
|
|
3905
3976
|
local_integrity=resume.get("local_integrity"),
|
|
3906
3977
|
local_integrity_pragma=resume.get("local_integrity_pragma"),
|
|
3907
3978
|
snapshot_duration_seconds=resume.get("snapshot_duration_seconds"),
|
|
3979
|
+
snapshot_wall_seconds=resume.get("snapshot_wall_seconds"),
|
|
3980
|
+
snapshot_slept_seconds=resume.get("snapshot_slept_seconds", 0),
|
|
3981
|
+
snapshot_sleep_intervals=resume.get("snapshot_sleep_intervals", []),
|
|
3908
3982
|
integrity_duration_seconds=resume.get("integrity_duration_seconds"),
|
|
3909
3983
|
raw_sha256=resume.get("raw_sha256"),
|
|
3910
3984
|
reclaim_basis=resume.get("reclaim_basis"),
|
|
@@ -3925,6 +3999,7 @@ def run_backup(
|
|
|
3925
3999
|
capacity_status_callback=record_capacity,
|
|
3926
4000
|
integrity_full=True if phase == "snapshot" else None,
|
|
3927
4001
|
integrity_status_callback=record_integrity,
|
|
4002
|
+
snapshot_telemetry_callback=record_snapshot_sleep,
|
|
3928
4003
|
)
|
|
3929
4004
|
except RuntimeError as exc:
|
|
3930
4005
|
reason = _redact_upload_secrets(str(exc))
|
|
@@ -3949,6 +4024,11 @@ def run_backup(
|
|
|
3949
4024
|
for resume in (
|
|
3950
4025
|
[candidate] if phase == "upload" or local_resume else [candidate, None] if candidate is not None else [None]
|
|
3951
4026
|
):
|
|
4027
|
+
result.pop("bytes_confirmed", None)
|
|
4028
|
+
result.pop("bytes_confirmed_at", None)
|
|
4029
|
+
if resume is None:
|
|
4030
|
+
resume_state = None
|
|
4031
|
+
result.pop("resumable_upload", None)
|
|
3952
4032
|
artifact = prepare_artifact(resume)
|
|
3953
4033
|
snapshot = artifact.gzip_path
|
|
3954
4034
|
snapshot_size = snapshot.stat().st_size
|
|
@@ -3974,6 +4054,9 @@ def run_backup(
|
|
|
3974
4054
|
"local_integrity": getattr(artifact, "local_integrity", None),
|
|
3975
4055
|
"local_integrity_pragma": getattr(artifact, "local_integrity_pragma", None),
|
|
3976
4056
|
"snapshot_duration_seconds": getattr(artifact, "snapshot_duration_seconds", None),
|
|
4057
|
+
"snapshot_wall_seconds": getattr(artifact, "snapshot_wall_seconds", None),
|
|
4058
|
+
"snapshot_slept_seconds": getattr(artifact, "snapshot_slept_seconds", 0),
|
|
4059
|
+
"snapshot_sleep_intervals": getattr(artifact, "snapshot_sleep_intervals", None) or [],
|
|
3977
4060
|
"integrity_duration_seconds": getattr(artifact, "integrity_duration_seconds", None),
|
|
3978
4061
|
"raw_sha256": getattr(artifact, "raw_sha256", None),
|
|
3979
4062
|
"reclaim_basis": getattr(artifact, "reclaim_basis", None),
|
|
@@ -3990,6 +4073,10 @@ def run_backup(
|
|
|
3990
4073
|
"bytes": snapshot_size,
|
|
3991
4074
|
}
|
|
3992
4075
|
)
|
|
4076
|
+
historical_sleep_intervals = (
|
|
4077
|
+
(resume.get("sleep_intervals") or result["snapshot_sleep_intervals"]) if resume is not None else []
|
|
4078
|
+
)
|
|
4079
|
+
record_run_sleep()
|
|
3993
4080
|
# create_sqlite_backup_artifact has already proven gzip CRC/ISIZE,
|
|
3994
4081
|
# SQLite header, sentinel and raw/gzip equality before dropping raw (#1387).
|
|
3995
4082
|
with snapshot.open("rb") as durable:
|
|
@@ -4003,9 +4090,24 @@ def run_backup(
|
|
|
4003
4090
|
for key in ("uploaded", "drive_file", "resumable_upload"):
|
|
4004
4091
|
if key in resume:
|
|
4005
4092
|
result[key] = resume[key]
|
|
4093
|
+
if resume.get("uploaded"):
|
|
4094
|
+
for key in (
|
|
4095
|
+
"upload_elapsed_seconds",
|
|
4096
|
+
"upload_wall_seconds",
|
|
4097
|
+
"upload_slept_seconds",
|
|
4098
|
+
"sleep_intervals",
|
|
4099
|
+
"sleep_note",
|
|
4100
|
+
):
|
|
4101
|
+
if key in resume:
|
|
4102
|
+
result[key] = resume[key]
|
|
4006
4103
|
resume_state = resume.get("resumable_upload")
|
|
4007
4104
|
result.update(local_verified=True, local_artifact=_upload_identity(snapshot), upload_state="pending")
|
|
4008
|
-
|
|
4105
|
+
record_run_sleep()
|
|
4106
|
+
# A completed session resumes verification before any network call; legacy final receipts stay unchanged.
|
|
4107
|
+
_append_json_log(
|
|
4108
|
+
resolved_log_path,
|
|
4109
|
+
{**result, "verification_pending": True} if upload and result["uploaded"] else result,
|
|
4110
|
+
)
|
|
4009
4111
|
if not upload:
|
|
4010
4112
|
break
|
|
4011
4113
|
if resume is not None and resume.get("uploaded") is True:
|
|
@@ -4037,11 +4139,31 @@ def run_backup(
|
|
|
4037
4139
|
raise RuntimeError("Saved artifact changed; local snapshot retained")
|
|
4038
4140
|
print("Saved artifact changed before resume; preparing a fresh snapshot", flush=True)
|
|
4039
4141
|
continue
|
|
4142
|
+
if saved_session is not None:
|
|
4143
|
+
confirmed = resume.get("bytes_confirmed")
|
|
4144
|
+
if type(confirmed) is int and 0 <= confirmed <= snapshot_size:
|
|
4145
|
+
result["bytes_confirmed"] = confirmed
|
|
4146
|
+
if isinstance(resume.get("bytes_confirmed_at"), str):
|
|
4147
|
+
result["bytes_confirmed_at"] = resume["bytes_confirmed_at"]
|
|
4148
|
+
|
|
4149
|
+
def record_upload_telemetry(metrics: dict[str, Any]) -> None:
|
|
4150
|
+
metrics = {
|
|
4151
|
+
**metrics,
|
|
4152
|
+
**upload_sleep_tracker.tick(prefix="upload", action="upload resumed after wake"),
|
|
4153
|
+
}
|
|
4154
|
+
result.update(
|
|
4155
|
+
{key: value for key, value in metrics.items() if key not in {"sleep_intervals", "sleep_note"}}
|
|
4156
|
+
)
|
|
4157
|
+
record_run_sleep()
|
|
4040
4158
|
|
|
4041
4159
|
def record_upload_progress(url: str, confirmed: int) -> None:
|
|
4042
4160
|
nonlocal resume_state
|
|
4161
|
+
previous = result.get("bytes_confirmed")
|
|
4162
|
+
same_session = resume_state is not None and resume_state.get("url") == url
|
|
4043
4163
|
next_state = {"url": url, "folder_id": folder_id, **upload_identity}
|
|
4044
4164
|
resume_state = next_state
|
|
4165
|
+
if not same_session or previous != confirmed:
|
|
4166
|
+
result["bytes_confirmed_at"] = dt.datetime.now(dt.UTC).isoformat()
|
|
4045
4167
|
result["bytes_confirmed"] = confirmed
|
|
4046
4168
|
_append_json_log(
|
|
4047
4169
|
resolved_log_path,
|
|
@@ -4057,6 +4179,8 @@ def run_backup(
|
|
|
4057
4179
|
def record_upload_thread_policy(policy: dict[str, Any]) -> None:
|
|
4058
4180
|
result["upload_thread_policy"] = policy
|
|
4059
4181
|
|
|
4182
|
+
record_run_sleep()
|
|
4183
|
+
upload_sleep_tracker = backup_sleep.SleepTracker()
|
|
4060
4184
|
try:
|
|
4061
4185
|
uploaded = upload_file_to_drive_raw(
|
|
4062
4186
|
snapshot,
|
|
@@ -4065,11 +4189,16 @@ def run_backup(
|
|
|
4065
4189
|
machine_id=resolved_machine_id,
|
|
4066
4190
|
progress_callback=record_upload_progress,
|
|
4067
4191
|
policy_callback=record_upload_thread_policy,
|
|
4068
|
-
telemetry_callback=
|
|
4192
|
+
telemetry_callback=record_upload_telemetry,
|
|
4069
4193
|
run_deadline=run_deadline,
|
|
4194
|
+
sleep_observer=upload_sleep_tracker,
|
|
4070
4195
|
**({"resume_session_url": saved_session["url"]} if saved_session else {}),
|
|
4071
4196
|
)
|
|
4072
4197
|
except DriveSessionExpiredError:
|
|
4198
|
+
result.pop("bytes_confirmed", None)
|
|
4199
|
+
result.pop("bytes_confirmed_at", None)
|
|
4200
|
+
result.pop("resumable_upload", None)
|
|
4201
|
+
resume_state = None
|
|
4073
4202
|
if phase == "upload" or local_resume:
|
|
4074
4203
|
# Drive confirmed expiration; restart the session for the SAME bytes.
|
|
4075
4204
|
uploaded = upload_file_to_drive_raw(
|
|
@@ -4079,14 +4208,17 @@ def run_backup(
|
|
|
4079
4208
|
machine_id=resolved_machine_id,
|
|
4080
4209
|
progress_callback=record_upload_progress,
|
|
4081
4210
|
policy_callback=record_upload_thread_policy,
|
|
4082
|
-
telemetry_callback=
|
|
4211
|
+
telemetry_callback=record_upload_telemetry,
|
|
4083
4212
|
run_deadline=run_deadline,
|
|
4213
|
+
sleep_observer=upload_sleep_tracker,
|
|
4084
4214
|
)
|
|
4085
4215
|
break
|
|
4086
4216
|
if resume is None:
|
|
4087
4217
|
raise
|
|
4088
4218
|
print("Saved Drive session expired; preparing a fresh snapshot", flush=True)
|
|
4089
4219
|
continue
|
|
4220
|
+
finally:
|
|
4221
|
+
record_upload_telemetry({})
|
|
4090
4222
|
break
|
|
4091
4223
|
if upload:
|
|
4092
4224
|
file_id = uploaded.get("id")
|
|
@@ -4095,6 +4227,7 @@ def run_backup(
|
|
|
4095
4227
|
# Drive has completed the session. Persist that fact before verification can
|
|
4096
4228
|
# fail or its final receipt can be truncated; an older checkpoint must not revive it.
|
|
4097
4229
|
result.update({"uploaded": True, "drive_file": uploaded})
|
|
4230
|
+
record_run_sleep()
|
|
4098
4231
|
resume_state = None
|
|
4099
4232
|
result.pop("resumable_upload", None)
|
|
4100
4233
|
_append_json_log(resolved_log_path, {**result, "verification_pending": True})
|
|
@@ -4218,15 +4351,23 @@ def run_backup(
|
|
|
4218
4351
|
if isinstance(error_code, str):
|
|
4219
4352
|
result["error_code"] = error_code
|
|
4220
4353
|
if isinstance(exc, DriveUploadStalledError):
|
|
4354
|
+
if exc.checkpoint_observed:
|
|
4355
|
+
if result.get("bytes_confirmed") != exc.bytes_confirmed:
|
|
4356
|
+
result["bytes_confirmed_at"] = dt.datetime.now(dt.UTC).isoformat()
|
|
4357
|
+
result["bytes_confirmed"] = exc.bytes_confirmed
|
|
4221
4358
|
result.update(
|
|
4222
4359
|
{
|
|
4223
4360
|
"error_type": exc.error_code,
|
|
4224
4361
|
"error_code": exc.error_code,
|
|
4225
|
-
"bytes_confirmed": exc.bytes_confirmed,
|
|
4226
4362
|
}
|
|
4227
4363
|
)
|
|
4228
4364
|
raise
|
|
4229
4365
|
finally:
|
|
4366
|
+
if result.get("status") != "reused":
|
|
4367
|
+
try:
|
|
4368
|
+
record_run_sleep()
|
|
4369
|
+
except Exception as exc:
|
|
4370
|
+
result["sleep_observation_error"] = f"{type(exc).__name__}: {_redact_upload_secrets(str(exc))}"
|
|
4230
4371
|
result["retained_raw_snapshots"] = _retained_raw_snapshot_names(Path(staging_dir))
|
|
4231
4372
|
raw = Path(staging_dir) / f"{resolved_date_stamp}.db"
|
|
4232
4373
|
if (result.get("error") or result.get("verification_error")) and not (
|
|
@@ -4525,6 +4666,11 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
4525
4666
|
# Startup so far is charged against the calendar's clock, not added on top of it.
|
|
4526
4667
|
work = math.floor(deadline - time.monotonic() - SNAPSHOT_RECEIPT_RESERVE_SECONDS)
|
|
4527
4668
|
if work < 1:
|
|
4669
|
+
from .job_alerts import report
|
|
4670
|
+
|
|
4671
|
+
report(
|
|
4672
|
+
"backup-snapshot", "Backup deferred: no work budget before calendar deadline", replace_reason=True
|
|
4673
|
+
)
|
|
4528
4674
|
print(
|
|
4529
4675
|
"brainlayer backup-snapshot deferred: no positive work budget plus the "
|
|
4530
4676
|
f"{SNAPSHOT_RECEIPT_RESERVE_SECONDS}s receipt reserve fits before the calendar deadline",
|
|
@@ -4534,11 +4680,32 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
4534
4680
|
timeout_seconds = min(timeout_seconds, work)
|
|
4535
4681
|
if _env_flag_enabled(BACKUP_SUPERVISED_CHILD_ENV):
|
|
4536
4682
|
return _run_backup_process(timeout_seconds)
|
|
4683
|
+
from .backup_heavy_gate import BackupGateDeferred, backup_heavy_gate, expected_phase_seconds
|
|
4537
4684
|
from .job_alerts import report
|
|
4538
4685
|
|
|
4539
4686
|
key = "backup-snapshot" if snapshot_phase else "backup-daily"
|
|
4540
4687
|
try:
|
|
4541
|
-
|
|
4688
|
+
admission_started = time.monotonic()
|
|
4689
|
+
minimum_work = expected_phase_seconds()
|
|
4690
|
+
if timeout_seconds < minimum_work:
|
|
4691
|
+
raise BackupGateDeferred(
|
|
4692
|
+
f"backup phase {os.environ.get('BRAINLAYER_BACKUP_PHASE', 'all')} deferred: "
|
|
4693
|
+
f"needs {minimum_work:g}s expected work, has {timeout_seconds:g}s in this window"
|
|
4694
|
+
)
|
|
4695
|
+
admission_deadline = (
|
|
4696
|
+
deadline - SNAPSHOT_RECEIPT_RESERVE_SECONDS - minimum_work
|
|
4697
|
+
if deadline is not None
|
|
4698
|
+
else admission_started + timeout_seconds - minimum_work
|
|
4699
|
+
)
|
|
4700
|
+
with backup_heavy_gate(deadline=admission_deadline, job_key=key):
|
|
4701
|
+
timeout_seconds -= math.floor(time.monotonic() - admission_started)
|
|
4702
|
+
code = _supervise_backup_process(
|
|
4703
|
+
timeout_seconds, **({"deadline": deadline} if deadline is not None else {})
|
|
4704
|
+
)
|
|
4705
|
+
except BackupGateDeferred as exc:
|
|
4706
|
+
print(str(exc), flush=True)
|
|
4707
|
+
report(key, str(exc), replace_reason=True)
|
|
4708
|
+
return BACKUP_DEFERRED_EXIT_CODE
|
|
4542
4709
|
except Exception:
|
|
4543
4710
|
report(key, "Database backup failed; check the backup log")
|
|
4544
4711
|
raise
|