Repository navigation
Release v0.11.0
🧱 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 aPolicyRegistryargument- Internal callers must:
- Resolve a
Config - Construct a
PolicyRegistryfrom it - Pass the registry explicitly when bootstrapping the context
- Resolve a
- 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
PolicyRegistryto 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_modenow maps cleanly toOutputTarget+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
- CLI
- Renamed
stdin→stdin_modethroughout CLI, config, API, and runtime - Propagated
stdin_filenameso 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:OutputTargetFileWriteStrategy
- 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
checkandstripper-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
PolicyRegistrywhen 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