Skip to content

Release v0.11.0

Choose a tag to compare

@github-actions github-actions released this 15 Jan 20:08
· 884 commits to main since this release

🧱 TopMark 0.11.0 — Policy & STDIN Architecture Hardening

This release delivers a set of internal architectural improvements that strengthen
policy correctness, STDIN handling, and CLI/API parity.

➡️ User-facing behavior remains compatible with the 0.10.x series, but there is an
intentional internal breaking change for integrators or tests that rely on TopMark
pipeline internals.


⚠️ Internal Breaking Change

Mandatory PolicyRegistry at Pipeline Bootstrap

  • ProcessingContext.bootstrap() now requires a PolicyRegistry argument
  • Internal callers must:
    1. Resolve a Config
    2. Construct a PolicyRegistry from it
    3. Pass the registry explicitly when bootstrapping the context
  • This change:
    • Eliminates ad-hoc and repeated policy merging
    • Guarantees deterministic effective policy resolution
    • Reduces per-file and per-step overhead

Note: This affects internal and test code only.
The public API (topmark.api.check, topmark.api.strip) and all CLI commands remain
source-compatible.


What Changed

Policy Evaluation

  • Introduced PolicyRegistry to precompute effective policies (global + per-file-type) once per run
  • Centralized policy access via ctx.get_effective_policy()
  • Removed per-context caching and None-guarded fallbacks
  • Ensured strip eligibility and guidance are based on:
    • the strip axis
    • the effective policy
    • independent of comparison status

Outcome Bucketing

  • Refactored bucketing into a precedence-ordered classifier (first match wins)
  • Added stable debug tags (bucket[...]) for easier diagnosis
  • Normalized bucket labels and removed duplication across header / comparison / strip reasons

CLI / Config / Runtime Alignment

  • Unified write-mode semantics across CLI, config, and writer:
    • CLI write_mode now maps cleanly to OutputTarget + FileWriteStrategy
    • STDIN content mode forces STDOUT output and clears file write strategies
    • Explicit diagnostics are emitted when config or CLI values are overridden due to STDIN
  • Renamed stdin → stdin_mode throughout CLI, config, API, and runtime
  • Propagated stdin_filename so STDIN-backed runs participate correctly in:
    • config discovery
    • policy evaluation
    • file resolution
  • Centralized all STDIN-related normalization in MutableConfig.sanitize(), enforcing invariants
    before freezing and removing duplicated CLI-only logic

Enums & Config Parsing

  • Introduced a stable, machine-keyed enum pattern (KeyedStrEnum) for config-facing enums:
    • OutputTarget
    • FileWriteStrategy
  • Decoupled machine identifiers from human-readable labels
  • Removed brittle string / Literal-based parsing
  • Standardized .parse() helpers for both config and CLI normalization

Writer Behavior

  • Updated WriterStep.may_proceed() to consistently respect:
    • apply intent
    • output target
    • STDIN mode
  • Ensured writer eligibility rules behave identically across CLI and API runs

API Runtime Parity

  • Aligned API execution with CLI behavior by applying the same:
    • config discovery
    • normalization rules
    • policy overlays

Fixes

CLI Guidance Correctness

  • Made check and strip per-file guidance both policy-aware and feasibility-aware
  • Prevented misleading “run --apply …” suggestions when changes are blocked by:
    • policy
    • feasibility
    • empty-file rules
    • strip-only scenarios

Tests

  • Updated pipeline and API tests to bootstrap contexts via PolicyRegistry
  • Added shared helpers to keep test setup DRY and consistent across:
    • pipeline tests
    • API tests
    • CLI tests

ℹ️ Notes

  • There are no user-facing breaking changes relative to 0.10.x
  • The public API surface remains stable
  • Internal consumers, extensions, and test harnesses must be updated to construct and pass a
    PolicyRegistry when bootstrapping pipeline contexts

This release makes policy behavior more predictable, easier to reason about, and safer to extend 🚀

Full Changelog: v0.10.1...v0.11.0