01 / Каноническая последовательность действий
Если назначить ID до дедупликации, любой redirect/canonical alias будет сдвигать последовательность и разрушать пакетные границы.
02 / Evidence для logical dedup
| ID | Evidence | Strength / rule |
|---|---|---|
| D1 | Exact normalized final URL match | Strong request-level duplicate evidence. |
| D2 | Redirect destination equality | Two discovered URLs converge to the same final URL. |
| D3 | Same valid rel=canonical within source | Strong logical-identity evidence when canonical is consistent. |
| D4 | Same source-specific stable content identifier | If source exposes article/post ID in markup/URL/API-like metadata. |
| D5 | Equivalent URL variants proven by source | www/non-www, trailing slash, print/mobile paths only when verified. |
| D6 | Same title only | Insufficient. Never merge solely on title. |
| D7 | Similar path slug only | Insufficient without stronger evidence. |
| D8 | Same publication date only | Insufficient. |
| Step | Dedup flow |
|---|---|
| 1 | Collect INCLUDE records and all URL identity evidence. |
| 2 | Group exact normalized/final URL matches. |
| 3 | Apply redirect-chain convergence. |
| 4 | Evaluate same-source rel=canonical evidence. |
| 5 | Apply source-specific verified equivalence rules. |
| 6 | Never merge remaining records by title similarity alone. |
| 7 | Choose one canonical URL per logical group. |
| 8 | Preserve all aliases/evidence for diagnostics. |
| 9 | Freeze logical article set. |
| 10 | Only then sort and assign public sequence/IDs. |
03 / Canonical URL resolution
| Priority | Source | Rule |
|---|---|---|
| 1 | Verified final URL after redirects | Base network truth for reachable page. |
| 2 | Valid same-source rel=canonical | Preferred logical URL if it points to same content and allowed source scope. |
| 3 | Source-specific stable preferred URL rule | Allowed only if evidenced and versioned. |
| 4 | Original discovered URL | Fallback if no stronger canonical evidence. |
| ID | Conflict | Behavior |
|---|---|---|
| C-01 | rel=canonical points to external domain | Do not switch automatically; mark conflict and keep source-scoped URL. |
| C-02 | redirect destination and rel=canonical disagree | Preserve both, lower confidence, resolve with source-specific rule or review. |
| C-03 | multiple pages canonicalize to one URL | Merge if content identity evidence is consistent. |
| C-04 | one page declares canonical to category/home | Treat as suspicious; do not merge blindly. |
| C-05 | canonical URL is dead but current final URL works | Prefer working source-scoped URL unless source policy proves otherwise. |
04 / Ordering strategy
| ID | Source | Use |
|---|---|---|
| O1 | Official chronological archive/category order | Best when preflight proves listings represent publication chronology. |
| O2 | article datePublished / equivalent | Use only when broadly present, parseable and plausible. |
| O3 | official feed order | Use if feed scope/coverage is sufficient for relevant corpus. |
| O4 | verified sitemap order | Use only when evidence proves sequence meaning. |
| O5 | deterministic traversal order | Fallback when chronology cannot be proven. |
| ID | Ordering rule |
|---|---|
| OR-01 | One dataset uses one declared primary ordering method. |
| OR-02 | Do not mix date order for some records and discovery order for others without explicit secondary tie-break rules. |
| OR-03 | Sort must be deterministic: same inputs + same profile → same sequence. |
| OR-04 | Missing dates do not silently become current date/zero date. |
| OR-05 | Tie-breaker must be stable, e.g. canonical URL lexical order or source-specific stable key. |
| OR-06 | Ordering method and confidence are stored in source manifest. |
| OR-07 | If ordering confidence is LOW, first-30 owner preview must clearly surface this. |
| OR-08 | Published sequence should not shift automatically after minor recrawl/update. |
Это соответствует логике текущего WOOD-подхода, но универсальный механизм не имеет права притворяться, что знает публикационную дату. Если chronology не доказана, используется другой deterministic order и это явно записывается в manifest.
05 / Source code
| ID | Rule |
|---|---|
| SC-01 | Generate short uppercase source code from source identity/name, e.g. FWW, MAKE, HACKADAY. |
| SC-02 | Code must be unique within Work dataset registry. |
| SC-03 | If collision exists, add deterministic disambiguator rather than silently reusing code. |
| SC-04 | Source code is stable after first production deploy. |
| SC-05 | Human-readable code is separate from internal database primary key. |
06 / Public article IDs
| ID | Rule |
|---|---|
| ID-01 | Public article IDs are sequential within one source dataset. |
| ID-02 | Default format: SOURCECODE_000001, SOURCECODE_000002, ... |
| ID-03 | Sequence starts only after dedup + ordering are frozen for the production build. |
| ID-04 | Raw crawler request IDs/candidate IDs never become public article IDs. |
| ID-05 | During staged first-30/pre-deploy rebuild, sequence may be recalculated. |
| ID-06 | After production deploy, automatic renumbering is forbidden unless an explicit dataset-update migration is approved. |
| ID-07 | Batch boundaries derive from final sequence: 1–30, 31–60, ... |
| ID-08 | Final partial batch is valid. |
07 / Final identity record
| Field | Purpose |
|---|---|
| logical_article_id_internal | Stable internal identity for the logical article. |
| dedup_group_id | Group representing all discovered aliases/variants. |
| source_id | Dataset source. |
| source_code | Stable public prefix. |
| public_article_id | e.g. MAKE_000421. |
| sequence_number | 1..N in final source order. |
| visible_title | Final human-facing title from classifier. |
| canonical_url | Resolved preferred original-source URL. |
| aliases[] | Observed alternative URLs/redirect origins/canonical variants. |
| ordering_method | archive/datePublished/feed/sitemap/discovery fallback. |
| ordering_key | Comparable value used for sorting. |
| ordering_confidence | HIGH/MEDIUM/LOW. |
| batch_id | Stable batch identity. |
| batch_number | 1..M. |
| previous_article_id | Null for first article. |
| next_article_id | Null for last article. |
| identity_evidence[] | Why aliases were merged or kept separate. |
| identity_version | Version of dedup/canonical rules used. |
08 / Batch boundaries and graph
| ID | Rule |
|---|---|
| B-01 | batch_number = ceil(sequence / 30). |
| B-02 | batch 1 covers 1–30; batch 2 covers 31–60; etc. |
| B-03 | Each article stores batch_id and batch_range. |
| B-04 | Each batch stores previous_file / next_file and master_index. |
| B-05 | Article prev/next links cross batch boundaries. |
| B-06 | No duplicate or missing public sequence inside final dataset. |
09 / Что разрешено менять до и после deploy
| State | Policy |
|---|---|
| UNPUBLISHED staging | May rebuild dedup groups, ordering and IDs freely until owner gate/full validation. |
| FIRST-30 preview | Preview IDs are provisional unless explicitly marked final; preferred UI should show that status. |
| PRODUCTION dataset | Public IDs and existing sequence become stable contract. |
| Later newly discovered historical article | Do not automatically renumber hundreds of published records. Defer to SP-15 update policy. |
| Bad canonical discovered after deploy | URL may be corrected while preserving public article ID if logical identity is unchanged. |
| Duplicate discovered after deploy | Requires controlled migration/tombstone/alias strategy in SP-15; not silent deletion/renumber. |
После публикации публичный ID должен оставаться связан с тем же логическим материалом. Обычный повторный crawl не имеет права автоматически перенумеровать сотни уже опубликованных записей.
10 / Structured events
| Event | Payload |
|---|---|
| DEDUP_GROUP_CREATED | group_id, member_count, primary_candidate |
| DEDUP_ALIAS_ADDED | group_id, alias_url, evidence_type |
| DEDUP_KEPT_SEPARATE | candidate_a, candidate_b, reason |
| CANONICAL_SELECTED | group_id, canonical_url, rule, confidence |
| CANONICAL_CONFLICT | group_id, urls, reason |
| ORDERING_SELECTED | source_id, method, confidence, evidence |
| SEQUENCE_ASSIGNED | public_article_id, sequence, canonical_url |
| BATCH_ASSIGNED | public_article_id, batch_id, range |
| IDENTITY_FREEZE | source_id, article_count, identity_version |
11 / Failure modes
| ID | Failure | Required behavior |
|---|---|---|
| F-07-01 | Same-title different articles merged | Forbidden; title alone is insufficient evidence. |
| F-07-02 | Tracking params create duplicate records | Normalize only proven tracking params; merge by stronger URL evidence. |
| F-07-03 | Print/mobile alias becomes separate article | Use source-specific equivalence if proven. |
| F-07-04 | Canonical points to homepage/category | Flag conflict; do not collapse article into listing. |
| F-07-05 | Missing dates reorder unpredictably | Use deterministic fallback/tie-breaker documented in manifest. |
| F-07-06 | One missed article shifts all IDs before deploy | Allowed to rebuild staging; validate boundaries before production freeze. |
| F-07-07 | One missed article found after deploy | Do not auto-renumber; defer to controlled update policy. |
| F-07-08 | Source name collision creates same prefix | Registry must enforce unique source_code. |
| F-07-09 | Alias URL later redirects elsewhere | Preserve historical alias evidence; re-resolve only under update policy. |
12 / Definition of Done
| ID | Criterion |
|---|---|
| A-07-01 | No public article ID is assigned before logical dedup groups are frozen. |
| A-07-02 | Same logical article found from multiple discovery paths appears once. |
| A-07-03 | Same title alone never causes dedup merge. |
| A-07-04 | Every logical article has one canonical URL plus preserved aliases/evidence. |
| A-07-05 | Canonical conflicts are explicit and never silently resolved across domains. |
| A-07-06 | One deterministic ordering method is declared for the dataset. |
| A-07-07 | Re-running same frozen input produces identical order and IDs. |
| A-07-08 | Public IDs are unique and sequential per source. |
| A-07-09 | Batch boundaries are exactly derived from sequence with max 30 records. |
| A-07-10 | prev/next article links remain valid across batch boundaries. |
| A-07-11 | Source code is unique and stable after production deploy. |
| A-07-12 | Published IDs are not automatically renumbered by routine recrawl. |
| A-07-13 | Boundary fixtures around 29/30/31/59/60/61 records pass. |
| A-07-14 | A known missed-article staging fixture proves pre-deploy rebuild corrects sequence safely. |
13 / Luna Medium bounded blocks
| Block | Scope | Expected result |
|---|---|---|
| LUNA-07-A | Identity evidence model | Alias/dedup group/canonical conflict schemas. |
| LUNA-07-B | Request-level alias grouping | final URL + redirect convergence. |
| LUNA-07-C | Canonical resolver | same-source canonical precedence/conflict tests. |
| LUNA-07-D | Source-code registry | unique/stable prefix generation and collision tests. |
| LUNA-07-E | Ordering engine | method contract, tie-breakers, deterministic tests. |
| LUNA-07-F | Public ID allocator | sequence → SOURCECODE_000001 rules. |
| LUNA-07-G | Batch assignment | 30-size boundaries + prev/next links. |
| LUNA-07-H | Freeze/change protections | staging rebuild vs published immutability tests. |
| LUNA-07-I | Regression fixtures | duplicate aliases, same-title distinct articles, missed-article boundary cases. |