Skip to content

Per-language hook table for captureTagsFacts (#354 step 5) #374

Open

Description

@joyful-ii-V-I

Claim it in this issue first. Size: M. Depends on: nothing. Claimed by: nobody. Language: C++ (the work is in shared ingest code; one language per commit).

The problem, in user terms

Every language that is added to ripwire pushes a few more Lang:: branches into one shared function, so each new language edit touches code that every other language's answers depend on, and review has to re-check them all. captureTagsFacts (src/ingest_sidecap.h, about 815 lines, from void captureTagsFacts( to its closing brace) holds about 35 lines naming a Lang:: at c20f4d9b, Elixir the most (16 mentions), then Ruby, C++ and Clojure (4 each). Check the count on your checkout:

sed -n '/void captureTagsFacts(/,/^}/p' src/ingest_sidecap.h | grep -c 'Lang::[A-Z]'

Files to touch

  • src/ingest_sidecap.h: captureTagsFacts. The decisions to move are per-capture: keep or drop the capture, which SymKind it gets, parameter count, arityExact, and the Ruby arms (bare-call capture, receiver written path, Rake/Jbuilder top-level self).
  • a new src/ingest_<lang>.h per language that has a body to hold (Elixir's lives beside src/ingest_elixir.h), each hook with a one-sentence reason above it (CONTRIBUTING, "Hooks"). An empty slot means the shared path.
  • the table itself: one constexpr hook table indexed by Lang, beside the other per-Lang tables (src/langfacts.h holds facts; this is hooks, so keep it out of that table). A value that is only data (a boolean, an enum) goes into langfacts.h as a column instead, per the "To decide where a change goes" rules in CONTRIBUTING.
  • test/langidentity/ratchet.tsv: the ceiling falls with each removed predicate and may never rise; lower it in the same commit.

Red-first fixture and gate arm

This is a refactor, so the first artifact is the byte-identity harness, not a failing test: build main, then run bash test/langidentitycheck.sh BASE HEAD --langs=<the language you moved> --repo=<lang>:<your clone> after each commit. An empty diff is the pass. The red-first piece is a ratchet arm: the Lang:: line count in the function is asserted in a gate (a count that must fall), so a commit that adds a branch back goes red.

  • Per-language gates that read the moved decisions: test/elixircheck.sh, test/elixirnamearitycheck.sh, test/elixirsemanticcheck.sh, test/clojurecheck.sh, test/rubybarecallcheck.sh, test/rubyrakejbuildercheck.sh, test/rubyrecvcheck.sh, test/kotlincheck.sh, test/jslangcheck.sh, test/langcheck.sh.

Acceptance

  • Every language's output byte-identical (the langidentity run for the moved language, plus a before/after map and ripwire src --clones diff).
  • One language per commit; Elixir first (it has the most).
  • Lang:: lines inside captureTagsFacts fall to zero by the end; no new Lang:: comparison in a shared file.
  • ripwire . --quality-delta=origin/main..HEAD gates 0; CONTRIBUTING "Definition of done for a common-code slice".

Not in scope

Moving captures into tags.scm (slices 4b and 5a are separate); the per-Lang fact tables (slice 6c); the base-clause readers.

Order with other work: src/ingest_sidecap.h is also touched by the open tags-predicate PR (#426, @conka8); rebase onto main before you start and again before review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions