Build validated and deploy inputs frozen.
01 / Главный контракт
Ни один предыдущий шаг не может быть пропущен. Публичная доступность файла сама по себе ещё не означает успешный deploy.
Точный project_root, document root, reverse proxy, deploy script и index-generation mechanism берутся только из SP-03 live discovery. Здесь описана логика процесса, а не выдуманный путь на сервере.
02 / Deploy input contract
| Input | Meaning |
|---|---|
| build_id | Immutable validated build from SP-11. |
| dataset_id | Stable dataset identity. |
| source_id | Stable source identity. |
| source_slug | Stable public folder slug. |
| source_name | Human-readable source title. |
| staging_output_ref | Validated directory/artifact set. |
| validation_report_ref | PASS evidence from SP-11. |
| article_count | Total records. |
| batch_count | Total batch files. |
| target_route | Public dataset route resolved from SP-03. |
| work_repo/project_root | Verified live Work project location from SP-03. |
| deploy_method | Verified current Work deployment mechanism. |
03 / Deploy state machine
Files copied/prepared in deploy staging area.
Target route, permissions, free space and collision policy checked.
Atomic/controlled publication in progress.
Files present at target; live verification not yet passed.
HTTP/browser verification of master and batches.
Dataset link registered in service/catalog/index.
Live verification + registration passed.
Publish/verify/register failed; rollback/retry required.
04 / Public path rules
| ID | Rule |
|---|---|
| P-12-01 | One source dataset gets one stable public root. |
| P-12-02 | Dataset root must not collide with another source. |
| P-12-03 | source_slug is frozen after first production deploy unless explicit migration. |
| P-12-04 | MASTER INDEX public URL is dataset root + index.html or server-equivalent directory index. |
| P-12-05 | Batch files remain under same dataset root to preserve relative links. |
| P-12-06 | No job IDs, temp paths or build workspace names appear in public URLs. |
| P-12-07 | Exact filesystem mapping is discovered from Work runtime, never guessed from URL structure. |
05 / Publish flow
| Step | Action |
|---|---|
| 1 | Confirm canonical job state is VALIDATING complete and build validation=PASS. |
| 2 | Lock exact build_id and prevent mutation during deploy. |
| 3 | Resolve live deploy target from SP-03 authoritative runtime facts. |
| 4 | Run preflight: path ownership, free space, route collision, current dataset state. |
| 5 | Copy/sync build into isolated deploy staging target. |
| 6 | Verify staged file count/checksums/manifest before switch. |
| 7 | Atomically switch/rename/sync according to existing Work deploy method. |
| 8 | Open live MASTER INDEX and representative/all batch URLs. |
| 9 | Verify content/build_id/schema/counts against expected build. |
| 10 | Register/update dataset in service page/catalog. |
| 11 | Update Work AI/global index only if SP-03 proves this is part of current canonical process. |
| 12 | Re-verify navigation from Work → Services → service → dataset → batch. |
| 13 | Persist live URLs and DEPLOY_DONE checkpoint. |
06 / Atomicity and idempotency
| ID | Rule |
|---|---|
| A-12-01 | Never publish directly from mutable renderer workspace. |
| A-12-02 | Prefer atomic directory switch/rename/symlink or equivalent proven Work deployment pattern. |
| A-12-03 | If atomic swap is impossible, publish in order that never exposes MASTER pointing to absent batches. |
| A-12-04 | Do not delete previous known-good build until new live verification passes. |
| A-12-05 | Rollback must restore previous public root or remove new incomplete publication safely. |
| A-12-06 | Repeated deploy of same build_id must be idempotent. |
| A-12-07 | Deploying a different build to same dataset root requires explicit version/state comparison. |
07 / Live verification
| ID | Check | Expected proof |
|---|---|---|
| L-12-01 | MASTER HTTP | Public master URL returns successful HTTP status. |
| L-12-02 | MASTER identity | Embedded dataset_id/build_id/schema match expected build. |
| L-12-03 | MASTER count | article_count/batch_count equal expected. |
| L-12-04 | Batch HTTP | Every listed batch URL is reachable, or at minimum all batches must be programmatically checked. |
| L-12-05 | Batch identity | Each batch manifest belongs to same dataset/build. |
| L-12-06 | Navigation | MASTER→batch and batch→MASTER/prev/next links resolve live. |
| L-12-07 | Original links | Representative original article links remain external source links, not rewritten to Work. |
| L-12-08 | No internal leak | No server paths/secrets/debug data appear live. |
| L-12-09 | Browser rendering | Representative pages visually load and remain readable. |
| L-12-10 | Final URL | Canonical final master URL stored in job state only after verification. |
Verifier должен доказать, что live page относится именно к ожидаемому build_id/dataset_id, а не является старой закэшированной версией.
08 / Dataset registration in Work
| Field | Registry value |
|---|---|
| dataset_id | Stable machine identity. |
| source_id | Source identity. |
| source_name | Display name. |
| source_url | Original source site. |
| dataset_url | Live MASTER INDEX. |
| article_count | Total records. |
| batch_count | Total batches. |
| ordering_method | Declared dataset order. |
| dataset_status | DONE or PARTIAL. |
| generated_at | Dataset generation time. |
| verified_at | Live verification time. |
| schema_version | AI-readable schema. |
| build_id | Published build. |
| ID | Catalog rule |
|---|---|
| C-12-01 | Completed dataset appears once in the service's completed-datasets list. |
| C-12-02 | Re-deploy/update modifies existing dataset registration; it must not create duplicate catalog entries. |
| C-12-03 | PARTIAL datasets must be visibly marked PARTIAL and never presented as complete. |
| C-12-04 | Catalog entry links to dataset MASTER, not directly to arbitrary batch. |
| C-12-05 | Catalog display data and machine registry come from same dataset registration record. |
| C-12-06 | If Work has an existing global AI index generator, integrate through it rather than hand-editing generated output. |
| C-12-07 | If global index update mechanism is not verified, mark it NOT_PROVEN and do not invent a parallel index. |
| Service page block | Content |
|---|---|
| Service identity | Автономный исследовательский конвейер сайтов. |
| New job action | Open operator UI/start URL input. |
| Active jobs | Optional compact current-job section if consistent with Work UI. |
| Completed datasets | Source name + article count + status + master link. |
| Dataset details | May show generation/verification date and ordering method. |
| Admin/public split | Operator controls should be protected; completed dataset visibility follows project access policy. |
09 / Rollback matrix
| Failure point | Required recovery |
|---|---|
| Publish fails before switch | Discard deploy staging; public state unchanged. |
| Switch succeeds but live verification fails | Restore previous known-good build/root; status DEPLOY_FAILED. |
| New dataset first deploy fails | Remove/disable incomplete route; do not register in catalog. |
| Catalog update fails after dataset live | Dataset may be live but job cannot be DONE; retry catalog registration or rollback according to policy. |
| Global AI index update fails | If mandatory in existing Work contract, DEPLOY_FAILED/PARTIAL; if optional, warn and create corrective task. |
| Repeated deploy command | Detect same build_id already live and verify rather than duplicating files/catalog rows. |
10 / Structured deploy events
| Event | Payload |
|---|---|
| DEPLOY_READY | job_id, dataset_id, build_id, target_route |
| DEPLOY_PRECHECK_OK | target_route, previous_build_id, free_space_summary |
| DEPLOY_STAGE_START | build_id, target |
| DEPLOY_STAGE_OK | file_count, checksum_summary |
| DEPLOY_PUBLISH_START | build_id, method |
| DEPLOY_PUBLISH_OK | dataset_url |
| LIVE_VERIFY_START | dataset_url, expected_build_id |
| LIVE_VERIFY_FILE_OK | url, document_type, build_id |
| LIVE_VERIFY_FAILED | url, reason, expected, observed |
| CATALOG_REGISTER_START | dataset_id |
| CATALOG_REGISTER_OK | dataset_id, catalog_ref |
| DEPLOY_ROLLBACK | reason, restored_build_id |
| DEPLOY_DONE | dataset_url, master_index_url, verified_at |
11 / Failure modes
| ID | Failure | Required behavior |
|---|---|---|
| F-12-01 | Target path guessed incorrectly | Forbidden; deploy target must be SP-03 VERIFIED. |
| F-12-02 | Partial file copy exposed | Prevent with staging + atomic/ordered publish. |
| F-12-03 | MASTER points to old/new mixed batches | Build-scoped deployment and live build_id checks. |
| F-12-04 | Insufficient disk space | Precheck before copy; fail safely. |
| F-12-05 | Permission denied | Do not chmod broadly; use existing deploy ownership/permissions. |
| F-12-06 | Nginx route missing | Deploy cannot be DONE; fix verified route or rollback. |
| F-12-07 | Live cache serves old build | Verification compares build_id; purge/reload only via established mechanism. |
| F-12-08 | Catalog duplicate | Use dataset_id uniqueness/upsert semantics. |
| F-12-09 | Service page broken by registration | Registration must pass HTML/browser validation; rollback catalog change. |
| F-12-10 | Global index format changed | Use canonical generator/API; never string-append blindly. |
| F-12-11 | Network verify timeout | Retry bounded times; DONE remains forbidden until proof. |
12 / Definition of Done
| ID | Criterion |
|---|---|
| A-12-01 | Only validation=PASS immutable build can enter deploy. |
| A-12-02 | Deployment uses verified Work target/method from SP-03. |
| A-12-03 | A failed deploy never leaves job marked DONE. |
| A-12-04 | Partial publication is not exposed as completed dataset. |
| A-12-05 | Previous known-good build can be restored when replacing an existing dataset. |
| A-12-06 | Repeated deploy of same build is idempotent. |
| A-12-07 | Every live batch URL listed by MASTER is checked programmatically. |
| A-12-08 | Live embedded build_id/dataset_id/schema match expected build. |
| A-12-09 | Work service/catalog contains exactly one registration for dataset_id. |
| A-12-10 | Service/catalog links to live MASTER INDEX. |
| A-12-11 | PARTIAL datasets are explicitly labeled. |
| A-12-12 | No internal server path/secret/debug data appears publicly. |
| A-12-13 | User receives final live dataset URL only after verification. |
| A-12-14 | Navigation Work→Services→service→dataset is browser-verified where route exists. |
| A-12-15 | Job canonical state records final URLs and DEPLOY_DONE checkpoint. |
13 / Luna Medium bounded blocks
| Block | Scope | Expected result |
|---|---|---|
| LUNA-12-A | Deploy target adapter | Implement against SP-03 verified Work deploy mechanism only. |
| LUNA-12-B | Staging + precheck | File count/free space/collision/previous-build checks. |
| LUNA-12-C | Atomic publish | Idempotent publish/switch and rollback. |
| LUNA-12-D | Live verifier | HTTP + manifest/build identity for master/all batches. |
| LUNA-12-E | Catalog registry | dataset_id upsert and service completed-datasets view. |
| LUNA-12-F | Global index integration | Only if verified existing Work contract requires it. |
| LUNA-12-G | Failure/rollback suite | Partial copy, 404, stale cache, duplicate registration. |
| LUNA-12-H | Browser path acceptance | Work→service→dataset→batch and final link. |