Skip to content

validation: print each tool's usage on -h and flag errors; anchor binary ignores - #85

Merged
nickpell merged 1 commit into
mainfrom
nick/key-validator-flag-usage-gitignore
Oct 2, 2026
Merged

nickpell merged 1 commit into
mainfrom
nick/key-validator-flag-usage-gitignore

Conversation

@nickpell

@nickpell nickpell commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Summary

  • key-validator and auction-validator each have their own showUsage() text, but neither sets flag.Usage. -h and an unknown flag therefore print Go's default Usage of <path>: flag list instead of the tool's usage text. Both tools now set flag.Usage = showUsage before flag.Parse(), so -h, -help, --help and flag errors all print the tool's own usage. The exit codes stay the flag.ExitOnError ones: 0 for -h, 2 for a flag error. The tools' own exit-code table already defines 2 as invalid input.
  • In .gitignore, the unanchored key-validator pattern also matched the source directory validation/cmd/key-validator/, so git add refused new files there without -f. go build writes the binary to the directory it runs from. The pattern now names only the binary in the two usual build directories: the repo root (go build ./validation/cmd/key-validator) and the package directory (go build run inside it). auction-validator gets the same anchored pair, because before this change its built binary was not ignored at all.

Notes for reviewers

  • The original key-validator ignore line came from use type definitions to represent different attestation encodings #13, under the # compiled commands comment. It was meant for the compiled binary, and the anchored patterns keep that intent.
  • Open Eliminate bid adjustment factors #44 edits the body of auction-validator's showUsage(). This PR adds one line next to flag.Parse() and does not touch showUsage(), so no textual overlap is expected.
  • On a flag error, the flag package writes the error to stderr and the usage text goes to stdout, because showUsage() prints to stdout. The existing missing-input path has the same split: usage on stdout, error on stderr.

Pre-merge checklist

  • Build passes (go build ./... and go vet ./...)
  • Lint passes (mise run //:lint: 0 issues; mise run //:tidy leaves no changes)
  • Tests pass (go test ./...)
  • For both tools, -h, -help and --help print the tool's usage text and exit 0. -bogus prints flag provided but not defined: -bogus on stderr, then the usage text, and exits 2. Before this change, -h and -bogus printed Go's default flag list.
  • git check-ignore -v matches /key-validator, /validation/cmd/key-validator/key-validator, /auction-validator and /validation/cmd/auction-validator/auction-validator. It reports no match for validation/cmd/key-validator/, validation/cmd/auction-validator/, or a new file in either directory. After building both tools from the repo root and from each package directory, git status --porcelain --ignored lists the four binaries as ignored and the new files as untracked.
  • Enclave binary unchanged: go list -deps ./enclave/... is identical before and after
  • Diff contains no unintended changes: .gitignore and the two main.go files only

Post-deploy/apply verification

  • The Go, Docker Build and EIF build runs on main for the merge commit are green, including update-pcrs (the enclave binary does not depend on these commands) (merge commit 71d22d5: Go run 37010543876, Docker Build runs 37010595113 and 37011352515, Build EIF run 37011024303 all success; PCR commit e19b206 on main)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused changes correctly implement the described CLI and ignore behavior without introducing unresolved issues.

Review effort: Balanced
Findings: None

What changed in this PR

Updates validator CLI help output and correctly scopes ignored binaries.

Changes:

  • Routes help and flag errors through each validator’s custom usage text.
  • Anchors ignore rules for validator binaries without hiding source directories.
File Description
validation/​cmd/​key-validator/​main.go Registers custom flag usage.
validation/​cmd/​auction-validator/​main.go Registers custom flag usage.
.gitignore Adds precise validator binary patterns.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@nickpell
nickpell merged commit 71d22d5 into main Oct 2, 2026
4 checks passed
@nickpell
nickpell deleted the nick/key-validator-flag-usage-gitignore branch October 2, 2026 13:03
nickpell added a commit to cloudx-io/openarbiter that referenced this pull request Oct 8, 2026
…binary (#48)

## Summary

- **Key-token comments.** The doc comments on `HandleKeyRequest`
(`enclave/handlers.go`) and `GenerateKeyAttestation`
(`enclave/attestation.go`) said the host echoes the key-attestation
token into a later arbitration request. `EnclaveArbitrationRequest` has
only `Type`, `RequestID`, `Bids` and `Timestamp`, and it has never had a
token field. #11 kept `auction_token` in the attested user_data and on
the unsigned envelope to preserve the existing wire shape. The comments
now say the token is kept for wire compatibility and that no arbitration
request carries it back. Each comment keeps its line count, so no code
line moves.
- **`.gitignore`.** `go build ./validation/cmd/validate-arbitration`
writes its binary to the working directory, and only `/bin/` was
ignored. `.gitignore` now ignores `/validate-arbitration` (built from
the repo root) and
`/validation/cmd/validate-arbitration/validate-arbitration` (built
inside the package directory). This uses the same anchored form and `#
compiled commands` heading as cloudx-io/openauction's `.gitignore`
(cloudx-io/openauction#85), so the source directory itself is not
ignored.

## Pre-merge checklist

- [x] Build passes: `go build ./...` and `go vet ./...`
- [x] Lint passes: `mise run //:lint` reports 0 issues; `mise run
//:tidy` leaves no changes
- [x] Tests pass: Go workflow `test` job green on this branch (run
37850777297)
- [x] `go build ./validation/cmd/validate-arbitration` from the repo
root, and `go build` inside the package directory: `git status
--porcelain` lists no untracked file, and `git check-ignore -v` matches
each binary to its new line. `git check-ignore` matches neither
`validation/cmd/validate-arbitration/` nor a new file in it.
- [x] Enclave code unchanged: `cmd/enclave-server` built with the
`docker.yml` flags plus `-trimpath -buildvcs=false` has the same SHA-256
on `origin/main` and on this branch
- [x] Diff contains no unintended changes: `.gitignore` and the two
comments only

## Post-deploy/apply verification

- [ ] The Go, Docker Build and EIF build runs on `main` for the merge
commit are green, including `update-pcrs`. PCR0 and PCR2 change with
every commit on `main`, as they did for the `.gitignore`-only #38; the
enclave code itself is unchanged.
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