Skip to content

fix: Decode MECP timestamps per MECPv1.4.1 - #497

Open
Blake-Latchford wants to merge 5 commits into
Avi0n:devfrom
Blake-Latchford:fix/mecp-timestamp
Open

Blake-Latchford wants to merge 5 commits into
Avi0n:devfrom
Blake-Latchford:fix/mecp-timestamp

Conversation

@Blake-Latchford

@Blake-Latchford Blake-Latchford commented Nov 20, 2026 •

Copy link
Copy Markdown

Description

Accept @630, @6:30 and expand boundary conditions. Third commit in a series for issue #494.

Testing

  • MECPDecodeTests covers each example in MECP 1.4.0 Support #494's timestamp section: the three-digit and colon forms, a trailing comma, a timestamp glued to a word, and an out-of-range value followed by a valid one. It also covers @2300, which needs the matcher to backtrack past @230.
  • Ran the MECP decode and catalog tests with swift test in the swift:6.2 Docker image on Linux. All decode tests pass. The one failure is pack choice uses the first preferred localization, which fails on Linux before any MECP code runs because Linux Foundation resolves zh-Hans to en. It is unrelated to this change.
  • swiftlint lint is clean on MECPDecode.swift.

I don't have access to an Apple device on which to test my code. However, I have tested the unit tests on linux/docker with the command below.

docker run --rm --user "$(id -u):$(id -g)" -e HOME=/tmp \
  -v "$REPO":"$REPO":ro -v "$HERE":"$HERE" -w "$HERE" \
  swift:6.2 swift test "$@"

Tested on

  • iOS [version]
  • iPadOS [version]
  • macOS [version]

Checklist

  • This PR was discussed with the maintainer either via GitHub issue or other means (Also check the box if this PR is small enough not to need discussion e.g. typo fix)
  • I have read CONTRIBUTING.md
  • Testing steps are documented above.
  • This change is not low effort and I took the time to test it

🤖 Generated with Claude Code

Blake-Latchford and others added 2 commits November 20, 2026 16:56
Accept @630, @6:30 and expand boundary conditions. Third commit in a series for issue Avi0n#494.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Avi0n

Avi0n commented Nov 22, 2026

Copy link
Copy Markdown
Owner

@Blake-Latchford Saw mecp-org/MECP#53 got merged, so I pushed the removing fix along with the mecp-org/MECP#53 claim order (timestamp -> pax -> duration) and pax validation changes to dev in dc01096.

You're good to merge dev into this PR whenever you have time. A couple small things that changed in MECPDecode that'll conflict on rebase:

  • firstTimestamp now takes excluding claimed: RangeSet<String.Index> and runs before firstPax, so @6:30 pax should come back as timestamp only (personCount == nil, tail "pax") and @6:30pax as neither.
  • boundary is now an isBoundary(_:) function instead of a Set, so CharacterClass.anyOf(boundary) won't compile as-is. If you put the 2-digit hour branches first (#/@(2[0-3]|[01][0-9]|[0-9]):?([0-5][0-9])/#), @2300 matches without needing RegexBuilder or a lookahead, and isBounded can check both sides directly.

Blake-Latchford and others added 3 commits November 21, 2026 20:26
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants