Skip to content

chore: release/repo hygiene, doc truth-up + drift gate, gate governance - #283

Merged
qnbs merged 6 commits into
mainfrom
chore/release-doc-gates
Jul 29, 2026
Merged

chore: release/repo hygiene, doc truth-up + drift gate, gate governance#283
qnbs merged 6 commits into
mainfrom
chore/release-doc-gates

Conversation

@qnbs

@qnbs qnbs commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

Recreated PR (was #280, auto-closed by GitHub — see note below). Third stacked PR in the deployment-surface/OpenRouter/doc-gates audit sequence, now targeting main directly since its previous base branch (fix/openrouter-live-catalog) was deleted when PR #279 merged.

  • chore(repo) — fixes README badges (removes duplicate codecov badge, removes the CII Best Practices placeholder badge + adds a TODO.md registration entry since that requires an external interactive signup), adds .github/CODE_OF_CONDUCT.md (Contributor Covenant 2.1), links it from both .github/CONTRIBUTING.md and the root CONTRIBUTING.md.
  • chore(docs) — truths up locale/release-status claims across ROADMAP.md/TODO.md/docs/TRANSLATION-GUIDE.md/CONTRIBUTING.md/.github/copilot-instructions.md (stale "17 locales" → 19), adds scripts/check-doc-metrics.mjs (+ .d.mts, + checkDocMetrics.test.ts) as a new CI drift gate wired into .github/workflows/ci.yml and package.json's docs:check script.
  • chore(gates) — documents scripts/check-coverage-ratchet.mjs (non-blocking, suggests threshold increases), a Suppression Reduction Plan in docs/CODE_QUALITY.md (groups the 33 noExplicitAny suppressions by cluster), and corrects docs/CI.md's description of Stryker mutation testing's actual (manual-trigger-only) status in the pipeline.

Why recreated

The original PR #280 was based on fix/openrouter-live-catalog. That branch went through several force-pushed rebases during PR #279's CodeRabbit correction loop, and when PR #279 merged (deleting its branch), GitHub couldn't cleanly auto-retarget PR #280 to main and closed it instead (gh pr reopen confirmed: "Could not open the pull request — base branch no longer exists"). The underlying chore/release-doc-gates branch and all its commits were unaffected; rebased it directly onto the current main and opened this replacement.

Test plan

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Added a full Code of Conduct and updated contribution/security reporting guidance.
    • Updated localization documentation and plans to reflect 19 supported locales, 21 translation modules, and ~2,849 translation keys; refreshed related README/roadmap/CI guidance and metrics.
  • CI & Quality Improvements

    • Added automated documentation-metrics drift checks and a non-blocking coverage “ratchet” report to help track improvement.
    • Adjusted mutation testing to run only via manual trigger (with updated CI documentation).
    • Improved metrics counting to prevent duplicate translation key tallies.

qnbs added 4 commits July 29, 2026 01:13
…h CONTRIBUTING files

- README.md: removed the duplicate codecov badge (kept the more informative
  `&label=Coverage` one) and the CII Best Practices badge, which had a literal
  `projects/XXXX` placeholder (broken image, dead link) — the project was
  never registered. Added a TODO.md entry with the registration URL; that's
  an external, interactive signup, so it stays a maintainer action, not
  something this pass does automatically.
- Added .github/CODE_OF_CONDUCT.md (Contributor Covenant 2.1), with an
  enforcement-contact section that mirrors SECURITY.md's pattern (GitHub
  Private Vulnerability Reporting, no hardcoded personal email).
- .github/CONTRIBUTING.md already referenced a Code of Conduct but linked
  externally to contributor-covenant.org instead of the new in-repo file —
  repointed it.
- The root CONTRIBUTING.md — the one README.md actually links to — had no
  Code of Conduct section at all. Added one, linking to the new file.

Investigated (no code changes, per the workstream's stop-and-ask boundaries):
- The v1.5.0 GitHub release sits chronologically between v1.20.0 and v1.21.0
  despite its lower semver, AND its 6 assets are all named
  "StoryCraft.Studio_1.20.0_..." — the project's pre-rebrand name (rebrand to
  WorldScript Studio shipped in v1.23.0) with a version that doesn't match the
  release tag at all. Flagged for the final report; deleting/retitling a
  public release is a maintainer decision.
- Issue #60 (vendor-fork audit, "permanent reminder — do not close") already
  has a 2026-07-28 maintainer comment documenting the audit as done, and
  `pnpm run verify:vendor` passes all 12 invariants. No action needed — it's
  correctly staying open per its own instruction.
… drift gate

ROADMAP.md still marked v1.24 as "(PLANNED)" though v1.24.0 (2026-06-21) and
v1.24.1 (2026-07-28) had both already shipped, and gave the locale count as
17 — stale since the 11->17 expansion (v1.24.0) plus ru/ko (landed the next
day, before v1.24.1). Same "17 locales" drift was independently present in
docs/TRANSLATION-GUIDE.md (also missing 1 of 21 modules — desktop.json — from
its module list and count), the root CONTRIBUTING.md (the one README.md
actually links to), .github/copilot-instructions.md (2 occurrences), and
docs/i18n/AUDIT_AND_IMPROVEMENT_PLAN.md's "current state" section. Fixed all
of them; left every CHANGELOG.md and dated AUDIT.md/TODO.md historical entry
untouched — they correctly describe what was true at a past release.

Added scripts/check-doc-metrics.mjs (wired into ci.yml's quality job as
`pnpm run docs:check`) so this class of drift fails CI instead of silently
accumulating again. It computes the actual locale count, key count (dedup'd
the same way check-i18n-keys.mjs does), and latest released version tag, then
scans README/ROADMAP/TODO/TRANSLATION-GUIDE/CONTRIBUTING for stale numbers or
a "vX.Y.Z ... PLANNED" claim for an already-released version.

Historical sections are exempt (Keep-a-Changelog `## [x.y.z]`, `## vX.Y.Z ...
RELEASED ...`, a heading suffixed with an emoji checkmark, a `**Status:** ✅
Released/Completed` line just below a heading, or this repo's own TODO.md "✅
= done" bullet convention) — the first version only recognized the
Keep-a-Changelog/RELEASED-heading shapes and produced 26 false positives
against TODO.md/ROADMAP.md's other historical conventions; broadened it
before wiring the gate in. tests/unit/checkDocMetrics.test.ts covers the
exclusion heuristic directly (the plan's explicit requirement — an untested
exclusion rule turns a drift gate into noise).
…n, mutation-testing status

- Re-pinned token-audit-baseline.json to the actual measured total (160,
  down from a stale 165 dated 2026-06-14) after WS-1..6 landed. Ratchets
  down only, per the project's hard rule against loosening a quality gate.
- Added scripts/check-coverage-ratchet.mjs: reads coverage/coverage-summary.json
  (added the `json-summary` reporter to vitest.config.ts — it wasn't being
  generated at all) and suggests raising a threshold when the measured value
  sits 2+ points above it, matching the "3 green runs, max 5 pts/quarter"
  rule already documented as a comment in vitest.config.ts but never
  mechanized. Wired into ci.yml as `continue-on-error: true` — informational
  only, never blocks the build; the ratchet decision stays with the
  maintainer.
- docs/CODE_QUALITY.md: added a Suppression Reduction Plan grouping all 33
  noExplicitAny suppressions (of 52 total, at an exact-match baseline with
  no headroom) into clusters by root cause and effort — no code changes,
  visibility only.
- docs/CI.md: corrected three places that still described Stryker mutation
  testing as part of the active `ci.yml` job graph (job-graph diagram, the
  `mutation` job's table row, and the CI-tier table) — it was removed from
  the merge pipeline on 2026-06-02 and now runs only via manual
  `workflow_dispatch` on mutation.yml. Documented why, how to trigger it,
  and the re-integration criterion.
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
worldscript-studio Ready Ready Preview, Comment Jul 29, 2026 12:14am

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ce666566-ade9-4527-8556-2db508628b04

📥 Commits

Reviewing files that changed from the base of the PR and between 6b50675 and f89922f.

📒 Files selected for processing (8)
  • .github/CONTRIBUTING.md
  • .github/workflows/ci.yml
  • README.md
  • docs/CI.md
  • docs/CODE_QUALITY.md
  • scripts/check-coverage-ratchet.mjs
  • scripts/check-doc-metrics.mjs
  • tests/unit/checkDocMetrics.test.ts
🚧 Files skipped from review as they are similar to previous changes (8)
  • .github/CONTRIBUTING.md
  • .github/workflows/ci.yml
  • README.md
  • docs/CODE_QUALITY.md
  • tests/unit/checkDocMetrics.test.ts
  • scripts/check-coverage-ratchet.mjs
  • docs/CI.md
  • scripts/check-doc-metrics.mjs

📝 Walkthrough

Walkthrough

The PR adds documentation metric validation, a non-blocking coverage ratchet check, updated i18n and project metrics, refreshed release and CI documentation, and repository governance guidance.

Changes

Documentation and quality maintenance

Layer / File(s) Summary
Documentation metrics audit
scripts/check-doc-metrics.*, tests/unit/checkDocMetrics.test.ts
Adds repository metric calculation, historical-section handling, release-version checks, drift reporting, declarations, and unit coverage.
Metric synchronization and documentation counts
scripts/sync-readme-metrics.mjs, README.md, .github/copilot-instructions.md, CONTRIBUTING.md, docs/TRANSLATION-GUIDE.md, docs/i18n/...
Deduplicates i18n key counting and updates locale, module, key, and test-count references.
CI documentation and coverage quality checks
package.json, .github/workflows/ci.yml, scripts/check-coverage-ratchet.mjs, vitest.config.ts
Adds documentation and informational coverage checks to CI and emits JSON coverage summaries.
Community governance documentation
.github/CODE_OF_CONDUCT.md, .github/CONTRIBUTING.md, CONTRIBUTING.md
Adds Contributor Covenant guidance, reporting instructions, and local code-of-conduct links.
Release and maintenance documentation
ROADMAP.md, docs/CI.md, docs/CODE_QUALITY.md, TODO.md, token-audit-baseline.json
Updates release notes, mutation-testing status, suppression baseline documentation, badge follow-up, and token-audit metadata.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CIQualityGate
  participant DocumentationChecker
  participant RepositoryState
  participant CoverageRatchet
  CIQualityGate->>DocumentationChecker: run docs:check
  DocumentationChecker->>RepositoryState: read locale data, release tags, and documentation
  RepositoryState-->>DocumentationChecker: return current metrics and document content
  DocumentationChecker-->>CIQualityGate: report drift or success
  CIQualityGate->>CoverageRatchet: run informational ratchet check
  CoverageRatchet->>RepositoryState: read coverage summary
  RepositoryState-->>CoverageRatchet: return coverage metrics
  CoverageRatchet-->>CIQualityGate: report ratchet suggestions
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main themes: repo hygiene, documentation updates, and new drift/governance checks.
Docstring Coverage ✅ Passed Docstring coverage is 81.82% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/release-doc-gates

Comment @coderabbitai help to get the list of available commands.

…module files

The new docs:check drift gate (this same branch) immediately caught a real
bug on its first CI run: README claimed 2859 i18n keys while the actual
deduplicated count is 2849. Root cause is in sync-readme-metrics.mjs itself,
not just the (already-fixed-elsewhere) duplicate source keys — getKeyCount()
summed leaf counts per module file independently, so any key defined in two
files (as 10 keys were, until the PR #281 dedup fix) got counted twice. This
is a latent bug: it will silently drift again the moment any future PR
reintroduces a cross-module duplicate, regardless of today's specific fix.

Changed getKeyCount() to collect keys into a Set across all module files,
matching check-i18n-keys.mjs's loadBundleKeys() dedup logic exactly — the two
scripts can no longer disagree about the canonical key count.
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codeant-ai

codeant-ai Bot commented Jul 28, 2026

Copy link
Copy Markdown

🏁 CodeAnt Quality Gate Results

Commit: f89922f1
Scan Time: 2026-07-29 00:39:03 UTC

✅ Overall Status: PASSED

Quality Gate Details

Quality Gate Status Details
Secrets ✅ PASSED 0 secrets found
Duplicate Code ✅ PASSED 0.0% duplicated
SAST ✅ PASSED No security issues
Bugs ✅ PASSED Rating S: No bugs
IAC ✅ PASSED Rating S: No issues

View Full Results

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🧹 Nitpick comments (1)
scripts/sync-readme-metrics.mjs (1)

59-72: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add a regression test for cross-module key deduplication.

This is the behavior change that fixes the README drift. Add fixtures with the same key in two English modules and assert it is counted once, so future edits cannot silently restore per-file double counting.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/sync-readme-metrics.mjs` around lines 59 - 72, Add a regression test
for getKeyCount using English locale fixtures containing the same key in two
module JSON files, and assert the result counts that key only once. Keep the
test focused on cross-module deduplication and preserve counting of distinct
keys.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/CODE_OF_CONDUCT.md:
- Around line 59-64: Update the `SECURITY.md` reference in the reporting
paragraph of `.github/CODE_OF_CONDUCT.md` to use the repository-root relative
path `../SECURITY.md`, matching the existing repository convention and
preserving the link text.

In @.github/workflows/ci.yml:
- Around line 121-122: Update the CI checkout configuration used before the “Doc
metrics drift gate” step so repository tags are fetched, using fetch-tags: true
or fetch-depth: 0. Ensure pnpm run docs:check executes with tag history
available for the stale-PLANNED validation.

In `@docs/CI.md`:
- Around line 84-89: Update the quality row in the CI documentation to list pnpm
run typecheck instead of the direct tsc command, matching the package script and
the command used elsewhere in the document; leave the other quality checks
unchanged.

In `@docs/CODE_QUALITY.md`:
- Around line 58-66: Reconcile the cluster counts in the baseline table so they
clearly account for exactly 52 suppressions. Update the approximate values or
add a concise overlap/rounding explanation, ensuring the displayed cluster
totals and the “52/52 — no headroom” headline are consistent without changing
the documented remediation guidance.

In `@README.md`:
- Around line 460-461: Update the stale locale/module inventory references in
README.md to consistently document 19 locales and 21 modules, matching
docs/TRANSLATION-GUIDE.md and .github/copilot-instructions.md while preserving
the existing inventory format.

In `@scripts/check-coverage-ratchet.mjs`:
- Around line 35-42: Update the coverage-summary loading logic in the
check-coverage-ratchet flow to catch read or JSON.parse failures for malformed
artifacts, then print the existing non-blocking skip message and return.
Preserve the current behavior for valid summaries without a total field and
ensure these failures remain non-failing under the script’s “Always exits 0”
contract.

In `@scripts/check-doc-metrics.mjs`:
- Around line 45-176: Add adjacent one-line comments in
scripts/check-doc-metrics.mjs for the filesystem metric reads in
getActualLocaleCount and getActualKeyCount, tag lookup in
getLatestReleasedVersion, drift scanning in scanForDrift, and CLI orchestration
in main, each using the format “// QNBS-v3: [Grund / Impact / Kreativer
Mehrwert]”. Also add a direct QNBS-v3 rationale beside the non-blocking ratchet
orchestration in scripts/check-coverage-ratchet.mjs; do not alter the logic.
- Around line 19-25: Update the TARGET_FILES list in check-doc-metrics.mjs to
include .github/copilot-instructions.md so docs:check scans the documented drift
source alongside the existing target files.

In `@tests/unit/checkDocMetrics.test.ts`:
- Around line 2-7: Replace the multiline rationale above the tests with one
adjacent single-line QNBS-v3 comment using the required Reason / Impact /
Creative value format, preserving the intent of documenting protection against
historical-section regressions in the drift gate.

---

Nitpick comments:
In `@scripts/sync-readme-metrics.mjs`:
- Around line 59-72: Add a regression test for getKeyCount using English locale
fixtures containing the same key in two module JSON files, and assert the result
counts that key only once. Keep the test focused on cross-module deduplication
and preserve counting of distinct keys.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1d428c73-78e2-4094-b786-0ee05fc8afec

📥 Commits

Reviewing files that changed from the base of the PR and between a0518c5 and 6b50675.

📒 Files selected for processing (20)
  • .github/CODE_OF_CONDUCT.md
  • .github/CONTRIBUTING.md
  • .github/copilot-instructions.md
  • .github/workflows/ci.yml
  • CONTRIBUTING.md
  • README.md
  • ROADMAP.md
  • TODO.md
  • docs/CI.md
  • docs/CODE_QUALITY.md
  • docs/TRANSLATION-GUIDE.md
  • docs/i18n/AUDIT_AND_IMPROVEMENT_PLAN.md
  • package.json
  • scripts/check-coverage-ratchet.mjs
  • scripts/check-doc-metrics.d.mts
  • scripts/check-doc-metrics.mjs
  • scripts/sync-readme-metrics.mjs
  • tests/unit/checkDocMetrics.test.ts
  • token-audit-baseline.json
  • vitest.config.ts

Comment thread .github/CODE_OF_CONDUCT.md
Comment thread .github/workflows/ci.yml
Comment thread docs/CI.md
Comment thread docs/CODE_QUALITY.md
Comment thread README.md
Comment thread scripts/check-coverage-ratchet.mjs Outdated
Comment thread scripts/check-doc-metrics.mjs
Comment thread scripts/check-doc-metrics.mjs
Comment thread tests/unit/checkDocMetrics.test.ts
Real bugs found and fixed:
- .github/CONTRIBUTING.md linked SECURITY.md as ../SECURITY.md, but that file
  lives at .github/SECURITY.md — a sibling of CONTRIBUTING.md, not one level
  up. The link resolved to a nonexistent repo-root file. CodeRabbit anchored
  this finding on .github/CODE_OF_CONDUCT.md, whose own (correct) sibling
  link I verified matches; the actual broken link was in CONTRIBUTING.md.
- .github/workflows/ci.yml's quality-job checkout never fetched tags, so
  check-doc-metrics.mjs's stale-PLANNED-status check (which reads `git tag`)
  silently no-oped in every CI run. Added fetch-tags: true.
- check-coverage-ratchet.mjs's JSON.parse had no try/catch — a truncated or
  invalid coverage-summary.json would throw uncaught, contradicting the
  script's own documented "always exits 0, never gates CI" contract. Now
  falls through to the same non-blocking skip message as a missing file.
- check-doc-metrics.mjs's TARGET_FILES list didn't include
  .github/copilot-instructions.md or .github/CONTRIBUTING.md, despite the
  script's own header comment naming both as files that had the exact stale-
  locale-count regression this gate exists to catch — a recurrence there
  would have passed docs:check silently.
- docs/CODE_QUALITY.md's suppression cluster table summed to ~53 against the
  stated 52/52 baseline. Recomputed exact per-cluster counts from
  `check-suppressions.mjs --details` (11 + 8 + 5 + 9 + 19 = 52) and corrected
  the useAppSelector/single-occurrence cluster file lists to match.
- README.md's project-tree comment still said "15 modules"; the doc-truth-up
  work elsewhere in this PR already established 19 locales × 21 modules.
- docs/CI.md's pipeline table said `tsc` where the actual quality-job step
  (and package.json) both use `pnpm run typecheck`.

Convention-only:
- Added the missing single-line QNBS-v3 rationale comments to
  check-doc-metrics.mjs (filesystem reads, tag lookup, drift scan, CLI
  orchestration) and check-coverage-ratchet.mjs (non-blocking contract).
- Collapsed checkDocMetrics.test.ts's multiline file-header rationale to one
  line.
@qnbs

qnbs commented Jul 29, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@qnbs

qnbs commented Jul 29, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@qnbs
qnbs merged commit f862727 into main Jul 29, 2026
20 checks passed
@qnbs
qnbs deleted the chore/release-doc-gates branch July 29, 2026 00:38
qnbs added a commit that referenced this pull request Jul 29, 2026
…, F-10 follow-up)

CI's quality job (Node 22 and 24) failed on push: TS2305, module
has no exported member 'getCanonicalProductionUrl'. A hand-maintained
scripts/check-doc-metrics.d.mts (added in #283) shadows the .mjs
source for TypeScript's purposes and wasn't updated with the two new
function signatures (getCanonicalProductionUrl, scanForUrlDrift)
added in the F-10 workstream.

Reproduced locally with rm -f *.tsbuildinfo && pnpm run typecheck --
the earlier "clean" claim in the run log had trusted a background
task's "completed, exit code 0" notification summary without reading
its actual tail output, the same trap already hit once earlier in
this sprint. Fixed by adding the missing declarations; re-verified
clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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