Skip to content

auditkit is in sdk, but audit_append is a HOST method and host core may not import sdk -- the writer belongs in spec #348

Open

Description

@aitrawog

Measured 2026-11-17, while landing P06 leg 3 (charly's audit wiring) against sdk v0.2026321.810.

The design row. DESIGN.md:376 lists audit_append as a host method:

| audit_append | appends one audit record (D-AUDIT) | always |

A host method is performed by the HOST — charly core — not by a plugin or a kit.

The layout rule. charly/AGENTS.md's IMPORT-PURITY gate states it:

charly/ core imports spec/* + proto only. The sdk mechanism kits are for PLUGINS, never the host.

So the two facts collide, and the gate proved it. Importing auditkit in charly/ core:

$ go test -count=1 ./...   # TestImportPurity_HostImportsOnlySpecAndVettedThirdParty
--- FAIL: TestImportPurity_HostImportsOnlySpecAndVettedThirdParty (0.01s)
    IMPORT-PURITY gate: 1 UNDECLARED github.com/opencharly/sdk import(s) in charly/ core
        audit_event.go:27: forbidden import "github.com/opencharly/sdk/auditkit" — the sdk mechanism
        kits (and the sdk root plugin-authoring package) are for PLUGINS, never the host

sdk/auditkit (opencharly/sdk#550, merged as v0.2026321.810) is therefore unreachable from the only layer that can call it for a host method. That PR passed its own review — the defect is not in its code, it is in the LAYER CHOICE, which no gate in sdk could see because sdk has no host.

Why the interim existed, and why it was flagged. Before the tag, charly carried a local JSON-Lines appender, and the validator correctly called it SHOULD-BE-sdk (ARCH). That finding was right about the mechanism and wrong about the destination: moving it to sdk satisfies ARCH and violates IMPORT-PURITY. The two gates point in opposite directions because the writer sits between them.

The three candidate resolutions, with their costs:

  1. Move the writer to spec/auditkit. spec is core-importable, already hosts storeroot (the same shape: one implementation of a cross-cutting concern that the host must perform), and sdk can re-export it exactly as sdk/storekit re-exports spec/storeroot. This is the smallest change and it matches the existing precedent.
  2. Declare it in residualSDKImportSites with a named exit — but that list is debt with an expiry, and adding a NEW permanent dependency to it is the thing the gate exists to prevent.
  3. Route the append through a plugin — but the recorder must be the layer that PERFORMS the act, and a plugin round-trip inside a mutation is the double-record risk D-AUDIT-1 forbids.

I would take (1), and I am not doing it unilaterally because moving a package between contract layers changes who owns it.

Until then P06 leg 3 stays closed: the wiring is correct and proven (three records for three acts, none for deploy add), and it cannot be completed against a package the host may not import.

Agent: lead
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

Activity

  1. added
    category:experience
    type:fix
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:experiencetype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions