Repository navigation
Give the adapters a package layout - #476
bar-capsule wants to merge 4 commits into
Conversation
Shared code, test harnesses and the example Guardian move under src/acs/, each adapter under src/acs/integrations/<framework>/, docs under docs/<framework>/ and tests under tests/. Imports come from the package. Signed-off-by: Bar Kaduri <bar@capsule.security>
pyproject.toml and uv.lock define the distribution, a [nat] extra, console scripts for the hooks, wire tools and example Guardian, and the acs.integrations and nat.components entry points. The wheel bundles the v0.1.0 schemas. Signed-off-by: Bar Kaduri <bar@capsule.security>
CI installs from adapters/uv.lock, runs the suites with and without the NAT extra, and builds and checks the wheel on Python 3.11 and 3.12. Dependabot covers /adapters. Signed-off-by: Bar Kaduri <bar@capsule.security>
READMEs, mapping pages and example configs use the installed commands, uv and the new paths. The adapters README states the Trace scope. Signed-off-by: Bar Kaduri <bar@capsule.security>
…urity-Project#489) Brings this branch to the tree of refimpl/adapters-14-review-fixes. Signed-off-by: Bar Kaduri <bar@capsule.security>
drk-ram
left a comment
There was a problem hiding this comment.
Reviewed at head bd4e30b631bbbf591fd5f727c0f8e439be418834.
This is a clean, well-scoped repackaging of adapters/ into an installable distribution, and I don't see anything blocking.
What I checked
pyproject.toml: console scripts, theacs.integrations/nat.componentsentry-point groups, and the[nat]extra all line up with what the adapters actually import and whatscripts/check_wheel.pyasserts post-install.hatch_build.py+src/acs/core/_schemas.py: the schema-bundling build hook writes tosrc/acs/core/schemasfor the sdist andacs/core/schemasfor the wheel, and_schemas.py's fallback chain (bundled -> checkout ->ACS_SPEC_DIRoverride, raisingFileNotFoundErrorotherwise) is consistent with that. Theparents[4]checkout path fromadapters/src/acs/core/_schemas.pyresolves correctly to<repo>/specification/v0.1.0- I walked it by hand to be sure.scripts/check_wheel.pyis a genuinely useful smoke test: it installs the built wheel into a throwaway venv outside the repo tree and exercises the console scripts, the entry-point groups, the kill switch, and a live example-Guardian start, rather than just asserting the wheel exists. The CIpackagejob runs it on 3.11 and 3.12.run_conformance.py'sEXPECTED_SKIPSwording update and the CI migration from pip touv sync --locked(with a NAT-extra job and a without-NAT job) match the documented behavior inadapters/README.md.tests/common/test_default_spec_dir.pyandtests/core/test_schemas.pycover the override/bundled/checkout precedence and the missing-schema failure case with subprocess-level isolation (not just mocking in-process), which is the right level of rigor for a path-resolution change like this.
No functional regressions found in the moved modules (_common.py -> src/acs/_common.py, example-guardian -> src/acs/guardian/) - the only substantive change there is the sys.path hack for importing example_guardian being replaced with a real package import, which is strictly safer.
Approving.
|
Closing this slice because PR #22 (the reference adapters for Claude Code, Cursor and NAT) merged into integration as 2630ec2, and that merge carries every slice in this stack. The top of the stack had the same files as PR #22's final commit, so nothing in this slice was left behind. Thanks, Bar, for cutting the adapters into pieces this size, because it made the review possible. |
Stacked on #22. Next: #477. The full stack is listed in #22.
What changed
Four commits; read them one at a time.
8dd599e6moves every file undersrc/acs/,tests/anddocs/<framework>/, with 56 renames; its other changes are the import lines, paths and minimalpyproject.tomlthe moved files need, since imports now come from the package instead ofsys.pathedits.30d6d67dpackages it asacs-adapters0.2.0:pyproject.toml,uv.lockin place of the four requirements files, console scripts for the hooks and wire tools, anacs.integrationsentry-point group, one package version, and the schemas bundled into the wheel.e9e4da65runs the adapter CI fromuv.lock, fails on any skip outside an allowlist, and checks the installed wheel on Python 3.11 and 3.12.bd4e30b6moves the docs to the installed commands and new paths, and states the Trace scope.Ariel's findings this answers
examples/split and the import-linter contract are in Move the example policy to acs.examples and check the import direction #486.pyproject.tomlanduv.lockWhere this differs from Ariel's proposal
adapter.pybesidehook.pyandwire.py. The split intoevents,hooksandresponsesreshapes the same functions as the per-hook table, so both go in the HookSpec follow-up.guardian/holds the example Guardian whole. Theexamples/policy and the import-linter contract are in Move the example policy to acs.examples and check the import direction #486.testing/has the capture Guardian and the test harness, without anassert_conforms(...)helper.Which issue does this implement
Part of #134
Base branch
Stacked on #22, not on
integration. It lands through #22; see the stack in #22.Type of change
I tested this
At this slice's top (
bd4e30b6), withclauderemoved from PATH andACS_LIVE_CLAUDEandACS_SPEC_DIRunset: 313 passed and 3 expected skips with the NAT extra, 275 passed and 3 expected skips without it. The skips are the two opt-in live Claude Code tests and the manual Cursor procedure. CI passes on this PR, including the installed-wheel check on Python 3.11 and 3.12.Checklist
git commit -s(required by the DCO)Security
Unchanged decisions; the hooks run as installed console scripts, and the wire tools refuse a hook command that cannot run.