Conversation
|
| Branch | transpiler-cleanup |
| Testbed | ubuntu-latest |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | leak-build-ms | Measure (units) x 1e3 | leak-count | Measure (units) | leak-run-ms | Measure (units) |
|---|---|---|---|---|---|---|
| benchmarks/concurrent/01_socket_throughput/bench | 📈 view plot | 5.59 units x 1e3 | 📈 view plot | 0.00 units | 📈 view plot | 1,362.88 units |
| benchmarks/concurrent/06_dynamic_spawn/bench | 📈 view plot | 5.08 units x 1e3 | 📈 view plot | 0.00 units | 📈 view plot | 3,307.55 units |
| benchmarks/concurrent/11_parallel_aggregation/bench | 📈 view plot | 4.99 units x 1e3 | 📈 view plot | 0.00 units | 📈 view plot | 6,916.93 units |
| benchmarks/concurrent/18_atomic_counter/bench | 📈 view plot | 4.97 units x 1e3 | 📈 view plot | 0.00 units | 📈 view plot | 40.86 units |
| benchmarks/inter-clear/04_concurrent_mvcc_fat_struct/bench | 📈 view plot | 5.12 units x 1e3 | 📈 view plot | 0.00 units | 📈 view plot | 332.14 units |
| benchmarks/sequential/03_alloc_throughput/bench | 📈 view plot | 4.96 units x 1e3 | 📈 view plot | 0.00 units | 📈 view plot | 11,790.00 units |
| benchmarks/sequential/08_sort/bench | 📈 view plot | 5.03 units x 1e3 | 📈 view plot | 0.00 units | 📈 view plot | 1,480.64 units |
| benchmarks/sequential/13_soa_layout/bench | 📈 view plot | 4.99 units x 1e3 | 📈 view plot | 0.00 units | 📈 view plot | 1,327.45 units |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #15 +/- ##
==========================================
+ Coverage 89.73% 89.76% +0.02%
==========================================
Files 173 174 +1
Lines 46723 46905 +182
Branches 11604 11463 -141
==========================================
+ Hits 41927 42102 +175
- Misses 4796 4803 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
aa91282 to
69570e2
Compare
…ts, respond_to? cleanup
Squashed from 21 incremental commits. Original history preserved at tag
`transpiler-cleanup-original`. Each piece below was independently green
on srb tc / prspec (3598/0) / transpile-tests (432/0 leaks).
Hash-as-struct schemas → typed Data classes in src/ast/schemas.rb:
- `EnumSchema(variants, visibility)`
- `ResourceSchema(close_zig, static_methods, fields, type_params, ...)`
- `UnionSchema(variants, type_params, visibility)`
- `StructSchema(fields, field_defaults, borrowed_fields, type_params,
methods, visibility, extern_module, as_type)`
Eliminates 60+ `schema.is_a?(Hash) && schema[:kind] == :X` dispatches
across annotator, MIR pipeline, and tools. Fields cleanly separated
from metadata; the `schema.keys.reject { |k| k.is_a?(Symbol) }` pattern
goes away (subsumes the original String/Symbol normalization).
Parallel registries in `mir_lowering.rb` (`@struct_schemas`,
`@union_schemas`) and `importer.rb` carry typed values too.
- `Formatter::Emitter::FnSig(toks, start, arrow_idx, po, pc)` — 5
methods that took the same arg cluster.
- `PipelineHost::PipelineSite(list, options)` — 24 lower_X methods in
PipelineHost; clump dropped from 13 methods.
- `MIRPass::WalkCtx(bindings, promo)` — read-only carry through
transform_body / recurse_branches!.
- `OwnershipDataflow::DataflowStep(state, consumed)` — per-walk state
for collect_ownership_transfers + 4 helpers.
Introduced `AST::HasBodies` module. Body-owning AST nodes (12 types:
IfStatement, WhileLoop, ForRange, ForEach, MatchStatement, WithBlock,
DoBlock, BgBlock, BgStreamBlock, FunctionDef, TestBlock,
WhileBindLoop) declare `child_bodies`. `AST.walk_body` and
`AST._bg_visit_recursive` collapse from hand-coded case chains to
trait-driven loops. Adding a new body-owning node type is now a single
include + def, no walker edits.
655 → 504 sites (-151). Methodology: trace each receiver via Prism +
call-site grep before touching. Most "guards" were dead defensive code
where Locatable's universal accessors (token, full_type, type_info,
storage, matched_stdlib_def, was_moved, zig_pattern, mutates_receiver,
line, column, etc.) made the check pointless on AST receivers.
Clusters cleaned: `:strip` / `:empty?` (emit() returns String|nil),
`:line` / `:column` (Locatable + Token), `:matched_stdlib_def`,
`:was_moved`, `:zig_pattern`, `:mutates_receiver`, `:token`,
`:full_type` (40 sites), `:value` (sites with case/when narrowing).
False positives caught by tests: 1 in `visit_StubDecl` where
`node.value` is genuinely polymorphic (AST | Symbol). Replaced with
explicit `is_a?(AST::Locatable)` and a comment.
Also removed 1 spec test that locked in the dead-defensive code via
`Struct.new(:stack_tier, :stack_vars_bytes)` — lockstep deletion per
CLAUDE.md "test for deleted functionality."
Converted PipelineHost#transpile_pipeline's 24-arm if/elsif chain to
case/when (54 LOC → 30 LOC). Other AST-is_a? chains in src/ are 2-3
arms with mixed predicates (`is_a?(X) && was_moved`) where case/when
doesn't simplify cleanly — those stay as-is.
- `.github/workflows/transpile-pure.yml`: PR-body-triggered byte-diff
of generated .zig vs merge base. Gated on `#TRANSPILE_PURE` marker.
- `clear emit-zig <path> -o <outdir>` CLI subcommand: walks .cht files
and writes generated .zig to a mirrored tree without compiling.
- Used by the workflow to capture deterministic transpiler output.
- Gemfile: sorbet, sorbet-runtime, tapioca added to dev group.
- `sorbet/config` + `sorbet/rbi/clear-stubs.rbi` (minimal stubs to
unblock `srb tc`).
- `tools/gen_attr_rbi.rb` (Prism-based RBI generator for AST attr_*
declarations) → `sorbet/rbi/clear-attr-accessors.rbi` (91 classes,
404 attr_* shims).
- Test pilot: importer.rb at `# typed: true` clean.
- `tools/respond_to_inventory.rb` — Prism walks src/ast/ast.rb to map
AST classes → attrs (Struct members + include Locatable +
attr_accessor + custom getters), then walks src/**/*.rb for every
respond_to?(:X) site. Outputs CSVs and a summary md.
- `tools/respond_to_narrowing.rb` — per-site receiver-type classifier.
For each respond_to? site, finds prior is_a? guards, case/when
arms, .X assignments from Locatable attrs, and walker-block params.
Classifies as ast_locatable / typed_specific /
from_locatable_attr / walker_yielded / unknown. Drove Phase 1f's
full_type sweep (40 sites, 1 false positive).
- `docs/agents/respond_to_inventory.md` — methodology + phased plan.
- TODO.md updated: P0 self-host prep #1 String/Symbol normalization
folded into #2 (the schema work subsumes it).
- Two pure-deletion commits removed dead code unrelated to the main
themes (4 dead methods debride flagged, dead defensive guards in
escape_analysis).
Co-Authored-By: Claude Opus 4.7 (1M context) <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.
#TRANSPILE_PURE
Self-host preparation: typed schemas, struct extractions, walker traits, respond_to? cleanup. Squashed from 21 incremental commits.
Test plan
How #TRANSPILE_PURE works on this branch
The transpiler uses
node.object_id.absto disambiguate nested-WITH guard variables, MATCH binding aliases, snapshot guards, and acquire-block labels. Rubyobject_idshifts whenever allocation order changes — so any refactor that adds/removes object allocations produces different counter values even when the generated Zig is functionally identical.We can't replace
object_idin the transpiler: it uniquely identifies cloned AST subtrees, which pipeline rewriting can produce. Source-position-based naming would silently collide on clones that share(line, column)— that would be a real bug.Solution: keep the transpiler unchanged and normalize the OUTPUT instead.
tools/normalize_zig.rbmaps each unique counter to a stable first-occurrence index per file (__c_guard_3220→__c_guard_N1). The workflow normalizes both base and branch trees before diffing, so structurally-equivalent output diffs to zero.Verified locally: 54 raw file diffs (counter shifts) → 0 after normalization.
See commit message for full breakdown.