fix(engine): stop scoring issues with unknown timestamps as maximally fresh - #2857
fix(engine): stop scoring issues with unknown timestamps as maximally fresh#2857JSONbored wants to merge 1 commit into
Conversation
… fresh
issueAgeDays returned 0 (the freshest possible age) whenever an open
issue's updatedAt and createdAt were both missing or unparseable, so a
garbage/missing-timestamp issue outranked genuinely fresh ones instead
of falling to the freshness floor. Floor unknown-age issues to a large
sentinel so they clamp to the same 0.05 floor a genuinely stale issue
gets, matching this PR's own commit history intent ("malformed
updatedAt cannot score a stale issue as fresh") and every existing
opportunity-freshness/opportunity-metadata-signals/opportunity-branch-
internals test assertion.
Also fixes two unrelated build breaks on main discovered while
verifying this fix's gate:
- packages/gittensory-engine/src/index.ts: a merge collision dropped
the `export {` opener before the contributor-fit re-export block,
breaking `tsc` for the whole barrel file.
- packages/gittensory-engine/src/governor-ledger.ts: importing
node:util's isDeepStrictEqual doesn't type-check under this
package's ambient-types-off tsconfig, and depends on a Node builtin
in a package shared with the Worker backend. Replaced with a small
self-contained structural-equality check scoped to its one call
site (JSON round-trip fidelity), keeping the package portable.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 38f355c | Commit Preview URL Branch Preview URL |
Jul 03 2026, 11:35 PM |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-04 00:13:28 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 6 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
test/unit/opportunity-branch-internals.test.ts,opportunity-freshness.test.ts, andopportunity-metadata-signals.test.ts: it is not a clock/date issue.issueAgeDays(packages/gittensory-engine/src/opportunity-freshness.ts) returns0— the freshest possible age — whenever an open issue'supdatedAt/createdAtare both missing or unparseable, deterministically, regardless of what "now" is. An issue with no usable timestamp at all was being scored as "just updated" (freshness1) instead of falling to the0.05floor a genuinely stale issue gets.issueAgeDays(feat(engine): add opportunity freshness scorer #2780) has a commit explicitly titled "fall back to createdAt when updatedAt is unparseable ... so malformed updatedAt cannot score a stale issue as fresh" — the intent was already to prevent exactly this outcome, but the remaining "no valid timestamp survived either fallback" case was left returning0. Fixed by flooring that case to a large sentinel (9999), which the existing exponential decay clamps to the same0.05floor a stale issue reaches — matching every failing assertion across all three test files.npm run typecheck/npm run build:miner), found and fixed two separate, unrelated, currently-broken-on-main build issues blocking any PR from passingtest:ciright now:packages/gittensory-engine/src/index.ts: a merge collision between two concurrent PRs (feat(miner-discovery): goal model — translate MinerGoalSpec into ranker weights #2787 and an earlier contributor-fit export) dropped theexport {opener before thecontributor-fit.jsre-export block, leaving four bare identifiers with no enclosing statement — a hardtscparse error for the whole barrel file (Expected a semicolon/Expression expected).packages/gittensory-engine/src/governor-ledger.ts: importsnode:util'sisDeepStrictEqual, which doesn't type-check under this package's"types": []tsconfig (no ambient Node types) and pulls a Node-only builtin into a package explicitly shared with the Worker backend. Replaced with a small self-contained structural-equality check scoped to its one call site (a JSON round-trip fidelity check, so it only ever needs to compare plain objects/arrays/primitives) — keeps the package portable, matches the file's stated "shared by the Worker backend and the Node-only miner CLI" design.Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlint(unaffected — no workflow files touched)npm run typecheck— also confirms theindex.tsbarrel-file fix (this was failing on unmodifiedorigin/mainbefore this PR)npm run db:migrations:check(no schema change)npm run build:miner— confirms thegovernor-ledger.tsfix (also failing on unmodifiedorigin/mainbefore this PR)npm run test:coveragelocally (full, unsharded) — 403 files / 7876 tests, 0 failures (previously 4 failures across 3 files before this fix)npm run test:workers(unaffected — no Worker-pool test files touched)npm run build:mcp/npm run test:mcp-pack(unaffected — no MCP package changes)npm run ui:openapi:check(unaffected — no API/schema changes)npm run ui:lint/npm run ui:typecheck/npm run ui:build(unaffected — noapps/gittensory-uichanges)npm audit --audit-level=moderate— 0 vulnerabilitiesissueAgeDaysfix exactly (.toBe(9999)/.toBe(0.05)), andtest/unit/governor-ledger.test.ts's{ value: undefined }round-trip case pins thedeepStrictEqualreplacement's core behavior. No new test files needed.Safety