Repository navigation
stdlib+vm: Symbol#intern + resolv/optparse/ripper + Puppet-boot batch - #27
Merged
Merged
Conversation
Advances `require "puppet"` boot through a chain of successive blockers, each fixed pure-Go (CGO=0) from scratch: - Symbol#intern: MRI alias of #to_sym (returns self); stops :sym.intern falling through to Puppet's arity-2 Object#intern. - resolv stdlib (new): real Resolv::IPv4/IPv6 parse/validate/render + ::Regex constants + Resolv.getaddress for literal IPs; DNS sockets raise NotImplementedError (Resolv::DNS constructable, query methods stubbed); full Resource constant tree. - digest/md5 + digest/sha1 + digest/sha2: register as provided sub-features of the existing Digest module. - Singleton-class include lookup (VM): lookupSMethod now consults a class's metaclass includes/prepends, so `class << self; include M; end` and `extend M` supply class methods (and subclasses inherit them) — Puppet's InstanceLoader. - File path coercion: new pathArg() coerces via #to_path/#to_str so File.* accept a Pathname (Puppet::FileSystem); applied across the File surface. - SystemExit (+status/success?), NoMemoryError, SecurityError, SignalException, Interrupt under Exception (not StandardError), matching MRI's tree. - Singleton prelude module (require "singleton"): memoized .instance, private .new/.allocate; frozen prelude regenerated. - Kernel#load / Kernel.load (new): re-executes a file every call, returns true, searches $LOAD_PATH; Puppet's autoloader uses Kernel.load. - $LOADED_FEATURES / $" : real mutable Array (autoload appends to it). - File.mtime: returns a Time; Errno::ENOENT for a missing file. - optparse + ripper loadable shells: classes/errors exist so require completes; the parsing methods raise NotImplementedError (real parsers are later rounds). Puppet boot now advances to `require "semantic_puppet"` — an external gem (not stdlib), the next round's target. 100% cross-package coverage; full suite green. Co-Authored-By: Claude Opus 4.8 <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.
Advances
require "puppet"boot by clearing a chain of successive blockers, each implemented pure-Go (CGO=0) from scratch under BSD-3-Clause, with tests and 100% cross-package coverage.Blockers cleared (in boot order)
Symbol#intern— MRI alias of#to_sym(returns self). Without it:sym.internfell through to Puppet's private arity-2Object#intern, raisingArgumentErrorduringrequire "puppet".resolvstdlib (newresolv.go) — realResolv::IPv4/Resolv::IPv6create/parse/validate/render plus the::Regexconstants;Resolv.getaddress/getaddressesare real for literal IPs (and raiseResolv::ResolvErrorfor a name needing a real query).Resolv::DNSis constructable but its query methods raiseNotImplementedError(real DNS sockets are a later round). FullResolv::DNS::Resource::IN::{A,AAAA,SRV,...}constant tree +Resolv::Hosts/Resolv::DNS::Name.digest/md5+digest/sha1+digest/sha2— registered as provided sub-features of the existingDigestmodule.includelookup (VM fix inlookupSMethod) — now consults a class's metaclassincludes/prepends, soclass << self; include M; endandextend Msupply class methods, and subclasses inherit them. This is the mechanism Puppet'sInstanceLoaderrelies on.pathArg()coerces via#to_path/#to_strsoFile.*accept aPathname(Puppet'sFileSystempasses Pathnames), applied across theFilesurface.SystemExit(withstatus/success?),NoMemoryError,SecurityError,SignalException,Interrupt— underException(notStandardError), matching MRI.Singletonprelude module (require "singleton") — memoized.instance, private.new/.allocate; frozen prelude regenerated (drift test green).Kernel#load/Kernel.load— re-executes a file every call, returns true, searches$LOAD_PATH; Puppet's autoloader usesKernel.load.$LOADED_FEATURES/$"— real mutable Array (the autoloader appends to it).File.mtime— returns aTime;Errno::ENOENTfor a missing file.optparse+ripperloadable shells — classes/error trees exist sorequirecompletes and load-time references resolve; the parsing methods (OptionParser#parse!,Ripper.sexp, ...) raiseNotImplementedError(real parsers are later rounds).New current boot blocker (next round)
Puppet boot now advances to
require "semantic_puppet"(frompuppet/pops.rb).semantic_puppetis an external gem — not stdlib and not vendored in the Puppet checkout — so this is a missing dependency rather than a VM/stdlib gap. Characterized as a large/out-of-scope item (needs the gem on the load path), the natural target for the next round.Verification
go test ./...),go vetclean,gofmtclean,go build ./cmd/rbgosucceeds.🤖 Generated with Claude Code