Repository navigation
fix(engine): one version helper, locked tool pins and proven-dead members - #205
Merged
Merged
Conversation
…ven-dead members The engine looked up the distribution "strix-agent", which no build of this project installs. pyproject.toml names the package lyrashield-engine, so three call sites always raised PackageNotFoundError: the SARIF tool.driver.version field was silently omitted, the TUI header showed "dev" and the telemetry version was "unknown". Add lyrashield/version.py with one engine_version() helper over the real distribution name and an explicit fallback so a frozen or uninstalled build never raises. Route the three wrong call sites through it. The four lookups that already used the product name are untouched. Align the pre-commit hook revisions to the locked versions (ruff v0.15.20 and bandit 1.9.4), so a local hook cannot pass lint or formatting the locked CI gate rejects. Bandit reads no severity floor from pyproject.toml; only the -l flag filters. Remove the inert severity key and state the real floor with -l in every invocation. A medium floor was rejected: it would drop B311, B403 and B405-B409, and the ruff equivalents of B403/B405-B409 are preview-only and inactive, so medium would weaken the gate. Delete only members with whole-repo grep proof of zero references: ancillary_cost_total, set_sandbox_cleanup_status, wait_kind_of, the utils.process_pull_line shim, scripts/docker.sh, the nonexistent root Dockerfile path in .trivyignore.yaml and the tenacity hidden import. Bound the fake-daemon wait in the image-pull deadline test and cache the Chromium download in CI. Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (20)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
PR_BODY.md was committed by mistake. The pull request body is the only place for it. No code changes. Co-Authored-By: Claude Code <noreply@anthropic.com>
…lper-tooling-deadcode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Engine core fixes: version lookup, tool pins, proven-dead members
Summary
The engine looked up the distribution
strix-agentfor its own version. Nobuild of this project installs that name:
pyproject.toml:2declareslyrashield-engine. The three wrong call sites therefore always raisedPackageNotFoundError, which silently omitted the SARIFtool.driver.versionfield, showed
devin the interactive TUI header and reportedunknowntotelemetry. One shared helper now resolves the real distribution name with an
explicit fallback, and the three call sites use it.
The pre-commit hook revisions are aligned to the versions
uv.lockand CIalready resolve, so a local hook can no longer pass lint or formatting the
locked gate rejects. The bandit severity setting in
pyproject.tomlwas inert,and the fix states and enforces the floor the gate actually applies instead of
the medium floor the config only appeared to set.
Seven unreferenced members and files are deleted, each with whole-repo
git grepproof. The image-pull deadline test gets a bounded daemon wait and CIcaches the Chromium download.
Per-change safety proof
Every deletion below was checked with
git grepacross the whole repo(
lyrashield,lyrashield_adapter,strix,tests,scripts,docs,pyproject.toml,strix.spec,.github,Makefile,UPGRADES.md,README.md,CONTRIBUTING.md, all*.mdx).1.
lyrashield/artifacts/usage.py—ancillary_cost_totalpropertyOne hit, the definition itself.
total_costat:234computes the same suminline and is unaffected.
_round_costand_ancillary_costsremain used bytotal_cost,to_recordandreset, so no supporting symbol was orphaned.2.
lyrashield/artifacts/state.py—set_sandbox_cleanup_statusOne hit, the definition itself. The method's own docstring calls it a
backward-compatible wrapper and no caller exists. The real method
set_cleanup_outcomekeeps its callers (interface/cli.py:311,lifecycle/finalize.py:126, plus tests), andCLEANUP_REMOVEDandCLEANUP_FAILEDremain used insideset_cleanup_outcomeitself.3.
lyrashield/lifecycle/agents.py—wait_kind_ofThe only other hit is the upstream substrate twin, which is a controlled
derivative boundary and was not touched. No
lyrashield/, test or scriptcaller exists. The
wait_kindsdict andWaitKindtype stay in use bypark_waiting, snapshot and restore.4.
lyrashield/interface/utils.py—process_pull_lineshimThe only removed hits are the three
utils.pylines. The test imports comefrom
lyrashield.interface.main, which re-exports the realimage_pull.process_pull_lineatmain.py:42.tests/test_main_helper_exports.py:21asserts that
mainre-exports theimage_pullimplementation and still passes.The other stub in the same file,
update_layer_status, is a different functionand was left alone.
5.
scripts/docker.shZero references anywhere in the repo. The script also builds
strix-sandbox,a different image name from the product one. The remaining 11 files in
scripts/are referenced by CI, the Makefile, tests or docs.6.
.trivyignore.yaml— rootDockerfilepathOnly
containers/Dockerfileexists. TheAVD-DS-0002rule and itscontainers/Dockerfilepath are unchanged, so the reviewed trust-boundarydecision still applies to the real file.
7.
strix.spec—tenacityhidden importtenacityis absent frompyproject.toml, absent fromuv.lock, notinstalled, and imported nowhere.
containers/python-requirements.txtpins itfor the sandbox image, which is a separate environment from the frozen engine
binary and is untouched.
strix.specis at the repo root, outsidestrix/**.Tests added
All new tests were made to fail locally before their fix and pass after.
tests/test_engine_version.py::test_sarif_write_path_emits_tool_driver_versionKeyError: 'version'—_write_report_projectionsresolved the wrong distribution, sosarif.py:262omitteddriver.versiontests/test_engine_version.py::test_sarif_write_path_still_omits_version_when_metadata_is_absenttests/test_engine_version.py::test_engine_version_falls_back_when_distribution_is_missingPackageNotFoundErrorescaped the old call sitestests/test_engine_version.py::test_engine_version_survives_a_broken_metadata_backendPackageNotFoundErrortests/test_quality_environments.py::test_precommit_hooks_use_the_locked_tool_versionsAssertionError: 'v0.11.13' == 'v0.15.20'tests/test_quality_environments.py::test_bandit_severity_floor_is_enforced_by_the_invocationAssertionError: 'severity' in {... 'severity': 'medium'}tests/test_release_build.py::test_binary_does_not_request_missing_hidden_importsAssertionError—'tenacity'present in the spectests/test_release_build.py::test_every_spec_hidden_import_is_a_declared_or_installed_distributionAssertionError: ... ['tenacity']The SARIF regression is the one that matters.
tests/test_sarif.py:60passestool_versionexplicitly, so it could never catch a broken lookup. The new testdrives
ReportState._write_report_projections, the production call chain thatresolves the version itself, and reads the written
findings.sarif.Existing behaviour is unchanged for the four lookups that were already correct
(
interface/arg_parser.py:40,lifecycle/runner.py:129,tools/proxy/caido_api.py:678,lyrashield_adapter/cli.py:158). They were notedited.
Bandit: how the intent was verified and why medium was rejected
The config key was inert. Verified with the installed bandit 1.9.4:
Bandit parses the key and never applies it as a filter. Only the
-l/--levelCLI flag filters. The fixture is a temporary file outside the repo, and the
whole-repo run is unaffected:
Enforcing medium would weaken the gate, which the brief forbids. The LOW rules
enabled by the current skip list are
B311,B403,B405,B406,B407,B408,B409. Their ruff equivalentsS403andS405-S409arepreview-only in the locked ruff 0.15.20 and this repo does not enable
preview:
So a medium floor would drop seven rules and leave six of them with no
replacement check at all. The applied fix states the real floor and enforces it:
pyproject.toml: the inertseverity = "medium"key is removed, replaced bya comment recording the verified behaviour and why medium is rejected.
Makefilesecurity,.pre-commit-config.yamlandscripts/verify-controlled-derivative.sh:-ladded.No severity threshold was lowered, no rule was skipped and no suppression was
added.
-lis behaviourally identical to bandit's default: no rule in bandit1.9.4 carries
UNDEFINEDseverity, so the defaultUNDEFINEDfloor and theLOWfloor select the same rules.-lmakes the floor explicit rather thanchanging it.
Gates run
uv sync --frozenuv run ruff check .uv run ruff format --check .uv run mypy strix lyrashield_adapter lyrashielduv run bandit -r strix lyrashield_adapter lyrashield -q -c pyproject.toml -luv run pytest tests/(all 152 test modules plustests/tuiandtests/upstream, run in chunks)scripts/verify-controlled-derivative.shfootprint and digest steps4 files changed, 22 insertions(+), 201 deletions(-); patch digest3629e8f382fdd8eccf78553b102a25e99c73454cmatchespython scripts/verify-customer-branding.pyuv run pre-commit validate-config .pre-commit-config.yamlpython3 scripts/report_twin_drift.pyTwo failures, both pre-existing and environmental, neither touched by this
change:
tests/test_quality_environments.py::test_precommit_and_make_run_the_same_type_check—
makeis not installed in this sandbox.tests/test_local_sources.py::test_clone_repository_checks_out_a_full_commit_sha_detached— this sandbox's git cannot resolve the detached test SHA.
The brief lists both as environmental. The three historical pytest failures
remain unreproduced and were not "fixed".
PROTECTED
ENGINE_REVISION, the engine.lyrashield-worker-pinand every dependency cap (openai, litellm,openai-agents, cryptography) are untouched.
uv.lockis unchanged.git diff --shortstat "$(cat .lyrashield-upstream-base)" -- strix/returns
4 files changed, 22 insertions(+), 201 deletions(-), unchanged. Thereviewed patch digest
3629e8f382fdd8eccf78553b102a25e99c73454cmatches. Nofile under
strix/**was edited.strix.specis at the repo root, outsidestrix/**.alone.
strix/core/agents.py:214 wait_kind_ofis the upstream twin of themember removed on the product side; the upstream file was not touched. Nothing
from the E2/E3 candidate lists beyond the seven proven-dead items was deleted.
suppression, no per-file ignore added.
ruff 0.16.6(engine PR build(deps-dev): bump ruff from 0.15.20 to 0.16.6 #139) staysopen and held.
scripts/customer-branding-allowlist.jsonlosesfour entries that named the removed
strix-agentlookups. Leaving them wouldhave exempted the exact lines this change removes. The gate passes, and the
remaining inherited-identifier exemptions are unchanged.
adds a cache step only. Every step name,
ifcondition and required check isunchanged, and the cache key falls back to a per-OS restore key so a miss
still downloads.
Not done
the daemon-reach wait is bounded and documented.
it was rejected rather than applied. Details above.
email_validatorinstrix.specis also absent fromuv.lockand theinstalled environment, like
tenacity. It is a pre-existing pydantic optionalextra, outside the reviewed deletion set, so it was recorded in the new test's
known_absentset rather than removed. Flagging it for a separate decision.requires
objdumpfrombinutils, which is not installable here. Theavailable substitute was run instead: parsing
strix.specand resolving all115
hiddenimportsentries withimportlib.util.find_specunderuv run --frozen --extra viewerleaves onlyemail_validatorunresolved andno
tenacity. The frozen-build check therefore remains an operator step.verify-controlled-derivative.shdid not run to completion as onecommand: its pytest stage exceeds the 120-second sandbox command cap. Its
footprint and digest invariants were run directly and pass, and its full pytest
stage was run in chunks with the same suite and
-W error::pydantic.PydanticDeprecatedSince211semantics; the bandit, ruff, mypy and format stages it wraps were each run
individually and pass.
_encrypt,profile_for,update_run_status,iter_runs,KEYCHAIN_CHATGPT_TOKEN) were not deleted. They are in the E2/E3candidate list but not in this workstream's approved deletion set.
Rollback
Code only, forward-only for any schema. Revert this PR.
Generated with Claude Code
Summary by CodeRabbit