Convention: saved-query discoverability follows Status — Approved is canon, Pending is a draft

オープン 初心者向け
#6,746 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
sql
領域
backend

調査の方向性

この issue の規約とサーフェス一覧表を、参照されているパス query-browser-resource.component.ts、search-query-catalog.action.ts、MentionAutocomplete.ts とあわせて読みます。ステータスフィルターと記載された例外を現在のコードと照合し、文書化されたルールとサーフェス一覧を正確に保ちます。新しいクエリ一覧表示サーフェスが Approved versus Pending の規約に従えるようになり、却下された権限付与のアプローチが明確に記録されていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Summary

Agents and users can now save queries from a conversation (#6743: a list made in chat saves its SQL as a query so the list can refresh). That makes MJ: Queries a table ordinary users write to, which it wasn't before, and MJ has no written rule about which saved queries are offered to whom.

This issue records the rule we adopted and the three mechanisms that are not the answer, so the next surface that lists queries stays in line.

The convention

Approved means MJ canon; Pending means a draft that belongs to whoever saved it.

  • Approved queries are discoverable by agents, composable into other queries, and surfaced in search and pickers.
  • Pending queries run — a list refreshes from one, and RunQuery only warns on a non-Approved status — but are not offered on shared surfaces.
  • Approval is the owner's act, and it is what promotes a draft into canon.

This matches what already shipped elsewhere: SkillSmith persists AI Skills as Pending for review, and Search Query Catalog is approvedOnly by default.

It is a discovery boundary, not access control. A Pending query is still runnable by anyone who can read the entities it reads (MJQueryEntityExtended.UserCanRun falls through to entity CanRead when a query has no permission rows), and every run is bounded by that user's own field-level security. Nothing about this hides data; it keeps other people's drafts out of lists, pickers and agent context.

Surfaces that must honour it

Checked on next at 1f821e2:

Surface State
Query Browser tree Already defaults 'Pending': false (query-browser-resource.component.ts:179)
Search Query Catalog action Already approvedOnly by default (search-query-catalog.action.ts:44)
Research Agent AVAILABLE_QUERIES Already Status = 'Approved'
Model Development APPROVED_QUERIES Already Status = 'Approved'
Query Strategist REUSABLE_QUERIES Already Reusable = 1 AND Status = 'Approved'
Query Builder ALL_QUERIES Status = 'Approved' OR Status = 'Pending', with SQL — the one exception; narrowed in #6743
#query mention autocomplete No status test at all (MentionAutocomplete.ts:191) — fixed in #6743

Anything new that lists saved queries belongs in this table.

What is not the answer, and why

  • MJ: Query Permissions — role-only (QueryPermissionProvider.SupportedGranteeTypes = ['Role']), and a role list overrides the entity read checks (stored-procedure semantics, MJQueryEntityExtended.UserCanRun step 2). Adding rows to make a query private widens access instead.
  • RLS on MJ: Queries — UserExemptFromRowLevelSecurity (entityInfo.ts:5581) means a user holding any role with an unfiltered Read grant gets no filter at all, so this only works if the unfiltered grant is stripped from every role in every installation. It also wouldn't restrict execution, since server-side query resolution runs as the system user by design.
  • A visibility column on MJ: Query Categories — UserID there is "created by" and NOT NULL, so it can't be repurposed, and a bespoke column would be a third mechanism beside MJ: Resource Permissions (where Queries is already a registered resource type) and the MJ: Search Scope Permissions shape.

If we want real per-principal query permissions

Do it once, as its own piece of work, in the MJ: Search Scope Permissions / proposed MJ: Graph Permissions shape from #6723: a UserID-or-RoleID principal with a PermissionLevel that includes an explicit None deny. That would need an owner column on MJ: Queries (today the entity has only ApprovedByUserID), and it is also the prerequisite for letting a gated action save a draft on a user's behalf — without it, such a query is unattributed in Record Changes and its owner can neither edit, delete nor approve it.

Related

  • #6743 — lists from queries and conversations (first consumer; narrows ALL_QUERIES and the mention list)
  • #6642 — list refresh from a saved view or query
  • #3485 — least-privilege filtering of client-shipped metadata; its item 4 is saved-query SQL. Partly stale: LoadQueryMetadata now defaults off and the provider sends 1=0 item filters for the whole query family (providerBase.ts:1071), so query SQL no longer rides the MJ_Metadata dataset by default
  • #6723 — per-graph permissions; the reference shape for per-principal resource permissions
主要言語
TSQL
スター
32
フォーク
7
平均マージ
1日 16時間
マージ済み PR(30日)
504

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MemberJunction/MJ のほかの issue

MemberJunction/MJ の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。