Skip to content

Tighten target detection edge case handling #26

@oleksiikolomiietssnapp

Description

@oleksiikolomiietssnapp

Review and strengthen the Package.swift parsing and folder pattern matching logic for edge cases.

Current Strengths

  • Good fallback mechanism: Package.swift → folder patterns → project name
  • Intelligent longest-path matching for nested structures
  • Handles test filtering well

Improvements Needed

Following patterns from SwiftPackageScripts:

  1. Explicit Validation

    • Validate simulator/path availability before processing (like their get_latest_simulator)
    • Check that extracted target names are valid (not empty, not test-like)
    • Return clear error codes on validation failure
  2. Edge Cases to Handle

    • Deeply nested directory structures (>3 levels)
    • Symlinks in source paths
    • Non-standard Package.swift formats
    • Unicode characters in target names
    • Targets with similar path prefixes (ensure longest match wins consistently)
  3. Fallback Robustness

    • Better logging of which detection method succeeded (currently done, but could be clearer)
    • Explicit error when no valid targets detected
    • Handle malformed jq output gracefully
  4. Test Coverage

    • Document expected patterns for file paths
    • Add examples of edge cases handled

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions