refactor: remove verified unused internals (#6460)
* refactor: remove verified unused internals * test(linear): synchronize webhook shutdown with writer join
This commit is contained in:
1 parent
3230013963
commit
f23a6d1485
105 files changed
+207
-1282
No files matched your search
@@ -45,14 +45,11 @@ class WebUIBundleStatus:
|
||||
|
||||
source_dir: Path
|
||||
dist_dir: Path
|
||||
index_html: Path
|
||||
source_available: bool
|
||||
dist_available: bool
|
||||
stale: bool
|
||||
reason: str
|
||||
newest_source: Path | None = None
|
||||
newest_source_mtime_ns: int | None = None
|
||||
dist_mtime_ns: int | None = None
|
||||
|
||||
@property
|
||||
def needs_build(self) -> bool:
|
||||
@@ -116,7 +113,6 @@ def inspect_webui_bundle(
|
||||
return WebUIBundleStatus(
|
||||
source_dir=resolved_source,
|
||||
dist_dir=resolved_dist,
|
||||
index_html=index_html,
|
||||
source_available=False,
|
||||
dist_available=index_html.is_file(),
|
||||
stale=False,
|
||||
@@ -127,7 +123,6 @@ def inspect_webui_bundle(
|
||||
return WebUIBundleStatus(
|
||||
source_dir=resolved_source,
|
||||
dist_dir=resolved_dist,
|
||||
index_html=index_html,
|
||||
source_available=True,
|
||||
dist_available=False,
|
||||
stale=True,
|
||||
@@ -150,27 +145,21 @@ def inspect_webui_bundle(
|
||||
return WebUIBundleStatus(
|
||||
source_dir=resolved_source,
|
||||
dist_dir=resolved_dist,
|
||||
index_html=index_html,
|
||||
source_available=True,
|
||||
dist_available=True,
|
||||
stale=True,
|
||||
reason="source_newer",
|
||||
newest_source=newest_source,
|
||||
newest_source_mtime_ns=newest_source_mtime_ns,
|
||||
dist_mtime_ns=dist_mtime_ns,
|
||||
)
|
||||
|
||||
return WebUIBundleStatus(
|
||||
source_dir=resolved_source,
|
||||
dist_dir=resolved_dist,
|
||||
index_html=index_html,
|
||||
source_available=True,
|
||||
dist_available=True,
|
||||
stale=False,
|
||||
reason="fresh",
|
||||
newest_source=newest_source,
|
||||
newest_source_mtime_ns=newest_source_mtime_ns,
|
||||
dist_mtime_ns=dist_mtime_ns,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -124,7 +124,6 @@ def _vite_command(runner: str, vite_cli: Path) -> list[str]:
|
||||
def start_webui_dev_server(
|
||||
*,
|
||||
target_url: str,
|
||||
browser_url: str,
|
||||
source_dir: Path | None = None,
|
||||
runner: str | None = None,
|
||||
environ: Mapping[str, str] | None = None,
|
||||
@@ -190,13 +189,11 @@ def start_webui_dev_server(
|
||||
def run_webui_dev_server(
|
||||
*,
|
||||
target_url: str,
|
||||
browser_url: str,
|
||||
output: Callable[[str], None] | None = None,
|
||||
) -> Generator[WebUIDevServer, None, None]:
|
||||
"""Run a Vite sidecar for the duration of a foreground WebUI command."""
|
||||
server = start_webui_dev_server(
|
||||
target_url=target_url,
|
||||
browser_url=browser_url,
|
||||
output=output,
|
||||
)
|
||||
try:
|
||||
|
||||
@@ -361,7 +361,6 @@ def login_oauth_provider(
|
||||
query,
|
||||
oauth_flows=oauth_flows,
|
||||
config_path=config_path,
|
||||
settings_payload=settings_payload,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -178,19 +178,11 @@ def mask_secret_hint(secret: str | None) -> str | None:
|
||||
def _resolve_env_placeholders(value: str | None) -> str | None:
|
||||
if not value:
|
||||
return None
|
||||
missing = False
|
||||
|
||||
def replace(match: re.Match[str]) -> str:
|
||||
nonlocal missing
|
||||
env_value = os.environ.get(match.group(1))
|
||||
if env_value is None:
|
||||
missing = True
|
||||
return ""
|
||||
return env_value
|
||||
return os.environ.get(match.group(1), "")
|
||||
|
||||
resolved = _ENV_REF_RE.sub(replace, value).strip()
|
||||
if missing and not resolved:
|
||||
return None
|
||||
return resolved or None
|
||||
|
||||
|
||||
@@ -1729,7 +1721,6 @@ def login_oauth_provider(
|
||||
*,
|
||||
oauth_flows: WebUIOAuthFlowRegistry,
|
||||
config_path: Path | None,
|
||||
settings_payload: SettingsPayloadBuilder,
|
||||
) -> dict[str, Any]:
|
||||
provider_name = (query_first(query, "provider") or "").strip()
|
||||
if not provider_name:
|
||||
|
||||
@@ -389,13 +389,13 @@ def _coerce_page_limit(limit: int | None) -> int:
|
||||
|
||||
|
||||
def _transcript_turn_at_ordinal(
|
||||
session_key: str, ordinal: int, *, history: HistoryReader,
|
||||
ordinal: int, *, history: HistoryReader,
|
||||
) -> list[dict[str, Any]] | None:
|
||||
return turn_records(history, ordinal) or None
|
||||
|
||||
|
||||
def _select_transcript_page(
|
||||
session_key: str, *, history: HistoryReader, limit: int | None,
|
||||
*, history: HistoryReader, limit: int | None,
|
||||
before: str | None, after: str | None = None, stats: TranscriptReplayStats | None = None,
|
||||
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
|
||||
stats = stats or TranscriptReplayStats()
|
||||
@@ -1302,7 +1302,7 @@ def build_webui_trace_detail_response(
|
||||
return None
|
||||
ordinal = int(match.group("turn"))
|
||||
message_id = match.group("message")
|
||||
turn = _transcript_turn_at_ordinal(session_key, ordinal, history=history)
|
||||
turn = _transcript_turn_at_ordinal(ordinal, history=history)
|
||||
if turn is None:
|
||||
return None
|
||||
turn, _ = _compact_completed_stream_deltas(turn, include_projection_receipts=True)
|
||||
@@ -1762,7 +1762,6 @@ def build_webui_thread_response(
|
||||
"""Return canonical transcript events for the WebUI projector."""
|
||||
replay_stats = stats or TranscriptReplayStats()
|
||||
lines, page = _select_transcript_page(
|
||||
session_key,
|
||||
history=history,
|
||||
limit=limit,
|
||||
before=before,
|
||||
@@ -1919,7 +1918,6 @@ def _history_prompt_summaries(history: HistoryReader) -> _ChunkPromptView:
|
||||
|
||||
|
||||
def _build_prompt_view(
|
||||
session_key: str,
|
||||
*,
|
||||
history: HistoryReader,
|
||||
session_turns_loader: Callable[[], list[_SessionBackfillTurn]] | None = None,
|
||||
@@ -2009,7 +2007,7 @@ def _prompt_view_snapshot(
|
||||
if cached is not None and (not cached.needs_canonical or session_version_loader is not None):
|
||||
_PROMPT_SNAPSHOTS.move_to_end(cache_key)
|
||||
return cached, revision
|
||||
view = _build_prompt_view(session_key, history=history, session_turns_loader=session_turns_loader)
|
||||
view = _build_prompt_view(history=history, session_turns_loader=session_turns_loader)
|
||||
# A caller supplying only messages cannot validate canonical changes, so a
|
||||
# recovered view needs a version loader before it can be reused.
|
||||
if (view.needs_canonical and session_version_loader is None) or revision != read_revision():
|
||||
|
||||
Reference in new issue
Block a user