Skip to content

test: pgc_reconcile_records reports an impossible mismatch on a pytest log #1242

Description

@OffgridwithJD

pgc_reconcile_records compares a suite log's stated checks run: N against the number of RESULT records it carries. Handed a pytest log it reports a mismatch that cannot be true:

  records=0 but the log states checks run: 126
  126 check(s) reported an outcome the count never saw:
    a check ran in a subshell, so its counter bump died with it while its
    ...

Both harnesses print checks run:. Only the shell one emits RESULT<tab> records. So the function reads a stated total, finds zero records, and concludes the suite lost 126 outcomes.

How it surfaced

Not by looking for it. @jdatcmd observed that a bare bash test/<suite>.sh never reaches this check -- it lives in run_all_versions.sh -- so every green either of us called from a development run today was called without it. I ran it over all 64 suite logs I had produced:

  64 logs reconciled   genuine mismatches: 0   false positives: 1

The one flagged log was a pytest log from an unrelated earlier run.

Why it is latent rather than live

run_all_versions.sh only ever hands this function shell-suite logs, so nothing in the gate can hit it today. It becomes live the moment anyone reconciles a directory of logs rather than a list -- which is the natural thing to do when auditing, and is how it was found.

What is missing

The function already guards two input faults, and its comments name both:

  • an absent log -- "no log to reconcile records against"
  • a log with no checks run: line at all -- "never reached its summary ... must not read as a clean reconciliation"

It does not guard the third: a perfectly good log of the other harness. One premise closes it -- if the log states a total and carries no RESULT records at all, that is a log this function cannot speak about, and saying so is different from reporting that every check vanished.

A second, smaller thing in the same output

The message prints a cause beneath the count:

a check ran in a subshell, so its counter bump died with it

That is the fault it was written for, and it is a hypothesis, not part of the measurement. On @jdatcmd's counter-clobber failure it would have sent them to subshells rather than to their own assignments; on a pytest log it explains a mismatch that is not real. The count above it is the evidence. Worth separating the two, or hedging the sentence.

Not proposed

Making the pytest harness emit RESULT records, or making this function understand both formats. The two harnesses stay independent, and the fix here is for the function to recognise that it has been handed something it cannot measure.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MpajdQbkVJ9ey1XyYHcikP

Activity

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

Metadata

Metadata

Assignees

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