PCrafter Raw HTTP/TCP SEQ/ACK validation
========================================

1. Uploaded implementation bug reproduction
--------------------------------------------
Initial client SND.NXT                 : 1000
HTTP request length                    : 36 bytes
Expected SND.NXT after transmit        : 1036
SEQ used by ACK for piggyback response : 1000
Result                                 : BUG REPRODUCED

Cause: send_bytes() delayed client_seq(SND.NXT) advancement until after
_wait_for_ack(). When the response packet both acknowledged the request and
contained payload, _process_packet() generated an ACK while client_seq still
pointed at the pre-request sequence.

2. Fixed implementation
-----------------------
- client_seq is advanced to target_ack immediately after the first send call
  succeeds and before any queued ACK/response is processed (TCP SND.NXT semantics).
- retransmissions still use immutable segment_seq.
- last_server_ack acts as SND.UNA.
- ACK values beyond SND.NXT are ignored.
- ambiguous ACK timeout moves the session to ERROR.
- HTTP layer consumes only parsed response bytes; arbitrary sleep and full
  receive-buffer clearing were removed.

3. Regression tests
-------------------
test_ack_beyond_snd_nxt_is_not_accepted            PASS
test_http_layer_does_not_use_sleep_or_clear_entire_buffer PASS
test_send_failure_does_not_advance_snd_nxt        PASS
test_piggyback_response_ack_uses_current_snd_nxt  PASS
test_two_requests_reuse_one_tcp_state              PASS

4. Static checks
----------------
python -m py_compile *.py                          PASS
AST inventory generation                          PASS
