STATIYA_POLUCHATEL_1
SP-15 · UPDATE DATASET
P8 / DATASET LIFECYCLE · STABLE PUBLIC IDENTITY

Обновление уже опубликованной базы

После публикации dataset становится публичным контрактом: article IDs могут использоваться людьми, AI и внешними ссылками. Поэтому update — не «пересобрать всё заново». Новые статьи, переезды URL, исправления дублей и исчезновение материалов должны обрабатываться так, чтобы существующая идентичность не ломалась.

7update modes
10change types
0silent renumbering
P1post-MVP ready

01 / Главный lifecycle contract

PUBLIC ID ≠ CURRENT SORT POSITION.

После первого production deploy идентификатор статьи становится стабильным ключом. Если позже нашлась старая пропущенная статья, мы не перенумеровываем сотни существующих записей.

Это post-MVP capability.

Первый релиз может не иметь кнопки «обновить dataset», но архитектура SP-07/SP-10/SP-12 уже должна позволять реализовать update без полного разрушения публичной идентичности.

02 / Update modes

CHECK_ONLY

Inspect source for changes; no public mutation.

PREVIEW_UPDATE

Build a candidate update plan and show delta summary.

APPEND_NEW

Add clearly new articles while preserving published IDs.

CORRECT_METADATA

Fix title/canonical URL/aliases for same logical article without changing public ID.

MERGE_DUPLICATE

Controlled migration when two published records are proven to be one logical article.

MARK_REMOVED

Mark source article unavailable/moved without deleting historical identity.

REBUILD_STAGING

Re-render dataset from updated stable identity graph before deploy.

03 / Stable identity principles

IDRule
I-15-01Public article_id remains bound to the same logical article after publication.
I-15-02Canonical URL may change if the logical article is the same.
I-15-03New historical articles do not trigger global renumbering.
I-15-04Routine update must preserve old working dataset URLs whenever possible.
I-15-05Aliases and redirect evidence accumulate over time.
I-15-06Corrections are versioned and reversible.
I-15-07Deleted/moved source pages are not silently forgotten from published history.

04 / Change types

TypeMeaning
NEW_ARTICLEValid article not present in published dataset.
URL_MOVEDExisting logical article now resolves to a new URL.
CANONICAL_CHANGEDCanonical preference changed but logical identity is same.
TITLE_CHANGEDSource title changed.
ARTICLE_REMOVEDPreviously published source URL is unavailable or intentionally removed.
ARTICLE_REDIRECTEDOld URL redirects to another same-source article/location.
DUPLICATE_DISCOVEREDTwo published records are now proven to be one logical article.
FALSE_POSITIVE_FOUNDPublished record no longer meets accepted article policy.
SOURCE_ORDER_CHANGEDCurrent site chronology/order differs from original published sequence.
SOURCE_POLICY_CHANGEDrobots/access/content structure changed.

05 / Update flow

StepAction
1Load deployed dataset manifest, identity version, build_id and current public IDs.
2Run source preflight again using current rules, but in CHECK_ONLY/PREVIEW mode.
3Discover/classify current source corpus without mutating published dataset.
4Resolve current logical identities against existing published identity graph.
5Generate delta set by change type.
6Apply stability policy: preserve IDs, URLs/aliases may update, new IDs allocated only for new logical articles.
7Build update preview with counts and risky conflicts.
8OWNER GATE for destructive/ambiguous migrations.
9Create new immutable dataset build in staging.
10Run full SP-14 validation/benchmark subset relevant to update.
11Deploy through SP-12 replacement/update path with rollback.
12Persist update history/version and new build_id.

06 / Новые статьи и ordering после публикации

RulePolicy
DefaultAssign a new public article_id at the end of the stable ID namespace.
Sequence vs display orderPublic ID order and display/order position may diverge after updates; do not renumber old IDs to force equality.
ManifestStore stable article_id separately from current display_order/current ordering key.
Batch renderingMay rebuild batch files according to current display order only if existing public article anchors/IDs remain stable.
Alternative safe MVP extensionAppend new articles to new batches without reshuffling historical batch files if simplicity/stability is preferred.
Owner decisionFinal append-vs-reflow behavior is chosen in SP-16/implementation after evaluating URL stability and update UX.
ConceptPolicy
Published IDImmutable identity key.
Published sequenceHistorical/original sequence may be retained as immutable field.
Current display orderMay be recomputed from source chronology when update policy allows.
Batch membershipCan be treated as build-time presentation, not identity, if URLs do not encode immutable article meaning.
RiskIf batch filenames change due reflow, old inbound links may break; deploy policy must decide redirects/aliases or append-only batches.
Важный архитектурный разрыв.

В первом production build article_id и sequence могут совпадать по смыслу. После обновлений стабильный ID и текущая display order могут разойтись. Это нормально и безопаснее, чем массовая перенумерация.

07 / Duplicate migration after deploy

StepPolicy
DetectRequire strong identity evidence: redirects/canonical/source stable ID/content evidence.
Choose survivorOne existing public article_id remains canonical logical identity.
Retired IDDo not silently reuse. Mark alias/tombstone → survivor.
HTML behaviorOld anchor/record may redirect or clearly state superseded-by, depending rendering strategy.
ManifestRecord superseded_by and migration_version.
Owner gateRequired before production mutation.

08 / Removed / unavailable / false-positive records

CasePolicy
Temporary fetch failureDo not mark removed immediately.
Repeated 404/410Mark source_status=UNAVAILABLE/REMOVED after threshold/evidence.
RedirectTreat as moved if identity consistent.
Dataset recordKeep public article_id and historical title/URL evidence.
Visible behaviorMay show unavailable marker or keep source link with status metadata.
DeletionHard deletion from published identity registry is exceptional and owner-approved.
False positivePolicy
Before deployRemove freely and rebuild staging IDs/order.
After deployDo not silently delete/reuse ID.
CorrectionMark record RETRACTED_FROM_DATASET or superseded, depending severity.
PresentationOptionally hide from default article list while preserving machine history/tombstone.
Owner gateRequired.
ReasonPreserve referential integrity for AI links, external references and future audits.

09 / Update manifest

FieldPurpose
update_idStable update attempt ID.
dataset_idTarget dataset.
from_build_idCurrently live build.
to_build_idCandidate/new build.
started_atTimestamp.
modeCHECK_ONLY / PREVIEW_UPDATE / apply mode.
source_snapshot_refCurrent preflight/crawl evidence.
changes[]Typed delta records.
added_countNew logical articles.
corrected_countMetadata/canonical corrections.
removed_countUnavailable/removed source records.
duplicate_merge_countControlled identity merges.
owner_gate_requiredBoolean.
owner_decisionAPPROVED / REJECTED / NOT_REQUIRED.
validation_statusPASS / FAIL.
deploy_statusNOT_STARTED / DEPLOYED / ROLLED_BACK.
Delta fieldPurpose
change_idStable delta item.
change_typeOne of defined types.
article_idExisting public ID if applicable.
new_candidate_idNew candidate/logical identity if applicable.
old_valuePrevious relevant state.
new_valueProposed state.
evidence[]Why change is believed true.
riskLOW / MEDIUM / HIGH.
automatic_actionAllowed automatic behavior.
owner_actionRequired approval if any.

10 / OWNER GATE rules

GateWhen
No gate requiredSimple new article addition with high-confidence identity and no published-ID mutation.
Gate requiredDuplicate merge involving published IDs.
Gate requiredFalse-positive correction/removal of published record.
Gate requiredSource root/domain identity migration.
Gate requiredLarge unexplained ordering/corpus delta.
Gate requiredAny update that breaks old public URLs.

11 / Update validation

IDCheck
V-15-01All previously published non-retired article IDs still resolve to same logical articles.
V-15-02No retired ID is reassigned to new content.
V-15-03New article IDs are unique.
V-15-04Canonical corrections preserve logical identity evidence.
V-15-05Update delta totals match actual manifest diff.
V-15-06Rendered dataset passes SP-11 validators.
V-15-07Security checks from SP-13 still pass.
V-15-08Live deploy replacement passes SP-12 verification.
V-15-09Old required URLs/anchors either remain valid or have explicit migration/redirect policy.
V-15-10Rollback restores previous build_id and catalog state.

12 / Structured update events

EventPayload
UPDATE_CHECK_STARTdataset_id, from_build_id
UPDATE_DELTA_FOUNDchange_id, change_type, article_id, risk
UPDATE_PREVIEW_READYupdate_id, totals, owner_gate_required
UPDATE_OWNER_APPROVEDupdate_id, decision
UPDATE_BUILD_STARTupdate_id, to_build_id
UPDATE_VALIDATION_OKupdate_id, to_build_id
UPDATE_DEPLOY_OKupdate_id, from_build_id, to_build_id
UPDATE_ROLLBACKupdate_id, restored_build_id, reason

13 / Failure modes

IDFailureRequired behavior
F-15-01Current source inaccessibleCHECK_ONLY/PREVIEW fails safely; live dataset unchanged.
F-15-02Huge unexpected corpus deltaRequire owner review; no automatic apply.
F-15-03New historical article would shift all IDsAllocate new stable ID instead; do not renumber.
F-15-04Canonical change points to unrelated articleDo not merge; conflict review.
F-15-05Duplicate discovered after publicationControlled merge/tombstone, never ID reuse.
F-15-06Old article disappears temporarilyDo not immediately mark removed.
F-15-07Update build fails validationKeep current live build.
F-15-08Replacement deploy failsRollback to previous build.
F-15-09Catalog update duplicates entryUpsert by dataset_id.

14 / Definition of Done

IDCriterion
A-15-01CHECK_ONLY can inspect changes without mutating public dataset.
A-15-02Published article IDs never silently change logical meaning.
A-15-03New historical article does not renumber existing IDs.
A-15-04URL/canonical correction preserves article_id when logical identity is same.
A-15-05Published duplicate merge requires controlled migration.
A-15-06Retired IDs are never reused.
A-15-07Source removal does not immediately erase historical dataset identity.
A-15-08Update preview clearly lists additions/corrections/removals/merges.
A-15-09High-risk/destructive update requires owner gate.
A-15-10New build is validated before replacement deploy.
A-15-11Rollback restores previous live build and registry state.
A-15-12Update history records from_build_id → to_build_id and typed deltas.
A-15-13Routine update remains compatible with AI-readable dataset schema.

15 / Luna Medium bounded blocks

BlockScopeExpected result
LUNA-15-AExisting dataset loaderRead deployed manifest/identity graph safely.
LUNA-15-BCurrent-source comparatorRun preflight/crawl/classify in non-mutating mode.
LUNA-15-CDelta classifierMap differences to typed change records.
LUNA-15-DStable identity updaterPreserve IDs; allocate only new identities.
LUNA-15-EOwner-gate rulesRisk classification and approval requirements.
LUNA-15-FUpdate rendererBuild new immutable dataset version.
LUNA-15-GReplacement deploySP-12-compatible replace/rollback flow.
LUNA-15-HMigration regression suiteNew historical article, moved URL, duplicate merge, removed article.

16 / Handoff

NEXT PLANNING ARTIFACT Statiya_poluchatel_1_16_MASTER_MERGE_START_PROJECT_LUNA_TASKS.html SP-16 must: - merge accepted SP-01…SP-15 decisions - reconcile runtime facts from SP-03 - freeze architecture decisions - create START_PROJECT bootstrap snapshot - define canonical project state + /razraba structure - compile first ACTIVE WINDOW for GPT-5.6 Luna / Medium - keep only bounded implementation tasks in the active window - attach verification and rollback to each implementation block