Skip to content

test(hub): let generate_hub_fixture generate and check a fixture for a given object location base #2043

Closed

Description

@DecisionNerd

Outcome

generate_hub_fixture can generate and check the Hub fixture for a given object location base. A Hub preview data plane on its own HTTPS origin can then serve a Rust-generated manifest whose object locations resolve there, so gf clone can be proven end to end against preview before production.

Context

  • Discovery v1 locations are absolute HTTPS URLs inside the canonical manifest ("Locations are transport"). Changing the origin changes the manifest digest, so the Hub must not rewrite them; Rust has to generate them (ADR 0053 reasoning).
  • generate(source, destination, location_base) already accepts the base, and summary_and_descriptors_do_not_depend_on_the_object_location_base proves summary and descriptors don't depend on it (PR test(hub): rebuild openalex fixture with summary and ontology module objects #1757, test(hub): rebuild openalex fixture with summary and ontology module objects #1745).
  • The generate_hub_fixture example and check() hard-code DEFAULT_LOCATION_BASE (https://data.graphforge.sh/objects/sha256/), so only the production fixture can be produced or verified.
  • gf clone correctly rejects loopback and private hosts, so a fully local clone stays out of scope. This is about public HTTPS preview origins.

Change

  • Add --location-base <https-url> (and an output directory) to generate_hub_fixture for generation and check modes. Validate the base with the graphforge-discovery location rules: HTTPS, public host, no credentials, ends in /.
  • Record the location base in the generated fixture metadata so provenance binds it.
  • The checked-in tests/fixtures/hub/generated/v1 stays on the default base.

Acceptance

  • Generating twice with the same non-default base is byte-identical.
  • Against the default output, only objects[].locations, the manifest, refs, and fixture metadata differ.
  • Check mode with the same base passes; a tampered location or a mismatched base fails closed.
  • No discovery protocol, schema, or clone-security change.

Related: #1732, #1745, #1767.

Activity

  1. DecisionNerd commented on Oct 14, 2026

    @DecisionNerd
    ContributorAuthor

    Merged to main through the squash merge queue in #2100. The example supports --location-base <https-url> and --output-dir <directory> in both --update generation and default check modes. The base is recorded in fixture.json, and check binds every object's location to the requested base.

    Acceptance evidence:

    • CARGO_TARGET_DIR=/home/ubuntu/gf-hub-fixture-target make test-rust ARGS="-p graphforge-cli --lib --test hub_fixture --example generate_hub_fixture": 147 passed; one existing ignored manual performance measurement.
    • Preview regression generates twice and compares every byte, compares every manifest field and artifact with the production fixture, passes check for the same base, and rejects the wrong base, tampered metadata, and each object's tampered location even after re-sealing the manifest digest.
    • The compiled example passed default check, preview update/check, repeated replacement with identical bytes, mismatched-base rejection, invalid-base preservation, and tampered-location rejection.
    • make test-rust ARGS="-p graphforge-cli --example generate_hub_fixture": all 3 example tests passed after the backup-restoration review fix.
    • CARGO_TARGET_DIR=/home/ubuntu/gf-hub-fixture-target make check: passed after the final edit.
    • Independent review found no remaining blockers; final CodeRabbit review found zero issues before the independently verified backup fix.

    The checked-in production object, summary, module, manifest, and refs bytes are unchanged. Only fixture provenance metadata changes. No discovery schema or clone-security changes.

    PR CI run: CI Gate passed at the final PR head. Merge-queue CI run: CI Gate passed; the squash commit is verified on main, and this issue closed automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttestingTest coverage and testing infrastructure

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions