ParameterTally attributes a nested Struct or Data constructor to the file's outer constant #1087

Open
opened 2026-10-17 15:46:41 +00:00 by jared · 0 comments
Owner

Problem

OsSdlc::CollaboratorPass::ParameterTally labels every constructor site in a file with the file's Zeitwerk constant. A nested Result = Struct.new(:root, :run_dir) inside lib/os_sdlc/crc_jobs.rb is therefore reported as a site of OsSdlc::CrcJobs, and the clump root+run_dir lists CrcJobs as a class that takes those names when only its nested value does. Findings over-count sites and the prescriber brief shows the wrong excerpt for that constant.

Observed

bin/collaborator-pass prescribe-brief --run <run> --subject root+run_dir lists site OsSdlc::CrcJobs with excerpt Result = Struct.new(...) at line 7.

Reproduce

bundle exec bin/collaborator-pass measure --sources params --ledger docs/crc/os-sdlc/ledger.tsv | grep -B2 -A2 CrcJobs

Approach

ConstructorSites tracks the lexical namespace while walking the Prism tree and names each site by its enclosing class or module plus the assigned constant for Data.define and Struct.new. The join with the ledger then falls back to the file's constant only when the nested constant has no row.

Required work: none beyond the acceptance criteria.

Acceptance criteria

  1. Given a file whose outer class has an initialize and a nested Result = Struct.new(:a, :b), when the tally runs, then the struct site's constant is Outer::Result and the initialize site's constant is Outer.
  2. Given today's lib, when measure --sources params runs, then OsSdlc::CrcJobs is not a site of root+run_dir unless its own initialize takes those names.

Origin

  • Trigger: slice 1 smoke run of prescribe-brief, 2026-10-17
  • Improvised this session: none
  • Chain: wrong site constant ← ParameterTally uses Sources#constant_for(path) for every site ← DESIGN (collaborator-pass brief, Signal schema: constant = the Sources constant for the file)
  • Root candidate: this ticket
  • Where: plugins/os-sdlc/lib/os_sdlc/collaborator_pass/parameter_tally.rb
  • Session: f1eaf768-77b4-48c7-afde-b0344f519273
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/f1eaf768-77b4-48c7-afde-b0344f519273.jsonl

VERDICT: CREATE
REASON: Observed wrong output in the shipped #1083 tool, not an agent improvisation. #1085 is a different root (the rubocop cop, not ParameterTally).

## Problem `OsSdlc::CollaboratorPass::ParameterTally` labels every constructor site in a file with the file's Zeitwerk constant. A nested `Result = Struct.new(:root, :run_dir)` inside `lib/os_sdlc/crc_jobs.rb` is therefore reported as a site of `OsSdlc::CrcJobs`, and the clump `root+run_dir` lists `CrcJobs` as a class that takes those names when only its nested value does. Findings over-count sites and the prescriber brief shows the wrong excerpt for that constant. ## Observed `bin/collaborator-pass prescribe-brief --run <run> --subject root+run_dir` lists site `OsSdlc::CrcJobs` with excerpt `Result = Struct.new(...)` at line 7. ## Reproduce ``` bundle exec bin/collaborator-pass measure --sources params --ledger docs/crc/os-sdlc/ledger.tsv | grep -B2 -A2 CrcJobs ``` ## Approach `ConstructorSites` tracks the lexical namespace while walking the Prism tree and names each site by its enclosing class or module plus the assigned constant for `Data.define` and `Struct.new`. The join with the ledger then falls back to the file's constant only when the nested constant has no row. Required work: none beyond the acceptance criteria. ## Acceptance criteria 1. Given a file whose outer class has an `initialize` and a nested `Result = Struct.new(:a, :b)`, when the tally runs, then the struct site's constant is `Outer::Result` and the initialize site's constant is `Outer`. 2. Given today's lib, when `measure --sources params` runs, then `OsSdlc::CrcJobs` is not a site of `root+run_dir` unless its own `initialize` takes those names. ## Origin - Trigger: slice 1 smoke run of prescribe-brief, 2026-10-17 - Improvised this session: none - Chain: wrong site constant ← ParameterTally uses Sources#constant_for(path) for every site ← DESIGN (collaborator-pass brief, Signal schema: constant = the Sources constant for the file) - Root candidate: this ticket - Where: plugins/os-sdlc/lib/os_sdlc/collaborator_pass/parameter_tally.rb - Session: f1eaf768-77b4-48c7-afde-b0344f519273 - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/f1eaf768-77b4-48c7-afde-b0344f519273.jsonl VERDICT: CREATE REASON: Observed wrong output in the shipped #1083 tool, not an agent improvisation. #1085 is a different root (the rubocop cop, not ParameterTally).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#1087
No description provided.