STATIYA_POLUCHATEL_1
SP-14 · VALIDATION & BENCHMARK
P7 / EXECUTABLE EVIDENCE BEFORE RELEASE

Валидация, тесты и эталонный benchmark

Сервис считается готовым не тогда, когда один демонстрационный запуск «вроде работает», а когда его ключевые контракты воспроизводимо проверяются. Особый benchmark — Fine Woodworking/WOOD: система должна независимо пройти источник и объяснимо приблизиться к качеству вручную собранной базы.

8test layers
10quality gates
9release blockers
1reference benchmark

01 / Verification contract

NO EXECUTABLE EVIDENCE → NO RELEASE.

Каждый критический инвариант из предыдущих SP должен быть либо unit/integration/browser/live test, либо явным owner gate с сохранённым evidence. Скриншот может дополнять тест, но не заменяет machine-verifiable checks.

Benchmark не должен подглядывать в ответ.

Fine Woodworking run стартует с source URL и общих правил. Ручной WOOD dataset используется только как frozen reference для сравнения результата.

02 / Test layers

T1
UNIT

Pure functions: normalization, parsing, ID allocation, ordering, batching, redaction.

T2
COMPONENT

Crawler queue, classifier, resolver, renderer, state repository, deploy adapter in isolation.

T3
INTEGRATION

Multiple components over controlled local fixtures.

T4
CHAOS / RESUME

Forced crashes, duplicate workers, partial checkpoints, deploy interruption.

T5
SECURITY

SSRF, redirects, robots, rate limits, secret leakage, injection, browser scope.

T6
BROWSER

Operator UI and generated dataset pages in real browser.

T7
LIVE

Actual Work deployment verification against public URLs.

T8
BENCHMARK

Real representative resource compared with known curated reference.

03 / Quality gates

GATE-01
PRE-IMPLEMENTATION

SP-03 runtime evidence exists; technology choices are not based on guesses.

GATE-02
CRAWLER READY

Discovery, queue, retry, scope and resume fixtures pass.

GATE-03
CLASSIFIER READY

Positive/negative corpus meets agreed precision-oriented thresholds.

GATE-04
IDENTITY READY

Dedup/order/ID boundary fixtures pass deterministically.

GATE-05
STATE READY

Forced-kill recovery and owner-gate persistence pass.

GATE-06
RENDER READY

All schema/HTML/navigation validators pass.

GATE-07
SECURITY READY

Security suite has no unresolved critical failures.

GATE-08
BENCHMARK READY

Fine Woodworking benchmark produces explainable differences within accepted tolerance.

GATE-09
DEPLOY READY

Immutable validated build + rollback path verified.

GATE-10
RELEASE READY

Live Work paths, catalog integration and browser navigation verified.

04 / Fixture families

IDFamilyCoverage
FIX-URLURL normalizationcase, fragments, ports, query params, trailing slash, encoded paths.
FIX-SITEMAPSitemapssingle sitemap, index, nested, loop, huge stream, mixed content.
FIX-ROBOTSrobots.txtallow, disallow, sitemap directives, unavailable robots.
FIX-FEEDFeedsRSS/Atom order, partial historical coverage, malformed entries.
FIX-LISTListingscategory/archive/pagination/calendar loop/tag/search pages.
FIX-ARTICLEArticleslong article, short valid tip, no image, lazy image, video-only, forum-like page.
FIX-CANONCanonical identityredirect alias, rel=canonical, print view, conflicting canonical, external canonical.
FIX-ORDEROrderingpublished dates, ties, missing dates, wrong lastmod, deterministic fallback.
FIX-JOBJob statecrash at each major phase, stale worker, double Continue.
FIX-HTMLGenerated HTML0/1/29/30/31/60/61/65 records, long titles, hostile titles.
FIX-SECSecuritylocalhost/private IP, redirect SSRF, huge body, script injection, credential-like values.
FIX-DEPLOYDeploypartial copy, stale cache, 404 batch, duplicate catalog registration.

05 / Unit/component matrix

ComponentRequired proof
URL normalizersame semantic URL → same request identity when rule proves equivalence; unrelated query variants stay separate.
Batch partitionerN records → exact ranges; 30 max; final partial valid.
Public ID allocatorsequence 1..N → unique SOURCE_000001..N.
Ordering enginesame frozen input → identical order on repeated run.
Canonical resolverstrong evidence beats weak; external conflict never silently wins.
Secret redactortokens/cookies/auth fields redacted, safe text preserved.
HTML escaperhostile title renders as text, not script/markup.
State transition validatorinvalid transitions rejected.
Checkpoint version guardstale state_version write rejected.

06 / Crawler evaluation

MetricExpectation
CoverageFraction of known benchmark corpus discovered before classification.
Duplicate request rateShould stay near zero after normalization/queue dedup.
Retry behaviorTransient failures retried; permanent failures bounded.
Browser usageMeasured percentage; must remain exceptional on HTTP-friendly source.
Loop resistanceCalendar/pagination/sitemap loops terminate.
ResumeForced stop resumes without full rediscovery.
Scope disciplineNo unapproved external hosts fetched.
Resource useMemory and concurrency remain bounded on large sitemap fixture.

07 / Classifier evaluation

AreaRule
Primary biasPrecision-first: false positives are more harmful than false negatives.
Positive setKnown valid articles/projects/tips.
Negative setcategory/archive/search/video-only/forum/service/no-image pages.
Uncertain setBorderline pages expected to resolve to EXCLUDE_UNCERTAIN.
Metricsprecision, recall, false-positive reasons, false-negative reasons.
Release emphasisNo obvious listing/video/service false positives in benchmark sample.
Profile tuningAny rule change must re-run full fixed evaluation set.
RegressionPreviously fixed page remains in fixture corpus.

08 / Identity / ordering / IDs

AreaRequired proof
Logical duplicate precisionAliases merge only with sufficient evidence.
Same-title separationDifferent articles with same title remain separate.
Ordering stabilityRepeated frozen build has identical order.
Boundary correctness29/30/31 and 59/60/61 cases.
ID stability predeployRebuild staging corrects missing records before freeze.
ID stability postdeployRoutine recrawl does not renumber published articles.

09 / Chaos and resume

Crash pointExpected recovery
Preflight crashResumes unfinished surfaces.
First-batch crashContinues toward first 30 without duplicate candidate records.
WAITING_FOR_OWNER restartStill waits.
Continue double-submitSingle durable approval.
Full crawl crashPending queue restored.
Validation crashRestarts from frozen corpus.
Deploy crashRecovers/rolls back without duplicate registration.
Live-verify crashDONE remains false until verification resumes.

10 / Security suite

TestExpected behavior
SSRF direct127.0.0.1, ::1, RFC1918, link-local blocked.
SSRF redirectpublic→private redirect blocked.
Scheme abusefile/data/javascript/ftp blocked.
DNS driftprivate resolution at request time blocked.
robotsdisallowed route never fetched.
429Retry-After/backoff honored.
Runaway URLssafety ceiling trips.
Browser popupnew host passes same scope guard.
Injectionsource title cannot execute on Work dataset page.
Leakagepublic artifacts/diagnostic packet contain no secrets/internal paths.

11 / Browser + live verification

Browser scenarioExpected behavior
Operator landingURL input works; invalid URL error is understandable.
PreflightPlan visible before full crawl.
Live logsState/header/counters/log stream visible without reload.
Owner gateContinue/Reject actions persist.
ReconnectPage reload restores canonical job state.
Dataset MASTERBatch directory and machine manifest present.
Batch pagesfirst/middle/final navigation works.
Mobilemonitoring + dataset pages remain usable.
JS off datasetcore generated HTML still usable.
Live checkExpected behavior
HTTPMASTER and every batch URL reachable.
Identitylive build_id/dataset_id/schema match expected.
Catalogexactly one dataset registration.
RouteWork → Services → service → dataset → batch path works.
Original source linksremain correct and external.
No mixed buildall live pages belong to same immutable build.
Rollbackknown-good previous build can be restored during replacement test if safe to exercise.

12 / Fine Woodworking / WOOD benchmark

Reference aspectWhat it means
Reference corpusExisting manually curated Fine Woodworking WOOD pages.
Reference structure30 substantive article records per full batch; final/boundary consistency.
Reference identityStable per-source IDs such as FWW/FW-style sequential identifiers.
Reference orderReverse chronological for Fine Woodworking dataset.
Reference graphprevious/next batch and article relationships.
Reference machine layerEmbedded JSON manifest + JSON-LD/data-* style machine-readable structures.
Reference source policyArticle page evidence preferred; sitemap/archive support discovery; uncertain non-articles excluded.
Reference caveatManual corpus may itself contain past corrections; newest available reference snapshot is required for formal benchmark.
IDBenchmark stepRule
B-14-01Freeze benchmark snapshotSelect latest trustworthy Fine Woodworking manual dataset/context and record exact reference version.
B-14-02Independent runNew service starts from source URL; do not seed it with the manual answer list.
B-14-03First-30 comparisonCompare titles, canonical URLs, order and exclusions.
B-14-04Tune by ruleFix source profile/systemic logic, not individual records.
B-14-05Full runCollect complete reachable corpus under current product/security policy.
B-14-06Normalize comparisonCompare logical articles by canonical/alias evidence, not raw URL string only.
B-14-07Explain deltasEvery missing/extra/reordered record gets a reason category.
B-14-08Boundary compareCheck batch transitions against reference around 30-record boundaries.
B-14-09Graph compareIDs/navigation/manifest consistency validated independently.
B-14-10DecisionAccept, retune, or block release based on documented deltas.
Не требуем повторять всю старую WOOD-метадату.

Сравниваем то, что важно новому сервису: coverage, корректность article/non-article, порядок, logical duplicates, canonical URL, границы пакетов, стабильные IDs и связность HTML/manifest.

13 / Как объяснять benchmark differences

CategoryMeaning
MISSING_VALIDReference article absent from generated corpus.
EXTRA_FALSE_POSITIVEGenerated record is not a valid article under accepted contract.
ORDER_DIFFERENCESame article set, different sequence.
CANONICAL_DIFFERENCESame logical article, preferred URL differs.
REFERENCE_POLICY_DIFFERENCEManual reference used a rule no longer in universal product contract.
ACCESS_DIFFERENCECurrent site/robots/access changed since manual reference.
SOURCE_CHANGEDArticle removed/moved/new since reference snapshot.
REFERENCE_DEFECTManual benchmark itself proven inconsistent.
BENCHMARK RULE Difference != automatic failure. Every difference must be: 1. reproducible; 2. categorized; 3. supported by source/reference evidence; 4. accepted as: - generated-system defect, - reference defect, - source changed, - policy difference, - access difference. Unexplained difference = release blocker.

14 / Release evidence packet

ArtifactPurpose
test_summary.jsonMachine-readable totals by suite/gate.
junit_or_equivalent.xmlOptional CI-compatible executable test results.
benchmark_delta.jsonPer-record benchmark differences and reason categories.
security_report.jsonSecurity test outcomes; no secret values.
browser_evidence/Screenshots/trace refs where browser proof is needed.
validation_report.jsonGenerated dataset structural validation.
live_verify.jsonPublic Work URL/build identity verification.
release_decision.md/jsonAccepted risks, blockers, exact build/commit versions.

15 / Hard release blockers

IDBlocker
BLOCKER-01Any SSRF bypass or secret leak.
BLOCKER-02DONE possible before live verification.
BLOCKER-03Resume loses owner approval or duplicates logical articles.
BLOCKER-04Generated visible HTML diverges from machine manifest.
BLOCKER-05Broken batch boundaries or duplicate/missing public IDs.
BLOCKER-06Classifier admits obvious category/video-only/service false positives in accepted benchmark sample.
BLOCKER-07Crawler escapes approved host scope.
BLOCKER-08Deploy can expose incomplete mixed build without rollback.
BLOCKER-09Benchmark differences cannot be explained/reproduced.

16 / Definition of Done

IDCriterion
A-14-01Every critical product contract has at least one executable test.
A-14-02All security-critical tests pass before release.
A-14-03Forced-kill recovery is tested at multiple phases.
A-14-040/1/29/30/31/60/61/65 rendering fixtures pass.
A-14-05Classifier regression corpus contains positives, negatives and uncertain examples.
A-14-06Fine Woodworking benchmark uses a frozen named reference snapshot.
A-14-07Benchmark run starts independently from source URL.
A-14-08Every benchmark delta has a categorized explanation.
A-14-09No release blocker remains unresolved.
A-14-10Live Work verification evidence matches exact build_id being released.
A-14-11Browser acceptance covers operator UI and generated dataset.
A-14-12Test evidence is machine-readable enough for a new AI session to inspect.
A-14-13A failed gate prevents progression to release.
A-14-14Accepted exceptions are explicit owner/ADR decisions, not hidden test skips.

17 / Luna Medium bounded blocks

BlockScopeExpected result
LUNA-14-AFixture harnessReusable local fixtures for sitemap/listing/article/security cases.
LUNA-14-BUnit/component suitesNormalization, classifier helpers, identity, batching, state.
LUNA-14-CCrawler integrationCoverage/retry/loop/resume/scope metrics.
LUNA-14-DChaos suiteForced kill, stale worker, deploy interruption.
LUNA-14-ESecurity suiteSSRF/robots/rate/browser/injection/leakage.
LUNA-14-FHTML/browser suiteRender validators + browser flows.
LUNA-14-GFine Woodworking benchmark harnessReference snapshot loader + independent run comparator.
LUNA-14-HDelta reporterCategorize missing/extra/order/canonical/reference/source changes.
LUNA-14-IRelease gate compilerSingle PASS/FAIL decision with evidence refs.

18 / Handoff

NEXT PLANNING ARTIFACT Statiya_poluchatel_1_15_UPDATE_EXISTING_DATASET.html SP-15 will define: - how a deployed dataset is checked for new/changed articles - how stable published IDs survive updates - append vs insertion policy - URL/canonical changes - deleted/moved articles - duplicate corrections - update preview/validation/deploy - migration and rollback behavior