A resumed acceptance window is measured by the rejection that stopped it
Most contracts hand a delivery ten business days to be accepted and then go quiet about what a rejection does to that count. Does the redelivery get a fresh ten days, or only what the first window had left? On a long engagement that term is worth real money, so code that replays a contract has to read it out of the contract rather than choose for it. Resuming is the harder half: a clock you…
A contract typically grants a delivery ten business days for acceptance, but the implications of a rejection on that time frame are often unclear. The crucial detail lies in the contract itself, not the library's default choice. The core challenge of resuming a contract rests on measuring how much time has elapsed since the rejection that halted it.
Engageledger, a Go library maintained by the author, captures contract terms as a signed append-only journal, integrating the journal's data with current terms and acceptance states for every milestone. Acceptance follows a business-day clock, where a delivery starts a window, and either an acceptance or rejection ends it. When no rejection occurs, the window expires as deemed_accepted.
The retest rule is straightforward: a single switch when reading the head, and another branch upon the arrival of the next delivery. The crux of the issue emerges when the data for these two variables is absent or incorrect. The contract head reads the optional acceptance object from the contract.opened body. The readConfig function extracts this information, handling cases where the acceptance object is missing or not structured correctly.
The function initializes the window to zero days and sets retest to RetestRestart if the retest_window is unrecognized. This approach ensures that a typo in a negotiated term does not inadvertently lead to a default. The fold process lacks a clock, so the rejection event carries the count of remaining days. Deadlines are fixed at the time of delivery, and the acceptance event records the close of the n-th business day, which is then stored as deadline_utc.
The fold cannot recompute deadlines upon replay, as it has no clock, preserving the integrity of deadlines and avoiding discrepancies when replayed at different times.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.