Skip to content

fix(tape): seed tape on startup to stop squeeze bursts, honor limits, debounce disk writes #77

Done

Description

@mlgitdev

Description

  1. On the first poll after app startup or session transition, st.hist is empty for every stock in the universe. In app/tape.py:282-286, any stock already up >= up_pct near HOD immediately fires squeeze alerts and Telegram pushes even if it gapped hours ago and is flat.
  2. app/tape.py:88,106-107,177-178 clamps max(retention_days, 4.0) and max(max_events, 5000), silently overriding lower user-configured values.
  3. self._save_history() synchronously serializes and rewrites up to 5,000 events to tape_history.json on every 2-second poll with any new event.

References: app/tape.py:76, 88, 100-117, 149-185, 282-286

Steps to Reproduce

  1. Start the Tape worker during a session where stocks are already up +12% and flat near HOD (change|5 = 0).
  2. Observe immediate false Squeeze Alert - Up 10% in 5min triggers on the first tick.
  3. Set retention_days = 1 or max_events = 500 in config and observe the backend ignores values below 4 days / 5000 events.

Expected Behavior

Seed the initial tape universe silently on the first poll of each session (preserving mid-session new-entry squeeze triggers), respect user-configured retention_days (>= 1) and max_events (>= 100), and debounce/throttle tape_history.json disk writes.

Operating System & Version

  • OS: Windows 11 x64 / macOS arm64 / Linux x86_64
  • Version: v2.12.0
  • Display / Scale: Verified via live Chrome CDP (1600x960) & local unit/backend suite

Logs & Additional Context

Backend reproduction confirmed flat gapped stock fired squeeze on first poll (events=1) and retention/max_events clamped up.

Activity

  1. self-assigned this
    on Dec 2, 2026
  2. added
    bug
    on Dec 2, 2026
  3. mlgitdev commented on Dec 2, 2026

    @mlgitdev
    OwnerAuthor

    🚀 Resolution In Progress

    A fix for this issue has been implemented and submitted in Pull Request #82 (v2.12.1).

    • Branch: fix/audit-remediation-67
    • PR URL: fix(core): resolve 15 verified audit issues across UI, API, concurrency, audio, and packaging (v2.12.1) #82
    • Summary of Changes: Added silent initial-poll universe seeding per session in app/tape.py to stop startup squeeze bursts, respected configured retention_days (>= 1) & max_events (>= 100), and debounced tape_history.json writes. Verified via unit tests.
    • Verification: compileall clean, 84/84 unit tests passing (including tests/test_audit_fixes.py), and live Chrome CDP verification passed.

    This issue will automatically close upon PR #82 review and merge into main.

  4. github-actions commented on Dec 2, 2026

    @github-actions

    ✅ Issue Validation Passed

    • Conventional Commit title syntax (fix(tape))
    • Verified issue type: BUG
    • Required template sections present and filled out

    This issue is well-structured and ready for work according to the Issue-First Protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions