Skip to content

feat: ProfileConfig.string_sentinels declaration + StructuralProfileResult propagation #177

Description

@DEVunderdog

Parent

#176

What to build

Add the user-facing string sentinel declaration surface to ProfileConfig and thread it through to StructuralProfileResult so Phase 2 can read declared sentinels from the profile without holding a config reference.

ProfileConfig (profiling/_config.py):

  • Add string_sentinels: dict[str, list[str]] field with default empty dict
  • Update to_dict() to serialize the field
  • Update from_dict() to restore it (missing key → empty dict, for backwards compatibility)
  • Update the class docstring to document the new parameter

StructuralProfileResult (profiling/_config.py):

  • Add string_sentinels: dict[str, list[str]] field with default empty dict
  • StructuralProfiler.profile() copies profile_config.string_sentinels into the result when building it

Acceptance criteria

  • ProfileConfig.string_sentinels field exists, defaults to {}
  • ProfileConfig.to_dict() includes the string_sentinels key
  • ProfileConfig.from_dict() restores string_sentinels; a dict without the key defaults to {}
  • StructuralProfileResult.string_sentinels field exists, defaults to {}
  • StructuralProfiler.profile() copies profile_config.string_sentinels onto the returned StructuralProfileResult
  • A ProfileConfig with no sentinels declared serializes and deserializes identically to the current behaviour
  • Unit tests cover: round-trip with sentinels declared, round-trip with no sentinels, old-format dict without the key deserializes to empty dict, profiler propagates the dict to the result
  • Docstrings updated per ADR-0034

Blocked by

None — can start immediately

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions