Skip to content

claw: write the text helpers once in specs/claw/text.t27 instead of copying them #10317

Closed as not planned

Description

@gHashTag

Goal

Seven helper bodies are copied across specs/claw/ and sit in tools/duplicate_bodies_baseline.txt since #10312 (Closes #10311): buf_has, digit_byte, put_count, put_str (gates.t27 + sarif.t27), str_eq (gates.t27 + suggest.t27), has_prefix (service.t27) / starts_with (preview.t27), and the byte-equality loop same in sarif_pins.t27. Write each of them once, in one shared module, and delete the copies, so the ratchet goes down instead of being blessed up.

Boundary

  • New file specs/claw/text.t27 (module ClawText) holding the counted-string helpers with their tests.
  • specs/claw/gates.t27, sarif.t27, suggest.t27, service.t27, preview.t27, sarif_pins.t27: delete the local copies, add use claw::text;, pass the length as a parameter at each call site.
  • gen/c/claw/gates.c regenerated and the seals whose spec text changed (ClawGates, ClawGatesPins, ClawService) re-saved, in the same commit.
  • Not touched: tools/dupe_scan.py, the policy gate files, the behaviour of any helper.

Scenarios

  1. t27c gen-c on a spec that uses claw::text returns 0 and the C output holds exactly the helpers the spec names (use_resolve splices them in before the backend runs). The comment in sarif.t27 saying the copies exist "because this file must lower alone" is wrong and is replaced.
  2. t27c test-report on text, gates, sarif, sarif_pins, suggest, service, preview, github_surface and recipes: no failing test, none blocked.
  3. python3 tools/dupe_scan.py is OK and the seven claw groups are gone from the known set.
  4. The gate-topology claw drift step still compiles gen/c/claw/gates.c and prints "matrix is current"; tools/check_seal_currency.py reports 0 stale generated-code hashes.
  5. preview.t27 keeps a single use: it imports claw::text only, because a second use with a same-named str_eq (recipes vs text) is reported ambiguous and the qualified recipes:: references stop resolving.

Requirements

  • Every helper takes its string length as a parameter (gen-c cannot express .len).
  • No behaviour change: the moved bodies are the existing ones; the callers differ only by the added length argument.
  • No new hand-written code outside .t27.
  • Seals and gen/c/claw/gates.c come from the lab build of the same tree.

Success Criteria

Close criteria

Close when the PR that moves the helpers into specs/claw/text.t27 is merged and the dupe baseline no longer lists the seven groups.

Activity

  1. added
    shape-refusedClosed by the issue-shape gate (specs/policy/issue_shape.t27); a passing edit reopens it
    on Oct 18, 2026
  2. github-actions commented on Oct 18, 2026

    @github-actions
    Contributor

    Closed by the issue-shape gate (specs/policy/issue_shape.t27, #7498): an issue must have the template's sections. Edit the body; an edit that passes reopens it.

    • missing: ## Success Criteria -- an outcome a machine can settle: a number with a unit, a backticked file, exit 0, or a backticked command
  3. added 2 commits that reference this issue on Oct 18, 2026
    990965c
    ded3572
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

    shape-refusedClosed by the issue-shape gate (specs/policy/issue_shape.t27); a passing edit reopens it

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions