feat(8205): a System with rulings and no file patterns is flagged
CI & Build / TypeScript typecheck (push) Canceled after 0s
CI & Build / Plugin hooks (push) Canceled after 0s
CI & Build / Python lint (push) Canceled after 0s
CI & Build / Python tests (push) Canceled after 0s
CI & Build / integration (push) Canceled after 0s
CI & Build / Build & push image (push) Canceled after 0s
CI & Build / TypeScript typecheck (push) Canceled after 0s
CI & Build / Plugin hooks (push) Canceled after 0s
CI & Build / Python lint (push) Canceled after 0s
CI & Build / Python tests (push) Canceled after 0s
CI & Build / integration (push) Canceled after 0s
CI & Build / Build & push image (push) Canceled after 0s
Its rulings reach no session: delivery is by path_patterns alone. enter_project carries rulings_undelivered (absent when none) with the fix call, the Systems list reads ruling_count, and the System card says so with a button to name its files. A System without rulings is not flagged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -128,6 +128,12 @@ async def enter_project(project_id: int) -> dict:
|
||||
create it with create_system rather than leaving the area unmodelled. Read
|
||||
a subsystem's accumulated records with list_system_records. Each is id and name; get_system has the charter.
|
||||
|
||||
`rulings_undelivered`, present only when it applies, lists Systems that
|
||||
carry rulings but name no files. A ruling reaches a session when a
|
||||
command or edit touches its System's files, so these rulings reach
|
||||
nobody. Name each area's files with
|
||||
`update_system(id, path_patterns=[...])`, globs from the repo root.
|
||||
|
||||
`platforms` is what the project is built on or ships as
|
||||
— Android app, container image, Go, … — each with how it is known
|
||||
(`declared` by a person, `detected` from a bound repo). They decide which
|
||||
@@ -281,6 +287,7 @@ async def enter_project(project_id: int) -> dict:
|
||||
},
|
||||
"pattern_coverage": coverage_svc.coverage_line(coverage) if coverage else None,
|
||||
"systems": [{"id": s.id, "name": s.name} for s in systems],
|
||||
**_rulings_undelivered(systems),
|
||||
"platforms": platforms,
|
||||
"design_system": design_system,
|
||||
"milestone_summary": milestone_summary,
|
||||
@@ -366,6 +373,25 @@ async def get_project(project_id: int) -> dict:
|
||||
return data
|
||||
|
||||
|
||||
def _rulings_undelivered(systems) -> dict:
|
||||
"""`{"rulings_undelivered": {...}}` when some System's rulings reach no
|
||||
session, else nothing: the key is absent, not empty, so its presence is
|
||||
the signal."""
|
||||
from grimoire.services import system_rulings
|
||||
|
||||
missing = system_rulings.undelivered(systems)
|
||||
if not missing:
|
||||
return {}
|
||||
return {"rulings_undelivered": {
|
||||
"systems": missing,
|
||||
"why": (
|
||||
"A System's rulings are shown when a command or edit touches its "
|
||||
"files. These name no files, so their rulings reach no session."
|
||||
),
|
||||
"fix": "update_system(id, path_patterns=[...]) with the area's files as globs from the repo root",
|
||||
}}
|
||||
|
||||
|
||||
def _inception_choices(design_system_id, seed_systems, platforms=None) -> dict | None:
|
||||
"""The tool args → an inception choices object, or None when no inception
|
||||
arg was given at all (a bare create stays undecided and enter_project
|
||||
|
||||
@@ -11,6 +11,7 @@ from grimoire.services import systems as systems_svc
|
||||
from grimoire.services.access import can_write_project
|
||||
from grimoire.services.projects import get_project_for_user
|
||||
from grimoire.services import system_usage as system_usage_svc
|
||||
from grimoire.services import system_rulings
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -52,6 +53,9 @@ async def list_systems_route(project_id: int):
|
||||
d = s.to_dict()
|
||||
d["open_issue_count"] = counts.get(s.id, 0)
|
||||
d["usage"] = usage.get(s.id, system_usage_svc.empty_system_usage())
|
||||
# Read beside the patterns: rulings and no files means none of them
|
||||
# is ever delivered (`system_rulings.undelivered`).
|
||||
d["ruling_count"] = len(system_rulings.parse_rulings(s.description))
|
||||
out.append(d)
|
||||
return jsonify({"systems": out})
|
||||
|
||||
|
||||
@@ -74,6 +74,25 @@ def parse_rulings(description: str | None) -> list[str]:
|
||||
return out
|
||||
|
||||
|
||||
def undelivered(systems) -> list[dict]:
|
||||
"""The Systems whose rulings reach no session: they carry rulings and
|
||||
name no files, so nothing a session touches falls under them.
|
||||
|
||||
Delivery is by `path_patterns` alone, so such a System's rulings are
|
||||
never shown on an edit or a command, and nothing else says so. A System
|
||||
without rulings has nothing to deliver and is not listed. One entry per
|
||||
System: `{"id", "name", "rulings"}`, rulings being how many.
|
||||
"""
|
||||
out = []
|
||||
for system in systems:
|
||||
if system.path_patterns:
|
||||
continue
|
||||
count = len(parse_rulings(system.description))
|
||||
if count:
|
||||
out.append({"id": int(system.id), "name": system.name, "rulings": count})
|
||||
return out
|
||||
|
||||
|
||||
def _relative(token: str, root: str, cwd_rel: str) -> str:
|
||||
"""`token` as a repo-relative path, or "" when it is not one."""
|
||||
if token.startswith("/"):
|
||||
|
||||
Reference in New Issue
Block a user