Skip to content

emrg: the pace guard's docstring works its one non-exact value the wrong way #2945

Closed

Description

@pm25coder

tests/test_competition_prompt.py guards the template's submission-pace rule. Its docstring illustrates that rule with three worked values, and one of them is rounded the opposite way from the rule it describes.

What was observed

The rule, at emrg/server/competition_prompt.md:95, states the gap as 86400 ÷ (n + 1) seconds for an allowance of n submissions per day, and then:

Where the day does not divide evenly the interval is rounded up, since a gap shorter than the division allows spends the attempt the ledger is trying to keep.

The guard's docstring, at tests/test_competition_prompt.py:1856-1858, illustrates the same form:

`86400 ÷ (n + 1)`, giving 43200 for one submission a day, 7854 for ten, 28800 for two. A rule

Measured:

n= 1  86400/2  = 43200.000   ceil = 43200
n= 2  86400/3  = 28800.000   ceil = 28800
n=10  86400/11 =  7854.545   ceil = 7855   <- the docstring says 7854

43200 and 28800 are exact, so they cannot disagree with either rounding direction. n = 10 is the only illustrated value that needs the direction, and the docstring gives the floor. The two numbers differ by one second in the wrong direction: a round substituting 7854 spaces its batches one second tighter than the rule allows, which is precisely the overspend the rule's rounding clause exists to prevent.

Why it matters

The docstring is what a maintainer reads before changing this guard, and it is the only place in the repository that shows the direction applied to a non-exact case. A worked example that contradicts its own rule teaches the wrong substitution, and this repository's rule for derived numbers is that a stated value has to be one a reader can reproduce. The template itself is correct — it names only the two exact values and states the direction in words — so nothing published is wrong; what is wrong is the illustration beside it.

What the fix must satisfy

  1. The illustrated value for n = 10 is the one the rule produces: 7855, not 7854.
  2. The sentence shows why the direction matters there rather than only asserting the number, so a reader can check the division and the direction against one line.
  3. The two exact values (43200, 28800) are kept: they are what a reader substitutes first.
  4. The guard's assertions are unchanged — the docstring is prose about the rule, and the rule's own text is what they read.
  5. Every number in the rewritten docstring is arithmetically reproducible from 86400 ÷ (n + 1) and the stated direction.

Acceptance

A reader substituting n = 10 into the docstring's own formula, and applying the docstring's own direction, arrives at the number the docstring gives. The guard still passes.

Activity

  1. pm25coder commented on Nov 17, 2026

    @pm25coder
    CollaboratorAuthor

    Handled by #2946

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions