Skip to content

chassis-harness 0.9.0

Choose a tag to compare

@github-actions github-actions released this 22 Sep 14:09
· 27 commits to main since this release
pip install chassis-harness==0.9.0

Production confidence: compatibility, operability, resilience, and scale. The
last planned release with deliberate pre-1.0 compatibility changes — the
surface is classified and baselined, persisted formats are versioned and
migrated, lifecycle behavior is hardened under cancellation and concurrency,
planning and telemetry are stable machine contracts, capacity is measured, and
a production reference application composes it all. The review record is
production-readiness.md.

Added

  • Production reference application (roadmap R034).
    examples/production_reference/ is one self-contained support-desk system on
    deterministic local fakes (no credentials, no external services) composing
    every documented capability: declarative configuration, a plugin catalog,
    scoped composition, AgentSpec materialization, capability requirements and
    preferences, tool registration and policy (including a denial), secret
    resolution and redaction, agent invoke and streaming, replay recording and
    replay with zero live calls, hot provider replacement with an old run pinned
    to its generation, Harness.preview() before every change, diagnostics and
    snapshot attribution, a controlled failure with full rollback, and graceful
    shutdown to resource baseline. It executes its own assertions, prints a
    deterministic documented transcript (examples/production_reference/README.md),
    runs in tests/integration/test_reference_app.py, and is a package-smoke
    canary in CI.
  • Reproducible performance and capacity baselines (roadmap R032).
    scripts/benchmark.py measures no-op reconciliation, one-entry replacement,
    dependency cascades, snapshot construction and hashing, plan/preview and
    diagnostics generation, tool snapshot lookup, generation acquire/release,
    replay lookup with repeated keys, graph-cache lookup, 10/100/1000-object
    configurations, and replacement under concurrent held runs — reporting median
    and p95 latency, peak memory, and the full environment, with a --check
    mode for conservative (3x) regression thresholds on stable scenarios.
    benchmarks/baseline-0.9.0.json records the 0.9.0 baseline and
    docs/performance.md documents methodology, capacity guidance, and the
    measured scaling limits (the data plane is flat; the control plane resolver
    is superlinear today — documented, with the optimization deliberately
    deferred). tests/perf/test_scaling_structure.py gates CI with deterministic
    work-count assertions: one identity computation per entry per plan/reconcile,
    one registry scan per tool lookup, and zero composition work on the data
    plane.
  • Optional OpenTelemetry adapter (roadmap R031 phase 2).
    chassis.telemetry.OpenTelemetryTelemetry maps the signal contract onto
    OpenTelemetry — Chassis spans become OpenTelemetry spans in the ambient
    context (parent/child preserved), Chassis events become events on the active
    span or zero-duration spans — behind the new opentelemetry extra
    (pip install "chassis-harness[opentelemetry]"; opentelemetry-api, never a
    core dependency). Importing chassis.telemetry without it is fine;
    constructing the adapter without it raises MissingExtraError naming the
    extra. Attributes and recorded errors are scrubbed before export, explicit
    backend overrides and SafeTelemetry isolation are preserved, and a failing
    collector cannot break the observed operation. Verified with the SDK's
    in-memory exporter (tests/telemetry/test_otel_adapter.py) and added to the
    per-extra and combined-extras package smokes. LangSmith support is unchanged —
    the two are separate adapters over the same core signal contract. Documented
    in docs/observability.md.
  • Stable operational signal contract (roadmap R031 phase 1, new guarantee
    G27). chassis.telemetry.signals declares every span and event Chassis emits
    — stable names, required and optional attributes, correlation fields (run id,
    thread id, generation id, snapshot digest, agent and revision, plugin entry
    and instance id, tool registration id, scope), and bounded-cardinality rules
    that forbid raw payloads — and validate_signal() checks one emission against
    the contract. The contract is enforced backend-independently against the
    recording backend (tests/telemetry/test_signal_contract.py), including that
    no secret material can reach any attribute. Missing signals now have
    emissions at their seams: generation.acquire/generation.release (run
    leases), generation.draining, generation.retired, replay.hit /
    replay.miss / replay.exhausted (tool boundary decisions), cleanup.failure
    (aggregated disposals and drain timeouts), telemetry.failure (a contained
    backend failure, announced by TeeTelemetry to its surviving siblings), and
    graph.cache eviction (result: "evict"). tool.execute gained the
    registration_id and run_id correlation attributes. The retirement event is
    renamed generation.drain → generation.retired (see migrations); names are
    stable from 0.9.0 on. Documented in docs/observability.md.
  • Stable machine-readable planning contract (roadmap R030, new guarantee
    G26). chassis.planning defines the versioned PlanResult document with a
    closed action vocabulary (add, remove, replace, reuse, rebuild,
    publish, reject, no-op), stable ReasonCodes, and per-action entry and
    scope identity, configuration keys (never values), dependency/capability
    cause, expected reuse and instance, generation impact, machine-readable
    validation failures, and ambiguity/preference records. Harness.preview()
    computes it with zero mutation — no revision bump, no dirty flag, no mount, no
    publication, no setup or cleanup effect — over the full pipeline (parse,
    migrate, validate, catalog-resolve, diff, resolve, reuse analysis, impact
    prediction), for the current state or a declarative configuration. Deterministic
    to_dict() declares PLAN_FORMAT_VERSION; preview parity with the subsequent
    apply and preview purity are both tested (tests/planning/). Documented in
    docs/planning.md.
  • Deterministic lifecycle stress and opt-in soak coverage (roadmap R029).
    tests/concurrency/test_lifecycle_stress.py runs bounded, seeded scenarios
    with real asyncio tasks — cancellation storms, replacement storms under
    lease, shutdown races, repeated cycles, bounded history under a long lease —
    each proving resources return to baseline. scripts/soak.py runs the same
    scenario classes for a wall-clock budget (opt-in, excluded from the default
    fast suite) and fails on any violated invariant.
  • Resource counters for lifecycle baselines (roadmap R029).
    Diagnostics.resource_counts() (and ResourceCounts) aggregates instances,
    owned scopes, effects, tasks, stragglers, cleanup failures, leases, and
    live/draining generations from authoritative state with no lock and no
    await, so a run or stress cycle can be bracketed by two reads and proved to
    return every resource to baseline.
  • Versioned and migrated persisted formats (roadmap R028, new guarantee
    G25). Every Chassis document that crosses a process, test-run, deployment, or
    package-version boundary now declares its own integer format version — never
    the package version: runtime snapshot records (SNAPSHOT_FORMAT_VERSION),
    replay recordings (REPLAY_FORMAT_VERSION), planning exports
    (PLAN_FORMAT_VERSION), and reconciliation/diagnostics exports
    (DIAGNOSTICS_FORMAT_VERSION), all dispatched by
    chassis.persistence.formats. RuntimeSnapshot.from_dict() and
    ReplaySession.from_dict()/load() are explicit readers that migrate
    pre-versioning 0.8.1 payloads and reject future versions, malformed version
    values, corrupted payloads, and payloads with no migration path with a typed
    FormatError (machine-readable reason: future_version,
    malformed_version, corrupted, unmigratable) — never reinterpreting an
    unknown field or version. Migration preserves semantic attribution (generation
    identity and sequence, agent identity and revision, capability versions,
    replay boundary kind and key, redaction status, tool/model result semantics).
    Sanitized fixtures produced by the released 0.8.1 implementation
    (tests/compat/v0.8.1/, generated from the v0.8.1 tag) prove the readers
    against what 0.8.1 actually wrote. The one documented non-migration: a 0.8.1
    snapshot's semantic scope provider map (0.8.1 persisted provider instance
    ids with no instance-to-entry mapping) is reported empty rather than guessed.
    RuntimeSnapshot.to_dict() also persists the semantic scope tree now, so a
    record round-trips exactly — snapshot digest() values therefore change.
  • Classified public API and compatibility checking (roadmap R027). The
    documented surface — every top-level export and documented import path — is
    audited in tests/compat/public-api.json with a stability class per name
    (stable public API, provisional API; anything unlisted is internal), and
    tests/compat/api-baseline-0.8.1.json records how the released 0.8.1 surface
    is shaped (kinds, signatures, enum values, public dataclass/Pydantic fields),
    generated from the v0.8.1 distribution. scripts/api_compat.py compares the
    installed surface with a baseline and reports removed names, moved names,
    incompatible signatures, changed enum values, and changed public fields
    deterministically, exiting non-zero on any of them; tests/test_api_compat.py
    covers each detection class and pins the current surface as compatible.
  • Typed deprecation machinery (roadmap R027). chassis.compat adds
    ChassisDeprecationWarning — carrying the deprecated API, its replacement,
    the deprecating version, and the earliest removal version as structured
    attributes — with deprecated (functions, methods, classes) and
    warn_deprecated, raised at the caller's frame. The policy and the intended
    1.0 deprecation window are documented in docs/compatibility.md; 0.9.0
    deprecates nothing itself.
  • The 0.9.0 roadmap and compatibility policy (roadmap R027–R034).
    docs/roadmap.md defines the production-confidence milestone — compatibility,
    operability, resilience, and scale — with severity, motivation, acceptance
    criteria, regression tests, and non-goals per requirement, and a validation
    matrix for the release gates. docs/compatibility.md classifies the surface
    (stable public API, provisional API, internal API, persisted formats),
    documents the API baseline and compatibility check, the typed deprecation
    window, and per-format persisted-data versioning. 0.9.0 is the last planned
    release with deliberate pre-1.0 compatibility changes; release-publication
    work is deferred to 1.0.0.

Fixed

Release-candidate defect review (second round; each fix carries a regression
that fails before it):

  • A plugin teardown raising CancelledError no longer aborts shutdown or
    leaks resources.
    Teardown failures outside Exception are recorded as
    teardown failures and disposal completes; the shutdown teardown loop is
    individually contained, so one instance can no longer leave the rest
    registered with zero live generations. The aggregated failure (including the
    CancelledError) is raised to every stop() caller and the harness reaches
    its real terminal state.

  • New runs can no longer acquire a generation after stop() has begun.
    stop() flips to STOPPING before its first yield, closing the window where
    an acquisition task already in the event-loop ready queue could pass the
    acquirable check and be drained (or disposed) underneath.

  • Corrupted or truncated replay documents are rejected, never silently
    treated as live sessions.
    A recording missing mode, fallback,
    metadata, or records raises FormatError (corrupted) instead of
    degrading into an empty live session that executes real boundaries, and
    malformed record fields (sequence, key, request, created_at,
    generation_id, run_id) are rejected instead of coerced.

  • Previewing an unchanged declarative configuration predicts reuse and a
    no-op
    (G26 parity): preview entries no longer bump revisions for unchanged
    entries, so preview(same_config) matches the subsequent apply_config() +
    reconcile(), which mutates nothing.

  • The API compatibility gate detects positional signature breaks. Parameter
    order is meaning: a swap or an insertion before an existing positional
    parameter is now reported as changed_signature even when the name set is
    unchanged.

  • @deprecated preserves coroutine functions. An async callable stays a
    coroutine function after decoration, so introspection-based dispatch keeps
    working and behavior is unchanged as promised.

  • A composition-identical reconcile no longer churns a generation (found by
    the roadmap R030 parity tests; present in every release with requirements).
    The no-op comparison read resolution provenance object-wise, whose pre-mount
    instance ids differ from post-mount ones, so the first re-reconcile after a
    requirement resolved always published a spurious generation — violating the
    documented "repeated reconciliation is a no-op". The comparison now uses
    observable composition (ScopeTree.same_observable_composition: topology,
    selection, and scope metadata), so revision metadata changes (which are
    observable) still publish.

  • Cancellation, draining, and shutdown hardened (roadmap R029). A lifecycle
    audit found thirteen gaps; the material ones are closed. stop() is a
    barrier — every caller blocks until disposal finishes and observes its
    result — and a cancelled stop() no longer wedges the harness in STOPPING:
    the shutdown completes in the background and reaches the terminal state with
    its failure recorded. acquire() refuses a stopping harness, closing the
    window where a run could start mid-shutdown. shutdown_grace_seconds is now
    one deadline for every draining generation together (previously one grace
    each), and Harness(task_shutdown_timeout=...) reaches plugin scopes
    (previously hardcoded to the 5s default). A disposer raising outside
    Exception no longer aborts the scope unwind or hides the other cleanup
    failures: it is aggregated and chained as the cause of the raised
    EffectCleanupError. Scope.fully_disposed now also requires every effect
    released and zero cleanup failures, which stay visible after close. A failed
    candidate build (after setup, before publication) now rolls back every
    mounted instance like a failed mount. A task failing after close is reported
    instead of disappearing, and async context entry racing a closing scope is
    refused and unwound instead of leaking. The one-shot lifecycle is explicit:
    start() after stop() raises HarnessStateError deterministically.