feat(7833): each moment declares which kinds of record its search may consider, editable in Settings > Moments
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 15s
CI & Build / TypeScript typecheck (push) Successful in 34s
CI & Build / Python tests (push) Failing after 1m35s
CI & Build / integration (push) Successful in 1m58s
CI & Build / Build & push image (push) Skipped

The kind x moment table (services/record_kinds.py):
- every record search fires at a door: the operator message, or a
  catalog moment (work.change for the write path);
- each door considers a set of kinds (snippet, note, lesson, process,
  task:issue/work/spike/plan); a kind left out is never searched there;
- the shipped defaults are today's behaviour; a user's change is stored
  per door, and putting a door back removes it.

Both note arms read it, replacing their fixed kind lists, and a reserved
slot whose kind is turned off is not reserved. The review re-run
searches the same kinds. Settings > Moments shows and edits the table,
with each cell's lines shown and opens from the record ledger.
list_moments returns it as record_kinds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-24 14:24:53 -05:00
co-authored by Claude Opus 5.5
parent b0fab00fe2
commit 9cbdfb205c
17 changed files with 654 additions and 43 deletions
+34
View File
@@ -22,6 +22,7 @@ from grimoire.services import moment_actions as moment_actions_svc
from grimoire.services import moments as moments_svc
from grimoire.services import reply_shapes as shapes_svc
from grimoire.services import record_deliveries as record_deliveries_svc
from grimoire.services import record_kinds as record_kinds_svc
from grimoire.services import rule_adherence as adherence_svc
from grimoire.services import rule_field_judgments as weights_svc
from grimoire.services import rule_moment_judgments as judgments_svc
@@ -259,6 +260,39 @@ async def adherence_route():
))
@retrieval_bp.route("/record-kinds", methods=["GET"])
@login_required
async def record_kinds_route():
"""The kind×moment table: which kinds of record each door's search may
consider, the shipped default beside each, and each cell's lines and
opens over `?days=` (default 30)."""
try:
days = max(1, min(int(request.args.get("days") or 30), 365))
except ValueError:
return jsonify({"error": "days must be a whole number"}), 400
return jsonify(await record_kinds_svc.table(get_current_user_id(), days=days))
@retrieval_bp.route("/record-kinds", methods=["PUT"])
@login_required
async def set_record_kinds_route():
"""Set one door's kinds. Body: `{"door", "kinds": [...]}`, or
`{"door", "kinds": null}` to put the door back to its shipped default.
Answers with the whole table."""
data = await request.get_json(silent=True) or {}
if not isinstance(data, dict) or not isinstance(data.get("door"), str):
return jsonify({"error": "door is required"}), 400
kinds = data.get("kinds")
if kinds is not None and (
not isinstance(kinds, list) or not all(isinstance(k, str) for k in kinds)
):
return jsonify({"error": "kinds must be a list of kinds, or null"}), 400
try:
return jsonify(await record_kinds_svc.set_kinds(get_current_user_id(), data["door"], kinds))
except ValueError as e:
return jsonify({"error": str(e)}), 400
@retrieval_bp.route("/record-reach", methods=["GET"])
@login_required
async def record_reach_route():