Skip to content

fix: wire --judge flag through and stop Action from hanging#2

Merged
memclutter merged 1 commit into
mainfrom
fix/judge-flag
Jun 28, 2026
Merged

fix: wire --judge flag through and stop Action from hanging#2
memclutter merged 1 commit into
mainfrom
fix/judge-flag

Conversation

@memclutter

Copy link
Copy Markdown
Owner

What & why

The --judge flag was parsed but ignored — Action always checked through a
hardcoded AZEnvPhpJudge, so the documented proxyjudge.us default never took
effect and --judge azenv.php / --judge proxyjudge.us behaved identically.

Changes

  • Add ResolveJudge(name) (Judge, error) + judgeNames() in judges.go:
    resolve the flag against the Judges registry; an unknown name errors and
    lists the valid names.
  • Action resolves the judge from --judge before the worker pool, aborts
    on an unknown name (nothing is probed), and passes the resolved judge to every
    worker. The proxyjudge.us default now actually applies.
  • Discovered deadlock, fixed in scope: Action never closed proxyAddrs, so
    the workers' range loops never ended and wg.Wait() blocked forever — the
    CLI hung after processing all proxies. Added close(proxyAddrs) after the feed
    loop. It had gone unnoticed because Action had no test.
  • Extract NewApp() so the binary and tests share the same flag wiring.

Tests (TDD)

  • TestApp_UnknownJudge--judge foo must error; was RED on the old code
    (ignored the flag, then hung 60s), now green.
  • TestResolveJudge — valid names resolve, unknown errors with the list.
  • Local: go test ./... -race, go vet, gofmt -l, golangci-lint run all
    clean.

🤖 Generated with Claude Code

The --judge flag was parsed but ignored: Action always checked through a
hardcoded AZEnvPhpJudge, so the proxyjudge.us default never took effect and
--judge azenv.php / --judge proxyjudge.us behaved identically.

Add ResolveJudge, which looks the name up in the Judges registry and errors
on an unknown name (listing the valid ones). Action now resolves the judge
from --judge before starting the worker pool, aborts on an unknown name
(checking nothing), and passes the resolved judge to every worker.

While adding a regression test, Action was found to hang forever: it never
closed the proxyAddrs channel, so the workers' range loops never ended and
wg.Wait blocked after the feed was exhausted. Close the channel after the
feed loop so the program exits as specified.

Extract NewApp so the cmd binary and tests share the same flag wiring, and
cover both fixes with tests (TestResolveJudge, TestApp_UnknownJudge).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@memclutter memclutter merged commit 45c3555 into main Jun 28, 2026
3 checks passed
@memclutter memclutter deleted the fix/judge-flag branch June 28, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants