📝 checkpoint_ISE_data_integrity_2026-12-02.mdv4.7.5 · 2026-12-05

Checkpoint — ISE_Data integrity after the double index run

Date: 2026-12-02 System: Live Package: ISE_data_integrity v1.0.0 Authors: Andrew.human & Claude.ai


1. Problem & Resolution

Problem: Two identical indexing jobs (posts, PDF, misc) were started at the same time on Live. Both may have written to the same stores in /var/www/html/ISE_Data. There were two risks:

What we established

OK   audio_checkpoint.json
OK audio_store.json
OK caption_failures.json
OK captions_store.json
OK chain_snapshot.json
OK embeddings_store.json
OK media_store.json
OK misc_store.json
OK orphan_state.json
OK pdf_dupe_deleted.json
OK pdf_duplicates.json
OK pdf_store.json
OK post_store.json
OK processor_checkpoint.json
OK transcripts_store.json
OK word_index.json
OK word_index_media.json
OK word_index_misc.json
OK word_index_pdf.json

Resolution: Andrew asked for the valid-JSON check and the store-shape probe to be made into permanent scripts and run hourly by cron on Live. They were delivered as ISE_data_integrity_v1.0.0.zip:

File Role
/bin/ISE_data_integrity.sh Cron entry point. Prints its version, date and time, then runs the two scripts below.
/bin/json_integrity1.sh Valid-JSON check on every *.json at the ISE_Data root. Prints OK or BAD per file.
/bin/json_integrity2.sh Shape, entry count and first keys of post/pdf/misc stores, plus the first 400 characters of processor_checkpoint.json.
ISE_data_integrity_manual.md Manual, with behaviour rules and pseudocode.

Crontab entry (root):

37 * * * * /bin/ISE_data_integrity.sh >> /var/log/ISE_data_integrity.log 2>&1

Install status: delivered, not yet confirmed installed on Live. Install timing is Andrew's call.


2. Risk Analysis

Risk Likelihood Effect Mitigation
Check runs while an indexer is writing a store, giving a false BAD Low–medium. MediaIndexer runs hourly. False alarm only. Nothing is changed. Schedule at :37, clear of the hour. Move the minute if MediaIndexer writes near it. Re-check any BAD by hand before acting.
python3 not found under cron (cron searches only /usr/bin:/bin) Was high with the original one-liner. Now low. The original one-liner hid the error and reported all 19 stores BAD. Scripts add /usr/local/bin to the search path. If python3 still isn't found, they print ERROR: python3 not found and exit 1. Tested: the fix works. The error message itself was not triggered, because hiding the test machine's python3 was refused there.
Live's python3 symlink moves from 3.8 to 3.15 Planned None expected The scripts use only the standard json module, which works the same on 3.8 and 3.15. No change needed.
Memory or CPU spike from loading every store hourly, including embeddings_store.json Unknown Brief load spike on the VPS Check ls -lh /var/www/html/ISE_Data/*.json. If the spike matters, cut the frequency to daily or skip the largest store.
Log growth Certain, small About 25–35 lines per hour Trivial for years. Add logrotate later if wanted.
Log times are in Live's clock zone, which reads about 3 hours behind Sydney Certain Confusion when matching log times to Sydney time Each run line carries the time zone name.
Scripts change data None — All three scripts are read-only by design (behaviour rule 1).

3. Code Change

New package. No existing code was modified. It is built from Andrew's original one-liner:

for f in *.json; do python3 -c 'import json,sys; json.load(open(sys.argv[1]))' "$f" 2>/dev/null && echo "OK   $f" || echo "BAD  $f"; done

Lines added around it in json_integrity1.sh, plus the same three setup lines in json_integrity2.sh. Andrew was told about these before they were built.

+#!/bin/bash
+# (standard Andrew.human & Claude.ai doc-block, @version 1.0.0, @date 2026-12-02, version history)
+VERSION="1.0.0"
+echo "json_integrity1.sh v$VERSION"
+export PATH="/usr/local/bin:$PATH"
+cd /var/www/html/ISE_Data || { echo "ERROR: cannot cd to /var/www/html/ISE_Data"; exit 1; }
+command -v python3 >/dev/null || { echo "ERROR: python3 not found - no checks run"; exit 1; }
for f in *.json; do python3 -c 'import json,sys; json.load(open(sys.argv[1]))' "$f" 2>/dev/null && echo "OK $f" || echo "BAD $f"; done

ISE_data_integrity.sh prints ISE_data_integrity.sh v1.0.0 <date time zone>, then calls /bin/json_integrity1.sh and /bin/json_integrity2.sh.

Tests run (automated, sandbox):


4. Open items for the next session

  1. Checkpoint race not yet ruled out. Read processor_checkpoint.json from the first json_integrity2.sh output. If it belongs to the post/PDF/misc indexer, check that its marker matches the newest item in the stores.

  2. Count, duplicate and checkpoint checks against the database. Claude is to write these from the json_integrity2.sh output:

    • each store's entry count against SMF's posts and attachments, less #do-not-index posts
    • no ID appearing twice in a store
    • checkpoint against the newest item

    All read-only. They could become json_integrity3.sh.

  3. Confirm the cron minute doesn't overlap MediaIndexer or any other ISE_Data writer (crontab -l).

  4. Check store sizes (ls -lh) before relying on an hourly load of every store.

  5. Stop a repeat (offered, not taken up): flock -n /var/lock/ise_index.lock <job> turns a second launch of the same indexing job into a no-op.