Skip to content

Original wording: review follow-ups (enumerators, upgrade test, pruning) - #96

Merged
assassin808 merged 5 commits into
mainfrom
feat/rehydrate-followups
Nov 10, 2026
Merged

assassin808 merged 5 commits into
mainfrom
feat/rehydrate-followups

Conversation

@assassin808

Copy link
Copy Markdown
Contributor

Should-fixes from the last review of #94. This PR stacks on #95, the Windows cache fix: it targets that branch, so the diff shows only the follow-ups. Retarget it to main once #95 is merged.

  • More enumerator shapes, removed in both the app (telemetry-core.ts stripEnumerators) and the helper (hs_original_text.py strip_enumerators), which use the same patterns:

    • Roman numerals (i., (ii)), Question 1:, Statement 2:, S1., A1)
    • Markdown headings (### Q1), Chinese 第1题:
    • the same enumerators mid-line (Q1: … Q2: …, (a) … (b) …)

    The helper now splits lines on \n, like the app.

  • The documented limit now names per-item structured data. Short items written as JSON objects with id keys, YAML entries or CSV rows are inside the accepted beta limit, alongside reordering, HTML tags and Likert labels.

  • Index upgrade:

    • Cached windows of an older index format are deleted.
    • The index loader is extracted into private-index.ts, so it can be tested without Electron. The app loads the index through it.
  • Tests:

    • the review's probe4 cases (TS)
    • v1 → v2 index upgrade: the old index and cached windows are dropped, the project is indexed again, and the index of a folder that no longer exists is pruned
    • Python unit tests for letters-only, enumerator stripping and shared windows across re-numbered items
  • Fixes the "40 letters or digits" comment, which now says 40 letters.

Tests (macOS, with HUMANSTUDY_TEST_PYTHON set to the app runtime's Python):

  • npm run typecheck: passes
  • node suite: 324 pass, 2 skipped
  • pack/runtime/tests: 579 tests OK
  • scripts/tests: 15 tests OK

🤖 Generated with Claude Code

assassin808 and others added 4 commits November 10, 2026 06:16
The helper wrote the restored protocol.json with write_text, which on Windows turns
\n into \r\n, while it recorded the sha256 of the \n text. The cached copy then never
matched its record: every check restored again, and the app's run would refuse the copy.
Write the exact bytes that are hashed (status.json too), and test that the cached
file's sha256 is its recorded one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h the platform separator

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t names), in the test and the pin lookup

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dex pruning

- Enumerators removed in both the app and the helper (same patterns): Roman numerals
  (i., (ii)), Question 1: / Statement 2: / S1. / A1), Markdown headings (### Q1),
  Chinese 第1题:, and the same enumerators mid-line (Q1: … Q2: …, (a) … (b) …).
  The helper splits lines on \n like the app.
- The doc's accepted limit names per-item structured data (JSON objects with ids,
  YAML, CSV).
- Tests: probe4 cases; the v1 -> v2 index upgrade (old index and cached windows dropped,
  the project indexed again, stale folders pruned) through the extracted loader
  (private-index.ts); Python unit tests for letters-only and enumerator stripping.
- Comment fix (40 letters); cached windows of an older format are pruned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@assassin808
assassin808 changed the base branch from fix/original-text-windows-cache to main November 10, 2026 14:09
- Full-width digits (第1题:, Q1:) are folded by NFKC before enumerators are stripped, in
  the app and the helper; both patterns name [0-9], never \d (ASCII in JS, any digit
  in Python).
- The line pattern is linear: \d+[a-z]?\s*(?:[.)::]\s*|$) instead of a lookahead that
  backtracked quadratically on long runs of spaces (timing tests on 100k-space lines).
- The comment over the private index in telemetry.ts names the current format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@assassin808
assassin808 merged commit e08aa5f into main Nov 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant