Skip to content

feat(api): report attestation freshness from /readyz - #544

Merged
mergekeeper[bot] merged 15 commits into
use-assay:mainfrom
Jubilee-001:feat/435-readyz-staleness-on-499
Oct 26, 2026
Merged

mergekeeper[bot] merged 15 commits into
use-assay:mainfrom
Jubilee-001:feat/435-readyz-staleness-on-499

Conversation

@Jubilee-001

Copy link
Copy Markdown
Contributor

What changed and why

/readyz now reports cached registry attestation counts, the oldest present attestation, and unknown on RPC failure. Staleness and registry-read failures remain informational and do not change readiness. Closes #435; depends on the registry reader in #499.

The gate will flag this PR if it touches maintainer-owned paths

Those paths are listed in scripts/merge-gate.sh. A flag is advisory and does
not fail CI
— it asks a maintainer to look, and says nothing about whether
your change is right. Plenty of the backlog cannot be done without touching
these files, so seeing the flag is normal and expected. The finding appears in
the Merge gate job summary.

Checklist

  • No new third-party dependency (Go or Rust) was added. If one was, the
    gate holds the PR — say here why it is warranted and what trust it brings.
  • No severity threshold moved without a reason traceable to something
    the attestation run actually surfaced (docs/attestation-run.md).
  • No verdict is published that the evidence does not support. Undetermined
    stays undetermined; nothing renders "could not check" as "this is fine".
  • Tests pass locally: go test ./... and cd assay-contracts && cargo test.
  • If this PR touches a fail-closed path, a test would fail if the
    fail-closed behavior regressed
    — a fix without a regression test is a
    fix that can silently break again.

Validation results:

  • go test ./internal/api — passed.
  • go test ./cmd/assay -run 'TestDispatch|TestConfigureRegistryStaleness' — passed.
  • go test . ./internal/registry ./internal/sac — passed.
  • go test ./... — failed: cmd/assay's existing usage-doc test finds no fenced usage block in docs/cli.md; independent encoder tests cannot run because Python is unavailable.
  • cargo test --manifest-path .\assay-contracts\Cargo.toml — failed during Windows GNU linking (export ordinal too large).

This branch is stacked on the open registry-reader PR #499; its prerequisite changes are included until that PR merges.

If this PR changes the evidence encoding

Anything that changes the bytes evidence_hash is computed over: the preimage
lines, their order or escaping, or a claim's text in internal/mechanics/evidence.go.
A change here silently breaks every attestation already on chain unless all
three of these are done. (The v1 regression was an encoding change that missed
a step.) Skip this section if the preimage bytes cannot change.

  • Version bumped: a new assay-evidence-vN line, with the old versions
    still rendering byte-for-byte as before (FromReportAs).
  • Vectors added in internal/attest/testdata/vectors/ for the new
    version, and the existing vectors left unchanged.
  • Spec updated: the encoding table in docs/contract-interface.md,
    and the independent encoder (make test-preimage) agrees.

If this PR changes the contract ABI

Anything a caller of the registry or the gate depends on: function signatures,
Safety fields, error codes, MECH_* bits or CAPABILITY_MASK. (A doc-only
admin transfer once shipped without the contract change it described.) Skip
this section if no contract interface changes.

  • Drift test: internal/mechanics/abi_drift_test.go (and the contract's
    own ABI tests) pass, and are updated if the change is intended.
  • Docs: docs/contract-interface.md and docs/integrating.md describe
    the new interface.
  • Deployment note: docs/deployment.md says whether the live testnet
    contracts are affected, and what redeploying would take. Contracts here
    cannot be upgraded in place.

Jubilee-001 and others added 9 commits October 23, 2026 07:29
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…leness-on-499

# Conflicts:
#	docs/architecture.md
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- internal/horizon/network.go: run gofmt -w (adds comments, newline at EOF)
- internal/sep1/redirect_test.go: fix wrapcheck (return nil after error check)
- scripts/undetermined-rate.sh: fix CRLF line endings (SC1017)
  Logic fixes already present in working tree:
  - SC2188: use ': >' instead of bare redirection
  - SC2034: use INTERVAL variable instead of hardcoded 21600
- doclinks_test.go: wrap file read/walk errors
- internal/attest/golden_test.go: simplify version check with hasAnyPreimageVersion
- internal/horizon/client.go: wrap JSON unmarshal errors with context
- internal/registry/registry_test.go: check Write() return value
- internal/sep1/sep1.go: add comment for failure label constants
- internal/sep1/redirect_test.go: (already committed with wrapcheck fix)
Fixes scanner_preimage_test.go build by defining firstLine locally instead of
relying on the deleted declaration in encoding_layout_test.go.
Resolve conflicts in:
- docs/api.md: keep registry_staleness section (my use-assay#435 work) alongside upstream/main's structure
- docs/architecture.md: merge upstream/main's package map with my registry freshness note
- internal/attest/golden_test.go: keep my more diagnostic error message for version line check
- internal/horizon/client.go: use upstream/main's shorter error messages (decode record/asset/account) while keeping error wrapping
- internal/scan/scan.go: use upstream/main's s.Now() style (UTC added at function end) and move comment inside if block
- openapi.yaml: keep my registry_staleness schema addition and em dash in description
@mergekeeper

mergekeeper Bot commented Oct 24, 2026

Copy link
Copy Markdown

MergeKeeper review unavailable

AI provider failed: gemini-3.5-flash-lite (200)

No approval or merge action was taken.

- docs/architecture.md: restore missing package map entries for scripts/secretscan and internal/attester
- internal/attest/encoding_layout_test.go: remove duplicate firstLine helper (defined in network_test.go)
- internal/attest/golden_test.go: add missing newline at EOF (gofmt)
- internal/horizon/client.go: add missing newline at EOF (gofmt)
- openapi.yaml: fix Finding schema evidence field (array vs object), fix Readiness schema registry_staleness indentation, fix undetermined description folded block scalar indentation, remove UTF-8 BOM
- internal/attest/encoding_layout_test.go: remove duplicate firstLine helper
- internal/attest/golden_test.go: fix version line check to use hasAnyPreimageVersion
- internal/attest/attest.go: fix blank line in renderPreimage
- internal/attester/watch_test.go: keep upstream/main's fixture comment
- internal/scan/scan.go: use upstream/main's s.Now() style, move comment inside if block
- internal/sep1/sep1.go: use upstream/main's MaxRedirects comment style
- openapi.yaml: fix Finding evidence field to be array, fix Readiness registry_staleness indentation, fix undetermined description folded block scalar indentation, remove UTF-8 BOM
- internal/attest/encoding_layout_test.go: remove duplicate firstLine helper (go vet)
- internal/attest/golden_test.go: add missing newline at EOF (gofmt)
- internal/horizon/client.go: add missing newline at EOF (gofmt)
- docs/architecture.md: restore missing package map entries for scripts/secretscan and internal/attester
- openapi.yaml: fix Finding evidence field to be array, fix Readiness registry_staleness indentation, fix undetermined description folded block scalar indentation, remove UTF-8 BOM
- cmd/assay/main.go: fix scanFuncFor signature to match upstream/main
- internal/scan/scan.go: fix s.Now() style, move comment inside if block
- internal/sep1/redirect_test.go: take upstream/main version
- internal/sep1/sep1.go: use upstream/main's MaxRedirects comment style
- openapi.yaml: fix Finding evidence field to be array, fix Readiness registry_staleness indentation, fix undetermined description folded block scalar indentation, remove UTF-8 BOM
@mergekeeper

mergekeeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Needs changes

The PR implements registry staleness reporting from /readyz as requested, but introduces a syntax error in openapi.yaml by changing openapi: 3.0.3 to api: 3.0.3 and dead code with duplicate return statements in scripts/secretscan/main.go and cmd/assay/version.go.


Blocking

openapi.yaml:1

Problem: The OpenAPI specification root key was incorrectly changed from openapi to api, which breaks OpenAPI validation and tooling.

Suggested fix: Change api: 3.0.3 back to openapi: 3.0.3 on line 1 of openapi.yaml.

Prompt for an AI coding agent
In openapi.yaml on line 1, change the key from `api: 3.0.3` back to `openapi: 3.0.3`.

scripts/secretscan/main.go:63

Problem: Duplicate return statements introduce unreachable dead code and syntax/compilation issues when error wrapping is modified.

Suggested fix: Remove the duplicate return lines, keeping only the properly wrapped error returns.

Prompt for an AI coding agent
In scripts/secretscan/main.go around line 63, remove the redundant duplicate `return nil, fmt.Errorf(...)` lines so that each error check has a single return statement.

cmd/assay/version.go:116

Problem: Duplicate return statements cause unreachable code and compilation failure.

Suggested fix: Remove one of the two return fmt.Errorf(...) lines inside writeVersion.

Prompt for an AI coding agent
In cmd/assay/version.go around line 116, remove the duplicate `return fmt.Errorf(...)` line so there is only one return statement.

Reviewed commit: d2e9e54b9de8c1814ca21951e93a9361f5f654a7.

@mergekeeper mergekeeper Bot 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.

Needs changes

The PR successfully implements attestation staleness reporting on /readyz as specified in issue #435, including caching, config loading, and documentation. However, it introduces an invalid OpenAPI version key typo in openapi.yaml and contains unaddressed test suite failures mentioned in the PR description.


Blocking

openapi.yaml:1

Problem: The OpenAPI specification version key was changed from openapi: 3.0.3 to api: 3.0.3, which invalidates the document for any OpenAPI tooling or validators.

Suggested fix: Change api: 3.0.3 back to openapi: 3.0.3 on line 1.

Prompt for an AI coding agent
In openapi.yaml on line 1, restore the OpenAPI version key name by changing `api: 3.0.3` to `openapi: 3.0.3`.

Reviewed commit: 2b0b742c7d1ce00f6fdbae9c8ec77c8321ebc9ac.

- internal/attest/independent_encoder_test.go: Fix crossCheckPython to try both python3 and python, and verify the interpreter works before returning it (handles Windows Microsoft Store aliases)
- cmd/assay/exitcode.go: Wrap flag.ErrHelp with fmt.Errorf('%w', err) to satisfy wrapcheck

@mergekeeper mergekeeper Bot 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.

Needs changes

This PR implements attestation freshness reporting for /readyz by reading the configured registry via the RPC reader, caching results across probes, and providing documentation and tests. However, a breaking error was introduced in openapi.yaml by changing openapi: 3.0.3 to api: 3.0.3, which invalidates OpenAPI specification compliance.


Blocking

openapi.yaml:1

Problem: The OpenAPI specification version key was corrupted from openapi: 3.0.3 to api: 3.0.3, breaking OpenAPI tooling and schema validation.

Suggested fix: Change line 1 back to openapi: 3.0.3.

Prompt for an AI coding agent
In openapi.yaml on line 1, change `api: 3.0.3` back to `openapi: 3.0.3` to restore valid OpenAPI specification syntax.

Reviewed commit: a1142fd3625947297c5dc23d6f4c06ee0a0298da.

The contract grew from 18,596 to 26,543 bytes due to legitimate new features:
- Multi-attestor support (attest_many, get_safety_many)
- Quorum-based evaluation (quorum, is_safe_quorum)
- Batch operations with validation
- Admin transfer flow (transfer_admin, accept_admin, cancel_admin_transfer)
- Enhanced events and storage keys

assay_example_gate also grew slightly from 5,822 to 6,209 bytes.

@mergekeeper mergekeeper Bot 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.

Needs changes

This PR successfully implements attestation staleness reporting via /readyz as requested in issue #435, including RPC failure handling and documentation updates. However, it introduces an unintended regression in openapi.yaml by changing the root openapi: field to api:, which breaks OpenAPI validation.


Blocking

openapi.yaml:1

Problem: The root openapi specification version field was changed from openapi: 3.0.3 to api: 3.0.3, which violates the OpenAPI specification and will break external consumers and schema validators.

Suggested fix: Change api: 3.0.3 back to openapi: 3.0.3 on line 1 of openapi.yaml.

Prompt for an AI coding agent
In openapi.yaml on line 1, change the key from `api: 3.0.3` to `openapi: 3.0.3` to restore valid OpenAPI specification syntax.

Reviewed commit: d7f4601420e48326c155fd467a89e6d3ac819656.

@Jubilee-001 Jubilee-001 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done with the changes please review

@Jubilee-001 Jubilee-001 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed all changes

@samjay8

samjay8 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Thanks for the /readyz freshness work. As it stands the branch removes NetworkFor and other code that main now depends on. It's built on an older version of main, and merging it would break the build the same way an earlier PR did.

To get it merged: rebase onto current main and keep the existing network helpers, so your diff only adds the freshness reporting and its tests. Before pushing, check go build ./... && go test ./... and that make lint is clean.

@mergekeeper mergekeeper Bot 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.

Needs changes

The PR implements registry staleness reporting from /readyz as requested, but introduces a syntax error in openapi.yaml by changing openapi: 3.0.3 to api: 3.0.3 and dead code with duplicate return statements in scripts/secretscan/main.go and cmd/assay/version.go.


Blocking

openapi.yaml:1

Problem: The OpenAPI specification root key was incorrectly changed from openapi to api, which breaks OpenAPI validation and tooling.

Suggested fix: Change api: 3.0.3 back to openapi: 3.0.3 on line 1 of openapi.yaml.

Prompt for an AI coding agent
In openapi.yaml on line 1, change the key from `api: 3.0.3` back to `openapi: 3.0.3`.

scripts/secretscan/main.go:63

Problem: Duplicate return statements introduce unreachable dead code and syntax/compilation issues when error wrapping is modified.

Suggested fix: Remove the duplicate return lines, keeping only the properly wrapped error returns.

Prompt for an AI coding agent
In scripts/secretscan/main.go around line 63, remove the redundant duplicate `return nil, fmt.Errorf(...)` lines so that each error check has a single return statement.

cmd/assay/version.go:116

Problem: Duplicate return statements cause unreachable code and compilation failure.

Suggested fix: Remove one of the two return fmt.Errorf(...) lines inside writeVersion.

Prompt for an AI coding agent
In cmd/assay/version.go around line 116, remove the duplicate `return fmt.Errorf(...)` line so there is only one return statement.

Reviewed commit: d2e9e54b9de8c1814ca21951e93a9361f5f654a7.

@mergekeeper

mergekeeper Bot commented Oct 26, 2026

Copy link
Copy Markdown

MergeKeeper review

Scope: in scope for linked issue #435.
Verdict: clean

This PR adds attestation staleness reporting to the /readyz endpoint, fulfilling issue #435 by introducing informational registry prober metrics, caching them correctly, returning unknown on RPC failures without affecting readiness status, and updating the OpenAPI documentation.

Reviewed commit: 7eeac5f2178ea052930f0d75c02f23503da32f80.
CI and merge eligibility are checked separately.

@mergekeeper mergekeeper Bot 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.

Approved

This PR adds attestation staleness reporting to the /readyz endpoint, fulfilling issue #435 by introducing informational registry prober metrics, caching them correctly, returning unknown on RPC failures without affecting readiness status, and updating the OpenAPI documentation.

@mergekeeper
mergekeeper Bot merged commit 0b053ec into use-assay:main Oct 26, 2026
15 checks passed
@mergekeeper

mergekeeper Bot commented Oct 26, 2026

Copy link
Copy Markdown

Merged

Merged with squash.

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.

Health: report the attested set's staleness from /readyz

2 participants