Refactor manifest.py into domain-specific modules #163
Reference in New Issue
Block a user
Delete Branch "issue-157-manifest-refactor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #157.
Summary
ManifestErrorand_as_json_objectinto_manifest_util.py— a shared base that breaks the circular-import chainmanifest_git.py—GitEntry,GitUser,_parse_git_gate_config, URL/name validatorsmanifest_egress.py—EGRESS_AUTH_SCHEMES,PipelockRoutePolicy,EgressRoute,EgressConfigmanifest_agent.py—AgentProvider,Agentmanifest.pyshrinks to ~280 lines:Bottle,Manifest, and re-exports of all public names so existing callers (from bot_bottle.manifest import X) are unaffectedChanges (1 commit)
All 867 unit tests pass.
@@ -73,2 +73,3 @@"""Apply PRD 0025 merge rules."""from .manifest import Bottle, GitUser, _validate_egress_routesfrom .manifest import Bottle, GitUserfrom .manifest_egress import _validate_egress_routesThis isn't really private/remove the underscore
@@ -0,0 +15,4 @@EGRESS_AUTH_SCHEMES = ("Bearer", "token")def _is_ip_literal(value: str) -> bool:move this into the main bot-bottle, generic util.
Also kind of surprised there isn't a way to call this function in this way from
ipaddress@@ -0,0 +6,4 @@from dataclasses import dataclass, fieldfrom typing import castfrom ._manifest_util import ManifestError, _as_json_objectnot really private/remove the underscore
@@ -0,0 +9,4 @@"""A manifest file (or the manifest tree) is invalid."""def _as_json_object(value: object, label: str) -> dict[str, object]:also not really private/remove underscore
@@ -0,0 +44,4 @@return (user, host, port, path)def _validate_unique_git_names(bottle_name: str, git: tuple[GitEntry, ...]) -> None:remove underscore
@@ -0,0 +15,4 @@return valuedef _parse_git_upstream(url: str, label: str) -> tuple[str, str, str, str]:remove underscore
@@ -0,0 +180,4 @@return not self.name and not self.emaildef _parse_git_gate_config(remove underscore
5ac6c8199cto8c9d4fbc46