feat(tune): add proposal-only Googlevideo scans

Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
ZeusinaandGPT-6 Bot committed 2026-10-09 23:04:53 +03:00
1 parent 7fad9b3b5c
commit 6220eb0b31
10 files changed
+638 -27

No files matched your search

+22 -4
View File
@@ -46,11 +46,29 @@ func history(args []string, stdout, stderr io.Writer) int {
}
func tuneHistory(db *sql.DB, limit int) (string, error) {
rows, err := db.Query(`SELECT id, finished_at, target, state, args, error,
query := `SELECT id, finished_at, target || ' frontend only' AS target, state, args, error,
(SELECT count(*) FROM protocol_results WHERE run_id = tune_runs.id),
(SELECT count(DISTINCT protocol) FROM protocol_results WHERE run_id = tune_runs.id
AND protocol IN ('tls12', 'tls13') AND passes_ok = 3 AND passes_total = 3)
FROM tune_runs ORDER BY id DESC LIMIT ?`, limit)
FROM tune_runs`
hasCache, err := hasGooglevideoRuns(db)
if err != nil {
return "", err
}
if hasCache {
query = `SELECT id, finished_at, target, state, args, error, total, verified FROM (` +
`SELECT id, started_at, finished_at, target || ' frontend only' AS target, state, args, error,
(SELECT count(*) FROM protocol_results WHERE run_id = tune_runs.id) AS total,
(SELECT count(DISTINCT protocol) FROM protocol_results WHERE run_id = tune_runs.id AND protocol IN ('tls12','tls13') AND passes_ok = 3 AND passes_total = 3) AS verified FROM tune_runs
UNION ALL SELECT r.id, r.started_at, r.finished_at, coalesce(r.endpoint, '(discovery unavailable)') || ' googlevideo exact endpoint', r.state, c.args, r.error,
(SELECT count(*) FROM candidate_evidence WHERE candidate_id = c.id),
(SELECT count(*) FROM candidate_evidence WHERE candidate_id = c.id AND endpoint = r.endpoint AND protocol IN ('tls12','tls13') AND passes_ok = 3 AND passes_total = 3 AND success_rate = 1 AND coverage = 1)
FROM googlevideo_tune_runs r LEFT JOIN strategy_candidates c ON c.id = r.candidate_id
) ORDER BY started_at DESC, id DESC LIMIT ?`
} else {
query += ` ORDER BY id DESC LIMIT ?`
}
rows, err := db.Query(query, limit)
if err != nil {
return "", err
}
@@ -72,12 +90,12 @@ func tuneHistory(db *sql.DB, limit int) (string, error) {
if !args.Valid || args.String == "" || runError.Valid {
return "", fmt.Errorf("proposed run %d has malformed outcome", id)
}
fmt.Fprintf(&text, "Run %d; finished %s; %s frontend only; PROPOSED, NOT ACTIVE; Args: %q; recorded TLS1.2 3/3; TLS1.3 3/3\n", id, finished, target, args.String)
fmt.Fprintf(&text, "Run %d; finished %s; %s; PROPOSED, NOT ACTIVE; Args: %q; recorded TLS1.2 3/3; TLS1.3 3/3\n", id, finished, target, args.String)
case "FAILED":
if !runError.Valid || runError.String == "" || args.Valid {
return "", fmt.Errorf("failed run %d has malformed outcome", id)
}
fmt.Fprintf(&text, "Run %d; finished %s; %s frontend only; FAILED; Error: %q\n", id, finished, target, runError.String)
fmt.Fprintf(&text, "Run %d; finished %s; %s; FAILED; Error: %q\n", id, finished, target, runError.String)
default:
return "", fmt.Errorf("run %d has unknown state %q", id, state)
}