Critical #60/#61 untrusted checkout: publish-containers.yml prepare runs for workflow_run only when the triggering run succeeded, was a push and came from this repository; build and merge need prepare, so the guard covers both checkouts. Mark stable commit triggers only on push of v* tags, schedule and workflow_dispatch are unchanged. Medium #55/#56: update-flake-lock.yml pins nix-installer-action v23 and update-flake-lock v29 to commit SHAs. High: secret_service_token returns only the token and raises SecretServiceUnavailable with the same reasons, _forge_access builds the token/reason pair (#62); jinja2 select_autoescape for html/htm/xml only, scaffolding output byte-identical (#29); chmod 0o755 to 0o700 for owner-run scripts in ink.py and 7 test sites; exact URL equality in a mirror probe test. Error #33: raise unittest.SkipTest from exc. Notes: empty-except to contextlib.suppress, one import form per module, unused variable, commented-out code, assertNotIn. | 🌿 Branch | 📊 Diff stat | 🎯 Fix | 💥 Break | 💸 Tokens | ⏱️ Velocity | 🛡️ Security | 🏆 Score | Gate | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | fix/codeql-alerts | 28 files +92/-81 | 90 % | 3 % | – | – | 100 % | 87 | ✅ 90/5, tokens and velocity <= 100, security 100 % | Evidence: tests/unit + tests/integration 880 passed, 574 subtests; 2 test_publish_integration failures are identical on a clone without these changes (global tag.gpgsign, sandbox blocks gpg). ruff and actionlint clean, MEDUSA 100 % critical 0 (1 accepted keyword false positive). Operator choice 7589a6f1 (swarm), operator review dcc2f461. Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
from __future__ import annotations
|
|
|
|
import importlib
|
|
import io
|
|
import unittest
|
|
from contextlib import redirect_stdout
|
|
from types import SimpleNamespace
|
|
from unittest.mock import patch
|
|
|
|
|
|
class TestIntegrationReposCreatePreview(unittest.TestCase):
|
|
def test_repos_create_preview_wires_create_repo(self) -> None:
|
|
# Import lazily to avoid hard-failing if the CLI module/function name differs.
|
|
try:
|
|
repos_mod = importlib.import_module("pkgmgr.cli.commands.repos")
|
|
except ImportError as exc:
|
|
raise unittest.SkipTest(f"CLI module not available: {exc}") from exc
|
|
|
|
handle = getattr(repos_mod, "handle_repos_command", None)
|
|
if handle is None:
|
|
self.skipTest("handle_repos_command not found in pkgmgr.cli.commands.repos")
|
|
|
|
ctx = SimpleNamespace(
|
|
repositories_base_dir="/tmp/Repositories",
|
|
binaries_dir="/tmp/bin",
|
|
all_repositories=[],
|
|
config_merged={
|
|
"directories": {"repositories": "/tmp/Repositories"},
|
|
"repositories": [],
|
|
},
|
|
user_config_path="/tmp/user.yml",
|
|
)
|
|
|
|
args = SimpleNamespace(
|
|
command="create",
|
|
identifiers=["github.com/acme/repo"],
|
|
remote=False,
|
|
preview=True,
|
|
)
|
|
|
|
out = io.StringIO()
|
|
with (
|
|
redirect_stdout(out),
|
|
patch("pkgmgr.cli.commands.repos.create_repo") as create_repo,
|
|
):
|
|
handle(args, ctx, selected=[])
|
|
|
|
create_repo.assert_called_once()
|
|
called = create_repo.call_args.kwargs
|
|
self.assertEqual(called["remote"], False)
|
|
self.assertEqual(called["preview"], True)
|
|
self.assertEqual(create_repo.call_args.args[0], "github.com/acme/repo")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|