Skip to content

Review proxy capture hardening changes - #25

Draft
gregschohn wants to merge 43 commits into
proxy-review-base-1a8d5edd8efrom
integrating3231
Draft

gregschohn wants to merge 43 commits into
proxy-review-base-1a8d5edd8efrom
integrating3231

Conversation

@gregschohn

Copy link
Copy Markdown
Owner

Review-only PR for the proxy capture hardening work after commit 1a8d5ed.

Review focus:

  • Kafka group membership used only to load-balance new connections
  • assignment-scoped writer identities and connection-local observation ordering
  • acknowledged manifests, broker LogAppendTime deadlines, and capability probing
  • process-wide fail-closed or one-way fail-open behavior after capture compromise
  • connection retirement, final empty manifests, NoMoreWrites, and orderly shutdown
  • incomplete-request and connection-duration limits
  • removal of obsolete peer-node-death protocols, file capture mode, and traceDirectory support
  • proxy unit, integration, and Testcontainers coverage

The protocol keeps the established TrafficStream protobuf name. The short-lived TrafficRecord rename has been removed to reduce review noise.

The base branch is a review-only ref pinned exactly to 1a8d5ed.

Close real proxy channels after capture exceptions so normal terminal connection
observations are produced. Ensure terminal observations and preceding traffic
are acknowledged before removing a connection from the active registry.

Enforce limits on incomplete requests, add manifest-cycle ordering to captured
observations, and remove the superseded coordination protocol.

Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Remove static partition routing and derive new-connection routing from the last
usable Kafka group assignment.

Use group size only for the startup requirement, and keep membership health
independent from publisher health once an assignment has been obtained.

Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Create assignment-scoped writer identities while allowing existing connections
to retain the writer selected when they were accepted.

Probe Kafka capability before joining membership, but keep later membership
health independent from capture correctness. Treat event-loop death and
application-visible Kafka write failure as process-level capture failures.

Make capture compromise a one-way process transition. In fail-closed mode, stop
accepting and forwarding capture-authoritative traffic while terminating.

Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Separate recoverable operation failures from failures that make capture
untrustworthy. Retire drained assignment-scoped writers and retire every
remaining writer during orderly shutdown.

Keep segmented observations contiguous on their publisher lane. Before retiring
a connection, acknowledge its terminal observation and all preceding traffic,
then remove it from the connection registry.

Publish the final empty manifest and NoMoreWrites only after accepted sends have
settled. Expose retirement through explicit capture callbacks and test both
successful and unsuccessful retirement outcomes.

Remove the discarded proxy coordination messages and their implementation.

Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Connect process shutdown to writer retirement and record the process's one-way
transition into compromised capture.

Keep group membership changes independent from retirement. Escalate terminal
capture failures through the process failure policy, and close source channels
when target-side failure makes continued forwarding impossible.

Add real-Kafka coverage for startup, assignment changes, stale membership, and
continued use of the last usable assignment.

Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Apply the configured process-wide failure policy to every required Kafka write.
Terminate immediately when internal capture ownership is corrupted or an
asynchronous publisher owner fails.

Refresh Kafka leader metadata before the startup probe and add real-Kafka
coverage for writer retirement.

Verify that proxy forwarding failures, capture failures, TLS failures, and
request-limit failures close the real channel and produce the normal terminal
capture observation.

Signed-off-by: Greg Schohn <schohn@amazon.com>
Expose persistent process state and metrics when capture cannot account for
traffic, including attribution to the connection or operation that discovered
the gap.

Stress startup, manifest scheduling, connection retirement, and publisher
shutdown boundaries.

Use acknowledged Kafka LogAppendTime for manifest freshness and require managed
capture topics to use LogAppendTime. Prove that composed writer retirement
preserves the required ordering across connections, manifests, and final
NoMoreWrites publication.

Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Delete the discarded coordination classes, scripts, configuration, tests, and
metrics left by earlier proxy protocols.

Remove file-based proxy capture and the traceDirectory option. Keep Kafka as the
only authoritative proxy capture destination, while retaining in-memory capture
only where required by focused tests.

Clean up interfaces, dependencies, fixtures, and generated configuration that
became unnecessary after those removals.

Signed-off-by: Greg Schohn <schohn@amazon.com>
@gregschohn
gregschohn force-pushed the integrating3231 branch 2 times, most recently from b7f8a47 to 99d36a3 Compare September 14, 2026 02:29
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Rework Kafka backpressure and target-permit handling so a paused partition cannot prevent the source-response progress needed to release replay work.
Define heartbeat-based proxy expiration, strict per-connection Kafka ordering, deterministic commit behavior, exact archive fidelity, and a CaptureRecord protobuf envelope for the three different types of records (as opposed to signaling in kafka metadata).

Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
I've left a couple outdated or transitional ones in docs that we'll want to delete later.
We should do other subfolders here for other specific concerns that have more than one doc.  E.g: workflows, backfill.

Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Rewrote the nine documents under docs/captureAndReplay in a more accessible
tone with less repetition, preserving every normative value, invariant,
ordering, and test obligation. Headings and anchors are unchanged so
existing cross-document and external links still resolve.

Material changes:

- asyncMessagePassingProgrammingGuide: corrected a stale threading model.
  The replay-intake input queue is drained by the dedicated replay-intake
  thread, not the Kafka executor; the Kafka queue is drained by the Kafka
  thread between bounded client calls; wakeup() is a stateless prompt.
- Resolved the empty-poll demand contradiction in favor of the lower-level
  model: empty poll results are never sent to replay intake, so they are no
  longer listed as demand-recompute triggers in the architecture doc.
- Standardized ConnectionRequestStarted on the first accepted target write
  (connection LLD section 8) everywhere, so cancellation between the turn
  start and the first write cannot make the two models disagree.
- Corrected the claim that a `range` archive cannot establish a retry
  boundary or broker-time expiration: higher-offset records inside the range
  do establish both; only the end of the range supplies no further evidence.
- Fixed symbol collisions: the unseen prior heartbeat in architecture 8.1 is
  now U (H remains the heartbeat publication interval), and the managed
  fleet broker-skew bound is now K (N remains replayer demand, P * T).
- Stated F's five-second default where F is introduced, and reworded the
  undefined "connection interval was reset" phrasing in proxy 1.1.
- Clarified that a late heartbeat record finishes and commits even when it
  does not move the writer-partition baseline.
- Pushed mechanism out of the top-level architecture doc in seven places
  (record flush interval, acknowledgement deadline, scale-down, publisher
  lane retirement, partition revocation, shutdown, proxy retirement
  timeline), keeping the concept and the invariant at the top and linking to
  the companion document that owns the rules normatively.
- Replaced the architecture 8.1 flowchart with a gantt chart drawn on one
  partition's broker-time axis, so the restart fallback's E + 2S wait is
  visible as a length rather than only described.
- Documented redelivery in architecture 9: it is Kafka's ordinary
  at-least-once behavior rather than a replayer operation, and Retain is
  reached only through cancellation, process failure, or a protocol
  violation. Relabeled the diagram's Retain edge accordingly.
- Rewrote the 7.4 retry-wait passage and the 7.5 tuple-output versus
  request-completion passage of replayerProcessingAndCommitArchitecture for
  readability.
- Reframed managedFleetCaptureRecovery (about 26% shorter) around its actual
  purpose: fleet management is not being implemented soon, and the document
  exists to confirm the architecture can support a future controller, so it
  deliberately carries less rigor than the rest.
- Added docs/captureAndReplayReviewFindings-2026-09-18.md recording the
  review verdict, the three inconsistencies above, the wording issues, and
  the non-issues that were checked and cleared.

Review coverage: captureAndReplayArchitecture.md has had a full review.
replayerProcessingAndCommitArchitecture.md has been reviewed up to but not
including section 8; section 8 onward received the tone pass but not the
detailed review.

Signed-off-by: Greg Schohn <schohn@amazon.com>
Define retry-ready supply as requests with resolved retry input whose
target turn has not finished. Derive Kafka input demand from whether
that supply remains below N.

This avoids treating requests that still depend on later Kafka evidence
as usable supply. It keeps intake moving until enough requests can make
retry decisions, while allowing fast source responses to satisfy the
threshold well before B + W instead of imposing fixed lookahead.

Document adaptive response lookahead, remove ConnectionRequestStarted
from the replay-intake protocol, and retain first-target-write tracking
only as connection-local cancellation state. This eliminates a
cross-owner lifecycle message that existed solely for demand accounting.

Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>
Signed-off-by: Greg Schohn <schohn@amazon.com>

This branch has not been deployed

No deployments
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