Skip to content

python logpoint checker: six small things found while testing and reviewing its failure paths #1375

Backlog

Description

@debugmcpdev

Found by the builder of #1371 while writing tests for the failure paths of the logpoint checker's process manager (src/session/log-message-checkers.ts), and by the last review of those tests. None is reachable as a wrong verdict; two are sentences that say something the server did not observe, and two are about how the new tests could fail for a reason other than the code.

  1. A later check repeats the first check's reason as if it had waited. After a checker that never answered, every later check of the run is answered at once (nothing is started again), and its reason reads "the checker did not start and answer within 5000 ms", which is true of the first check only. The case of a checker that answered and then failed says it properly: "the checker failed again in this run (…)". Expected: the later answers say the reason was recorded earlier in this run.

  2. A reason for a case that has not happened. If a policy throws while describing its adapter for a launch, the run is left with "this launch's adapter is not a process this server started". Nothing reaches it today: only the Python policy asks the checker, and its description of a launch does not throw. It should say what happened before a second policy uses the checker.

  3. failedForRun changes no answer. Removing the map, or the early return that reads it, alters nothing: the failed process stays in the run's table and the same reason is derived again from it. The new test holds the behaviour (a rule of "always replace" fails five tests), not the map. One of the two should go.

  4. ProxyConfig.adapterCommand carries a cwd its type does not declare (the Ruby policy sets one). A test had to name the wider type to pass the type check.

  5. Three new tests measure elapsed wall time on a path that uses no timer and starts no process (tests/core/unit/session/log-message-checkers.test.ts): "leaves a run unchecked once its checker cannot be had…" asserts each later check answers in under 200 ms, "answers a spawn that throws with why…" asserts a close in under the stop grace, and "bounds a close even when the checker survives its kill…" uses two real 100 ms timers with a fake child. The code under test resolves on microtasks, so a pass normally takes under a millisecond, but a single scheduling stall on a loaded two-core runner could fail them. The same facts can be held without a clock: nothing was spawned (already asserted) and no timer was armed (fake timers). If main goes red in this file, look here first.

  6. The reason for a checker that exits before answering is fixed by whichever of exit and close fires first, and exit may fire before stderr has been read. "names the last line the checker wrote to stderr when it exits before answering…" relies on the data arriving first. The builder saw the line present in 600 of 600 runs on Windows and Linux, at full and at 0.4 CPU. If exit ever wins, the answer's reason lacks the interpreter's own words, and that test fails. Describing the exit on close would remove the order.

Class, for 1 and 2: a diagnosis that names a cause the server did not observe (as #1370). For 5 and 6: a test that can fail for a reason other than the behaviour it names. Path: edge.

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions