Code Farm: per-plot auto-replant pause and crop-lock check; community sync and node work

Continuous Delivery could never be turned off once a crop was planted. Add a
one-shot per-plot "stop after harvest" flag (POST /game/plot/stop, Devii tool
game_plot_stop, game_plots.stop_after_harvest), cleared by the next plant,
autoreplant claim or Refactor. Autoreplant now also respects crop locks through
the shared _crop_lock predicate. Plan and measurements in happyplanting.md.

Also includes the pending community sync, node network and related work in the
tree; the full suite passed (4999) with all of it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-17 02:23:43 +02:00
co-authored by Claude Sonnet 5.5
parent ce899fc5e1
commit 02ab747cd0
203 changed files with 11624 additions and 301 deletions
+31 -7
View File
@@ -27,6 +27,26 @@ function minutes(text) {
return match ? Number(match[1]) * 60 + Number(match[2]) : null;
}
function windowOpen(from, to, current) {
const start = minutes(from);
const end = minutes(to);
if (start === null || end === null || start === end) {
return true;
}
return start < end ? current >= start && current < end : current >= start || current < end;
}
function zoneMinutes(moment, timeZone) {
let format;
try {
format = new Intl.DateTimeFormat("en-GB", { timeZone, hour: "2-digit", minute: "2-digit", hourCycle: "h23" });
} catch (error) {
format = new Intl.DateTimeFormat("en-GB", { timeZone: "UTC", hour: "2-digit", minute: "2-digit", hourCycle: "h23" });
}
const parts = Object.fromEntries(format.formatToParts(moment).map((part) => [part.type, part.value]));
return Number(parts.hour) * 60 + Number(parts.minute);
}
export class Limits {
constructor(options = {}) {
this.baked = options.baked || LIMITS;
@@ -39,6 +59,7 @@ export class Limits {
this.reconnectMax = this.baked.reconnect_max_seconds;
this.serverBandwidthMb = this.baked.max_donor_mb_per_day;
this.serverConcurrent = this.baked.max_concurrent_per_node;
this.serverWindow = { from: "", to: "", timeZone: "UTC" };
this.local = Limits.normaliseLocal({}, this.baked);
this.inflight = 0;
if (options.local) {
@@ -97,6 +118,11 @@ export class Limits {
this.baked.max_concurrent_per_node,
this.baked.max_concurrent_per_node,
);
this.serverWindow = {
from: typeof values.active_from === "string" ? values.active_from : "",
to: typeof values.active_to === "string" ? values.active_to : "",
timeZone: typeof values.timezone === "string" && values.timezone ? values.timezone : "UTC",
};
}
get maxBodyBytes() {
@@ -137,14 +163,12 @@ export class Limits {
}
inActiveHours() {
const from = minutes(this.local.activeFrom);
const to = minutes(this.local.activeTo);
if (from === null || to === null || from === to) {
return true;
}
const now = this.clock();
const current = now.getHours() * 60 + now.getMinutes();
return from < to ? current >= from && current < to : current >= from || current < to;
if (!windowOpen(this.local.activeFrom, this.local.activeTo, now.getHours() * 60 + now.getMinutes())) {
return false;
}
const { from, to, timeZone } = this.serverWindow;
return windowOpen(from, to, zoneMinutes(now, timeZone));
}
admit(usedBytes) {