Skip to content

refactor: extract shared scoring + consolidate time utils#823

Merged
jackwener merged 2 commits intomainfrom
refactor/simplify-shared-logic
Apr 5, 2026
Merged

refactor: extract shared scoring + consolidate time utils#823
jackwener merged 2 commits intomainfrom
refactor/simplify-shared-logic

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • Extract applyUrlScoreAdjustments() and scoreArrayResponse() into analysis.ts, eliminating duplicated endpoint scoring logic between explore.ts and record.ts
  • Consolidate formatDuration(ms) and formatUptime(seconds) into a single formatDuration(ms) in download/progress.ts, extended to handle hours — reused by commands/daemon.ts
  • Browser abstraction (BasePage) already well-structured — transport-specific methods (goto/evaluate/screenshot) correctly remain abstract; no further lift needed

Test plan

  • All 1409 unit tests pass (1 pre-existing flaky e2e skipped)
  • Verify opencli daemon status displays uptime correctly
  • Verify explore + record scoring behavior unchanged

- Extract applyUrlScoreAdjustments() and scoreArrayResponse() to analysis.ts,
  eliminating duplicated endpoint scoring between explore.ts and record.ts
- Consolidate formatDuration/formatUptime into a single formatDuration(ms)
  in download/progress.ts, reused by commands/daemon.ts
- Revert explore.ts scoreEndpoint to original inline /api/ /x/ bonus
  without record's tracking/analytics penalty (blocker from review)
- Math.round uptime*1000 to avoid floating-point noise in daemon status
@jackwener jackwener merged commit d61dd7b into main Apr 5, 2026
9 checks passed
@jackwener jackwener deleted the refactor/simplify-shared-logic branch April 5, 2026 18:50
@jackwener jackwener mentioned this pull request Apr 5, 2026
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