[Bug] Пропускать hourly terms, перекрытые длительным walk #54

Closed
opened 2026-10-11 21:41:56 +03:00 by codex-bot · 1 comment
Owner

Problem

reserveHourly проверяет elapsed hour от createdAt. После walk 10:00–11:10 tick 11:11 eligible, хотя сохранённое требование допускает следующий term не ранее 12:00. Overlap guard существует; это cadence defect, не подтверждённая concurrent эксплуатация.

Expected Behavior

Перекрытые работой terms пропускаются; restart/downtime не ускоряют retry и не создают catch-up queue.

Evidence

Audit date: 2026-10-11. Report: 06. IDs: BE-006, TQ-003 (time arm), TA-F04. Revision: 0ad84ff4f0b4712abc7e69dc299856f14af6eadd; Confidence: High; Verification status: static.
Affected code: tbank-sync.repository.ts:171–218; scheduler:48–86. Requirement: specs hourly-investment-sync/spec.md:19–25 at fcdc805f6c1b3be6a20a7e858e3e80cbd83a9121.

Scope

In scope

Existing eligibility formula и real SQLite reservation time table.

Out of scope

Второй scheduler, distributed lease, изменение approved cadence без решения owner.

Proposed Approach

Вычислять следующий допустимый 60-minute term от attempt start, учитывая terms во время работы; сохранить один catch-up после downtime.

Acceptance Criteria

  • 10:00–11:10 не запускает repeat до 12:00; 10:00–12:10 — до следующего разрешённого term.
  • Short/failed attempt, exact boundary, same-process running, restart/downtime и new revision различаются контролируемыми cases.
  • Real reservation не допускает overlap; elapsed-time mock не заменяет DB fence.

Verification

Existing isolated SQLite runner, controlled Date/start/finish, persisted rows; backend verify на конечном diff.

Dependencies

Нет. T01 — связанный owner, но его реализация не обязательна для локальной формулы.

Traceability

Campaign: WealthLedger/main#23 . Findings: BE-006, TQ-003, TA-F04. Repository: WealthLedger/backend; T03.

<!-- wealthledger-audit:2026-10-11:hourly-eligibility --> ## Problem reserveHourly проверяет elapsed hour от createdAt. После walk 10:00–11:10 tick 11:11 eligible, хотя сохранённое требование допускает следующий term не ранее 12:00. Overlap guard существует; это cadence defect, не подтверждённая concurrent эксплуатация. ## Expected Behavior Перекрытые работой terms пропускаются; restart/downtime не ускоряют retry и не создают catch-up queue. ## Evidence Audit date: `2026-10-11`. Report: [06](https://git.personal.ksv741.ru/WealthLedger/main/src/commit/d07fbfabb1295780952a554185989d2d5b5c8349/audits/2026-10-11/reports/06-backend-architecture-report.md). IDs: BE-006, TQ-003 (time arm), TA-F04. Revision: `0ad84ff4f0b4712abc7e69dc299856f14af6eadd`; Confidence: High; Verification status: static. Affected code: [tbank-sync.repository.ts:171–218](https://git.personal.ksv741.ru/WealthLedger/backend/src/commit/0ad84ff4f0b4712abc7e69dc299856f14af6eadd/src/modules/investments/tbank-sync/tbank-sync.repository.ts#L171-L218); scheduler:48–86. Requirement: specs hourly-investment-sync/spec.md:19–25 at `fcdc805f6c1b3be6a20a7e858e3e80cbd83a9121`. ## Scope ### In scope Existing eligibility formula и real SQLite reservation time table. ### Out of scope Второй scheduler, distributed lease, изменение approved cadence без решения owner. ## Proposed Approach Вычислять следующий допустимый 60-minute term от attempt start, учитывая terms во время работы; сохранить один catch-up после downtime. ## Acceptance Criteria - [ ] 10:00–11:10 не запускает repeat до 12:00; 10:00–12:10 — до следующего разрешённого term. - [ ] Short/failed attempt, exact boundary, same-process running, restart/downtime и new revision различаются контролируемыми cases. - [ ] Real reservation не допускает overlap; elapsed-time mock не заменяет DB fence. ## Verification Existing isolated SQLite runner, controlled Date/start/finish, persisted rows; backend verify на конечном diff. ## Dependencies Нет. T01 — связанный owner, но его реализация не обязательна для локальной формулы. ## Traceability Campaign: https://git.personal.ksv741.ru/WealthLedger/main/issues/23 . Findings: BE-006, TQ-003, TA-F04. Repository: WealthLedger/backend; T03.
codex-bot added this to the Technical Audit Remediation — 2026-10-11 milestone 2026-10-11 21:41:56 +03:00
codex-bot added the Kind/Bug
Priority
Medium
3
audit/2026-10-11
labels 2026-10-11 21:41:56 +03:00
codex-bot was assigned by hermes-agent 2026-10-12 00:04:25 +03:00
hermes-agent added this to the WealthLedger — Delivery Board project 2026-10-12 00:04:26 +03:00
Author
Owner

Сделано в WealthLedger/backend#93 (merged в develop): следующий term считается от старта попытки с учётом длительности walk. Тесты в test/tbank-hourly-lifecycle.e2e-spec.ts (boundary, overlap на 1 и 2 term, новая revision, dead-process + downtime, same-process running). npm run verify OK, e2e 28/28.

Сделано в WealthLedger/backend#93 (merged в develop): следующий term считается от старта попытки с учётом длительности walk. Тесты в test/tbank-hourly-lifecycle.e2e-spec.ts (boundary, overlap на 1 и 2 term, новая revision, dead-process + downtime, same-process running). `npm run verify` OK, e2e 28/28.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: WealthLedger/backend#54