feat: ban runtime typeof and decode at I/O boundaries - #35
Open
K-Mistele wants to merge 5 commits into
Open
Conversation
Ban runtime typeof checks so external values are decoded at I/O boundaries instead of narrowed by representation. Enable as warn and keep it off in the existing anti-slop test override. HumanLayer-Session: https://app.dev.codelayer.gg/sessions/01a06063-7b22-7f52-bc6a-c57092fdb108
Parse file, YAML, JSON, and provider payloads with Schema at their I/O seam. Dispatch trusted unions with Predicate and Match. Map platform errors from tagged reasons. Keep typeof FOLD_VERSION: Bun injects that identifier at build time. HumanLayer-Session: https://app.dev.codelayer.gg/sessions/01a06063-7b22-7f52-bc6a-c57092fdb108
Ignore the Bun-injected FOLD_VERSION typeof check. TUI and theme paths stay excluded. HumanLayer-Session: https://app.dev.codelayer.gg/sessions/01a06063-7b22-7f52-bc6a-c57092fdb108
Drop runtime typeof peeks on exec and squashed causes. Keep the typed error message from Error values. HumanLayer-Session: https://app.dev.codelayer.gg/sessions/01a06063-7b22-7f52-bc6a-c57092fdb108
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
anti-slop/no-runtime-typeofas an errortypeofchecksFOLD_VERSION; TUI and theme paths stay excludedContext
Runtime
typeofwas standing in for parsing at encoded boundaries (skills, plugins, OAuth, tool wire input) and for dispatch on already-decoded unions. Fold's program-design rule is parse at the edge, then Predicate/Match on trusted values.Validation
bunx oxlint --deny-warnings -A all -D anti-slop/no-runtime-typeofon in-scope paths — 0 errorsbun --bun run typecheckfor fold-core, fold-agent, fold-cli, fold-codex, fold-xai