Primary crawler candidate if compatible with verified runtime.
После runtime discovery нужно не «выбрать любимую библиотеку», а провести одинаковые ограниченные испытания и зафиксировать решения. Этот пакет задаёт единые fixtures, метрики, hard-fail критерии и структуру ADR-01…ADR-05.
Primary crawler candidate if compatible with verified runtime.
Alternative crawler candidate under identical fixtures and metrics.
Mandatory comparison if EXEC-17 finds an already-present equivalent.
Нельзя игнорировать существующую инфраструктуру только потому, что в плане заранее рассматривались Crawlee и Scrapy.
| Dimension | Same for every candidate |
|---|---|
| Fixture set | Same controlled sitemap/archive/article/loop/robots/429 fixtures for every candidate. |
| Source sample | Same bounded public test source or recorded fixture snapshot. |
| Request budget | Same max URLs, concurrency ceiling and timeout budget. |
| Security policy | Same SSRF/scope/robots/rate-limit guard. |
| Resume test | Same forced-kill point and recovery expectation. |
| Output contract | Same request/candidate event schema. |
| Measurement | Same timing/resource/error counters. |
| ID | Capability |
|---|---|
| S-19-01 | Read seed URLs from approved crawl_plan-like fixture. |
| S-19-02 | Normalize and de-duplicate requests. |
| S-19-03 | Enforce same-host/scope guard. |
| S-19-04 | Fetch HTTP pages with retries/timeouts. |
| S-19-05 | Parse links and enqueue bounded pagination. |
| S-19-06 | Emit idempotent candidate URL records. |
| S-19-07 | Persist enough queue/checkpoint state for forced-stop resume. |
| S-19-08 | Handle robots/rate policy through shared guard layer. |
| S-19-09 | Do not implement article classifier/render/deploy inside the spike. |
| ID | Metric | Expectation |
|---|---|---|
| M-19-01 | Correct discovered URL count | Must match fixture truth. |
| M-19-02 | Duplicate request count | Prefer zero after normalization/queue dedup. |
| M-19-03 | Out-of-scope fetches | Must be zero. |
| M-19-04 | Forced-stop recovery | Must resume without restarting whole fixture. |
| M-19-05 | 429/backoff behavior | Must respect configured/reported delay. |
| M-19-06 | Peak memory | Measured under same fixture. |
| M-19-07 | Wall-clock time | Secondary metric; correctness beats speed. |
| M-19-08 | Implementation complexity | LOC/config/adapter burden. |
| M-19-09 | Runtime fit | Works cleanly with verified Work Python/Node/process model. |
| M-19-10 | Observability fit | Structured events/logging integration effort. |
| M-19-11 | Security fit | Can enforce redirect/DNS/scope policy without hacks. |
| M-19-12 | Maintenance risk | Dependency maturity, project activity, lock-in/upgrade burden. |
| Scoring area | Weight |
|---|---|
| Correctness / determinism | 25% |
| Resume / persistence integration | 20% |
| Security / scope enforcement | 15% |
| Work runtime fit | 15% |
| Observability integration | 10% |
| Implementation complexity | 10% |
| Performance | 5% |
| ID | Failure condition |
|---|---|
| HF-19-01 | Cannot enforce same security/scope policy. |
| HF-19-02 | Cannot resume safely after forced stop without custom rewrite disproportionate to benefit. |
| HF-19-03 | Requires incompatible runtime stack or invasive production changes. |
| HF-19-04 | Cannot produce deterministic/idempotent request/candidate events. |
| HF-19-05 | Relies on browser automation for ordinary HTTP-first crawling. |
| HF-19-06 | Introduces privileged/root execution requirement. |
| Artifact | Purpose |
|---|---|
| spike_<candidate>_runtime.json | Versions, environment and exact commit. |
| spike_<candidate>_metrics.json | All common metrics. |
| spike_<candidate>_events.jsonl | Structured sample event stream. |
| spike_<candidate>_resume.txt/json | Forced-stop and resume evidence. |
| spike_<candidate>_security.txt/json | Scope/robots/rate evidence. |
| spike_<candidate>_notes.md/html | Integration friction and caveats. |
| Field | Meaning |
|---|---|
| adr_id | Stable ADR ID. |
| title | Decision title. |
| status | PROPOSED / ACCEPTED / REJECTED / SUPERSEDED. |
| context | Verified runtime and product constraints. |
| options[] | All serious candidates. |
| evidence_refs[] | Spike/runtime/test evidence. |
| decision | Chosen option. |
| why | Evidence-based rationale. |
| rejected_reasons | Why alternatives lost. |
| consequences | Trade-offs and follow-up work. |
| security_impact | Security implications. |
| rollback | How to reverse decision. |
| review_trigger | What future condition warrants reconsideration. |
| ADR | Area | Decision scope |
|---|---|---|
| ADR-01 | Crawler core | Crawlee / Scrapy / existing Work equivalent. |
| ADR-02 | Persistent state + queue | Existing DB/queue first; new dependency only if evidence requires it. |
| ADR-03 | Live event/log transport | Existing stack / SSE / WebSocket / polling. |
| ADR-04 | Renderer | Existing template system or lightweight deterministic renderer. |
| ADR-05 | Deploy adapter | Verified current Work deployment/rollback mechanism. |
| State / queue | Rule |
|---|---|
| Existing first | If Work already has a durable DB/queue, evaluate reuse before adding RQ/Celery/etc. |
| Checkpoint contract | Must support monotonic state_version and atomic or equivalent safe transitions. |
| Worker lease | Must prevent two active mutators for same job. |
| Recovery | Must survive process/server restart. |
| Operational burden | Prefer fewer new services for MVP. |
| Logging | Rule |
|---|---|
| Existing first | Reuse current Work logging/event transport if adequate. |
| UI need | Must support current status plus near-live structured events. |
| Reconnect | Client reconnect must not change job state. |
| Fallback | Polling acceptable if runtime lacks safe push transport. |
| No log-as-state | Transport choice cannot make logs canonical state. |
| Renderer | Rule |
|---|---|
| Deterministic | Same frozen model → same semantic output. |
| Escaping | Safe by default. |
| Static output | Core dataset readable without JS. |
| Dependency fit | Prefer existing Work templating; otherwise lightweight dependency. |
| Deploy | Rule |
|---|---|
| Existing mechanism | Do not invent second deploy path. |
| Atomicity | Need stage/publish/verify/rollback behavior. |
| Permissions | Least privilege. |
| Catalog integration | Must know canonical service/index update mechanism. |
| ID | Criterion |
|---|---|
| A-19-01 | All viable crawler candidates receive the same fixture/input budget. |
| A-19-02 | Every candidate produces comparable metric/evidence artifacts. |
| A-19-03 | Hard-fail criteria eliminate unsafe/incompatible candidates immediately. |
| A-19-04 | Crawler decision is written as ADR-01 with evidence refs. |
| A-19-05 | State/queue choice is written as ADR-02. |
| A-19-06 | Logging transport choice is written as ADR-03. |
| A-19-07 | Renderer choice is written as ADR-04. |
| A-19-08 | Deploy adapter choice is written as ADR-05. |
| A-19-09 | No ADR contains secret values. |
| A-19-10 | START_PROJECT is still not instantiated until all required ADRs are ACCEPTED. |
| Block | Scope | Output |
|---|---|---|
| LUNA-19-A | Create shared spike fixtures | One reusable fixture harness and truth set. |
| LUNA-19-B | Implement candidate A adapter | Only bounded crawler spike contract. |
| LUNA-19-C | Implement candidate B adapter | Same contract and fixtures. |
| LUNA-19-D | Implement existing-stack adapter | Only if EXEC-17 proves one exists. |
| LUNA-19-E | Run forced-stop/security tests | Same tests for each candidate. |
| LUNA-19-F | Compile comparison matrix | Common metrics + hard-fail status. |
| LUNA-19-G | Write ADR-01 | Crawler core decision. |
| LUNA-19-H | Write ADR-02…05 | Runtime-dependent architecture decisions. |
ORDER: EXEC-17 runtime discovery → EXEC-19 equal candidate spikes → ADR-01 crawler → ADR-02 state/queue → ADR-03 logging transport → ADR-04 renderer → ADR-05 deploy adapter → conflict review → EXEC-18 template instantiation → immutable START_PROJECT → /razraba initialization → Active Window 01 implementation