Skip to content

test(daemon): cover lock-target matrix, auth-hook rejections, archive root inference, and longpress duration - #3447

Open
thymikee wants to merge 2 commits into
mainfrom
crap/3424-daemon-tests
Open

thymikee wants to merge 2 commits into
mainfrom
crap/3424-daemon-tests

Conversation

@thymikee

@thymikee thymikee commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Covers the four low-coverage CRAP findings from #3424 (G1 of 3) through their owning modules' public entry points; no production changes, no splits.

Function CRAP before → after
request-lock-policy.ts targetSelectorsConflict 33 → 9.4 (33% → 83%)
server/http-authorization.ts sendAuxiliaryAuthHookRejection 30 → 5 (0% → 100%)
artifact-archive.ts inferArchiveRootName 30 → 5 (0% → 100%)
session-script-writer.ts readLongPressDurationFromPositionals 30 → 5 (0% → 100%)

Routes: applyRequestLockPolicy fresh-session target/lock-platform matrix; the shared aux HTTP auth gate rejecting a hook via the diagnostics route; extractTarInstallableArtifact without expectedRootName; SessionScriptWriter.write longpress selector rewrite. Each new test was observed to fail under a targeted mutation of its function, then pass again.

Part of #3424, part of #3414.

Validation

  • Tested commit: 8c6bbd8a0 (rebased onto current main).
  • pnpm check:affected --run: all runnable checks passed (format, lint, typecheck, fallow, related tests) under the machine-wide lock.
  • pnpm check:coverage-crap --all on a per-file map: no function at or above 30 among the four owned files (was 4).
  • CI Coverage/Integration evidence on the PR head tracked in the checks tab.

View guided diff Turn on auto-fix

… root inference, and longpress duration fallback

Covers the four 0-33%-covered daemon functions from #3424 (G1) through
their public entry points:
- applyRequestLockPolicy: fresh-session target vs lock-platform matrix
  (targetSelectorsConflict, 33% -> 83%)
- the shared auxiliary HTTP auth gate: hook rejection rendered as the
  flat REST error at the hook's status (sendAuxiliaryAuthHookRejection,
  0% -> 100%)
- extractTarInstallableArtifact: top-level root inference for ios and
  android without an expectedRootName (inferArchiveRootName, 0% -> 100%)
- SessionScriptWriter.write: longpress duration recovery from recorded
  positionals, dropping blank/non-numeric tails
  (readLongPressDurationFromPositionals, 0% -> 100%)

Each new test was observed to fail under a targeted mutation of its
function before landing.
@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 5.17 MB 5.17 MB 0 B
Package (unpacked) 5.17 MB 5.17 MB 0 B
Package (download) 1.55 MB 1.55 MB -10 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 34.9 ms 35.9 ms +1.0 ms
CLI --help 96.1 ms 95.5 ms -0.6 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread src/daemon/__tests__/request-lock-policy.test.ts
Cubic review: the fresh-session matrix only pinned rejections; a change
that also rejected the valid mobile target would have passed. Adds the
accepted-target case for each mobile-family lock platform.
@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at 9d82198. The new tests read correctly against the code, and all 18 checks are green. Since the diff only touches tests, no production route can cause failures here. There are no conflicts, and I did not run the tests or mutations locally.

Not blocking, and you can take or leave these: the auth-hook harness in http-authorization.test.ts copies the one in http-server-tenant-trust.test.ts, so extract it if a third caller appears; the rejection tests match message text and could also assert code: 'INVALID_ARGS'; and the new matrix does not catch target === 'desktop' becoming target !== 'mobile', so adding tv to the mobile-family accepted loop would close that gap.

The cubic-dev-ai thread on accepted mobile cases per lock (#3447 (comment)) is fixed at this head, because the loop at request-lock-policy.test.ts:302-315 covers android, harmonyos and ios. Please resolve it.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 11, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant