Expand market-data coverage and harden approval replay - #13
Conversation
…odex/feat-add-by-hsc-pr
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
A few new code paths bypass injected/deterministic timestamps (and one masks non-retryable Windows lock errors as timeouts), which undermines reproducibility and diagnosability.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 3
Open (3)
What changed in this PR
This PR expands the system’s market-data and research validation surfaces (native 15m/1h/4h history, bounded 5m support, depth collection), while hardening persistence/replay mechanics (Windows file locks, verified JSON write semantics, and governance approval/traceability replay bound to frozen evidence) to keep the project fail-closed and research-only.
Changes:
- Extend market-history + depth collection wiring (shared continuous builder, bounded depth shards, supervisor fast-retry and cache fallback behavior).
- Add research safety + determinism hooks for validation and virtual-market operations (Spot price-normalized sizing ratio, walk-forward purge/embargo, daily-loss tuning trigger + evidence persistence).
- Strengthen governance/policy evidence binding and operational scripts (frozen traceability audit reuse, approval evidence immutability checks, Windows startup task restart/locking robustness).
| File | Description |
|---|---|
| tests/test_virtual_wallet_journal.py | Adds coverage for daily-loss tuning trigger batching semantics. |
| tests/test_validation_pipeline.py | Adds tests for walk-forward purge/embargo and Spot sizing normalization. |
| tests/test_system_report.py | Adds tests for preferring primary local reasoning health evidence. |
| tests/test_storage.py | Adds tests for bounded JSONL tail and verified JSON write retry/canonicalization. |
| tests/test_service_manifest.py | Updates service command + startup script expectations for new workflows. |
| tests/test_security_tooling_contract.py | Adjusts expected gitleaks ignore entry count. |
| tests/test_runtime_hygiene.py | Fixes import ordering around runtime_hygiene. |
| tests/test_runtime_artifacts_migration.py | Tightens failure assertions and expands invalid-shape coverage. |
| tests/test_research_application.py | Adds diagnostic blocker detail for DGE evaluation failure type. |
| tests/test_repository_validator.py | Adds policy registration coverage + governance lock evidence replay tests. |
| tests/test_repository_cleanup_audit.py | Updates expected classification totals after new surfaces. |
| tests/test_public_showcase.py | Improves parametrization and monkeypatch specificity for subprocess usage. |
| tests/test_opportunity_monitor.py | Tightens typing and import ordering for monitor compatibility helpers. |
| tests/test_oos_maturity.py | Adds hash-bound event ledger tests and Spot OOS deployment preparation tests. |
| tests/test_model_registry_coverage_closure.py | Updates blocker code expectation for invalid local model manifest. |
| tests/test_market_history_sync.py | Adds supervisor fast-retry test and cache fallback behavior test. |
| tests/test_market_history_boundary_contracts.py | Updates refresh blocking semantics and adds virtual-market requester checks. |
| tests/test_market_depth.py | Strengthens transport stub behavior and tests checkpoint compaction. |
| tests/test_market_data_gateway.py | Updates gateway construction to shared builders + improves monkeypatch targeting. |
| tests/test_maintainability_ratchet.py | Improves invalid-shape test expectations and monkeypatch targeting. |
| tests/test_lowest_twenty_coverage_models.py | Cleans monkeypatch paths and typing for lowest-coverage edges. |
| tests/test_lowest_coverage_technology_language_policy.py | Adds absolute path rejection coverage for safe-path validators. |
| tests/test_lowest_coverage_remaining_edges.py | Updates expected local advisory listener blocker naming. |
| tests/test_lowest_coverage_persistence_and_governance.py | Extends verified JSON write canonical shape assertions. |
| tests/test_local_dashboard_source.py | Updates dashboard asset hash + new UI assertions for data-gap coverage. |
| tests/test_live_readiness_preview.py | Tightens reader type assertions and monkeypatch path specificity. |
| tests/test_kaizen_quality.py | Updates architecture migration ledger expectations for internal radar modules. |
| tests/test_internal_radar.py | Adds safer typed helpers for payload shape checks. |
| tests/test_internal_radar_vision.py | Introduces a typed allowed gateway stub and strengthens privacy assertions. |
| tests/test_governance_gate.py | Adds test ensuring replay uses frozen traceability audit evidence. |
| tests/test_governance_constitution_sync.py | Adds transitive compliance trace support + publication boundary acceptance tests. |
| tests/test_futures_replay.py | Updates futures replay dataset path under runtime/data/datasets. |
| tests/test_event_journal.py | Adds Windows file lock transient retry + timeout test coverage. |
| tests/test_docs_hygiene.py | Adjusts filename policy and context-router expectation assertions. |
| tests/test_dge_recovery_replay_shadow.py | Tightens context blockers and asserts negative evidence behavior. |
| tests/test_dge_engine.py | Adds regression test for blocked virtual market decision profile behavior. |
| tests/test_data_acquisition.py | Extends snapshot priority behavior and adds deterministic clock injection coverage. |
| tests/test_config_reporting.py | Updates Settings expectations for governed horizons and futures OOS artifact root. |
| tests/test_cli.py | Updates timeframes defaults and adds virtual loss tuning orchestration test. |
| tests/governance/terminology/test_terminology_policy.py | Expands safe-path rejection coverage and normalizes tuple formatting. |
| tests/governance/terminology/test_governance_enforcement_fabric.py | Expands invalid-shape assertions and improves error matching. |
| tests/governance/architecture/test_technology_language_policy.py | Adds publication paths into technology/language policy projection coverage. |
| src/ai4binance/virtual_wallet_journal.py | Adds deterministic daily-loss tuning trigger generation and surface API. |
| src/ai4binance/validation_pipeline_runtime.py | Adds Spot notional-to-equity sizing + walk-forward purge/embargo + run-card hash binding. |
| src/ai4binance/storage/jsonl.py | Hardens bounded tail reads to avoid returning partial leading records. |
| src/ai4binance/storage/destination_verification.py | Adds canonical shape verification + bounded os.replace retry on transient denial. |
| src/ai4binance/ops/system_report.py | Adds primary local reasoning health preference + normalized blocker codes. |
| src/ai4binance/ops/public_showcase.py | Tightens subprocess invocation signaling and constants for scan status. |
| src/ai4binance/ops/architecture_migration.py | Adds migration rules for internal radar modules. |
| src/ai4binance/local_dashboard/server.py.in | Exposes virtual runtime precondition fields to the dashboard snapshot/projection. |
| src/ai4binance/local_dashboard/local_views.js | Updates labels + UI state to reflect data-gap coverage and runtime preconditions. |
| src/ai4binance/internal_radar.py | Refactors radar candidate collection/analysis into helpers with checkpointing. |
| src/ai4binance/internal_radar_vision.py | Introduces gateway protocol typing for the vision runner admission boundary. |
| src/ai4binance/infrastructure/persistence/safe_json.py | Aligns verified write path to canonical JSON shape comparison. |
| src/ai4binance/governance/terminology_policy.py | Hardens safe-path validation across POSIX/Windows absolute paths. |
| src/ai4binance/governance/technology_language_policy.py | Hardens safe-path validation across POSIX/Windows absolute paths. |
| src/ai4binance/governance/repository_validator.py | Expands allowed top-level surfaces and bumps policy version. |
| src/ai4binance/governance/model_registry.py | Extracts manifest parsing and artifact validation helpers for clearer failure modes. |
| src/ai4binance/governance/governance_enforcement_fabric.py | Improves quality mapping parsing and safe-path validation robustness. |
| src/ai4binance/governance/gate.py | Adds frozen traceability audit loading + CLI parameter plumbing. |
| src/ai4binance/governance/dge_models.py | Ensures decision authority cannot exceed enabled execution profile. |
| src/ai4binance/governance/constitution_sync.py | Adds transitive compliance-trace scanning and publication README inclusion. |
| src/ai4binance/governance/adapters.py | Hardens DGE adapter error handling and improves negative evidence logic. |
| src/ai4binance/events/file_lock.py | Adds Windows retryable lock acquisition with deterministic timeout. |
| src/ai4binance/data/market_history_sync.py | Adds cache fallback on universe blockers and supervisor fast-retry behavior. |
| src/ai4binance/data/market_depth.py | Adds checkpoint-based compaction and adjusts resync behavior. |
| src/ai4binance/data/acquisition.py | Adds injectable clock and enforces clock ordering vs server time when using local depth. |
| src/ai4binance/config.py | Updates default timeframes, market-history horizon, and futures OOS artifact directory. |
| src/ai4binance/compatibility/opportunity_monitor.py | Generalizes estimate helper typing to Mapping. |
| src/ai4binance/cli/runtime.py | Adds virtual-market stale refresh requests + virtual loss tuning persistence. |
| src/ai4binance/cli/research.py | Routes validation into Spot OOS deployment preparation with bounded authority. |
| src/ai4binance/cli/market_gateway.py | Reuses canonical continuous builder and optionally wires depth collection. |
| src/ai4binance/cli/market_data.py | Adds canonical continuous builder and bounded depth collector shards. |
| src/ai4binance/cli/futures_oos.py | Updates replay root path under runtime/data/datasets. |
| src/ai4binance/application/research.py | Adds bounded DGE error-type projection into blockers. |
| src/ai4binance/agents/validation_gate.py | Threads maturity blockers explicitly and preserves compatibility accessor. |
| scripts/sync_governed_document_lock_approval_evidence.py | Persists approval evidence with immutability binding to manifest references. |
| scripts/quality.ps1 | Adds frozen governance report binding into approval replay invocation. |
| scripts/install_startup_task.ps1 | Adds restart modes, safer log rotation, and native stderr handling for PS5. |
| scripts/export_governed_document_lock_approval.py | Adds immutability-bound evidence reuse and safe-path/sha validation. |
| publication/sanitize_publication.py | Removes stray whitespace/formatting artifact. |
| publication/README.md | Documents publication boundary ownership for gateway/persistence/locking/showcase surfaces. |
| policies/repository-validator/manifest-policy.json | Bumps policy version and registers publication/examples/security surfaces. |
| docs/references/reference_global_terminology_and_taxonomy.md | Bumps reference version and clarifies implementation link (non-authoritative). |
| config/research/virtual_market_acceptance.yaml | Adds Spot OOS validation specification and explicit authority constraints. |
| config/quality/ruff-maintainability-baseline.json | Extends baseline-approved paths for new/expanded modules. |
| config/operations/services.json | Updates market-history service command to new CLI entrypoint. |
| config/governance/technology_language_ownership.yaml | Allows publication scripts/manifests under governance language placement rules. |
| config/governance/governed_document_lock_manifest.json | Updates bound approval evidence SHA-256 references. |
| .gitleaksignore | Adds historic fingerprints for bound governance approval artifacts. |
| .gitignore | Ignores generated security tooling assurance artifacts under runtime/. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Summary
Validation
Safety boundaries remain PAPER_TRADING, MANUAL_CONFIRMATION, LIVE_EXECUTION_DISABLED, RESEARCH_ONLY, and LIVE_ORDER_BLOCKED.