Skip to content

Clean up readability warnings in the analysis, collection and comparison modules - #45

Merged
OstenHun merged 8 commits into
mainfrom
task/eslint-cleanup-src-2
Nov 23, 2026
Merged

OstenHun merged 8 commits into
mainfrom
task/eslint-cleanup-src-2

Conversation

@OstenHun

Copy link
Copy Markdown
Owner

What changed and why

The second readability cleanup after ESLint was added (#43, #44). It covers src/core/analysis.ts, collection.ts and comparison.ts. These files had 29 readability warnings and now have none, and this PR adds them to the list in eslint.config.js where the five readability rules are errors. It changes no behavior.

The commits are meant to be read separately. git diff --color-moved helps tell moved code from new code.

  • f5b7f7a Renames only. One-letter callback parameters and the parsed option values get descriptive names.
  • Function splits, one file per commit (67c858d, fe33700, c67b17e).
    • collection.ts: collect delegates the conflicting-classification check, linking an already verified copy, writing the managed copy and building the file record. runCollection delegates argument and URL checks, finding the selected row, and the unavailable, decide and collect inputs. report names its next-step message instead of nesting ternaries.
    • comparison.ts: relationState delegates the source-relation check, the origin label, missing and unregistered claim references, the current dependencies and the staleness test.
    • analysis.ts: runAnalysis delegates argument parsing, opening an analysis document and saving an answer. comparisonInput delegates splitting one paper's candidate claims into included and held items.
  • bd3cfc9 keeps runCollection's declared return type (Promise<undefined>), which moving the URL check had changed to Promise<void>.
  • 8814c04 promotes the rules for these three files.
  • 61eb59f, 1724242 Review fixes. relationState computes staleness before building its result, as before, and three helper names are clearer.

The first cleanup (#44) showed that splitting async code can add await points. Here, only synchronous parts were moved out, or whole blocks that the original already awaited at that point. Values the original read before an await are still read before it. The managed copy that collect creates is still removed when a later check fails.

No warning needed a behavior change to fix. Remaining warnings in the repository: 328 (357 on main).

Verification

  • npm run lint: 0 errors; 0 warnings in the three files. A scratch one-letter name in comparison.ts fails lint.
  • npm run check:format, npm test (94 product and 143 skill tests), npm run check:docs, npm run test:package, node dist/cli.js validate --workspace examples/minimal --json and git diff --check passed on Windows 11 with Node 24.22.3.
  • Flow differential. Both builds (efca5d3 and this branch) were loaded in one process, and the same 600 seeded command sequences (16,511 steps) ran against a fresh synthetic topic and card workspace at the same path. They covered topic selection, PDF collection with existing and downloaded files, URLs, published and draft editions and wrong PDFs, unavailable, draft consent, sources, card and review changes, analysis-open and analysis-save with valid and invalid answers, analysis-list, comparison-input, comparison.json, relation files with pinned dependencies, and compare --json. Targeted sequences also covered reclassifying a published file as a draft, reusing a verified copy in a second selection round, publishing a renamed copy when the managed name is taken, and a withdrawn claim in a relation. Each step's return value, printed JSON (with generated_at and random file names masked), thrown error (class, code, message, exit code) and the final file tree were identical.
  • Types. A type-level equality check of everything the three modules export, before and after, passes. It first caught one member missing from comparisonInput's held union and the runCollection return type; both are fixed. Comparing two different modules makes the check fail.
  • The CLI differential from Clean up readability warnings in the CLI and core modules #44 (845 commands) and its module differential (about 78,500 inputs) also showed no differences against efca5d3 on 8814c04, before the two small review fixes.
  • Known residual, same kind as Clean up readability warnings in the CLI and core modules #44. Where the code now awaits openAnalysis, saveAnswer or writeManagedCopy, the helper settles a few microtasks later. A microtask injected by instrumentation can therefore run before the lock release after a validation failure, or before the next file check. Outputs, errors and write order are unchanged.
  • Claude Code prepared this change. Codex (read-only) and Claude Fable (read-only) reviewed it once each; the findings above are applied or listed. This is not a human review.
  • Not checked locally: Ubuntu, macOS and Node 22. The comparison server (compare --port) is outside these files and was not exercised.

Checklist

  • I kept private materials, local paths, and secrets out of this pull request.
  • I checked the attribution and licenses of any third-party code or materials included here.

🤖 Generated with Claude Code

OstenHun and others added 8 commits November 23, 2026 20:52
Rename only: callback parameters and the parsed option values in
analysis.ts and collection.ts get descriptive names. No behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
collect delegates the conflicting-classification check, linking an
already verified copy, writing the managed copy and building the file
record. runCollection delegates argument and URL checks, finding the
selected row, the unavailable and decide inputs and the edition
evidence. report names its next-step message instead of nesting
ternaries. Every await stays where it was or ends a helper that the
original code also awaited at that point. No behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
relationState delegates the source-relation check, the origin label,
missing and unregistered claim references, the current dependencies and
the staleness test. Values it read before awaiting the source states are
still read before that await. No behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runAnalysis delegates argument parsing, opening an analysis document
(the Paper connection check and the new edition section) and saving an
answer (answer JSON checks). comparisonInput delegates sorting one
paper's candidate claims into included and held items. The held item
type is written out so the exported declaration stays the same. Every
await stays where it was or ends a helper that the original also
awaited at that point. No behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moving the URL check out of runCollection changed its inferred return
type from Promise<undefined> to Promise<void>. Declare the original type.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The split computed needs_recheck while spreading the relation into the
result object, after the copy. The original computed it first. Keep
that order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
partitionCandidateClaims splits candidates without reordering them, the
document returned by opening or saving is named document, and nextStep
takes a boolean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T16:53:51.007725Z 1724242 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Nov 23, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@OstenHun
OstenHun merged commit ce1bf5e into main Nov 23, 2026
2 checks passed
@OstenHun
OstenHun deleted the task/eslint-cleanup-src-2 branch November 25, 2026 09:15
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