Skip to content

Validate raw discovery runner records before forwarding - #82

Merged
j0sh merged 2 commits into
mainfrom
ja-codex/discovery-validation
Nov 12, 2026
Merged

j0sh merged 2 commits into
mainfrom
ja-codex/discovery-validation

Conversation

@j0sh

@j0sh j0sh commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Discovery could forward runner records with string prices, nonnumeric capacities, or conflicting field names, leaving clients to interpret the same response differently.

Validate raw runner records before retaining them for forwarding. JSON v2 rejects duplicate keys and invalid Unicode; known fields require the documented casing and types, and observation timestamps must be RFC3339. Integer checks inspect digits and exponents without expanding large numbers. Malformed runners are skipped individually, while unknown extensions and exact numeric tokens are preserved. Shared decoding and signer normalization remain unchanged.

Validation:

  • go test -race ./discovery/... ./signer -count=1
  • go vet ./discovery/... ./signer
  • Schema, forwarding, and signer HTTP tests cover field types, casing, timestamps, Unicode, duplicate keys, exponent limits, raw-record preservation, and typed normalization.

Local Apple M4 Max benchmark (median of three runs, complete inventory decoding): 100 full runner records increased from 0.254 ms to 0.572 ms, and 1,000 from 2.43 ms to 5.47 ms. The latter allocates 3.99 MiB versus 1.27 MiB cumulatively. Validation runs during upstream refresh; cached HTTP reads do not repeat it.

Related to #64.

Copilot AI balanced review requested due to automatic review settings November 12, 2026 05:55
@j0sh
j0sh deployed to docker-publish November 12, 2026 05:57 — with GitHub Actions Active
@j0sh
j0sh deployed to docker-publish November 12, 2026 05:58 — with GitHub Actions Active
@j0sh
j0sh deployed to docker-publish November 12, 2026 05:58 — with GitHub Actions Active
@j0sh
j0sh deployed to docker-publish November 12, 2026 05:58 — with GitHub Actions Active

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.

🟡 Changes recommended

Validation misses Unicode case-fold aliases accepted by the signer, allowing records to pass validation with conflicting field interpretations.

1 open issue
What changed in this PR

This PR validates raw runner records before discovery forwards them, while preserving unknown extensions and original numeric tokens. Shared decoding and signer normalization remain unchanged.

Changes:

  • Validate known field casing and types, timestamps, duplicate keys, and Unicode.
  • Expand schema and forwarding tests, plus signer compatibility coverage.
  • Document discovery’s malformed-record filtering.
File Description
signer/​discovery_test.go Verify signer normalization remains lenient.
docs/​http-api.md Document field validation and malformed-record filtering.
discovery/​server.go Validate raw runner fields before retaining records.
discovery/​server_test.go Verify malformed runners are skipped during forwarding.
discovery/​schema_test.go Expand schema and raw-record validation coverage.

Review effort: Balanced

Comment thread discovery/server.go Outdated
Comment on lines +207 to +208
for name, value := range fields {
key := strings.ToLower(name)
Copilot AI balanced review requested due to automatic review settings November 12, 2026 07:39
@j0sh
j0sh deployed to docker-publish November 12, 2026 07:42 — with GitHub Actions Active

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.

🟢 Approval recommended

No active review issues block approval of the runner-record validation change.

1 open issue

Review effort: Balanced

@j0sh
j0sh deployed to docker-publish November 12, 2026 07:43 — with GitHub Actions Active
@j0sh
j0sh deployed to docker-publish November 12, 2026 07:43 — with GitHub Actions Active
@j0sh
j0sh deployed to docker-publish November 12, 2026 07:43 — with GitHub Actions Active
@j0sh
j0sh merged commit 7d2c76c into main Nov 12, 2026
14 checks passed
@j0sh
j0sh deleted the ja-codex/discovery-validation branch November 12, 2026 07:44

This branch was successfully deployed

1 active deployment
docker-publish — 4383c1a2 Deployed Nov 12, 2026 by j0sh via docker-pr / promote #166
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