STATIYA_POLUCHATEL_1
SP-12 · WORK DEPLOY
P5 / VALIDATED BUILD → LIVE WORK → VERIFIED CATALOG

Deploy на Work и интеграция в каталог

Публикация — отдельный контролируемый этап. Только immutable build со статусом PASS может попасть на Work. После копирования файлов сервис обязан проверить реальные live URL, зарегистрировать dataset в каталоге сервиса и лишь затем поставить job в DONE.

PASSbuild required
9deploy states
10live checks
0DONE before verify

01 / Главный контракт

VALIDATE → STAGE → PUBLISH → VERIFY LIVE → REGISTER → DONE.

Ни один предыдущий шаг не может быть пропущен. Публичная доступность файла сама по себе ещё не означает успешный deploy.

Filesystem/route не угадываются.

Точный project_root, document root, reverse proxy, deploy script и index-generation mechanism берутся только из SP-03 live discovery. Здесь описана логика процесса, а не выдуманный путь на сервере.

02 / Deploy input contract

InputMeaning
build_idImmutable validated build from SP-11.
dataset_idStable dataset identity.
source_idStable source identity.
source_slugStable public folder slug.
source_nameHuman-readable source title.
staging_output_refValidated directory/artifact set.
validation_report_refPASS evidence from SP-11.
article_countTotal records.
batch_countTotal batch files.
target_routePublic dataset route resolved from SP-03.
work_repo/project_rootVerified live Work project location from SP-03.
deploy_methodVerified current Work deployment mechanism.

03 / Deploy state machine

DEPLOY_READY

Build validated and deploy inputs frozen.

DEPLOY_STAGING

Files copied/prepared in deploy staging area.

DEPLOY_PRECHECK

Target route, permissions, free space and collision policy checked.

DEPLOY_PUBLISHING

Atomic/controlled publication in progress.

DEPLOY_PUBLISHED

Files present at target; live verification not yet passed.

VERIFYING_LIVE

HTTP/browser verification of master and batches.

REGISTERING_CATALOG

Dataset link registered in service/catalog/index.

DEPLOY_DONE

Live verification + registration passed.

DEPLOY_FAILED

Publish/verify/register failed; rollback/retry required.

04 / Public path rules

IDRule
P-12-01One source dataset gets one stable public root.
P-12-02Dataset root must not collide with another source.
P-12-03source_slug is frozen after first production deploy unless explicit migration.
P-12-04MASTER INDEX public URL is dataset root + index.html or server-equivalent directory index.
P-12-05Batch files remain under same dataset root to preserve relative links.
P-12-06No job IDs, temp paths or build workspace names appear in public URLs.
P-12-07Exact filesystem mapping is discovered from Work runtime, never guessed from URL structure.
PROVISIONAL PUBLIC INFORMATION ARCHITECTURE Work └── Services └── Автономный исследовательский конвейер сайтов └── Completed datasets └── Source X └── /datasets/<source-slug>/ ├── index.html ├── articles-001-030.html └── ... Exact route naming is finalized only after SP-03 verifies current Work conventions.

05 / Publish flow

StepAction
1Confirm canonical job state is VALIDATING complete and build validation=PASS.
2Lock exact build_id and prevent mutation during deploy.
3Resolve live deploy target from SP-03 authoritative runtime facts.
4Run preflight: path ownership, free space, route collision, current dataset state.
5Copy/sync build into isolated deploy staging target.
6Verify staged file count/checksums/manifest before switch.
7Atomically switch/rename/sync according to existing Work deploy method.
8Open live MASTER INDEX and representative/all batch URLs.
9Verify content/build_id/schema/counts against expected build.
10Register/update dataset in service page/catalog.
11Update Work AI/global index only if SP-03 proves this is part of current canonical process.
12Re-verify navigation from Work → Services → service → dataset → batch.
13Persist live URLs and DEPLOY_DONE checkpoint.

06 / Atomicity and idempotency

IDRule
A-12-01Never publish directly from mutable renderer workspace.
A-12-02Prefer atomic directory switch/rename/symlink or equivalent proven Work deployment pattern.
A-12-03If atomic swap is impossible, publish in order that never exposes MASTER pointing to absent batches.
A-12-04Do not delete previous known-good build until new live verification passes.
A-12-05Rollback must restore previous public root or remove new incomplete publication safely.
A-12-06Repeated deploy of same build_id must be idempotent.
A-12-07Deploying a different build to same dataset root requires explicit version/state comparison.

07 / Live verification

IDCheckExpected proof
L-12-01MASTER HTTPPublic master URL returns successful HTTP status.
L-12-02MASTER identityEmbedded dataset_id/build_id/schema match expected build.
L-12-03MASTER countarticle_count/batch_count equal expected.
L-12-04Batch HTTPEvery listed batch URL is reachable, or at minimum all batches must be programmatically checked.
L-12-05Batch identityEach batch manifest belongs to same dataset/build.
L-12-06NavigationMASTER→batch and batch→MASTER/prev/next links resolve live.
L-12-07Original linksRepresentative original article links remain external source links, not rewritten to Work.
L-12-08No internal leakNo server paths/secrets/debug data appear live.
L-12-09Browser renderingRepresentative pages visually load and remain readable.
L-12-10Final URLCanonical final master URL stored in job state only after verification.
HTTP 200 недостаточно.

Verifier должен доказать, что live page относится именно к ожидаемому build_id/dataset_id, а не является старой закэшированной версией.

08 / Dataset registration in Work

FieldRegistry value
dataset_idStable machine identity.
source_idSource identity.
source_nameDisplay name.
source_urlOriginal source site.
dataset_urlLive MASTER INDEX.
article_countTotal records.
batch_countTotal batches.
ordering_methodDeclared dataset order.
dataset_statusDONE or PARTIAL.
generated_atDataset generation time.
verified_atLive verification time.
schema_versionAI-readable schema.
build_idPublished build.
IDCatalog rule
C-12-01Completed dataset appears once in the service's completed-datasets list.
C-12-02Re-deploy/update modifies existing dataset registration; it must not create duplicate catalog entries.
C-12-03PARTIAL datasets must be visibly marked PARTIAL and never presented as complete.
C-12-04Catalog entry links to dataset MASTER, not directly to arbitrary batch.
C-12-05Catalog display data and machine registry come from same dataset registration record.
C-12-06If Work has an existing global AI index generator, integrate through it rather than hand-editing generated output.
C-12-07If global index update mechanism is not verified, mark it NOT_PROVEN and do not invent a parallel index.
Service page blockContent
Service identityАвтономный исследовательский конвейер сайтов.
New job actionOpen operator UI/start URL input.
Active jobsOptional compact current-job section if consistent with Work UI.
Completed datasetsSource name + article count + status + master link.
Dataset detailsMay show generation/verification date and ordering method.
Admin/public splitOperator controls should be protected; completed dataset visibility follows project access policy.

09 / Rollback matrix

Failure pointRequired recovery
Publish fails before switchDiscard deploy staging; public state unchanged.
Switch succeeds but live verification failsRestore previous known-good build/root; status DEPLOY_FAILED.
New dataset first deploy failsRemove/disable incomplete route; do not register in catalog.
Catalog update fails after dataset liveDataset may be live but job cannot be DONE; retry catalog registration or rollback according to policy.
Global AI index update failsIf mandatory in existing Work contract, DEPLOY_FAILED/PARTIAL; if optional, warn and create corrective task.
Repeated deploy commandDetect same build_id already live and verify rather than duplicating files/catalog rows.

10 / Structured deploy events

EventPayload
DEPLOY_READYjob_id, dataset_id, build_id, target_route
DEPLOY_PRECHECK_OKtarget_route, previous_build_id, free_space_summary
DEPLOY_STAGE_STARTbuild_id, target
DEPLOY_STAGE_OKfile_count, checksum_summary
DEPLOY_PUBLISH_STARTbuild_id, method
DEPLOY_PUBLISH_OKdataset_url
LIVE_VERIFY_STARTdataset_url, expected_build_id
LIVE_VERIFY_FILE_OKurl, document_type, build_id
LIVE_VERIFY_FAILEDurl, reason, expected, observed
CATALOG_REGISTER_STARTdataset_id
CATALOG_REGISTER_OKdataset_id, catalog_ref
DEPLOY_ROLLBACKreason, restored_build_id
DEPLOY_DONEdataset_url, master_index_url, verified_at

11 / Failure modes

IDFailureRequired behavior
F-12-01Target path guessed incorrectlyForbidden; deploy target must be SP-03 VERIFIED.
F-12-02Partial file copy exposedPrevent with staging + atomic/ordered publish.
F-12-03MASTER points to old/new mixed batchesBuild-scoped deployment and live build_id checks.
F-12-04Insufficient disk spacePrecheck before copy; fail safely.
F-12-05Permission deniedDo not chmod broadly; use existing deploy ownership/permissions.
F-12-06Nginx route missingDeploy cannot be DONE; fix verified route or rollback.
F-12-07Live cache serves old buildVerification compares build_id; purge/reload only via established mechanism.
F-12-08Catalog duplicateUse dataset_id uniqueness/upsert semantics.
F-12-09Service page broken by registrationRegistration must pass HTML/browser validation; rollback catalog change.
F-12-10Global index format changedUse canonical generator/API; never string-append blindly.
F-12-11Network verify timeoutRetry bounded times; DONE remains forbidden until proof.

12 / Definition of Done

IDCriterion
A-12-01Only validation=PASS immutable build can enter deploy.
A-12-02Deployment uses verified Work target/method from SP-03.
A-12-03A failed deploy never leaves job marked DONE.
A-12-04Partial publication is not exposed as completed dataset.
A-12-05Previous known-good build can be restored when replacing an existing dataset.
A-12-06Repeated deploy of same build is idempotent.
A-12-07Every live batch URL listed by MASTER is checked programmatically.
A-12-08Live embedded build_id/dataset_id/schema match expected build.
A-12-09Work service/catalog contains exactly one registration for dataset_id.
A-12-10Service/catalog links to live MASTER INDEX.
A-12-11PARTIAL datasets are explicitly labeled.
A-12-12No internal server path/secret/debug data appears publicly.
A-12-13User receives final live dataset URL only after verification.
A-12-14Navigation Work→Services→service→dataset is browser-verified where route exists.
A-12-15Job canonical state records final URLs and DEPLOY_DONE checkpoint.

13 / Luna Medium bounded blocks

BlockScopeExpected result
LUNA-12-ADeploy target adapterImplement against SP-03 verified Work deploy mechanism only.
LUNA-12-BStaging + precheckFile count/free space/collision/previous-build checks.
LUNA-12-CAtomic publishIdempotent publish/switch and rollback.
LUNA-12-DLive verifierHTTP + manifest/build identity for master/all batches.
LUNA-12-ECatalog registrydataset_id upsert and service completed-datasets view.
LUNA-12-FGlobal index integrationOnly if verified existing Work contract requires it.
LUNA-12-GFailure/rollback suitePartial copy, 404, stale cache, duplicate registration.
LUNA-12-HBrowser path acceptanceWork→service→dataset→batch and final link.

14 / Handoff

NEXT PLANNING ARTIFACT Statiya_poluchatel_1_13_SECURITY_ROBOTS_RATE_LIMITS.html SP-13 will freeze: - admin/operator access model - URL input/SSRF protections - robots handling - per-domain rate limits - authentication/CAPTCHA boundary - browser/network sandbox - secrets policy - public/private data boundaries - security acceptance tests