Skip to content

DSPX 3382 mlkem scenarios#463

Draft
dmihalcik-virtru wants to merge 3 commits into
DSPX-3302-05-claude-pluginfrom
DSPX-3382-mlkem-scenarios
Draft

DSPX 3382 mlkem scenarios#463
dmihalcik-virtru wants to merge 3 commits into
DSPX-3302-05-claude-pluginfrom
DSPX-3382-mlkem-scenarios

Conversation

@dmihalcik-virtru
Copy link
Copy Markdown
Member

@dmihalcik-virtru dmihalcik-virtru commented May 29, 2026

  • feat(otdf-sdk-mgr): manage platform service + install scenario (DSPX-3302)
  • fix(otdf-sdk-mgr): repair install scenario + harden silent failures
  • style(otdf-sdk-mgr): ruff format
  • refactor(otdf-sdk-mgr): address PR review feedback on platform installer
  • docs+chore: require uv run ruff/pyright pre-commit; fix cli_scenario typing
  • docs(agents): expand and reorganize AGENTS.md across packages
  • feat(otdf-sdk-mgr): install tip --ref for branches, PRs, and SHAs
  • fixup addd platform source to gitignore
  • fix(otdf-sdk-mgr): normalize only semver tail for immutable platform refs
  • fix(otdf-sdk-mgr): address PR review critical issues
  • fix(otdf-sdk-mgr): tighten error handling and dedupe APIs
  • test(otdf-sdk-mgr): cover mutable-rebuild, PR refspec, registry
  • feat(otdf-local): multi-instance test environments (DSPX-3302)
  • feat(xtest): --scenario and --instance flags for conftest (DSPX-3302)
  • feat(.claude): bug-repro plugin for OpenTDF (DSPX-3302)
  • refactor(.claude): generalize scenario-from-bug-report → scenario-from-ticket (DSPX-3302)
  • feat(.claude): feature-design skill for cross-repo features (DSPX-3302)
  • fix(.claude): allow Skill tool + correct acli comment list syntax (DSPX-3302)
  • feat(otdf-sdk-mgr): schema dump CLI + xtest/schema canonical JSON Schemas (DSPX-3302)
  • fixup play nicer with claude code permissions model
  • fixup better skill descriptions
  • fixup(scenario-from-ticket): shorten description to trigger condition only
  • feat(xtest): Adds pure mlkem test scenarios
  • fixup: adds scneario file

Stack (a60d3302):

Generated by wgo stack. Edit text above or below this block, not inside it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9a924dfe-c4de-4286-8346-47757e0db3ed

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch DSPX-3382-mlkem-scenarios

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

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

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 implements a multi-instance test harness refactor, enabling concurrent local platform and KAS instances on disjoint port ranges, alongside Claude agent skills for scenario and feature design. It also adds support for pure ML-KEM key wrapping (mlkem:768 and mlkem:1024) and allows installing platform binaries at specific git refs using git worktrees. The review feedback highlights opportunities to improve robustness, such as handling missing git executables or network errors during remote tag queries, verifying worktree paths exist before setting them as working directories, removing redundant git fetch operations, and consistently specifying encoding="utf-8" on file read/write operations to avoid platform-dependent decoding issues.

from git import Git

results: list[dict[str, Any]] = []
raw = Git().ls_remote(SDK_GIT_URLS["platform"], tags=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

If git is not installed on the system, or if there is a network outage, Git().ls_remote will raise git.exc.GitCommandNotFound or git.exc.GitCommandError. These exceptions are not caught in cli_versions.py (which only catches RegistryUnreachableError), leading to an unhandled traceback and crash. We should wrap the Git().ls_remote call in a try...except block and raise RegistryUnreachableError.

Suggested change
raw = Git().ls_remote(SDK_GIT_URLS["platform"], tags=True)
from git.exc import GitCommandError, GitCommandNotFound
try:
raw = Git().ls_remote(SDK_GIT_URLS["platform"], tags=True)
except GitCommandNotFound as e:
raise RegistryUnreachableError(f"git executable not found: {e}") from e
except GitCommandError as e:
raise RegistryUnreachableError(f"failed to query remote git platform tags: {e}") from e

Comment on lines +74 to +80
worktree = binary.parent
version_file = binary.parent / ".version"
if version_file.exists():
for line in version_file.read_text().splitlines():
if line.startswith("worktree="):
worktree = Path(line.split("=", 1)[1].strip())
break
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

If the repository has been moved to another location on disk, the absolute path recorded in .version will point to a non-existent directory. Setting cwd=worktree in subprocess.run or ProcessManager.start will then crash with a FileNotFoundError. We should check if the candidate worktree path exists before using it, falling back to binary.parent if it doesn't. Also, read_text() should specify encoding="utf-8".

Suggested change
worktree = binary.parent
version_file = binary.parent / ".version"
if version_file.exists():
for line in version_file.read_text().splitlines():
if line.startswith("worktree="):
worktree = Path(line.split("=", 1)[1].strip())
break
worktree = binary.parent
version_file = binary.parent / ".version"
if version_file.exists():
for line in version_file.read_text(encoding="utf-8").splitlines():
if line.startswith("worktree="):
candidate = Path(line.split("=", 1)[1].strip())
if candidate.exists():
worktree = candidate
break

Comment on lines +72 to +78
worktree = binary.parent # safe fallback
version_file = binary.parent / ".version"
if version_file.exists():
for line in version_file.read_text().splitlines():
if line.startswith("worktree="):
worktree = Path(line.split("=", 1)[1].strip())
break
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

If the repository has been moved to another location on disk, the absolute path recorded in .version will point to a non-existent directory, causing a crash when setting cwd=worktree. We should check if the candidate worktree path exists before using it, falling back to binary.parent if it doesn't. Also, read_text() should specify encoding="utf-8".

Suggested change
worktree = binary.parent # safe fallback
version_file = binary.parent / ".version"
if version_file.exists():
for line in version_file.read_text().splitlines():
if line.startswith("worktree="):
worktree = Path(line.split("=", 1)[1].strip())
break
worktree = binary.parent # safe fallback
version_file = binary.parent / ".version"
if version_file.exists():
for line in version_file.read_text(encoding="utf-8").splitlines():
if line.startswith("worktree="):
candidate = Path(line.split("=", 1)[1].strip())
if candidate.exists():
worktree = candidate
break

Comment on lines +91 to +94
# Worktrees from a bare clone have no `origin` remote, so reset
# to the just-fetched ref in the bare repo instead of `git pull`.
_run(["git", "-C", str(worktree_path), "fetch", "origin", branch])
_run(["git", "-C", str(worktree_path), "reset", "--hard", "FETCH_HEAD"])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The comment states that worktrees from a bare clone have no origin remote, but the code immediately runs git fetch origin. Since the bare repository has already fetched the updates (at line 72), the ref is already updated in the shared database. Running git fetch again inside the worktree is redundant and slow. We can simplify this by resetting directly to the branch.

Suggested change
# Worktrees from a bare clone have no `origin` remote, so reset
# to the just-fetched ref in the bare repo instead of `git pull`.
_run(["git", "-C", str(worktree_path), "fetch", "origin", branch])
_run(["git", "-C", str(worktree_path), "reset", "--hard", "FETCH_HEAD"])
# Worktrees from a bare clone share the bare repo's database, so we
# reset to the bare repo's just-fetched ref instead of fetching again.
_run(["git", "-C", str(worktree_path), "reset", "--hard", branch])

Comment on lines +159 to +160
_run(["git", f"--git-dir={bare_repo_path}", "fetch", "origin", ref, "--tags"])
_run(["git", "-C", str(worktree_path), "checkout", "--force", "FETCH_HEAD"])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The bare repository has already fetched the updates (at line 140 or 145). Running git fetch again is redundant and slow. We can simplify this by checking out the ref directly.

Suggested change
_run(["git", f"--git-dir={bare_repo_path}", "fetch", "origin", ref, "--tags"])
_run(["git", "-C", str(worktree_path), "checkout", "--force", "FETCH_HEAD"])
_run(["git", "-C", str(worktree_path), "checkout", "--force", ref])

from ruamel.yaml import YAML

y = YAML(typ="safe")
raw = y.load(scenario_path.read_text())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

read_text() is called without specifying an encoding, which can lead to platform-dependent decoding errors (e.g., on Windows). It is safer to specify encoding="utf-8".

Suggested change
raw = y.load(scenario_path.read_text())
raw = y.load(scenario_path.read_text(encoding="utf-8"))

print(f" Warning: {msg} (will retry at runtime)")
raise InstallError(msg)
dist_dir.mkdir(parents=True, exist_ok=True)
(dist_dir / ".version").write_text(f"{module}@{tag}\n")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

write_text() is called without specifying an encoding, which can lead to platform-dependent encoding errors. It is safer to specify encoding="utf-8".

Suggested change
(dist_dir / ".version").write_text(f"{module}@{tag}\n")
(dist_dir / ".version").write_text(f"{module}@{tag}\n", encoding="utf-8")

def _record_version(dist_dir: Path, ref: str, worktree: Path) -> None:
"""Write a `.version` metadata file alongside the binary."""
sha = _git_rev_parse(worktree, "HEAD")
(dist_dir / ".version").write_text(f"ref={ref}\nsha={sha}\nworktree={worktree}\n")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

write_text() is called without specifying an encoding, which can lead to platform-dependent encoding errors. It is safer to specify encoding="utf-8".

Suggested change
(dist_dir / ".version").write_text(f"ref={ref}\nsha={sha}\nworktree={worktree}\n")
(dist_dir / ".version").write_text(f"ref={ref}\nsha={sha}\nworktree={worktree}\n", encoding="utf-8")

subprocess.CalledProcessError,
OSError,
) as e:
out.write_text(json.dumps(_snapshot(status="partial"), indent=2) + "\n")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

write_text() is called without specifying an encoding, which can lead to platform-dependent encoding errors. It is safer to specify encoding="utf-8".

Suggested change
out.write_text(json.dumps(_snapshot(status="partial"), indent=2) + "\n")
out.write_text(json.dumps(_snapshot(status="partial"), indent=2) + "\n", encoding="utf-8")

typer.echo(f" Wrote partial manifest to {out}", err=True)
raise typer.Exit(1)

out.write_text(json.dumps(_snapshot(), indent=2) + "\n")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

write_text() is called without specifying an encoding, which can lead to platform-dependent encoding errors. It is safer to specify encoding="utf-8".

Suggested change
out.write_text(json.dumps(_snapshot(), indent=2) + "\n")
out.write_text(json.dumps(_snapshot(), indent=2) + "\n", encoding="utf-8")

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

X-Test Failure Report

1 similar comment
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

X-Test Failure Report

@dmihalcik-virtru dmihalcik-virtru force-pushed the DSPX-3382-mlkem-scenarios branch 2 times, most recently from 3601aa4 to b12abe7 Compare June 2, 2026 17:46
@dmihalcik-virtru dmihalcik-virtru force-pushed the DSPX-3302-05-claude-plugin branch from d787998 to ad4b4a3 Compare June 2, 2026 17:46
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

X-Test Failure Report

dmihalcik-virtru and others added 3 commits June 2, 2026 13:47
Scenario YAML files can now configure KAS preview settings via the
features dict, avoiding manual edits to generated opentdf.yaml files
that don't persist through service restarts.

- Documents KasPin.features field with open-ended description for
  forward compatibility with new platform preview settings
- Updates pure-mlkem scenario to enable hybrid_tdf_enabled for ML-KEM
- Adds FEATURES.md guide with examples and precedence rules
- Regenerates JSON schemas from Pydantic models

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@dmihalcik-virtru dmihalcik-virtru force-pushed the DSPX-3382-mlkem-scenarios branch from b12abe7 to 7ec8c8c Compare June 2, 2026 17:47
@dmihalcik-virtru dmihalcik-virtru force-pushed the DSPX-3302-05-claude-plugin branch from ad4b4a3 to 256b593 Compare June 2, 2026 17:47
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

X-Test Failure Report

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 2, 2026

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

X-Test Failure Report

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