Repository navigation
Conversation
Recorded from TraceClassifier.classify on main before it is split into its ASN lookup and its categorization, so the split can be held to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A8mvWou2vH56zDnkZkqT2X
- TraceDeadline: one absolute instant on DiscoveryClock, with the cutoff for a phase cap (a tie is the deadline's) and its wake-up. - raceDeadline: work raced against a deadline, not joined; a passed deadline starts nothing; a late value or error is expiry; the caller's cancellation wins over expiry. DeadlineRace is generic over the value and the clock, and askWithinDeadline uses it unchanged. - RDNSCache.batchLookup(_:until:): answers gathered before the instant, kept apart from the cache; no query started or joined after it; nil is batchLookup(_:) exactly. - TraceClassifier.classify split into asnLookupAddresses and categorize, with the same output. Preparation for Deadline For Traces; no caller sees a change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A8mvWou2vH56zDnkZkqT2X
…e-prep Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A8mvWou2vH56zDnkZkqT2X
The race resumes its caller before it stops the wake-up, so reading the stop count at once could see zero on a correct run. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A8mvWou2vH56zDnkZkqT2X
…olds When the instant passed between the batch's first check and its race, the race expired without running a lookup and the batch returned nothing, even for an address already cached. At expiry the batch now fills any address it has no answer for from the cache, without asking. Shown by cachedAnswerSurvivesExpiryDuringSetup, which fails without the cache read. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A8mvWou2vH56zDnkZkqT2X
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is preparation for Deadline For Traces, the 0.19.0 slice that gives
traceClassifiedone overall deadline. It adds the pieces that deadline will be built from and tests each one on its own. Nothing a caller can see changes. No production path calls the new code yet, and the two existing functions it touches (TraceClassifier.classifyandaskWithinDeadline) keep exactly their current behaviour.The pieces:
TraceDeadline(new fileTraceDeadline.swift): one absolute instant onDiscoveryClock, the clock that counts system sleep. For a phase with its own cap, it gives the earlier of the two cutoffs; a tie goes to the overall deadline. It also arms the wake-up for that instant.raceDeadline(until:arm:_:): runs work against a deadline without waiting for the work to finish.DeadlineRace, the existing race behindaskWithinDeadline, is now generic over the value and the clock.askWithinDeadlineuses it with its old clock and the same results.RDNSCache.batchLookup(_:until:): ends the wait for a reverse-DNS batch at the deadline and returns every answer that arrived before the instant.nildeadline is exactlybatchLookup(_:).TraceClassifiersplit:classifyis nowasnLookupAddresses(which addresses go to the ASN resolver) followed bycategorize(categories and gap filling from the answers in hand), with the same output.TestSeams.observeBatchAnswer: lets a test move the clock only once an answer is in.Behaviour changes
None. Evidence:
ClassifierSplitTestswas committed first (ed77c15). It recordsclassify's output on unmodified main for six inputs: a filled gap, a resolver that throws (thetry?path), non-global hops after a public one, a VPN trace, IPv6 with link-local, and a trace with no answers. It also records which addresses and timeouts reached the resolver. After the split, bothclassifyand the hand-composed parts reproduce those records exactly.Reproduce
Mutations
Each mutation below was applied by itself, the two new suites were run, and the file was restored. Every one makes the named test fail.
raceDeadlinestarts work after the deadline has passedlookupstarts or joins a query after the deadlinenildeadline is notbatchLookup(_:)try?dropped fromclassifyGates
The touched suites are DeadlinePrepTests, ClassifierSplitTests, the RDNSCache, RDNSHoldoff, RDNSSharedLookup and RDNSSuppression tests, PublicIPResolverTests, and the three classification suites.
🤖 Generated with Claude Code
https://claude.ai/code/session_01A8mvWou2vH56zDnkZkqT2X