1. Purpose
Доказать, что worker безопасно и воспроизводимо превращает leased queue item в один FetchResult,
не выполняет classifier/parser responsibilities и не управляет persistent retry временем самостоятельно.
Worker выполняет одну bounded попытку. Persistent retry scheduling принадлежит TASK-005 queue.
2. Entry gate
| Requirement | Expected | Actual | Evidence |
| TASK-002 | VERIFIED security guard | REAL_VALUE | REAL_REF |
| TASK-003 | VERIFIED Job fencing | REAL_VALUE | REAL_REF |
| TASK-004 | VERIFIED CrawlPlan | REAL_VALUE | REAL_REF |
| TASK-005 | VERIFIED persistent queue | REAL_VALUE | REAL_REF |
| HTTP client | Real approved adapter known | REAL_VALUE | REAL_REF |
| TLS behavior | Verification enabled | REAL_VALUE | REAL_REF |
TASK-006 остаётся BLOCKED, пока TASK-005 не VERIFIED.
3. Execution identity
| Field | Value |
| Project | Autonomous Site Research Pipeline / Statiya_poluchatel_1 |
| Window | AW-01 |
| Task | TASK-006 |
| Specification | EXEC-31 — HTTP Fetch Worker Implementation Packet |
| Evidence document | EXEC-45 |
| Result | UNFILLED / BLOCKED UNTIL TASK-005 VERIFIED |
| Executed by | REAL_VALUE |
| Started / completed | REAL_VALUE |
4. Environment facts
REPO_ROOT=REAL_VALUE
BRANCH=REAL_VALUE
REVISION_BEFORE=REAL_VALUE
REVISION_AFTER=REAL_VALUE
HTTP_CLIENT=REAL_VALUE
DNS_CONNECT_STRATEGY=REAL_VALUE
TLS_LIBRARY_OR_STACK=REAL_VALUE
BODY_STREAMING_API=REAL_VALUE
CLOCK_SOURCE=REAL_VALUE
TEST_SERVER=REAL_VALUE
TEST_RUNNER=REAL_VALUE
TASK_002_EVIDENCE_REF=REAL_VALUE
TASK_005_EVIDENCE_REF=REAL_VALUE
PROJECT_STATE_REF=REAL_VALUE
5. Reuse-before-build review
| Capability | Existing? | Action | Ref |
| HTTP client/transport | REAL_VALUE | REUSE / EXTEND / CREATE | REAL_REF |
| Timeout config | REAL_VALUE | REUSE / EXTEND / CREATE | REAL_REF |
| Streaming response reader | REAL_VALUE | REUSE / EXTEND / CREATE | REAL_REF |
| Retry classifier helper | REAL_VALUE | REUSE / EXTEND / CREATE | REAL_REF |
| Header sanitizer | REAL_VALUE | REUSE / EXTEND / CREATE | REAL_REF |
| Rate limiter/origin budget | REAL_VALUE | REUSE / EXTEND / CREATE | REAL_REF |
6. Changed files
{
"changed_files": [
{
"path": "REAL_PATH",
"change_type": "ADDED | MODIFIED | DELETED",
"purpose": "REAL_DESCRIPTION"
}
]
}
Allowed scope
- HTTP fetch worker;
- transport adapter integration;
- manual redirect loop;
- response streaming/limits;
- retry classification;
- FetchResult persistence/serialization;
- queue ACK/NACK integration;
- fixtures/tests.
Out of scope
- HTML parsing;
- link extraction;
- classifier;
- logical dedup;
- browser rendering;
- deploy.
7. One-attempt worker contract
INPUT:
leased QueueItem
current Job fencing token
READY CrawlPlan
PROCESS:
validate target at request time
execute one bounded HTTP attempt
manually process bounded redirects
stream bounded response
classify result
OUTPUT:
immutable FetchResult
+
ACK or NACK request to TASK-005
Evidence
- worker does not internally sleep/retry indefinitely;
- worker does not create a second queue;
- retry timing delegated to TASK-005;
- worker rejects stale fencing before durable mutation;
- completed attempt has one durable result identity.
8. Request-time security revalidation
Даже URL, уже проверенный при enqueue, повторно проверяется непосредственно перед connect.
Required proof
- normalized URL revalidated by TASK-002;
- resolved addresses revalidated;
- scope still valid under current CrawlPlan;
- redirect targets receive full validation;
- unsafe target rejected before connection;
- current security-policy/version captured in FetchResult evidence.
Critical transport proof
VALIDATED_DNS_TO_ACTUAL_CONNECT_BINDING:
PROVEN | BLOCKED | NOT_PROVEN
METHOD:
REAL_VALUE
EVIDENCE:
REAL_REF
Если client после validation самостоятельно резолвит hostname без accepted mitigation,
DNS rebinding / TOCTOU gap остаётся blocker.
9. Redirect handling
Required behavior
- automatic redirects in client disabled or proven safely intercepted;
- Location parsed as untrusted URL;
- relative Location resolved safely;
- every hop passes TASK-002 security + scope;
- redirect count hard-limited;
- loop detected;
- redirect chain recorded in FetchResult;
- unsafe redirect terminates attempt without connect to unsafe target.
{
"redirect_tests": {
"one_safe_redirect": "PASS | FAIL",
"multi_hop_safe": "PASS | FAIL",
"loop": "PASS | FAIL",
"limit": "PASS | FAIL",
"private_target": "PASS | FAIL",
"unsupported_scheme": "PASS | FAIL",
"scope_escape": "PASS | FAIL"
}
}
10. Timeouts / hard limits
| Limit | Configured value | Tested? | Evidence |
| Connect timeout | REAL_VALUE | YES / NO | REAL_REF |
| Read timeout | REAL_VALUE | YES / NO | REAL_REF |
| Total attempt duration | REAL_VALUE | YES / NO | REAL_REF |
| Redirect count | REAL_VALUE | YES / NO | REAL_REF |
| Header bytes/count | REAL_VALUE | YES / NO | REAL_REF |
| Compressed response bytes | REAL_VALUE | YES / NO | REAL_REF |
| Decompressed/body bytes | REAL_VALUE | YES / NO | REAL_REF |
| Retained evidence size | REAL_VALUE | YES / NO | REAL_REF |
Required proof
- body read is streaming/bounded;
- worker does not download huge payload then check size;
- decompression bomb path bounded;
- timeout maps to structured retry class;
- limit hit maps to structured terminal result.
11. Content handling
Supported useful types
text/html
application/xhtml+xml
application/xml
text/xml
application/rss+xml
application/atom+xml
text/plain
Evidence
- content-type normalized;
- charset extracted where relevant;
- binary/media response does not enter HTML parser path;
- status and headers summary retained safely;
- body storage/reference strategy recorded;
- cookies/auth headers not persisted in evidence.
12. Rate / concurrency evidence
Required
- global concurrency bound;
- per-origin concurrency bound;
- per-origin pacing/rate limit;
- CrawlPlan rate policy honored;
- 429 Retry-After passed to queue scheduler;
- future browser fallback can share origin budget rather than bypass it.
{
"rate_policy": {
"global_concurrency": "REAL_VALUE",
"per_origin_concurrency": "REAL_VALUE",
"per_origin_rate": "REAL_VALUE",
"retry_after_honored": "PASS | FAIL"
}
}
13. Retry classification evidence
FETCH_OK
FETCH_OK_REDIRECTED
RETRY_429
RETRY_5XX_TRANSIENT
RETRY_TIMEOUT
RETRY_CONNECTION_TRANSIENT
NO_RETRY_NOT_FOUND
NO_RETRY_ACCESS_DENIED
NO_RETRY_SECURITY_REJECT
NO_RETRY_REDIRECT_POLICY
NO_RETRY_BODY_LIMIT
Required mapping tests
| Condition | Expected | Actual |
| 200 HTML | FETCH_OK | REAL_VALUE |
| 301→200 | FETCH_OK_REDIRECTED | REAL_VALUE |
| 429 | RETRY_429 | REAL_VALUE |
| 503 | RETRY_5XX_TRANSIENT | REAL_VALUE |
| timeout | RETRY_TIMEOUT | REAL_VALUE |
| connection reset/transient | RETRY_CONNECTION_TRANSIENT | REAL_VALUE |
| 404 | NO_RETRY_NOT_FOUND | REAL_VALUE |
| 403 | NO_RETRY_ACCESS_DENIED or accepted policy equivalent | REAL_VALUE |
| private redirect | NO_RETRY_SECURITY_REJECT | REAL_VALUE |
| redirect loop/limit | NO_RETRY_REDIRECT_POLICY | REAL_VALUE |
| body cap | NO_RETRY_BODY_LIMIT | REAL_VALUE |
14. Immutable FetchResult evidence
{
"fetch_id": "...",
"queue_item_id": "...",
"job_id": "...",
"requested_url": "...",
"final_url": "...",
"redirect_chain": [],
"status_code": 200,
"content_type": "text/html",
"charset": "utf-8",
"headers_summary": {},
"body": {
"storage": "INLINE_BOUNDED | BLOB_REF",
"content_ref": "...",
"bytes": 0
},
"timing": {},
"resolved_addresses": [],
"security_policy_version": "...",
"result_code": "FETCH_OK",
"retry_hint": null,
"evidence_refs": []
}
Required proof
- FetchResult stored/returned exactly once per attempt identity;
- result is not later mutated by classifier;
- body bounds reflected in metadata;
- redirect chain preserved;
- security evidence preserved;
- sanitized headers only;
- result serializes/deserializes safely.
15. TASK-005 queue integration
| Fetch class | Queue action |
| FETCH_OK / FETCH_OK_REDIRECTED | ACK / COMPLETED |
| RETRY_* | NACK retriable with retry hint |
| NO_RETRY_* | NACK terminal |
Required proof
- ACK/NACK uses current queue lease;
- ACK/NACK uses current Job fencing token;
- stale lease/fence rejects mutation;
- retry scheduling remains queue responsibility;
- same attempt replay does not double-increment counters;
- crash after FetchResult persist but before ACK can be recovered idempotently.
16. Logs / sanitization
Allowed structured fields
- job_id;
- queue_item_id;
- fetch_id;
- stage;
- result_code;
- status_code;
- requested/final URL if product logging policy allows;
- timings;
- bytes;
- reason code.
Must not log
- response body;
- cookies;
- Authorization;
- Set-Cookie values;
- secrets/tokens;
- arbitrary sensitive headers.
17. Required local fixture HTTP server
| Endpoint | Purpose |
| /ok-html | 200 bounded HTML |
| /redirect-one | one safe redirect |
| /redirect-loop | loop handling |
| /redirect-private | security rejection before unsafe connect |
| /429 | Retry-After handling |
| /503 | transient server error |
| /slow | timeout |
| /large-body | streaming body cap |
| /binary | unsupported/binary content |
| /malformed-location | redirect policy error |
| /robots.txt | control resource |
| /sitemap.xml | XML fetch path |
18. Tests executed
| Test group | Command | Result | Evidence |
| 200 HTML fetch | REAL_COMMAND | PASS / FAIL | REAL_REF |
| Safe redirects | REAL_COMMAND | PASS / FAIL | REAL_REF |
| Unsafe redirects | REAL_COMMAND | PASS / FAIL | REAL_REF |
| Timeouts | REAL_COMMAND | PASS / FAIL | REAL_REF |
| Body/header limits | REAL_COMMAND | PASS / FAIL | REAL_REF |
| 429/Retry-After | REAL_COMMAND | PASS / FAIL | REAL_REF |
| 5xx retry classification | REAL_COMMAND | PASS / FAIL | REAL_REF |
| 404/403 terminal behavior | REAL_COMMAND | PASS / FAIL | REAL_REF |
| FetchResult serialization | REAL_COMMAND | PASS / FAIL | REAL_REF |
| Queue ACK/NACK integration | REAL_COMMAND | PASS / FAIL | REAL_REF |
| Crash/replay integration | REAL_COMMAND | PASS / FAIL | REAL_REF |
| Regression suite | REAL_COMMAND | PASS / FAIL | REAL_REF |
19. Negative / security cases
- worker called with stale Job fencing token → reject;
- worker called with invalid/expired queue lease → reject;
- target becomes private at request time → reject;
- redirect to private target → reject before connect;
- unsupported redirect scheme → reject;
- TLS verification disabled by config → startup/config/test failure;
- body exceeds cap → stop stream and classify terminal;
- redirect exceeds max → terminal redirect-policy result;
- Retry-After absurdly large → bounded by queue policy;
- malformed Location → structured terminal result;
- binary response does not execute parser/classifier here.
{
"negative_tests": {
"stale_fence": "PASS | FAIL",
"expired_lease": "PASS | FAIL",
"request_time_private_resolution": "PASS | FAIL",
"private_redirect": "PASS | FAIL",
"tls_verification": "PASS | FAIL",
"body_limit": "PASS | FAIL",
"redirect_limit": "PASS | FAIL",
"malformed_location": "PASS | FAIL"
}
}
20. Acceptance checklist
| Acceptance item | Result | Evidence |
| Worker performs one bounded attempt | PASS / FAIL | REAL_REF |
| Request-time TASK-002 revalidation | PASS / FAIL | REAL_REF |
| DNS/connect safety proof | PASS / FAIL | REAL_REF |
| Every redirect revalidated | PASS / FAIL | REAL_REF |
| TLS verification enabled | PASS / FAIL | REAL_REF |
| Timeouts hard-enforced | PASS / FAIL | REAL_REF |
| Body/headers bounded while streaming | PASS / FAIL | REAL_REF |
| Rate/concurrency policy enforced | PASS / FAIL | REAL_REF |
| Retry classes exact | PASS / FAIL | REAL_REF |
| Immutable FetchResult produced | PASS / FAIL | REAL_REF |
| Queue ACK/NACK integration correct | PASS / FAIL | REAL_REF |
| Crash/replay does not corrupt counters | PASS / FAIL | REAL_REF |
| Logs sanitized | PASS / FAIL | REAL_REF |
| No parser/classifier/browser logic added | PASS / FAIL | REAL_REF |
| No unrelated diff | PASS / FAIL | REAL_REF |
21. Gaps / blockers
{
"security_blockers": [],
"transport_blockers": [],
"known_gaps": [],
"unproven_limits": [],
"blocks_TASK_007": true
}
Automatic blockers
- request bypasses TASK-002;
- redirect auto-follow bypasses validation;
- DNS/connect TOCTOU unmitigated;
- TLS verification disabled;
- body limit checked only after full download;
- unbounded timeout/redirect path;
- worker runs persistent retry loop itself;
- stale worker can ACK/NACK;
- FetchResult mutable or not durable enough for replay semantics;
- secrets/body contents appear in logs.
22. Final result
VERIFIED
PARTIAL
FAILED
BLOCKED
Для HTTP worker security/transport blocker не может быть downgraded до «known gap», если он позволяет unsafe network access.
23. Project state update
If VERIFIED
{
"active_window_id": "AW-01",
"last_verified_task": "TASK-006",
"completed_tasks": [
"TASK-001",
"TASK-002",
"TASK-003",
"TASK-004",
"TASK-005",
"TASK-006"
],
"current_task_id": "TASK-007",
"last_evidence_ref": "EXEC-45_FILLED_REAL_REF",
"repo_revision": "REAL_REVISION_AFTER",
"open_blockers": [],
"state_version": "INCREMENT_REAL_VALUE"
}
If not VERIFIED
{
"current_task_id": "TASK-006",
"last_task_result": "PARTIAL | FAILED | BLOCKED",
"open_blockers": ["..."],
"next_action": "TASK_006_REPAIR_OR_TRANSPORT_SECURITY_REVIEW"
}
24. Canonical machine-readable result
{
"schema": "STATIYA_TASK_EXECUTION_EVIDENCE",
"schema_version": "1.0",
"project_id": "autonomous-site-research-pipeline",
"active_window_id": "AW-01",
"task_id": "TASK-006",
"packet_ref": "EXEC-31",
"evidence_document_ref": "EXEC-45",
"result": "BLOCKED_UNTIL_TASK_005_VERIFIED",
"task_005_evidence_ref": "REAL_VALUE",
"http_client": "REAL_VALUE",
"dns_connect_strategy": "REAL_VALUE",
"repo": {
"root": "REAL_VALUE",
"revision_before": "REAL_VALUE",
"revision_after": "REAL_VALUE"
},
"changed_files": [],
"reused_components": [],
"created_components": [],
"tests": [],
"acceptance_checks": [],
"security_blockers": [],
"known_gaps": [],
"next_task_allowed": false,
"next_task_id_if_verified": "TASK-007",
"next_packet_if_verified": "EXEC-32",
"created_at": "REAL_VALUE"
}
25. Next exact action
EXEC-45 заполняется только после реального TASK-005 = VERIFIED и исполнения EXEC-31.
If TASK-006 = VERIFIED
Следующий execution step:
TASK-007 / EXEC-32 — Candidate Link Discovery + Emission.
If TASK-006 ≠ VERIFIED
Создать bounded transport/security repair record и не переходить к TASK-007.