Skip to content

chore: remove dead _checkPermission param + CI coverage gate (#107) - #160

Merged
cheerc merged 1 commit into
mainfrom
chore/107-cleanup
Jun 24, 2026
Merged

chore: remove dead _checkPermission param + CI coverage gate (#107)#160
cheerc merged 1 commit into
mainfrom
chore/107-cleanup

Conversation

@cheerc

@cheerc cheerc commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

Final cleanup PR for #107 coverage sprint — dead code removal + CI hardening.

Changes

1. _checkPermission(createdBy)_checkPermission()

The createdBy parameter became dead code after #152 (all logged-in users can edit). This PR:

  • Removes the parameter from the function signature
  • Removes the argument from all 4 callers (saveData, updateScheduleMetadata, deleteSchedule, copySchedule)
  • Removes the now-unused const createdBy = rowValues[3] declarations
  • Removes unused rowValues destructuring in 2 functions
  • Updates backendSignatureContracts.test.js expected param count: 1 → 0

2. EXTRACTED_TO_LIB cleanup

No action needed — grep found zero EXTRACTED_TO_LIB or NOT_EXTRACTABLE comments in JavaScript.html.

3. CI coverage gate

Changed CI t8 Vitest step from npm test to npx vitest run --coverage so coverage thresholds (defined in vitest.config.js) are enforced on every PR.

4. PHP P2 verification

Existing 60 PHP tests already cover both targets:

  • index.php routingIndexRoutesTest.php (10 tests, subprocess-isolated route error paths)
  • generate_iframe.php accessAccessControlTest.php (5 tests, token-based access control)

Files Changed (3)

File Change
程式碼.js Remove dead createdBy param + unused variables (-8 lines)
tests/unit/backendSignatureContracts.test.js Param count 1 → 0
.github/workflows/ci.yml npm testnpx vitest run --coverage

Verification

  • npx eslint 程式碼.js — 0 errors ✅
  • npm test — 1164/1164 pass ✅
  • npx vitest run --coverage — all thresholds pass ✅

refs #107
follows spec

…#107)

Sub-tasks completed:

1. _checkPermission(createdBy) → _checkPermission()
   - Remove unused createdBy parameter (dead since #152 — all logged-in
     users can edit)
   - Remove createdBy argument from all 4 callers (saveData,
     updateScheduleMetadata, deleteSchedule, copySchedule)
   - Remove now-unused 'const createdBy = rowValues[3]' declarations
   - Remove unused rowValues destructuring in updateScheduleMetadata
     and deleteSchedule
   - Update backendSignatureContracts.test.js param count 1 → 0

2. EXTRACTED_TO_LIB cleanup — no action needed (grep found zero matches)

3. CI coverage gate — change t8 Vitest step from 'npm test' to
   'npx vitest run --coverage' so coverage thresholds are enforced

4. PHP P2 — existing 60 PHP tests already cover:
   - index.php routing (IndexRoutesTest.php, 10 tests)
   - generate_iframe.php access (AccessControlTest.php, 5 tests)

ESLint 0 errors, all 1164 tests pass, coverage thresholds pass.

refs #107

Agend-Agent: cb-team-impl2
Agend-Branch: chore/107-cleanup
Agend-Issued-At: 2026-06-24T12:47:06.972137+00:00
@cheerc

cheerc commented Jun 24, 2026

Copy link
Copy Markdown
Owner Author

✅ VERIFIED

Reviewed HEAD: 86b5008
Reviewer: cb-team-reviewer
Audit mode: standard (D2, lenses: correctness + security)

Files Reviewed (3)

  • 程式碼.js_checkPermission dead param removal + unused variable cleanup
  • tests/unit/backendSignatureContracts.test.js — param count 1→0
  • .github/workflows/ci.ymlnpm testnpx vitest run --coverage

Stage 1 — Correctness

  • _checkPermission(createdBy)_checkPermission() at all 4 callers (L209/368/417/458) ✓
  • const createdBy = rowValues[3] removed at saveData/updateScheduleMetadata/deleteSchedule/copySchedule ✓
  • values: rowValues destructuring simplified where only used for createdBy ✓
  • copySchedule still uses sourceRowValues[4] (isDraft) — correct, only createdBy removed ✓
  • Remaining createdBy references are response payload (getData L137/153, addSchedule L337, copySchedule L479) — NOT permission checks ✓
  • Signature contract: ['_checkPermission', 1]['_checkPermission', 0]
  • CI: npx vitest run --coverage enforces vitest.config.js thresholds in CI ✓

Stage 2 — Security

Evidence

  • ran: grep _checkPermission|createdBy 程式碼.js → 4 callers (no args), 4 response-only createdBy refs
  • cited: 程式碼.js:43 — function _checkPermission() (param removed)
  • cited: 程式碼.js:45-46 — login guard preserved
  • cited: ci.yml:27-28 — npx vitest run --coverage
  • cited: backendSignatureContracts.test.js:61 — ['_checkPermission', 0]

@cheerc
cheerc merged commit 96c20d5 into main Jun 24, 2026
1 check passed
@cheerc
cheerc deleted the chore/107-cleanup branch June 24, 2026 12:56
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