Skip to content

fix(apply): microsecond-precision LWW + sidecar bump regression test#85

Merged
d4rken merged 3 commits into
devfrom
feat/dev-383-pin-meta-bump-test
May 16, 2026
Merged

fix(apply): microsecond-precision LWW + sidecar bump regression test#85
d4rken merged 3 commits into
devfrom
feat/dev-383-pin-meta-bump-test

Conversation

@d4rken

@d4rken d4rken commented May 16, 2026

Copy link
Copy Markdown
Member

Two fixes in scripts/lib/feed-env-apply.sh that together pin the metadata contract image-webconfig's DEV-383 work depends on.

iso_now now stamps with microsecond fractional and the normalize helper for LWW compare pads or truncates incoming and on-disk stamps to a fixed-width microsecond form. Without this, two writes to the same tracked key inside one wall-clock-second produced equal post-normalize strings and the strictly-newer LWW rule silently dropped the second one. Matches the server-side merge precision (Python datetime.isoformat()) so same-second tie semantics behave symmetrically across the round trip.

Adds a regression test pinning that an object-form apply payload bumps the feed.meta.json sidecar even when the canonical value matches the on-disk value. This is the path apl-feed config sync uses to heal stuck future timestamps, and image-webconfig now relies on the contrapositive — explicit metadata is load-bearing, so local-writer callers must omit it for unchanged tracked keys.

Addresses DEV-383.

d4rken added 2 commits May 16, 2026 18:13
…changed tracked key

The apply library updates feed.meta.json whenever an object-form payload carries metadata for a tracked key that survives the LWW gate, even if the canonical value matches on-disk. This is the path that lets apl-feed config sync heal a stuck future timestamp by re-sending the server tuple with the existing value.

Pinning the behavior makes the contract explicit so that local webconfig writes can rely on it: webconfig must omit unchanged tracked keys from the payload, otherwise every form save would push fresh edited_at stamps and clobber legitimate concurrent edits under LWW.
iso_now now stamps with microsecond fractional and the normalize helper for LWW compare pads/truncates incoming and on-disk stamps to a fixed-width microsecond form. Without this, two writes to the same tracked key inside one wall-clock-second produced equal post-normalize strings and the strictly-newer LWW rule silently dropped the second one.

Matches the server-side merge precision (Python datetime.isoformat()) so symmetric same-second tie semantics hold across the round trip. The existing fractional-second test changes from skip to apply; new tests cover the explicit same-second ordering scenarios and the bare-on-disk pad-for-compare path. The bare-string default-stamp regex in test_feed_env_apply.bats and test_apl_feed_mlat.bats now permits the optional fractional segment.
@d4rken d4rken changed the title test(apply): pin sidecar bump for unchanged-value metadata writes fix(apply): microsecond-precision LWW + sidecar bump regression test May 16, 2026
The LWW normalize pads or truncates incoming and on-disk stamps to microsecond precision. Accepting more than 6 fractional digits at the wire would silently collapse strictly-newer ordering for nanosecond-precision writers, so the schema check in apl-feed apply and the strict regex in feed-env-apply.sh now reject inputs with more than 6 fractional digits.
@d4rken d4rken merged commit 39d5a58 into dev May 16, 2026
12 checks passed
@d4rken d4rken deleted the feat/dev-383-pin-meta-bump-test branch May 16, 2026 17:57
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.

1 participant