Repository navigation
[Repo Assist] rust-guard: reuse ORG_FIELD_ALIASES in infer_scope_for_baseline - #16527
Conversation
…line Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active issues remain in the reviewed changes, which consistently centralize organization-field alias handling across baseline inference and labeling logic.
No open issues 🎉
What changed in this PR
This PR centralizes organization-field lookup logic in the Rust guard, allowing baseline scope inference and labeling rules to share the same alias handling while preserving existing behavior.
Changes:
- Moves
get_first_non_empty_fieldinto shared label helpers and re-exports it for crate-wide use. - Updates baseline scope inference to use
ORG_FIELD_ALIASESand the shared helper. - Builds the organization alias list from the canonical field-name constant.
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/lib.rs | Uses the shared organization alias lookup during baseline scope inference. |
| guards/github-guard/rust-guard/src/labels/tool_rules.rs | Removes the local helper, updates imports, and applies related formatting changes. |
| guards/github-guard/rust-guard/src/labels/mod.rs | Re-exports the shared helper for crate-internal consumers. |
| guards/github-guard/rust-guard/src/labels/helpers.rs | Adds the reusable first-non-empty-field helper. |
| guards/github-guard/rust-guard/src/labels/constants.rs | Uses the canonical organization-name field constant in ORG_FIELD_ALIASES. |
Review effort: Lite (dynamic)
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write leaked on any surface — all read probes (Parts A, C) succeeded as expected.
|
🤖 This is an automated PR from Repo Assist.
Follow-up to the remaining item from #16386 (Improvement 2, org-name lookup).
Change
infer_scope_for_baselinehand-rolled a 4-steporg/org_name/organization/organization_namelookup chain, duplicatingORG_FIELD_ALIASES(already used intool_rules.rs). This PR:get_first_non_empty_fieldfromtool_rules.rstolabels/helpers.rs(pub(crate), re-exported vialabels),ORG_FIELD_ALIASESinlib.rs,ORG_FIELD_ALIASESfromfield_names::ORGANIZATION_NAME, so that constant is no longer dead code (removes adead_codewarning).No behaviour change: same alias order, same non-empty-string semantics.
Test Status
cargo build: passcargo clippy: no new warnings (pre-existing ones unchanged)cargo test: 723 passed, 0 failed (existing tests cover the alias precedence ininfer_scope_for_baselineandget_first_non_empty_field)cargo fmt --checkreports a pre-existing diff intools.rsunrelated to this change; I left it untouched.Add this agentic workflow to your repo
To install this agentic workflow, run