breg: serve each profile's writable inputs in the Action metadata

Offen
#2,720 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
54/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
rust

Rechercherichtung

Start with the proposals.actions[] inventory in crates/registry-breg/src/api/mod.rs:761 and the per-profile metadata entry in crates/registry-breg/src/artifacts.rs:1304; trace how compiled permissions supply readable inputs and writable inputs. Then inspect the Rust client metadata, crates/registry-breg-client-node/client.d.ts, the Python binding, and the Proposals docs and metadata schema. Done means the acceptance cases pass for explicit, default, and empty writable input lists, and all three clients expose the field with type tests.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Problem

A Proposal grant can restrict a profile to a list of writableInputs. The engine compiles the list and enforces it: an Edit, Revise, Rebase or Start that changes any other input is refused. The metadata never serves the list. A client cannot tell a fixed input from an editable one, so a form lets people change fields the server will then refuse. The person finds out only after submitting.

Evidence

All line numbers are on origin/main at 36d25ef652.

  • crates/registry-breg/src/contract.rs:715: writable_inputs: Option<UniqueSet<String>> on the grant source. Absent means every declared input is writable.
  • crates/registry-breg/src/model.rs:578: the compiled writable_inputs: Option<BTreeSet<String>> on CompiledProposalPermission.
  • crates/registry-breg/src/immediate_actions.rs:2912 to :2939: package validation of the list.
  • crates/registry-breg/src/mutation/proposal.rs:130 to :156 (validate_input_write_authority) refuses a value outside the list. It is called at :1180 (Start) and :1489.
  • crates/registry-breg/src/mutation/proposal.rs:590: the list is part of the request digest contract, so it is already treated as part of the public response contract.
  • crates/registry-breg/src/api/mod.rs:761 to :780: the proposals.actions[] inventory serves actionId, accessProfile, operations, readableInputs and readableContextFields. It has no writable member.
  • crates/registry-breg-client-node/client.d.ts:497 to :503 (BRegProposalActionDescriptor) and crates/registry-breg-client/src/metadata.rs:966 to :981 carry readableInputs only. The Python binding follows the Rust client (crates/registry-breg-client-py/src/lib.rs:1527).
  • Documented behaviour: docs/site/src/content/docs/configure/breg-proposals.mdx:133 to :172 says a grant without writableInputs leaves every input writable.

Proposed change

  1. Add writableInputs to each proposals.actions[] entry, for profiles whose operations include Start, Edit, Revise or Rebase. Absent grant list serves the full set of declared inputs, so the member is always present and a client does not need to know the default rule. Serve an empty list for profiles that cannot write.
  2. Also serve it in the per-profile Action description (public_action_metadata_entry, crates/registry-breg/src/artifacts.rs:1304) where a profile can start the Action.
  3. Add the member to the Rust client, the Node client types and the Python binding. This is an additive response member, so it relies on the client tolerance work in #1945.
  4. Update the Proposals configuration page and the metadata schema.

Acceptance

  • A test shows a grant with writableInputs: [a] serves ["a"], and a grant without the key serves every declared input.
  • A test shows a reader serves an empty list.
  • The Rust, Node and Python clients expose the member, with type tests.
  • A client form built from the metadata cannot offer an input that the server refuses.
Vorherrschende Sprache
Rust
Sterne
2
Forks
0
Ø Merge
9 Std. 48 Min.
Gemergte PRs (30 T.)
151

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus registrystack/registry-stack

Alle Issues in registrystack/registry-stack

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.