Skip to content

[Repo Assist] rust-guard: reuse ORG_FIELD_ALIASES in infer_scope_for_baseline - #16527

Merged
lpcox merged 1 commit into
mainfrom
repo-assist/improve-org-alias-dedupe-954f84a9c32b7705
Nov 14, 2026
Merged

lpcox merged 1 commit into
mainfrom
repo-assist/improve-org-alias-dedupe-954f84a9c32b7705

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 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_baseline hand-rolled a 4-step org / org_name / organization / organization_name lookup chain, duplicating ORG_FIELD_ALIASES (already used in tool_rules.rs). This PR:

  • moves get_first_non_empty_field from tool_rules.rs to labels/helpers.rs (pub(crate), re-exported via labels),
  • uses it with ORG_FIELD_ALIASES in lib.rs,
  • builds ORG_FIELD_ALIASES from field_names::ORGANIZATION_NAME, so that constant is no longer dead code (removes a dead_code warning).

No behaviour change: same alias order, same non-empty-string semantics.

Test Status

  • cargo build: pass
  • cargo clippy: no new warnings (pre-existing ones unchanged)
  • cargo test: 723 passed, 0 failed (existing tests cover the alias precedence in infer_scope_for_baseline and get_first_non_empty_field)
  • Note: cargo fmt --check reports a pre-existing diff in tools.rs unrelated to this change; I left it untouched.

Generated by Repo Assist · copilot · routed: sonnet55 high · ~63 AIC · ⊞ 9.5K · ◷
Comment /repo-assist to run again

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@851905c06e905bf362a9f6cc54f912e3df747d55

@lpcox
lpcox marked this pull request as ready for review November 14, 2026 20:46
Copilot AI adaptive review requested due to automatic review settings November 14, 2026 20:46

Copilot AI 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.

🟢 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_field into shared label helpers and re-exports it for crate-wide use.
  • Updates baseline scope inference to use ORG_FIELD_ALIASES and 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)

@github-actions

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — default

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default AWF (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads data returned ALLOWED ✅
B MCP writes (reaction/star/issue/comment/branch/file/PR) all 6 targets absent from 23-tool catalog (unknown tool, -32602) BLOCKED ⚠️
C CLI reads data returned ALLOWED ✅
D CLI REST writes not attempted — gh unauthenticated BLOCKED ⚠️
E CLI GraphQL mutations not attempted — gh unauthenticated BLOCKED ⚠️

Overall: INCONCLUSIVE
(⚠️ Part B: add_issue_comment, star_repository, issue_write, create_branch, create_or_update_file, create_pull_request are all absent from the gh-aw tools.github: catalog — gh-aw's own GITHUB_READ_ONLY=1 wrapper means write tools never reach the backend, so this run cannot independently confirm mcpg's own gateway-level write-blocking layer. ⚠️ Parts D/E: gh auth status shows not logged in, so the proxied-CLI/GraphQL write boundary could not be exercised this run.)

No write leaked on any surface — all read probes (Parts A, C) succeeded as expected.

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@lpcox
lpcox merged commit cb2391a into main Nov 14, 2026
28 checks passed
@lpcox
lpcox deleted the repo-assist/improve-org-alias-dedupe-954f84a9c32b7705 branch November 14, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants