Skip to content

[HC-015] Hard cutover shared helper hoist across compiler, runtime, scripts, and tests #8146

@doublemover

Description

@doublemover

Hard cutover policy: repeated helper implementations are hoisted to shared modules. No local static reimplementations of common behavior remain in parser, sema, IR, pipeline, runtime, scripts, or tests.

Source facts already established:

  • Parser, semantic, IR, pipeline, runtime, and scripts repeatedly build normalized selectors, profile strings, JSON fragments, diagnostic text, stable sorted lists, source paths, command output, artifact paths, and AST walks.
  • io/objc3_json.h exists, while other modules still concatenate JSON manually.
  • Runtime acceptance and workflow scripts duplicate subprocess, progress, report, and artifact handling.

Required native shared tree:

  • native/objc3c/src/support/text/
    • join.h/.cpp
    • case_convert.h/.cpp
    • string_escape.h/.cpp
  • native/objc3c/src/support/selectors/
    • selector_normalization.h/.cpp
    • method_family.h/.cpp
  • native/objc3c/src/support/source/
    • source_location.h/.cpp
    • source_range_format.h/.cpp
  • native/objc3c/src/support/ast_walk/
    • expr_walk.h/.cpp
    • stmt_walk.h/.cpp
    • decl_walk.h/.cpp
  • native/objc3c/src/support/stable_order/
    • stable_sort.h/.cpp
    • deterministic_key.h/.cpp
  • native/objc3c/src/support/identifiers/
    • safe_suffix.h/.cpp
    • symbol_names.h/.cpp
  • native/objc3c/src/io/json/
    • json_value.h/.cpp
    • json_writer.h/.cpp
    • json_parser.h/.cpp
  • native/objc3c/src/io/process/
    • process_command.h/.cpp
    • process_result.h/.cpp
  • native/objc3c/src/io/filesystem/
    • path_normalization.h/.cpp
    • artifact_paths.h/.cpp

Required Python shared tree:

  • scripts/objc3c_shared/
    • commands.py
    • artifacts.py
    • json_io.py
    • progress.py
    • fixtures.py
    • schemas.py
    • paths.py
    • hashing.py

Required work:

  • Replace local static helpers with shared helpers from the trees above.
  • Delete manual JSON parser and writer fragments outside shared JSON modules.
  • Delete duplicate subprocess wrappers in workflow and acceptance scripts.
  • Delete duplicate fixture discovery and schema validation helpers.
  • Delete duplicate selector normalization and method-family helpers.
  • Delete duplicate AST traversal collectors across semantic feature summaries.
  • Add dependency-boundary tests that prevent helper code from drifting back into feature modules.

Maximum effort shared hoist pass:

  • Perform a complete dedupe pass across every file touched by HC-003 through HC-014.
  • Hoist shared code to the narrowest common owner.
  • Prefer domain-level shared modules over global support modules for domain-specific behavior.
  • Add tests for every hoisted helper.

Acceptance criteria:

  • rg "EscapeJsonString|BuildNormalizedObjcSelector|JoinStringVector|Collect.*FromExpr|Collect.*FromStatement|subprocess.run|json.dumps|ProcessStartInfo" native scripts tests shows shared helper usage or approved shared module definitions only.
  • Dependency-boundary tests fail on new local helper clones.
  • Shared helper modules have focused unit tests.
  • Feature modules contain feature behavior, not common plumbing.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions