Repository navigation
Account composition input per document and charge completion (1.9.0-dev) - #81
Merged
Merged
Conversation
Salvage the native composition accounting correction from the historical composition branch (PR #63) onto current main without its performance toolkit. parseDocument retires the preceding input count before the next document, so inputBytes applies per document while the reported total stays cumulative. Completion now charges its own 424-byte counter report and 50 work units on the original ledger. Add the checked reserveExternalLogicalBytes(_:count:overhead:) overload; the two-argument form keeps its signature. Carry the contract test expectations and the two owned cancellation and substitution proofs. Update the composition guide, resource and qualification contracts, discovery counts (JSONIntegrationTests 34 -> 36), CHANGELOG (1.9.0-dev) and the CLI source identity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ThorFuchs
added a commit
that referenced
this pull request
Nov 9, 2026
Merge main at 5362626 (#81 composition per-document input and charged completion, #82 README for 1.8.0). Combine the Unreleased 1.9.0-dev CHANGELOG entries, set JSONIntegrationTests to 45 (43 here plus #81's two owned proofs) in the native, portable and WASI inventories and the harness assertion, and regenerate the CLI source identity. This candidate builds JSONIntegrationTests with -strict-memory-safety -warnings-as-errors. Mark #81's test-only withUnsafeCurrentTask cancellation hook with unsafe, using the same justification as the existing composition contract test. Behavior is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ThorFuchs
added a commit
that referenced
this pull request
Nov 10, 2026
Squash of the 1.9 candidate: ordered Inspection batches, the public immutable configured store with exact-ID lookup and bounded BFS follow (public API admitted by the maintainer 2026-11-10), exact Transform source definitions with compile reports, finite indexed selection scopes, cross-product acceptance, composition CI execution lanes, and the reconciliations with published 1.8.0 and #81. The full commit history, including the qualified source-bound commits, remains on branch codex/1.8-selection-main-qa. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two accounting gaps in
JSONCompositionScope(public since 1.6.0), salvaged from #63 without its performance toolkit, as decided in the 2026-11-09 PR review. Targets 1.9.0-dev.parseDocumentcheckpoints and retires the preceding input count before admitting the next document, soinputBytesapplies to each document. The reported input total stays cumulative. Work, logical retention, accepted-capacity history and first-failure identity never restart. Today, multi-document compositions hit the input limit early because input is counted across all documents.reserveExternalLogicalBytes(_:count:overhead:)overload checks the multiplication and then the addition before growth. The existing two-argument form keeps its signature.The runtime change is about 50 lines in
JSONCompositionScope.swiftandJSONWorkMeter.swift. The five carried files are byte-identical to #63's versions, and none of them had changed on main since #63's base.Behavior note for adapters: reported
retainedBytesandworkUnitsfor a completed composition grow by 424 and 50. A composition sitting exactly at its retention or work limit before this change now refuses at completion. That is the intended correction: the report's own cost was previously unaccounted.Tests
CompositionContractTestsexpectations now include the completion buffer and work (+424,+50).jcompOwnedCancellationOccursInsideNativeWork(cancellation observed inside each of 7 native stages) andjcompOriginalHealthAndIdentitySurvivePackageSubstitution.JSONIntegrationTestsgoes from 34 to 36 in the native, portable and WASI lists, with the harness assertion updated.Local results at
da33936(macOS 27, SDK 27.2, Apple Swift 6.4.2, language mode 6):python3 Scripts/ci.py --lane compositionpython3 Scripts/ci.py --lane nativepython3 Scripts/ci.py --lane docsNot run locally: safety, linux and wasm lanes, and performance. #63's quiet-runner performance gate isn't carried over; that check failed in #63 because the runner was busy (64.10% against a 90% idle rule), not because of a measured slowdown.
Left behind on #63's branch (kept for provenance)
The 41-file
Tools/CompositionQualificationadditions stay oncodex/composition-nav8-r3: compiler-bug reproducers, proof negatives, benchmark and probe, and thecomposition-performance.ymlworkflow on thexcode-27runner. The guide keeps the explicit-borrow guidance and points to that branch for the reduced Swift compiler crash reproducers.Overlap
#74 (1.9 workflows) also changes
TestDiscovery.json(JSONIntegrationTests 34 → 43) and CHANGELOG. Whichever lands second should add the counts together (43 + 2) and merge the bullets underUnreleased — 1.9.0-dev.🤖 Generated with Claude Code