Skip to content

SLT.BETA.013 – Improve split helper implementation #75

@flyingrobots

Description

@flyingrobots

[SLT.BETA.013] Improve split helper implementation

Overview

Refactor Bosun's split_string helper to use local arrays/readarray for performance and document delimiter semantics, especially for multi-character separators.

References & Assets

  • Figma / Design: N/A
  • Product Spec: N/A
  • Related Issues / PRs: Bosun helper improvements
  • Feature Flags / Experiments: N/A
  • Other Assets: scripts/bosun

User Story

As a Bosun contributor, I want a reliable split helper with documented behavior so that table rendering and CLI parsing remain fast and predictable.

Acceptance Criteria

  • split_string refactored to use local arrays/readarray for performance
  • Documentation clarifies multi-character delimiter behavior
  • Tests cover edge cases (empty fields, multi-character separators, trailing delimiters)

Definition of Done

Updated helper implementation, documentation, and tests merged, with lint/tests passing.

Scope

In-Scope

  • Refactor of split helper
  • Documentation updates
  • Test coverage for edge cases

Out-of-Scope

  • Broader Bosun refactors beyond split helper

Deliverables

  • Est. Lines of Code: ~120
  • Est. Blast Radius: scripts/bosun, docs/bosun.md, tests

Implementation Details

High-Level Approach

Replace manual parsing with readarray/IFS aware approach, ensure helper remains POSIX-compatible, and update docstring and README examples.

Affected Areas

  • scripts/bosun
  • docs/bosun.md
  • tests/bosun_split.bats

Implementation Steps

  • Refactor helper using local arrays
  • Document delimiter semantics in docs/bosun.md
  • Add tests for edge cases

Test Plan

Happy Path

  • Splitting typical output returns expected fields

Edge Cases

  • Multi-character and trailing delimiters handled correctly
  • Empty input returns empty array without errors

Failure Cases

  • Invalid delimiter surfaces helpful error (if applicable)

Monitoring & Success Metrics

  • No regressions in Bosun CLI tests

QA Sign-off Matrix

Environment Surface Owner Status Notes
Local Docker Bosun CLI TBD Pending Validate via make test

Requirements

Hard Requirements

  • Helper must remain shell-compatible and efficient

Soft Requirements

  • Document usage for contributors

Runtime Requirements

  • Works on all supported distros in Docker matrix

Dependencies & Approvals

  • None

Production Notes

Priority: 3 / 5

Performance/maintainability improvement (P2).

Complexity: 2 / 5

Focused helper refactor.

Estimate: 6 - 8 hours

Includes implementation, docs, tests.

Risk & Rollback

  • Primary Risks: Regression in CLI parsing
  • Mitigations: Tests for edge cases
  • Rollback / Kill Switch: Revert helper change

Additional Notes

Ensure helper remains backward compatible with existing callers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions