feat: let the operator set the daily comment limit per account

The allowance was derived from the adaptive trust level with no way to
change it, which made the dashboard's "1 / 2 today" unexplainable and
left no way to slow an account down or push one along.

`dailyLimit` is null by default, keeping today's adaptive behaviour. A
whole number between 1 and 50 overrides it and is enforced verbatim in
either direction — it can raise an account above what it has earned or
hold it below. The trust level keeps being tracked underneath and is
reported as `adaptiveAllowance`, so the earned figure stays visible next
to the override, and clearing the field hands pacing back to the ladder.

Raising the limit above the earned allowance does remove the adaptive
backoff after a bad comment, so the dashboard says exactly that where the
limit is set. It does not touch the pause on two consecutive removals, a
comment the public cannot see, or a captcha challenge: those are safety
stops rather than rate controls and no limit setting can disable them.

Also correct two things the page was saying badly. The allowance is now
labelled "used in last 24h" with the trust level shown as what it earns,
because it is a rolling window and not a midnight reset. And a
per-community cap above the account allowance now states how much of it
is actually reachable — "1 of 10 today" beside an account limit of 2 read
as far more headroom than existed, since caps distribute the allowance
rather than adding to it.

Verified against a local instance: override above and below the earned
allowance, unrelated saves preserving it, clearing it through the UI,
rejection of 0/51/2.5/non-numeric, and a limit failing to clear a pause.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Jamie BruntonandClaude Opus 5 committed 2026-08-11 21:07:25 +01:00
1 parent f88db1ae7d
commit 5deac87cf1
15 files changed
+351 -26

No files matched your search

@@ -178,11 +178,16 @@ function AccountDetail({ account }: { account: GrowthAccountDetail }) {
const addSubreddit = useAddGrowthSubredditMutation(accountId);
const [newSubreddit, setNewSubreddit] = useState('');
const [delayMinutes, setDelayMinutes] = useState(String(Math.round(settings.minDelayMs / 60_000)));
const [dailyLimit, setDailyLimit] = useState(settings.dailyLimit === null ? '' : String(settings.dailyLimit));
useEffect(
() => setDelayMinutes(String(Math.round(settings.minDelayMs / 60_000))),
[settings.minDelayMs],
);
useEffect(
() => setDailyLimit(settings.dailyLimit === null ? '' : String(settings.dailyLimit)),
[settings.dailyLimit],
);
return (
<div className="growth-detail">
@@ -224,9 +229,17 @@ function AccountDetail({ account }: { account: GrowthAccountDetail }) {
<dt>Used in last 24h</dt>
<dd>{stats.postedLast24h} / {settings.dailyAllowance}</dd>
</div>
<div>
<dt>Daily limit</dt>
<dd>
{settings.dailyLimit === null
? `Automatic — ${settings.adaptiveAllowance}/day`
: `Set to ${settings.dailyLimit}/day`}
</dd>
</div>
<div>
<dt>Trust level</dt>
<dd>{settings.trustLevel} of 4 → {settings.dailyAllowance}/day</dd>
<dd>{settings.trustLevel} of 4 → {settings.adaptiveAllowance}/day earned</dd>
</div>
<div>
<dt>Comments live</dt>
@@ -247,14 +260,55 @@ function AccountDetail({ account }: { account: GrowthAccountDetail }) {
</dl>
<p className="field-hint">
The allowance comes from the trust level, not from a setting: level 0 permits 2 comments
a day, then 3, 5, 8 and 12. It is a rolling 24-hour window rather than a midnight reset,
so capacity frees up 24 hours after each comment. The level rises on its own while
comments survive and earn upvotes, and falls back the moment one is removed or heavily
downvoted. Two removals in a row, or a comment the public cannot see, pauses the account
for you.
Left automatic, the allowance follows the trust level: level 0 permits 2 comments a day,
then 3, 5, 8 and 12, rising while comments survive and earn upvotes and falling back the
moment one is removed or heavily downvoted. Set a daily limit to override that. Either
way it is a rolling 24-hour window rather than a midnight reset, so capacity frees up 24
hours after each comment, and two removals in a row or a comment the public cannot see
pauses the account regardless.
</p>
<div className="growth-pacing">
<NumberField
hint={settings.dailyLimit === null
? `Leave blank to let the allowance follow the trust level, currently ${settings.adaptiveAllowance}/day.`
: `Overriding the earned allowance of ${settings.adaptiveAllowance}/day. Clear the field to go back to automatic.`}
label="Daily limit"
min={1}
max={50}
name="growth-daily-limit"
onChange={setDailyLimit}
suffix="/day"
value={dailyLimit}
/>
<button
className="button secondary"
disabled={updateSettings.isPending}
onClick={() => {
const raw = dailyLimit.trim();
if (raw === '') {
updateSettings.mutate({ dailyLimit: null });
return;
}
const parsed = Number.parseInt(raw, 10);
if (Number.isInteger(parsed) && parsed >= 1 && parsed <= 50) {
updateSettings.mutate({ dailyLimit: parsed });
}
}}
type="button"
>
Save limit
</button>
</div>
{settings.dailyLimit !== null && settings.dailyLimit > settings.adaptiveAllowance ? (
<p className="field-hint">
This is above the {settings.adaptiveAllowance}/day this account has earned, so the
adaptive backoff can no longer slow it down after a bad comment. The pause on two
removals in a row, or a comment the public cannot see, still applies.
</p>
) : null}
<div className="growth-pacing">
<NumberField
hint="Shortest gap between two comments. A random extra delay is always added on top."