Establish Milestone 0 compatibility and quality gates
This commit is contained in:
parent
15a913003c
commit
8ebb78a71d
15 changed files with 1114 additions and 27 deletions
|
|
@ -393,17 +393,21 @@ class ProjectIndex:
|
|||
def _logic_projections(self) -> tuple[LogicProjection, ...]:
|
||||
if isinstance(self.project, LogicProject):
|
||||
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"
|
||||
),
|
||||
)
|
||||
self._require_logic_allowed(len(projections))
|
||||
return projections
|
||||
return ()
|
||||
|
||||
def _require_logic_allowed(self, projection_count: int) -> None:
|
||||
if projection_count and not self.allow_logic:
|
||||
raise DocForgeError(
|
||||
"adapter_policy_forbids_logic",
|
||||
(
|
||||
"This index preserves a no-AST adapter and refuses function-Logic "
|
||||
"publication or retrieval"
|
||||
),
|
||||
logic_projection_count=projection_count,
|
||||
)
|
||||
|
||||
def check(self, *, verify_rows: bool = True) -> dict[str, object]:
|
||||
if isinstance(self.project, IncrementalStateProject):
|
||||
state = self.project.incremental_state()
|
||||
|
|
@ -491,6 +495,14 @@ class ProjectIndex:
|
|||
raise DocForgeError(
|
||||
"stale_index", "Derived index does not match canonical source", field=key
|
||||
)
|
||||
try:
|
||||
logic_projection_count = int(metadata["logic_projection_count"])
|
||||
except (KeyError, ValueError) as error:
|
||||
raise DocForgeError(
|
||||
"invalid_index",
|
||||
"Derived index has invalid Logic metadata",
|
||||
) from error
|
||||
self._require_logic_allowed(logic_projection_count)
|
||||
current_signature = self._index_signature()
|
||||
if not verify_rows and (
|
||||
current_signature == self._verified_index_signature or self._attestation_matches()
|
||||
|
|
@ -503,7 +515,7 @@ class ProjectIndex:
|
|||
"edge_hash": metadata["edge_hash"],
|
||||
"edge_count": int(metadata["edge_count"]),
|
||||
"logic_hash": metadata["logic_hash"],
|
||||
"logic_projection_count": int(metadata["logic_projection_count"]),
|
||||
"logic_projection_count": logic_projection_count,
|
||||
"logic_node_count": int(metadata["logic_node_count"]),
|
||||
"logic_edge_count": int(metadata["logic_edge_count"]),
|
||||
"status": "ok",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue