Files
rengine/reports/sections/endpoints/section.py
T
Yogesh OjhaandClaude Fable 5.1 0a69f3201c copy: state the fact, delete the explanation
Repo-wide sweep of every user-facing string: frontend components, routes,
config and stores; API details and route docs; shared definitions and
models; stage config help; report prose; MCP, toolbox, interest and
connector text; notification and worker messages.

Descriptions that explained, reassured, justified or restated their title
are deleted. Confirm dialogs name what is removed and stop. Failed actions
read "<Noun> not <verbed>", successes "<Noun> <verbed>". No reader address,
no product-as-subject, no em-dashes or parentheticals in prose.

Mirrors updated on both sides: EPSS band help, compare refusal reasons,
interest labels. Four tests asserting on old wording follow the new text.
The rules are condensed into CLAUDE.md under Writing.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SK5o8xR96cbSnAfjYSTPSe
2026-09-12 11:35:07 +05:30

54 lines
2.0 KiB
Python

from __future__ import annotations
from reports.base import RenderContext, Section
from reports.config import SectionConfig, flag, limit
from shared.definitions.endpoints import STATIC_CLASSES
from shared.definitions.reports import SectionGroup
from shared.definitions.surface import SurfaceDimension
_INTEREST = ("admin", "auth", "api_doc", "debug_endpoint", "infra", "upload", "secret")
class EndpointsConfig(SectionConfig):
notable_only: bool = flag(
True,
title="Only notable paths",
description="Administrative, authentication, API and debug paths.",
)
hide_static: bool = flag(True, title="Hide static files")
only_answering: bool = flag(True, title="Only paths that answered")
max_rows: int = limit(60, title="Rows shown", minimum=5, maximum=2000)
show_params: bool = flag(True, title="Show parameter names")
class EndpointsSection(Section):
name = "endpoints"
title = "Endpoints"
description = "Administrative, authentication, API and debug paths."
group = SectionGroup.SURFACE.value
order = 30
launch_fields = frozenset({"max_rows"})
requires = frozenset({SurfaceDimension.ENDPOINTS.value})
config_model = EndpointsConfig
def build(self, ctx: RenderContext, cfg: EndpointsConfig) -> dict | None:
rows = ctx.data.endpoint_rows
if cfg.hide_static:
rows = [e for e in rows if e.endpoint_class not in STATIC_CLASSES]
if cfg.only_answering:
rows = [e for e in rows if e.status]
if cfg.notable_only:
rows = [e for e in rows if set(e.interest or []) & set(_INTEREST)]
if not rows:
return None
rows = sorted(rows, key=lambda e: (e.host, e.path))
total = len(rows)
return {
"rows": rows[: cfg.max_rows],
"total": total,
"hidden": max(0, total - cfg.max_rows),
"show_params": cfg.show_params,
"notable_only": cfg.notable_only,
"all_endpoints": ctx.data.count_of(SurfaceDimension.ENDPOINTS.value),
}