Skip to content

docs(adr): ADR-0074 Amendment 3 (PROPOSED), close every live day from the archive, unattended, whole allow-list (#538) - #539

Merged
NeoNix-Lab merged 7 commits into
implement/fidfrom
agent/issue-538-adr-0074-amendment-3
Oct 28, 2026
Merged

NeoNix-Lab merged 7 commits into
implement/fidfrom
agent/issue-538-adr-0074-amendment-3

Conversation

@NeoNix-Lab

@NeoNix-Lab NeoNix-Lab commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

ADR-0074 Amendment 3 (PROPOSED): close every live day from the archive, unattended, for the whole allow-list

Refs #538. Design only: one file, docs/decisions/ADR-0074-multi-instrument-bybit-linear-trades-v1.md (the status header and a new Amendment 3, A3.1 to A3.13). No code, no test, no governance file, no data.

Maintainer's requirement (2026-10-27), which shapes the proposal: every instrument of the allow-list (BTCUSDT, ETHUSDT, SOLUSDT, XRPUSDT, DOGEUSDT), automatic, and every day closed well, so that no day is repaired by hand again.

What it proposes

  • Problem (A3.1). In cycles mode the pause between two slices is not covered and not reconciled. Measured on homelab (operator-reported, read-only): 2026-10-24 has 3,327 slices, 3,326 gaps, 28,718 s uncovered (33.2%); 2026-10-25 has 3,333 gaps, 29,681 s (34.4%). 3,324 of the 3,326 gaps of 10-24 are at most 30 s; the two longer ones are consistent with restarts (not checked against logs). The share of trades actually lost on those days is not measured (no archive file on the server); [design] live: publication supersedes earlier cycles and the loop loses ~27% of trades (ADR-0075) #504's 27.2% is the only measured loss. The 2026-10-26 manual replacement is recorded as evidence, not as a precedent.
  • Closure (A3.2, A3.3). For a closed day made of live slices: retire every slice with the A2.3 reassessment (valid -> invalid, nothing deleted), import the archive day as dt=<day>/seg=000000.000 through S13/S14 with the A2.2 importer variant widened to slices, verify. Conservation by (exchange_ts, trade_id) with full-field equality; refusals for a checkpoint binding, a writing/closed slice, a bridge slice without its neighbour, an uncontained gap record, an overlap, and a day that has nothing to repair.
  • Unattended operation (A3.12). A timer runs every hour over the whole allow-list; a day is taken from 12:00 UTC of the following day and retried every hour until it is closed (a late archive file is absorbed by the retry; a day that cannot be closed signals on a change of reason or age, not every hour). Days are selected by rule (closed, made of slices, not already closed by an archive key), never from a list; a slice day is closed when it has ended and the live checkpoint is bound to a later day (this replaces the 24-hour margin of A2.4 for slice days). Per day: complete and conserved (verify only); incomplete, archive fetched and conserved (replace the whole day: retire the slices, import, verify); anything else that refuses the import (archive absent or changed, a live record that differs, an overlap): mark the day invalid by retiring its slices with the existing A2.3 reassessment, signal, and let the next run take it again; a failed verification also retires the imported partition. The reviewed date plan of A2.6 is replaced by the guards: nothing deleted, every retirement reversible, plan bound to the archive hash and incumbent identities, conservation before any replacement, idempotence, no new control table.
  • The live service is never blocked (A3.4, A3.11 item 5). The closure is a separate process on its own timer and unit; every lock has a short lock_timeout and the closure yields and resumes at the next run; one object per transaction with pauses between them; download, parse and certification hold no catalog lock and run under CPU/memory limits and lower priority; a wall-clock limit per run. The publication latency of the service during a closure is a required measurement, with a bound; not assumed.
  • Overlap rule (A3.6). Corrects the plan of R02, which does not check that no valid partition of an adjacent day overlaps the day (the blocker met on 2026-10-26).
  • What it does not do (A3.12, A3.7). It does not make the current day complete: a day is closed only after it ends and the archive is published. Only the continuous session (O02) completes a day as it happens; the system asked for is the two together. With O02 running, the run verifies and replaces nothing.
  • Not adopted (A3.9). Catalog DELETE, a day-level retirement, a REST reconciliation after every cycle (window of 1,000 trades: about 36 to 77 s), an operator-only run per reviewed plan, an atomic replacement.

Decided by the maintainer (2026-10-28)

A day not closed after 23 hourly attempts is marked invalid and abandoned (no later run takes it; reopen line to retry); the signals are lines appended to a JSON-lines log (also the record of attempts and abandoned days; a lost log only gives more attempts, never changes data). This removes the per-run maximum of days and the severity threshold. The validity of a day is decided only by the archive verification within the 23 attempts; long-gap records do not decide it and ADR-0044 is not amended.

Still open (A3.10)

Whether the Bybit archive file of the previous day exists at 12:00 UTC (not measured; the hourly retry absorbs a late file), retention of the 2026-10-26 directories and dump (the retired slices of a day closed from the archive carry no retention duty, maintainer 2026-10-28; the run deletes nothing), whether a complete live day may ever be replaced (proposed never), and, outside this amendment, whether the explicit-gap state of the live service caused by an open long-gap record should ever end.

Checks

  • python tools/workflow.py preflight: compileall, git diff --check, package boundaries, governance boundary: all pass.
  • Every number in A3.1 comes from the issue and from the operator's pasted query results; ADR section references were read in the repository at 47ad612.

Not done

Acceptance; the amendment of ADR-0044; governance registration of the atoms in SCOPE.md (a separate governance issue, as #518 for #515); the implementation; any change of production data; the first run; the switch of the service to continuous.

🤖 Generated with Claude Code

…the archive (#538)

Design only. Proposes retire-and-import for closed days published as live
slices in cycles mode (A2.3 reassessment per slice, then the archive day as
dt=<day>/seg=000000.000), with the plan, refusals, overlap rule, relation to
the continuous session and the open items for the maintainer. Changes no
code, governance file or data.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@NeoNix-Lab NeoNix-Lab changed the title docs(adr): ADR-0074 Amendment 3 (PROPOSED), close live cycles days from the archive (#538) docs(adr): ADR-0074 Amendment 3 (PROPOSED), close every live day from the archive, unattended, whole allow-list (#538) Oct 27, 2026
NeoNix-Lab and others added 6 commits October 27, 2026 21:19
#538)

Records the maintainer's requirement of 2026-10-27: every instrument of the
allow-list, automatic, every day closed. Adds A3.12 (selection by rule, three
outcomes, the guards that replace the reviewed date plan, what it does not do)
and rewrites the open items on instruments, trigger and gap records. Design
only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… fallback (#538)

The daily run closes the previous day at 12:00 UTC. A slice day is closed when
it has ended and the live checkpoint is bound to a later day (replaces the
24-hour margin for slice days). When the import is refused the day is marked
invalid with the existing A2.3 reassessment and retried by the next run; a
failed verification retires the imported partition too. Design only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ce (#538)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…o a JSON-lines log (#538)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…not by long-gap records (#538)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…y an archive closure (#538)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant