Skip to content

feat: versioned metadata-only environment discovery (RFC 011) - #1138

Merged
cursor[bot] merged 9 commits into
huggingface:mainfrom
thegovind:feat/rfc011-catalog-discovery
Sep 15, 2026
Merged

cursor[bot] merged 9 commits into
huggingface:mainfrom
thegovind:feat/rfc011-catalog-discovery

Conversation

@thegovind

@thegovind thegovind commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements the first metadata-only repository discovery profile from RFC 011,
merged in #1093.

  • A packaged, versioned Environment Card and catalog schema, with strict
    source/path/revision and interface-role invariants.
  • A deterministic producer over direct-child environment definitions in a
    pinned Git tree. It reuses authored manifest, package and README metadata,
    records provenance, and never imports candidate code.
  • openenv catalog build, openenv catalog inspect, and a read-only
    openenv discover --catalog lexical baseline.
  • Explicit incomplete reports, unknown evidence, atomic snapshot writes,
    same-snapshot identifier lookup, and correction/supersession/withdrawal
    comparison.
  • Authored task metadata for Echo, Coding, BrowserGym, Calendar, Chess and
    Reasoning Gym, plus a revision-named CI snapshot artifact.

No runtime endpoint, environment installation, image pull, candidate probing,
tool invocation, reset/step, or execution-policy boolean is added.

Profile decisions

This draft implements 0.1-draft: GitHub source definitions, explicit publisher
configuration, complete inline snapshots, and declared interfaces only. It does
not pretend to verify RFC 008 runtime evidence or duplicate the normalized
validation manifest. Unsupported profiles and validated claims fail explicitly.

The initial inventory is the configured Git tree's direct-child openenv.yaml
definitions, not every deployment or community environment. Proposed source
revision 338577885c00d69a92e652991b367fa246918093 produces 39 records.
A failed eligible record still makes the inventory incomplete; logging it does
not make the build complete.

The CLI requires an explicit snapshot. Automatic remote retrieval and a central
registry are not introduced. GitHub Actions artifacts are reviewable outputs,
not an assertion that every finder already indexes them.

Task discovery beyond Echo

Six environments now have authored descriptions, tags and representative queries:

Environment Task a person or coding agent can look for
Echo Check client and tool-call plumbing
Coding Run Python snippets and inspect execution output
BrowserGym Fill forms and interact with web pages
Calendar Create and update events in simulated scheduling tasks
Chess Choose legal UCI moves against an opponent
Reasoning Gym Answer dataset-scored, single-question tasks

Calendar's five declared event tools are evidenced in its tracked tool-definition
file. The other new entries do not infer an agent-tool interface from a framework
or harness name. Runtime, reward and training code are unchanged.

The maintained-inventory tests use actual repository metadata in a temporary Git
tree, keep all eligible environment paths, and fail if candidate packages are
imported. Five held-out task queries are different from the authored hints.

Validation

  • Current fix head: 89774a991c77c780e45df767fe95730ac7f06b4d.
    The PR check list records its Python 3.11/3.12 CI, packaging, docs, lint and
    automated review status.
  • 103 discovery tests include a real temporary Git repository, byte-identical
    rebuilds, uncommitted-file isolation, symlink rejection, duplicate metadata,
    cross-revision mismatches, missing wire claims, malformed snapshots, exact
    lookup, lexical selection, and lifecycle failures. Wrong-root regressions
    recompute valid digests before asserting scope rejection.
  • A combined discovery/existing CLI run passed 228 tests before five additional
    schema path cases were added; all 103 final discovery tests then passed.
  • Review regressions cover file-based versus text license declarations at both
    package and repository scope, conflicting file/text tables, and matching query
    cardinality across declaration/entry models and their packaged JSON schemas.
  • The real 39-entry snapshot at the current source revision was consumed by
    the independently implemented HF reader. Every complete card round-tripped
    unchanged through six HTTP pages and six MCP pages. All five held-out task
    queries also selected the intended environment through HTTP and the HF CLI.
  • All six curated examples pass the packaged JSON schemas and both independent
    parsers. Their complete data is unchanged in the public catalog proposal.
  • Existing tests for the selected environment families: 17 passed, 10 skipped
    for unavailable optional runtime dependencies. These are not claims of live
    browser, database, simulator or training validation.
  • Wheel build, packaged schema generation, import sorting, format checks,
    lint, documentation sync, and whitespace checks completed.

Maintainer review fixes

  • README frontmatter recognizes LF, CRLF and CR. Real Git-to-CLI tests depend on
    frontmatter-only descriptions, so package fallback cannot hide the regression.
    Unclosed frontmatter fails under each line-ending format.
  • Custom license comparison retains the source text rather than treating every
    other result as the same license. Different or unspecified custom declarations
    become unknown with a warning; matching text and SPDX aliases retain evidence.
  • Packaged JSON schemas now include portable path constraints, artifact
    presence/absence rules, conditional license evidence and exactly one
    orchestration interface. The same negative cases exercise Python and JSON
    Schema, and all schema patterns compile in both ECMAScript and Go.
  • 2,801 generated relative-path cases agree between the Python model and
    generated schema. This is sampled coverage, not a claim that JSON Schema
    captures every semantic rule.
  • The consumer validation and retrieval contract
    explicitly identifies the additional URI, SPDX, package-requirement,
    source/artifact and tool-revision checks. Source retrieval is not installation.
  • Rebuilding the real 39-card snapshot at the existing pinned source with the
    corrected producer gives the same digest and zero corrected, added or withdrawn
    cards. The six catalog proposals remain valid and unchanged.

An earlier Python 3.12 job missed an unchanged rubric test's 100ms wall-clock
bound. That test and its runtime files match upstream. The target passed
locally alongside the discovery and CLI tests, and one unchanged CI rerun
passed. No timing threshold, assertion or reward logic was changed.

The repository lint hook reformats and checks out modified files; the equivalent
non-mutating formatter/import-sort/lint checks were used instead to preserve the
change set. No assertions were removed and no runtime tests were replaced by
success-shaped fallbacks.

Review focus

Please review the explicit repository profile, publisher namespace contract,
metadata precedence, and the local snapshot publication/consumption boundary.
Finder integrations are separate consumers, not implementation details of the
OpenEnv runtime.

Public companions:

These PRs do not assert that an external finder already indexes the records.
Catalog admission, presentation and rollout remain separate owner decisions.


Note

Medium Risk
New CLI surface and metadata contract affect publication and consumer trust boundaries (licenses, identifiers, completeness), but the path does not install or run environments and fails closed on incomplete catalogs.

Overview
Adds RFC 011’s 0.1-draft profile: revision-bound, metadata-only environment catalogs built from a pinned Git tree—separate from AutoEnv runtime resolution.

A new openenv.discovery library scans direct-child envs/*/openenv.yaml at a commit (via git ls-tree / cat-file, no Python imports), merges discovery.json, manifests, pyproject.toml, and README frontmatter into ARD-style Environment Cards, and emits complete snapshots with digest, provenance, license rules, and strict invariants (artifact binding, inventory accounting, incomplete builds on errors).

CLI: openenv catalog build / inspect and top-level openenv discover for lexical search, exact filters, and identifier lookup against a local snapshot only—no remote fetch or execution.

Also ships packaged JSON schemas + generate_discovery_schemas.py --check, discovery.json for Echo, Coding, BrowserGym, Calendar, Chess, and Reasoning Gym, a Discovery catalog GitHub Actions artifact workflow, docs (catalog-discovery.md), and broad contract/integration tests (tests/discovery/).

Reviewed by Cursor Bugbot for commit a41a4cd. Bugbot is set up for automated code reviews on this repo. Configure here.

@jspisak
jspisak requested a review from zkwentz September 9, 2026 18:25
@thegovind
thegovind marked this pull request as ready for review September 9, 2026 19:22
@bot-ci-comment

bot-ci-comment Bot commented Sep 9, 2026

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@thegovind

Copy link
Copy Markdown
Collaborator Author

@burtenshaw tagging you for review of the RFC 011 catalog producer and discovery CLI, especially source identity, snapshot completeness, and the declaration-only profile. The independent public consumer is in huggingface/hf-discover#46.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b1b0ed0. Configure here.

Comment thread src/openenv/discovery/metadata.py Outdated
Comment thread src/openenv/discovery/models.py Outdated
@cursor
cursor Bot requested a review from burtenshaw September 10, 2026 06:22

@burtenshaw burtenshaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. Just left some turbo nits.

text = source.read(path)
if text is None or not text.startswith("---\n"):
return {}
lines = text.splitlines()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Need to watch different line ending formats because this will be run in the CLI.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 89774a9. Frontmatter now recognizes LF, CRLF and CR openers, with the existing splitlines-based body/closing-marker parsing. The real Git-to-CLI regression uses a description available only in README frontmatter, so CRLF/CR cannot pass via package-metadata fallback. Unclosed frontmatter remains an error for all three formats. Git autocrlf is disabled within the test fixtures, not in user repositories.

Comment thread src/openenv/discovery/producer.py
Address huggingface#1138 feedback on line endings, custom license identity and schema validation. Document consumer validation and source retrieval boundaries.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed exact head 89774a99 after the Ben nits follow-up.

  • Exact-head CI is fully green (Tests 3.11/3.12, Package CI, lint, docs, locks, ThinkingBox, discovery snapshot, Bugbot).
  • The three review items look addressed: LF/CRLF/CR frontmatter parsing, source-aware custom-license comparison, and generated JSON Schema parity with the Python model, including focused tests.
  • This remains a public discovery API / architecture change implementing a Draft RFC. It is not a routine merge for the release automation.

Please re-approve on this head if the design is accepted (burtenshaw, zkwentz). Until then it stays out of the 0.4.3 candidate.

Open in Web View Automation 

Sent by Cursor Automation: Release

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Recorded burtenshaw APPROVED on exact head a41a4cd9 (main merge-up after the nits fix).

Next gate for release automation: wait for exact-head CI to finish green on this head, then squash-merge if repository policy allows. zkwentz is still requested — if that review is required for merge, please resolve it; otherwise we will proceed once checks are terminal green.

This PR remains a public discovery API / Draft RFC change and will stay out of the 0.4.3 notes/version decision until maintainers confirm whether it ships as part of that cut or with a later minor.

Open in Web View Automation 

Sent by Cursor Automation: Release

@cursor
cursor Bot merged commit 72e69ce into huggingface:main Sep 15, 2026
11 checks passed
@hf-security-analysis

Copy link
Copy Markdown
Contributor

⚠️ Workflow security review — 3 high

Scanned 1 workflow file(s) with zizmor, pinact, OSV/GHSA, Claude, over the full workflow files on the default branch.

.github/workflows/discovery-catalog.yml

  • ⚠️ HIGH unpinned-action — .github/workflows/discovery-catalog.yml:29 (via pinact · also flagged by zizmor)
    Action is not pinned to an immutable commit SHA: - uses: actions/checkout@v7

    Fix: Replace with - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

  • ⚠️ HIGH unpinned-action — .github/workflows/discovery-catalog.yml:30 (via pinact · also flagged by zizmor)
    Action is not pinned to an immutable commit SHA: - uses: astral-sh/setup-uv@v7

    Fix: Replace with - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0

  • ⚠️ HIGH unpinned-action — .github/workflows/discovery-catalog.yml:51 (via pinact · also flagged by zizmor)
    Action is not pinned to an immutable commit SHA: - uses: actions/upload-artifact@v4

    Fix: Replace with - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

🔀 A fix PR is open against this branch: #1161

Pinning and static findings are deterministic. Findings marked (via Claude) are model judgements — check them before acting.

burtenshaw pushed a commit that referenced this pull request Sep 15, 2026
Co-authored-by: hf-security-analysis[bot] <265538906+hf-security-analysis[bot]@users.noreply.github.com>
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