Skip to content

feat(monty): unlock the Python stdlib in molds and harden the runtime - #37

Open
pytgaen wants to merge 6 commits into
mainfrom
fix/0.9.1-reliability
Open

feat(monty): unlock the Python stdlib in molds and harden the runtime#37
pytgaen wants to merge 6 commits into
mainfrom
fix/0.9.1-reliability

Conversation

@pytgaen

@pytgaen pytgaen commented Aug 17, 2026

Copy link
Copy Markdown
Owner
  • feat(monty): upgrade the embedded engine to v0.0.21, making collections, itertools, and dataclasses importable from molds alongside function decorators and user-defined classes
  • fix(pipeline): apply max_duration to the complete chain, including dynamically injected steps, instead of resetting the timer for every Monty execution
  • fix(pipeline): stop recursive pipeline.insert_next() / pipeline.append() growth after 1,024 injected steps with an explicit error
  • fix(json): preserve integers from i64::MIN through u64::MAX as numeric JSON values when converting to and from Monty, including direct serializers
  • fix(shape): allow multi-input raw pass-through with --output-format raw -O, using each input filename as the destination
  • fix(shape): install streamed file outputs only after successful conversion, preserving existing files, Unix permissions, symlink targets, and hard-linked inputs
  • fix(sandbox): reject overflowing minute and hour duration values instead of panicking or wrapping
  • fix(sandbox): keep max_memory enforced after Monty v0.0.20 moved memory accounting into allocator globals, by charging those counters around mimalloc in src/mem_limit.rs
  • fix(http): detect MIME types case-insensitively and keep unknown text/* response bodies textual
  • fix(http): reject HTTP error statuses before reading potentially large response bodies
  • fix(library): return an explicit error when run_pipeline() receives a configuration with no mold or expression step
  • fix(install): require a checksum manifest, exactly one checksum for the selected asset, and a matching SHA-256 before extracting POSIX or Windows downloads
  • fix(runtime): bound the process-wide regex, template, and HTTP client caches with fixed-capacity LRU eviction
  • perf(ndjson): stream identity NDJSON to JSON/JSON compact from files or stdin while preserving empty-line behavior and exact JSON integers
  • test(sandbox): cover gradual memory accumulation against max_memory, closing the gap that let the enforcement regression build green
  • test(ci): add fail-closed installer fixtures and a Windows job exercising the PowerShell installer plus a real binary transformation
  • chore(deps): migrate Monty from a Git pin to the published monty / monty-types crates and drop the jiter Git patch
  • chore(deps): refresh the full lockfile and upgrade serde-saphyr to 1.1 and fancy-regex to 0.19, absorbing the pending Dependabot batch
  • fix(scripts): install ca-certificates in the docker e2e container, which ubuntu:24.04 omits — reqwest could not build its HTTPS client, so both remote-mold tests failed under docker regardless of the binary under test
  • docs(runtime): document the chain-wide duration budget, dynamic-step ceiling, exact JSON integer range, and the v0.0.21 engine baseline
  • chore(notes): drop the consumed 07/2026 evaluation notes

pytgaen added 6 commits July 27, 2026 23:55
- fix(pipeline): enforce a chain-wide duration budget and cap dynamic step injection
- fix(json): preserve exact integers through the complete native JSON u64 range
- perf(ndjson): stream identity NDJSON to pretty and compact JSON
- fix(output): install streamed files safely while preserving existing file semantics
- fix(shape): support multi-input raw pass-through with -O
- fix(sandbox): reject overflowing duration values
- fix(http): normalize MIME detection and reject error statuses before body reads
- fix(library): return an error for empty pipeline configurations
- fix(runtime): bound regex, template, and HTTP client caches
- fix(install): require exact SHA-256 manifests on POSIX and Windows
- ci(install): exercise fail-closed installers and a Windows binary smoke test
- chore(deps): refresh compatible direct and transitive dependencies
- docs: align runtime, security, formats, comparison, and platform guidance
- test: expand correctness, file-safety, installer, and performance coverage
Replace the Monty Git pin with the published monty and monty-types crates.

Adapt boundary imports, compile options, and OS-call resumption to the 0.0.19 API.

Refresh compatible dependencies while retaining the jiter security patch and get-size2 compatibility pin.

Update build metadata and internal dependency documentation.
…n molds

Molds can now `import collections` (Counter, defaultdict, deque,
namedtuple), `import itertools` (count, repeat, pairwise, compress,
islice, chain, cycle) and `import dataclasses` for a native @DataClass
defined in the mold itself. Function decorators and plain classes work
too — the latter already did, despite what the docs claimed.

Monty 0.0.20 is where all of this lands, and where the host API breaks:
LimitedTracker and NoLimitTracker are gone, ResourceTracker went from
trait to concrete struct, the generic parameter it threaded through
MontyRepl / ReplProgress / RunProgress disappeared with it, and
ResourceLimits::new() was replaced by its Default impl. 0.0.21 changes
nothing fimod links against — monty/src and monty-types/src are
byte-identical to 0.0.20 — so go there directly.

The part the compiler cannot catch is that 0.0.20 also moved max_memory
enforcement out of the interpreter's own accounting and into two globals
that only a charging allocator writes. fimod installs mimalloc, so those
counters would never move and the limit would silently stop applying: a
mold accumulating 3M dicts under a 50MB cap was measured reaching 1.7GB.
Rather than adopt monty-alloc, which forwards to System and costs ~20% on
every invocation, keep mimalloc and charge the counters around it in
mem_limit.rs. unsafe_code stays denied everywhere except that module.

The regression would have shipped green, because nothing covered the
enforcement itself — only config parsing. The new sandbox test closes
that: it fails when the allocator is reverted to bare mimalloc.

Dropping the jiter git patch is now possible as its comment anticipated;
0.0.21 resolves jiter 0.16.0 from the registry, leaving no git source in
the lockfile.
…x to 0.19

serde-saphyr 0.0.29 -> 1.1.0 and fancy-regex 0.18 -> 0.19 are the only
root dependencies left behind after refreshing the lockfile; every other
crate in Dependabot's pending batch is already at or above the requested
version.

fancy-regex 0.19 makes Captures generic over its input type
(Captures<'t, S: Input + ?Sized>) so it can back both str and [u8]
matching. fimod only ever matches against str, so the two helper
signatures in src/regex.rs are pinned to Captures<'_, str>.

get-size2 stays pinned at 0.10.1: 0.10.2 already moves to compact_str
0.10 while Ruff 0.0.3 is still on 0.9, which puts two CompactString
types in the graph and breaks Ruff's derive(GetSize). The comment now
records that boundary and the condition to lift it.
The draft was written for 0.9.1, before feat(monty) landed on the branch
and pushed the bump to minor. Retitle it and fold in what it never
covered: the Monty v0.0.21 upgrade and the standard-library modules it
unlocks in molds, the allocator work that keeps max_memory enforced, the
test that closes the enforcement gap, and today's dependency batch.

The old Housekeeping line credited the previous batch with a serde-saphyr
bump, which now contradicts the 1.1 upgrade; the dependency entries are
rewritten as one coherent set.
The incus branch of container_start() provisions its container; the
docker branch provisioned nothing, and ubuntu:24.04 ships without a
trust store. reqwest could not build its HTTPS client at all, so both
remote-mold tests failed under docker regardless of the binary under
test.

The failure surfaced as "Mold not found in any configured registry",
which reads like a broken build rather than a missing CA bundle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant