Skip to content

chore(tui): document non-interactive validation path#15

Merged
ProfRandom92 merged 8 commits into
mainfrom
feat/evidence-event-serialization
Jul 8, 2026
Merged

chore(tui): document non-interactive validation path#15
ProfRandom92 merged 8 commits into
mainfrom
feat/evidence-event-serialization

Conversation

@ProfRandom92

Copy link
Copy Markdown
Owner

Summary:

  • Aligns evidence terminology with the implemented state log chain model.
  • Removes stale Merkle/Merkle-like wording from docs, skills, and schema descriptions.
  • Replaces an interactive TUI dry-run validation step with a headless pytest-based validation path.

Changed files:

  • SKILL.md
  • evidence-chain.md
  • ANTIGRAVITY_CLI_WORKFLOW.md
  • LOCAL_V0_WORKSPACE_README.md
  • evidence-state-log-entry.v0.schema.json

Validation:

  • git show --check
  • git grep check for Merkle occurrences
  • python -m pytest
  • git diff --check

Risk:
Low. Documentation and schema-description alignment only; no runtime behavior changes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces local state log chains and evidence event verification, replacing the previous Merkle tree concept. It adds new JSON schemas, updates the CLI and TUI to support file-based verification, implements pattern and minItems validation, and includes comprehensive tests. The review feedback highlights a critical bug in pattern matching where re.match should be replaced with re.search to align with JSON Schema specifications. Additionally, the feedback suggests enforcing a minimum of one entry in state log chains to match schema constraints, cleaning up an inline import in the status screen, and strengthening the evidence event schema with pattern constraints for hashes.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +46 to +49
if "pattern" in schema and isinstance(instance, str):
import re
if not re.match(schema["pattern"], instance):
raise ValueError(f"{location} does not match pattern {schema['pattern']}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In JSON Schema, the pattern keyword is not implicitly anchored (it behaves as a partial match unless explicitly anchored with ^ and $). Using Python's re.match restricts the match to the beginning of the string, which can cause valid JSON instances to fail validation if the pattern is not anchored but matches later in the string. Using re.search is the correct way to implement JSON Schema pattern matching in Python.

Suggested change
if "pattern" in schema and isinstance(instance, str):
import re
if not re.match(schema["pattern"], instance):
raise ValueError(f"{location} does not match pattern {schema['pattern']}")
if "pattern" in schema and isinstance(instance, str):
import re
if not re.search(schema["pattern"], instance):
raise ValueError(f"{location} does not match pattern {schema['pattern']}")

Comment on lines +147 to +149
def verify_state_log_chain(entries: list[dict[str, Any]]) -> dict[str, Any]:
"""Verify sequence, previous state hashes, git commit refs, and content hashes in a state log chain."""
previous_hash = GENESIS_HASH

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The schema schemas/evidence-state-log.v0.schema.json defines a minItems constraint of 1 for the state log array. However, verify_state_log_chain currently accepts an empty list of entries and returns {"ok": True}. To ensure consistency between schema validation and cryptographic verification, we should explicitly reject empty state log chains.

def verify_state_log_chain(entries: list[dict[str, Any]]) -> dict[str, Any]:
    """Verify sequence, previous state hashes, git commit refs, and content hashes in a state log chain."""
    if not entries:
        return {"ok": False, "error": "state log chain must contain at least one entry"}
    previous_hash = GENESIS_HASH

Comment on lines +58 to +61
state_log_path = repo_root / "examples/workspace/evidence-state-log.sample.json"
from modules.evidence.evidence import verify_file_state_log
state_log_res = verify_file_state_log(filepath=state_log_path)
evidence_ok = bool(evidence_res.get("ok")) and bool(state_log_res.get("ok"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The inline import of verify_file_state_log is unnecessary and can be moved to the top of the file alongside other imports from modules.evidence.evidence (such as verify_sample_evidence on line 9) to keep the imports clean and consistent with modules/cli/tui.py.

Suggested change
state_log_path = repo_root / "examples/workspace/evidence-state-log.sample.json"
from modules.evidence.evidence import verify_file_state_log
state_log_res = verify_file_state_log(filepath=state_log_path)
evidence_ok = bool(evidence_res.get("ok")) and bool(state_log_res.get("ok"))
state_log_path = repo_root / "examples/workspace/evidence-state-log.sample.json"
state_log_res = verify_file_state_log(filepath=state_log_path)
evidence_ok = bool(evidence_res.get("ok")) and bool(state_log_res.get("ok"))

Comment on lines +24 to +29
},
"previous_hash": {
"type": "string"
},
"hash": {
"type": "string"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To make the schema validation more robust and consistent with evidence-state-log-entry.v0.schema.json, we should add a regex pattern constraint to enforce that previous_hash and hash are valid 64-character hexadecimal strings.

    "previous_hash": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{64}$"
    },
    "hash": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{64}$"
    }

@ProfRandom92 ProfRandom92 merged commit 0d7585e into main Jul 8, 2026
6 checks passed
@ProfRandom92 ProfRandom92 deleted the feat/evidence-event-serialization branch July 8, 2026 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant