1
0
Fork 0
Code Issues Pull requests Projects Releases 2 Packages Wiki Activity Actions Pages

Preserve no-AST adapter bindings

This commit is contained in:
Andraxion 2026-07-29 02:59:15 -04:00
parent bb13258861
commit 6c05607b14
7 changed files with 209 additions and 13 deletions

View file

@ -107,8 +107,9 @@ def _status(
class ProjectIndex:
"""A disposable index that always checks current canonical source before queries."""
def __init__(self, project: ProjectService) -> None:
def __init__(self, project: ProjectService, *, allow_logic: bool = True) -> None:
self.project = project
self.allow_logic = allow_logic
self._verified_index_signature: tuple[int, int, int, int, int] | None = None
@property
@ -391,7 +392,16 @@ class ProjectIndex:
def _logic_projections(self) -> tuple[LogicProjection, ...]:
if isinstance(self.project, LogicProject):
return self.project.logic_projections()
projections = self.project.logic_projections()
if projections and not self.allow_logic:
raise DocForgeError(
"adapter_policy_forbids_logic",
(
"This index preserves a no-AST adapter and refuses function-Logic "
"publication"
),
)
return projections
return ()
def check(self, *, verify_rows: bool = True) -> dict[str, object]: