KB-6775
RS3C-04 — Catalog-Sync Code Behavior Reconstruction (dot-catalog-sync) — 2026-06-21
5 min read Revision 1
rs3ccatalog-syncbehavior-reconstructionsource-awaredual-writer2026-06-21
RS3C-04 — Catalog-Sync Code Behavior Reconstruction (dot-catalog-sync) — 2026-06-21
Macro: RS3C (Mục tiêu B) · Deliverable: 04 of 13 · source-aware, line-cited
Source-of-record: RS3C-02 §3, operational dot-catalog-sync sha256 7dd84cda… (264 lines), byte-identical to deployed OPERATIONAL (DOT-015).
Date: 2026-06-21 · read-only · 0 mutations
Headline: catalog-sync is a read/scan + report tool whose only write is meta_catalog.record_count (aggregate integer). It never writes dot_tools. This resolves the dual-writer question by source (RS3C-05).
1. Behavior reconstruction table
| # | Claim (code-derived) | Source line/fragment | Confidence | Risk | Note |
|---|---|---|---|---|---|
| C1 | Entrypoint = main "$@" |
L264 | HIGH | — | single entry |
| C2 | Args: --type=<dot_tools|pages|collections>, --all, --help/-h, --local/--cloud |
L208–219 | HIGH | low | requires a type or --all else exit 1 (L216–219) |
| C3 | Scan paths: dot/bin/dot-* (exec), web/pages/*.vue, Directus /collections |
L84 find "${DOT_ROOT}/bin" -name "dot-*" -type f -perm +111; L110 web/pages; L131 /collections?limit=-1 |
HIGH | low | filesystem + REST reads |
| C4 | Read vs write — READ: filesystem find, REST GET |
L84, L52, L131, L173 | HIGH | — | discovery only |
| C5 | WRITE — only meta_catalog.record_count |
L68 api_request PATCH "${BASE_URL}/items/meta_catalog/${item_id}" "{\"record_count\":${count}}" |
HIGH | low | the sole mutation: an integer count on meta_catalog |
| C6 | NEVER writes dot_tools |
no POST/PATCH/DELETE to /items/dot_tools anywhere in L1–264 |
HIGH | — | not a registry writer → no dual-write on dot_tools (RS3C-05) |
| C7 | Upsert/insert/update/delete: PATCH-update only (record_count) | L68; lookup by code L52 | HIGH | low | no insert/delete; no upsert; updates one numeric field |
| C8 | Conflict/clobber: only overwrites record_count (intended) |
L47–75 update_record_count |
HIGH | low | if meta_catalog entry missing → warn + return (L56–66), no creation |
| C9 | dot_tools relationship: counts & lists, no mutation | L77–98 scan_dot_tools: find → count → update_record_count "CAT-006" → echo list |
HIGH | — | reconciliation reporter for CAT-006, read-only on the registry |
| C10 | Registrar relationship: shares scan dir, different sink | both scan dot/bin/dot-*; catalog-sync writes meta_catalog, registrar writes dot_tools |
HIGH | low | no in-process call; non-overlapping write targets |
| C11 | Timing/on-deploy: invoked with args; no internal scheduler | L205–262; dot_tools.DOT-015 trigger_type=NULL; CAT-006 metadata "on-deploy" |
MED | low | scheduling is external (deploy hook), not in source; last_executed 2026-03-31 |
| C12 | Metadata derivation: counts only | L86, L112, L141 | HIGH | — | no status/operation/paired_dot treatment |
| C13 | status/operation/paired_dot treatment: NONE | absent | HIGH | — | catalog-sync does not touch DOT lifecycle fields |
| C14 | Auth: DOT_TOKEN via dot-auth, REST bearer |
L230–240, L37/L42 | HIGH | med | same token family as registrar; scope unproven from this file |
| C15 | TLS: --globoff only (no -k) |
L36, L41 | HIGH | low | unlike registrar (which uses -k), catalog-sync does not skip TLS verify |
| C16 | Model-A counts (--all): counts 6 collections via aggregate, PATCHes their record_count |
L151–184 update_model_a_counts |
HIGH | low | extends record_count writes to CAT-000/001/003/004/005/009 |
2. Source-aware boundary conclusion (feeds RS3C-05)
dot_toolswriter set = {dot-dot-register} only. Catalog-sync is not a second writer to the registry (C6).meta_catalog.record_countwriter set = {dot-catalog-sync} (and possibly others, out of scope). This is a count cache, disjoint from registry rows.- The RS3B-02 hypothesis "catalog-sync may be a second
dot_toolswriter (potential dual-writer)" is DISPROVEN by source. The companion hypothesis "catalog-sync is read-only" is partially wrong — it does write, but onlymeta_catalog.record_count, neverdot_tools. - Therefore: no dual-writer clobber risk on the DOT registry; the only cross-effect is that catalog-sync's CAT-006 count can lag/disagree with
dot_tools(a reporting drift, not a registry mutation).
3. Status
- Behavior reconstruction:
COMPLETE_SOURCE_DERIVED. - Dual-writer-on-registry:
DISPROVEN_BY_SOURCE(catalog-sync writes onlymeta_catalog.record_count). - No unsafe registry-write behavior found in catalog-sync; its only write is a benign count field.
- Registration gate unchanged:
REGISTRATION_HOLD·CAN_PROCEED = NO.