Skip to content

SCRIP-METRIC-003: private local analysis with JSON and offline HTML - #270

Closed
andy-zen-dev wants to merge 1 commit into
masterfrom
scrip-metric-003-local-analysis
Closed

andy-zen-dev wants to merge 1 commit into
masterfrom
scrip-metric-003-local-analysis

Conversation

@andy-zen-dev

Copy link
Copy Markdown
Collaborator

Closes #269.

Product outcome

python -m scriptorium.analyze manuscript.txt --output analysis.json

python -m scriptorium.analyze manuscript.txt --format html --output report.html

Uses the existing deterministic engine directly: all 29 rows, units, profiles, dictionary identity and raw/normalized hashes. Optional UTF-8 dictionary/profile pairing; explicit short-input and unavailable-value limitations; no manuscript/dictionary contents or external services. Accessible offline HTML includes all metric families and profile details. Output publication is atomic and create-only, including existing files, aliases and dangling symlinks. No metric formulas or scientific gates change.

Verification at 752f3c4

  • 22 focused tests PASS against byte-identical current core files (metrics/text/dialogue/vocabulary), not behavior-equivalent substitutes.
  • Actual module CLI: JSON and HTML each rebuilt twice with byte-identical output.
  • Engine-value equality, Unicode/raw identity, dictionary privacy, empty input, threshold boundaries, failed writes and output collision tests PASS.
  • Full repository CI: pending hosted exact-head execution.
  • Browser visual verification: NOT_RUN at PR creation; structural keyboard/table checks PASS.

Scope / integration

Independent of #268; only an additive README section overlaps that PR and it is at a different location. Adopts and hardens the pending local-analysis handoff rather than maintaining a parallel implementation. No Pages activation or package-registry publication. Later fresh acceptance is required before merge; this turn authors the change.

Refs #269. Reuse the deterministic engine, preserve all metric identities,
add 22 positive/negative tests and atomic create-only output. Document
working commands without corpus, source-text or parity promotion.

Copy link
Copy Markdown
Collaborator Author

Exact-head verification completed for 752f3c491af2f1c563a0c5ae31e9452f93a1c0a3:

  • All five returned applicable PR-triggered workflow runs completed success.
  • Pages run 37618413182, job 112782285170: full standard-library test suite, canonical site build, deterministic double build and artifact upload all passed. Deploy correctly skipped on this PR.
  • The 22 focused local tests use byte-identical canonical metrics/text/dialogue/vocabulary modules and exercise the real engine, not substitutes. Actual CLI JSON and HTML rebuilds were byte-identical. Committed scriptorium/analyze.py blob b99886b5ca46e175efc4c70b39b7b81408b12cd3 matches the tested implementation.
  • Full-suite execution is now verified in hosted CI; the earlier PR-body pending status was at creation. Visual verification of this standalone local-analysis HTML remains NOT_RUN; structural keyboard/table/privacy tests passed.

No merge in this authoring run. This PR is independent of #268/#272 and is eligible for its own later fresh exact-head acceptance without waiting for that stack.

@andy-zen-dev andy-zen-dev left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Owner-requested review, exact head 752f3c4.

Two reproduced findings in scriptorium/analyze.py (blob b99886b5ca46e175efc4c70b39b7b81408b12cd3):

  • P1: main() calls Path.read_bytes()/read_text() before checking file type or size. A local FIFO with no writer blocks indefinitely; reproduced in a child process terminated after a 2-second deadline. Reject special files before blocking reads, bound manuscript/dictionary input, and test the actual CLI.
  • P2: parser.error(str(exc)) discloses absolute input/output paths. Reproduced on an existing report; the old report was preserved, but stderr exposed its full path. Return actionable path-free errors.

The analyzer/output separation, unchanged metric engine, null handling and create-only writer are sound in the inspected scope. This is COMMENT-only solo-maintainer review, not GitHub self-approval or merge acceptance. The owner now requests one new integration PR against master; carry the existing implementation and these fixes into that delivery path, retaining #269 and this PR as provenance until the integration is accepted. No scientific gate or formula change is requested.

Copy link
Copy Markdown
Collaborator Author

Superseded delivery path: #276, per the owner's 2026-10-18 request for one new PR covering remaining ready issues. The analyzer was adopted through #274 and retained in #276 with the FIFO/non-regular input and private-error fixes plus their regressions; no parallel reimplementation. #276 at d81aa3a46c0125561a1ba610d51a6cf9f06df0c4 now has 23/23 successful PR workflows and a 759-test canonical suite, installed-wheel smoke and deterministic site/gallery builds.

This older head 752f3c491af2f1c563a0c5ae31e9452f93a1c0a3 is unchanged and still has the recorded review findings; do not merge it independently. Converting to draft to make #276 the single active review path. Preserve this PR/history until later successor acceptance confirms issue #269 is delivered; no branch deletion or premature completion.

Copy link
Copy Markdown
Collaborator Author

Superseded by merged #276 (merge commit 03d122aaf676385ee91e86e5b4cbdf3d212ab752). Its six historical changed paths are included in merged #276; #270's FIFO/nonblocking-read and path-disclosure findings were fixed there and exact-head CI passed. Original PR commit remains divergent and must not be independently merged.

Closing this stale Draft PR without deleting its branch, force-pushing or claiming that its own old checks now pass. The canonical follow-up belongs to the current master / new feature issues.

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.

SCRIP-METRIC-003: ship local UTF-8 analysis as private JSON and offline HTML

1 participant