Skip to content

Give the adapters a package layout - #476

Closed
bar-capsule wants to merge 4 commits into
refimpl/adapters-00-basefrom
refimpl/adapters-01-package-layout
Closed

bar-capsule wants to merge 4 commits into
refimpl/adapters-00-basefrom
refimpl/adapters-01-package-layout

Conversation

@bar-capsule

@bar-capsule bar-capsule commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #22. Next: #477. The full stack is listed in #22.

What changed

Four commits; read them one at a time.

  • 8dd599e6 moves every file under src/acs/, tests/ and docs/<framework>/, with 56 renames; its other changes are the import lines, paths and minimal pyproject.toml the moved files need, since imports now come from the package instead of sys.path edits.
  • 30d6d67d packages it as acs-adapters 0.2.0: pyproject.toml, uv.lock in place of the four requirements files, console scripts for the hooks and wire tools, an acs.integrations entry-point group, one package version, and the schemas bundled into the wheel.
  • e9e4da65 runs the adapter CI from uv.lock, fails on any skip outside an allowlist, and checks the installed wheel on Python 3.11 and 3.12.
  • bd4e30b6 moves the docs to the installed commands and new paths, and states the Trace scope.

Ariel's findings this answers

Where this differs from Ariel's proposal

  • Each integration keeps one adapter.py beside hook.py and wire.py. The split into events, hooks and responses reshapes the same functions as the per-hook table, so both go in the HookSpec follow-up.
  • guardian/ holds the example Guardian whole. The examples/ 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 an assert_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

  • Reference implementation or adapter
  • Tooling or CI

I tested this

At this slice's top (bd4e30b6), with claude removed from PATH and ACS_LIVE_CLAUDE and ACS_SPEC_DIR unset: 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

  • Commits are signed off with git commit -s (required by the DCO)
  • Prose follows STYLE.md
  • No secrets, tokens, or internal URLs in the diff

Security

Unchanged decisions; the hooks run as installed console scripts, and the wire tools refuse a hook command that cannot run.

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>
@github-project-automation github-project-automation Bot moved this to Needs triage in ACS Project Tracker Nov 3, 2026
@bar-capsule
bar-capsule added this pull request to stack #490 November 3, 2026 20:10
@bar-capsule
bar-capsule removed this pull request from stack #490 November 3, 2026 20:19
@bar-capsule
bar-capsule changed the base branch from refimpl/adapters-00-base to bar/adapters November 3, 2026 20:19
@bar-capsule
bar-capsule changed the base branch from bar/adapters to refimpl/adapters-00-base November 3, 2026 20:20
@bar-capsule
bar-capsule added this pull request to stack #491 November 3, 2026 20:20
bar-capsule added a commit to bar-capsule/ACS that referenced this pull request Nov 3, 2026
…urity-Project#489)

Brings this branch to the tree of refimpl/adapters-14-review-fixes.

Signed-off-by: Bar Kaduri <bar@capsule.security>
@acs-board-reconciler acs-board-reconciler Bot moved this from Needs triage to In progress in ACS Project Tracker Nov 4, 2026
@bar-capsule
bar-capsule marked this pull request as ready for review November 4, 2026 12:31

@drk-ram drk-ram left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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, the acs.integrations / nat.components entry-point groups, and the [nat] extra all line up with what the adapters actually import and what scripts/check_wheel.py asserts post-install.
  • hatch_build.py + src/acs/core/_schemas.py: the schema-bundling build hook writes to src/acs/core/schemas for the sdist and acs/core/schemas for the wheel, and _schemas.py's fallback chain (bundled -> checkout -> ACS_SPEC_DIR override, raising FileNotFoundError otherwise) is consistent with that. The parents[4] checkout path from adapters/src/acs/core/_schemas.py resolves correctly to <repo>/specification/v0.1.0 - I walked it by hand to be sure.
  • scripts/check_wheel.py is 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 CI package job runs it on 3.11 and 3.12.
  • run_conformance.py's EXPECTED_SKIPS wording update and the CI migration from pip to uv sync --locked (with a NAT-extra job and a without-NAT job) match the documented behavior in adapters/README.md.
  • tests/common/test_default_spec_dir.py and tests/core/test_schemas.py cover 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.

@rocklambros

Copy link
Copy Markdown
Collaborator

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.

@rocklambros rocklambros closed this Nov 5, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Done in ACS Project Tracker Nov 5, 2026
@bar-capsule
bar-capsule deleted the refimpl/adapters-01-package-layout branch November 8, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants