Skip to content

allow assuming trust during upward discovery#2652

Merged
Sebastian Thiel (Byron) merged 2 commits into
mainfrom
override-upward-trust
Jun 18, 2026
Merged

allow assuming trust during upward discovery#2652
Sebastian Thiel (Byron) merged 2 commits into
mainfrom
override-upward-trust

Conversation

@Byron

@Byron Sebastian Thiel (Byron) commented Jun 18, 2026

Copy link
Copy Markdown
Member

Tasks

This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.

  • refackiew

Everything below this line was generated by Codex GPT-5.

Created by Codex on behalf of Byron. Byron will review before this is ready to merge.

Reported issue

In gix-discover/src/upwards/types.rs:38-42, change the field to become an enum that can also represent a given trust. If so, no trust computation will be done and the given trust is assumed. This is useful if users should be able to override the trust level, even during discovery. Related to https://github.com/helix-editor/helix/pull/15857#issuecomment-4726705250 .

Summary

  • Changed gix_discover::upwards::Options::required_trust to the new gix_discover::upwards::Trust enum.
  • Kept the default behavior as Trust::Required(gix_sec::Trust::Reduced).
  • Added Trust::Assume(level) so discovery skips Trust::from_path_ownership() and returns the caller-provided trust level.
  • Added regression coverage that asks for the opposite of the fixture's computed trust and verifies the assumed trust is returned.

Validation

  • cargo test -p gix-discover --test discover upwards::can_override_computed_trust
  • cargo test -p gix-discover
  • cargo check -p gix-discover -p gix --tests
  • cargo check --workspace --all-targets --no-default-features --features lean
  • RUSTDOCFLAGS="-D warnings" cargo doc -p gix-discover --no-deps --features sha1

Review

  • codex review --commit 93d6a0b6f5aaf68b458086b1d405b223f4621472 reported that the public field type change should be marked as breaking.
  • The patch was rewritten with change!: and a commit body documenting the source break.
  • codex review --commit 1ef03b25c6b3b99efe56a0e7648267a952a6e0c4 reported no issues.

@Byron
Sebastian Thiel (Byron) marked this pull request as ready for review June 18, 2026 09:16
Copilot AI review requested due to automatic review settings June 18, 2026 09:16

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.

Pull request overview

This PR updates gix-discover’s upward repository discovery options to allow callers to assume a trust level (skipping ownership-based trust computation), enabling explicit trust overrides during discovery (e.g., for downstream integrations needing custom trust handling).

Changes:

  • Replaced upwards::Options::required_trust: gix_sec::Trust with upwards::Options::trust: upwards::Trust (new enum).
  • Added Trust::Assume(level) to bypass gix_sec::Trust::from_path_ownership() and return the provided level.
  • Added a regression test ensuring assumed trust is returned while discovery still finds the repository.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
gix-discover/src/upwards/types.rs Introduces upwards::Trust enum and updates Options to use it (breaking API change).
gix-discover/src/upwards/mod.rs Wires Trust::{Required,Assume} into discovery logic and adjusts returned trust handling.
gix-discover/tests/discover/upwards/mod.rs Adds coverage for overriding computed trust via Trust::Assume.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gix-discover/src/upwards/types.rs
Comment thread gix-discover/src/upwards/mod.rs Outdated
upward discovery options should allow callers
to override the trust level during discovery. When a trust level is provided,
discovery should not compute trust from path ownership and should instead assume
the provided level.

This intentionally changes the public Options::trust (formerly `required_trust`)
field from gix_sec::Trust to gix_discover::upwards::Trust so the field can
represent either a required computed trust threshold or an assumed trust level.
Existing callers that set required_trust directly need to wrap their threshold
in Trust::Required(_).

The fix keeps the default as the existing reduced-trust requirement, while
Trust::Assume(level) skips Trust::from_path_ownership() and returns the provided
trust level.

Co-authored-by: Sebastian Thiel <[email protected]>
@Byron Sebastian Thiel (Byron) changed the title change!: allow assuming trust during upward discovery allow assuming trust during upward discovery Jun 18, 2026
Copilot AI review requested due to automatic review settings June 18, 2026 11:42

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread gix/src/discover.rs
@Byron
Sebastian Thiel (Byron) merged commit 52d26d7 into main Jun 18, 2026
32 checks passed
@Byron
Sebastian Thiel (Byron) deleted the override-upward-trust branch June 18, 2026 12:11
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.

3 participants