Adds executeTagged to the tagged subpath - #162
Merged
Merged
Conversation
execute and executeValue hand a statement program's halt context back under the plain projection, so a program that stores the float two reads back the integer two. executeTagged, on the tagged subpath beside evaluateTagged, runs the same statement program - a compiled list, or source text compiled as compileProgram compiles it - and answers the halt context as the tagged encoding's text on both arms, so decodeTagged reads every value back as the one the program bound. The run is execute's: the main entry point's options, the same budgets and refusals, and the caller's context never written into. A source the program compiler refuses is its ParseError with no context; a context the value boundary refuses carries none either. A halt context the encoding cannot carry is the encoder's reason as an EvaluationError; on the failing arm the run's own error stays the answer and the context it cannot write is left off. It takes no tagged request: the encoding is the only form it answers in, and the tagged option stays evaluateTagged's alone. Tests pin the float on both arms, the compiled-list form, dates, durations and absences, the loop budget, both no-context refusals and both encoding refusals; each new sabotage was run and reverted. The README documents it beside evaluateTagged, and an Added fragment names it. Refs: pts-mmls
Adds a dated foot Note to ADR-0002, add-only, that decides nothing. The note defining an entry point as a function that runs a program and answers its result listed four such functions; executeTagged is a fifth and the tagged subpath's second. The Note says the tagged option is still accepted by evaluateTagged alone, since executeTagged takes EvaluateOptions and always answers the encoding, and that this change discharges the statement-mode amendment's sentence that a change giving the subpath a statement mode owes the encoding across the returned context. Also states in the README that on the failing arm the run's own error stays and an unencodable partial context is left off, and points execute's doc comment at executeTagged for a host that needs the brand. Refs: pts-mmls
johnnyt
force-pushed
the
pts-mmls-execute-tagged
branch
from
October 1, 2026 12:58
2997bd3 to
a7c0975
Compare
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.
What
executeTaggedon the./taggedsubpath: the statement run besideevaluateTagged.executeandexecuteValuehand a program's halt context back under the plain projection, so a program that stores the float two reads back the integer two.executeTaggedruns the same statement program and answers the halt context as the tagged encoding's text on both arms, sodecodeTaggedreads every value back as the one the program bound - an integral float stays a float, and a date, a datetime, a duration and an absence come back as themselves.Adding this name to this release was ruled by the operator, 2026-10-01.
src/tagged.ts:executeTagged(program: Program | string, context?, options?: EvaluateOptions). A list runs as given; a string is compiled withcompileProgram, and a refusal is thatParseErroron the failing arm with no context. The run isexecuteToContext, the functionexecuteruns, so the options, budgets and refusals areexecute's and the caller's context is never written into. The failing arm carries the partial context in the same encoding, and none when the value boundary refused the context.test/export-surface.json:executeTaggedadded to the./taggedlist.README.md: documented besideevaluateTaggedin "The tagged subpath", with an executed example; the entry-points import line and the subpath bullet name it.changelog.d/pts-mmls.md: anAddedfragment naming it.src/index.ts:execute's doc comment points a host that needs the brand atexecuteTagged. No code change there.docs/adr/0002-the-value-domain-and-the-host-boundary.md: a dated foot Note, below.No change under
src/evaluator.ts;executeToContextwas already exported from that module.Record
One
## Noteat the foot of ADR-0002, add-only (git diff origin/main...HEAD -- docs/adr/shows no removed line) and with no Status line. It namesexecuteTaggedas a fifth function in the note "the projection is an export and is not an entry point for host input", whose sentence opening "Those areevaluate,executeandexecuteValue" listed four. It saystaggedis still accepted byevaluateTaggedalone, sinceexecuteTaggedtakesEvaluateOptionsand always answers the encoding, which keeps the Decision's "accepted by the entry point that subpath exports and by no other" and the options note's "the subpath's entry point,evaluateTagged" true of the option. It also says this change discharges the sentence in the amendment on the three questions the statement-mode note holds: "a change that gives it one owes the encoding across the returned context".Why a Note and not an Amendment:
docs/adr/README.mdsays an amendment changes what the record decides and a note does not. The listing sentence is itself inside a note, which decides nothing. The statement-mode amendment already anticipated a statement run on the subpath and stated what it owes. Adding this function was ruled by the operator, 2026-10-01. So this text records which accepted sentences a new function falls under and how each still reads, and decides nothing.Direction check, done in-turn: each quoted sentence was matched against the record's text at
929bcb7. The claim thatencodeTaggedrefuses a cyclic value, one past the depth limit and one past the place budget rather than raising was checked against its doc comment and code insrc/tagged.ts. The main-entry claim was checked againstexecuteandexecuteValueinsrc/index.ts, which still answer the plain projection.Provenance
Engineering choices this PR makes, each reversible before the release prep:
taggedrequest: a plain default would answer exactly whatexecuteanswers, and keeping thetaggedoption onevaluateTaggedalone leavesdocs/adr/0002-the-value-domain-and-the-host-boundary.md's statements about that option as they are. The result shape mirrorsevaluateTagged's arms (ok, the answer,error), with the context in place of the value, asexecute's does.compileProgram, independent of whetherexecute's own source form has switched to program mode; nothing here depends on that change.EvaluationError, with no context. On the failing arm the run's own error stays the answer and the context it cannot write is left off.executeTagged, whichtest/export-surface.jsonpins.Rebased onto
929bcb7, which exportedDecompileResultand added its name totest/export-surface.json's.list. This change adds to the./taggedlist, so the rebase applied with no conflict and both names are kept. The open change that switchesexecute's source form to program mode also editsREADME.mdandexecute's doc comment insrc/index.ts. A rebase over it is additive.Tests
New
executeTaggedtests intest/tagged.test.tspin: the float two on the success arm from source text; the compiled-list form; the partial context on the failure arm (a protected-root refusal) with the float intact; a date, a duration and an absence; the loop budget's refusal with the context it reached; a source the program compiler refuses and a context the value boundary refuses, both with no context; a halt context the encoding cannot carry; the run's own refusal kept when its partial context cannot be encoded; and that the caller's context is not written into.Sabotage, each run against
test/tagged.test.tswith the file restored byte-equal before the next; every failure was an assertion failure:src/tagged.tsexecuteTaggeddescribe block)Gate
mise exec -- pnpm run gategreen on the rebased head: typecheck, lint, neutrality, the suite with coverage (35 files, 2833 tests passed),corpus:checkatv9.4.2, build, identity and resolution all passed. CI runs the same gate.