build_tools.syllable_walk_web.api.walker_common
Shared stateless helper functions for walker API handlers.
This module contains request-coercion and comparison helpers that do not need
filesystem access or mutation side effects. It exists to reduce the size and
cognitive load of api/walker.py while preserving existing endpoint
contracts.
Functions
|
Return |
|
Map reach-cache read outcomes to verification status and reason. |
|
Resolve request |
|
Coerce one optional integer constraint from request payload. |
|
Compute Patch A/B manifest-hash relation and policy signal. |
Module Contents
- build_tools.syllable_walk_web.api.walker_common.is_sha256_hex(value)[source]
Return
Truewhen value is a lowercase 64-character SHA-256 hash.
- build_tools.syllable_walk_web.api.walker_common.reach_cache_verification_from_read(*, cache_status, cache_message, input_hash, output_hash)[source]
Map reach-cache read outcomes to verification status and reason.
This preserves the user-facing semantics consumed by the Walker UI: - cache hit + valid hashes =>
verified- cache hit + missing hashes =>error- invalid/miss/none/error map to deterministic reason strings
- build_tools.syllable_walk_web.api.walker_common.resolve_patch_state(body, state)[source]
Resolve request
patchto("a"|"b", PatchState).- Parameters:
body (dict[str, Any]) – Request payload that may include
patch.state (build_tools.syllable_walk_web.state.ServerState) – Global server state containing patch A and patch B.
- Returns:
Tuple of
(patch_key, patch_state)when valid; otherwiseNone.- Return type:
tuple[str, build_tools.syllable_walk_web.state.PatchState] | None
- build_tools.syllable_walk_web.api.walker_common.coerce_optional_constraint_int(body, field_name, *, default)[source]
Coerce one optional integer constraint from request payload.
Semantics: - Missing field: use provided
default. - Explicitnull: disable this constraint (returnNone). - Provided value: coerce tointor return deterministic error.