Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Go 可直接提供构建后的 SPA,也可由 nginx / 静态服务器提供 `we
| --- | --- | --- |
| 总览 | `/` | 最新快讯、统计、研究入口、报告与下载、作者列表 |
| 顶会报告 | `/top-conf/` | 会议/年份/类别筛选、向量搜索、分页、related work、报告打开与下载 |
| 数据覆盖 | `/coverage/` | 论文数、原始摘要和有效/过期总结计数、最近落盘与任务成功时间、任务失败类别 |
| 领域导读 | `/field-briefing/` | 印象补全方向、向量召回、分类综述、综述/SoK、论文推荐 |
| 总结汇报 | `/summary-brief/` | 全景或主题简报、发现、统计表与条形图、问答、局限与讨论 |
| 安全资讯 | `/secnews/` | 资讯日历、Top 10、BleepingComputer、The Hacker News、SecurityWeek、价值分、详情折叠 |
Expand Down Expand Up @@ -120,6 +121,8 @@ HTML 报告由 Go 模板生成。PDF 使用 Chromium,通过 `FASTNEWS_CHROME`

NeurIPS 原始摘要补全读取官方论文详情页,按 PDF 路径中的论文 ID 和卷号核对身份,不用出版日期推断会议年份。每篇成功结果追加到 `top-conf/data/abstracts/<conf>_<year>.jsonl` 并同步落盘;后续运行只请求缺少摘要的文章,失败保留此前进度。默认每次补全 12 篇,`--limit 0` 或 `--all` 处理全部缺失文章。摘要来源与正文合并后提供给分类器;已有总结若对应旧材料则不会作为当前总结进入目录/报告,重新执行 `summarize-conf` 只更新材料发生变化的记录。未补全语料的既有断点保持原行为;这里的摘要补全不调用 LLM。

`GET /api/coverage` 根据当前本地档案统计覆盖率,不把已注册会议当作已采集语料。会议 CLI 的采集、摘要补全和总结任务会在 `top-conf/data/job_status/` 保存开始/结束、最近成功与安全的错误类别;不保存原始错误或认证 URL。开始后未留下结束记录时,页面明确说明未记录结束,不据此断言进程仍在运行。历史任务没有状态文件时显示未记录。覆盖率刷新读取已落盘的断点,统计与报告遵守同一公开/登录访问边界。

## 验证

```bash
Expand Down
34 changes: 34 additions & 0 deletions cmd/fastnews/abstracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
Expand All @@ -14,6 +15,8 @@ import (

"github.com/FastR-D/FastNews/internal/catalog"
"github.com/FastR-D/FastNews/internal/config"
"github.com/FastR-D/FastNews/internal/httpapi"
"github.com/FastR-D/FastNews/internal/store"
)

func TestNeuripsAbstractsResumeAndRefreshSourceBoundSummaries(t *testing.T) {
Expand Down Expand Up @@ -59,6 +62,33 @@ func TestNeuripsAbstractsResumeAndRefreshSourceBoundSummaries(t *testing.T) {
}))
defer model.Close()
c := config.Config{Root: t.TempDir(), LLMKey: "fixture", LLMURL: model.URL}
db, err := store.Open(filepath.Join(c.Root, "accounts"))
if err != nil {
t.Fatal(err)
}
defer db.Close()
app, err := httpapi.New(c, db)
if err != nil {
t.Fatal(err)
}
assertCoverage := func(abstracts, summaries, stale int, state string) {
t.Helper()
recorder := httptest.NewRecorder()
app.Handler().ServeHTTP(recorder, httptest.NewRequest("GET", "/api/coverage", nil))
var result struct {
Conferences []catalog.ConferenceCoverage `json:"conferences"`
}
if err := json.Unmarshal(recorder.Body.Bytes(), &result); err != nil || recorder.Code != 200 || len(result.Conferences) != 1 {
t.Fatal("coverage response", recorder.Code, recorder.Body.String(), err)
}
row := result.Conferences[0]
if row.Papers != 2 || row.Abstracts != abstracts || row.Summaries != summaries || row.StaleSummaries != stale || row.Job == nil || row.Job.State != state || row.Job.LastSuccessAt == nil {
t.Fatal("coverage did not follow persisted evidence", row)
}
if state == "failed" && (row.Job.ErrorKind != "source_http" || row.Job.HTTPStatus != 503) {
t.Fatal("failure reason was lost", row.Job)
}
}
args := []string{"--conference", "neurips", "--year", "2025"}
ctx := context.Background()
for _, command := range []string{"fetch-conf", "summarize-conf"} {
Expand All @@ -69,6 +99,7 @@ func TestNeuripsAbstractsResumeAndRefreshSourceBoundSummaries(t *testing.T) {
if models.Load() != 2 {
t.Fatal(models.Load())
}
assertCoverage(0, 2, 0, "completed")
if err := job(ctx, c, "enrich-abstracts", append(append([]string{}, args...), "--limit", "1")); err != nil {
t.Fatal(err)
}
Expand All @@ -79,6 +110,7 @@ func TestNeuripsAbstractsResumeAndRefreshSourceBoundSummaries(t *testing.T) {
if err := job(ctx, c, "enrich-abstracts", enrichArgs); err == nil {
t.Fatal("interrupted enrichment succeeded")
}
assertCoverage(1, 1, 1, "failed")
file := filepath.Join(c.Root, "top-conf/data/abstracts/neurips_2025.jsonl")
checkpoints, err := catalog.Rows(file)
if err != nil || len(checkpoints) != 1 {
Expand All @@ -93,6 +125,7 @@ func TestNeuripsAbstractsResumeAndRefreshSourceBoundSummaries(t *testing.T) {
if first.Load() != 1 || second.Load() != 2 {
t.Fatal("completed papers were fetched again", first.Load(), second.Load())
}
assertCoverage(2, 0, 2, "completed")
checkpoints, err = catalog.Rows(file)
if err != nil || len(checkpoints) != 2 {
t.Fatal("resume duplicated or lost abstracts", checkpoints, err)
Expand All @@ -118,6 +151,7 @@ func TestNeuripsAbstractsResumeAndRefreshSourceBoundSummaries(t *testing.T) {
if models.Load() != 4 {
t.Fatal("source update did not refresh exactly the changed summaries", models.Load())
}
assertCoverage(2, 2, 0, "completed")
cat.Invalidate()
papers, err = cat.Papers()
if err != nil || len(papers) != 2 {
Expand Down
10 changes: 5 additions & 5 deletions cmd/fastnews/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ func job(ctx context.Context, c config.Config, command string, args []string) er
case "weekly-report":
return p.Weekly(*days, *pdf)
case "fetch-conf":
return p.FetchConference(ctx, *conf, *year, *rawURL)
return p.RunConferenceJob(ctx, command, *conf, *year, *limit, *rawURL)
case "enrich-abstracts":
count := *limit
if *all {
count = 0
}
return p.EnrichConferenceAbstracts(ctx, *conf, *year, count)
return p.RunConferenceJob(ctx, command, *conf, *year, count, "")
case "summarize-conf":
return p.SummarizeConference(ctx, *conf, *year)
return p.RunConferenceJob(ctx, command, *conf, *year, *limit, "")
case "conference-report":
return p.ConferenceReport(*conf, *year, *pdf)
case "update-range":
Expand All @@ -73,10 +73,10 @@ func job(ctx context.Context, c config.Config, command string, args []string) er
for y := *since; y <= *until; y++ {
for _, conference := range []string{"usenix", "ieee-sp", "ndss", "ccs"} {
fmt.Fprintln(os.Stderr, conference, strconv.Itoa(y))
if e := p.FetchConference(ctx, conference, y, ""); e != nil {
if e := p.RunConferenceJob(ctx, "fetch-conf", conference, y, *limit, ""); e != nil {
return e
}
if e := p.SummarizeConference(ctx, conference, y); e != nil {
if e := p.RunConferenceJob(ctx, "summarize-conf", conference, y, *limit, ""); e != nil {
return e
}
p.Catalog.Invalidate()
Expand Down
142 changes: 142 additions & 0 deletions internal/catalog/coverage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
package catalog

import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"sort"
"strconv"
"strings"
"time"
)

type ConferenceJobStatus struct {
Stage string `json:"stage"`
State string `json:"state"`
StartedAt time.Time `json:"startedAt"`
EndedAt *time.Time `json:"endedAt,omitempty"`
LastSuccessAt *time.Time `json:"lastSuccessAt,omitempty"`
ErrorKind string `json:"errorKind,omitempty"`
HTTPStatus int `json:"httpStatus,omitempty"`
}

type ConferenceCoverage struct {
Conference string `json:"conference"`
Name string `json:"name"`
Year int `json:"year"`
Papers int `json:"papers"`
Abstracts int `json:"abstracts"`
Summaries int `json:"summaries"`
StaleSummaries int `json:"staleSummaries"`
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
Job *ConferenceJobStatus `json:"job,omitempty"`
}

func (c *Catalog) ConferenceJob(conf string, year int) (*ConferenceJobStatus, error) {
body, err := os.ReadFile(filepath.Join(c.Root, "top-conf/data/job_status", fmt.Sprintf("%s_%d.json", conf, year)))
if os.IsNotExist(err) {
return nil, nil
}
if err != nil {
return nil, err
}
var result ConferenceJobStatus
if err := json.Unmarshal(body, &result); err != nil {
return nil, err
}
return &result, nil
}

func (c *Catalog) Coverage() ([]ConferenceCoverage, error) {
keys := map[string]bool{}
for _, pattern := range []string{"top-conf/data/conferences/*.jsonl", "top-conf/data/job_status/*.json"} {
files, err := filepath.Glob(filepath.Join(c.Root, pattern))
if err != nil {
return nil, err
}
for _, file := range files {
keys[strings.TrimSuffix(filepath.Base(file), filepath.Ext(file))] = true
}
}
out := []ConferenceCoverage{}
for key := range keys {
at := strings.LastIndex(key, "_")
if at < 0 {
continue
}
conf := key[:at]
metadata, ok := Conferences[conf]
if !ok {
continue
}
year, err := strconv.Atoi(key[at+1:])
if err != nil || year < 2000 || year > 2100 {
continue
}
rows, err := c.ConferenceRows(conf, year)
if err != nil {
return nil, err
}
papers := map[string]map[string]any{}
for _, row := range rows {
if id := First(Str(row, "_id"), Str(row, "link")); id != "" {
papers[id] = row
}
}
entry := ConferenceCoverage{Conference: conf, Name: metadata.Name, Year: year, Papers: len(papers)}
for _, row := range papers {
if strings.TrimSpace(Str(row, "description")) != "" {
entry.Abstracts++
}
}
summaries, err := Rows(filepath.Join(c.Root, "top-conf/data/summary", key+"_summary.jsonl"))
if err != nil {
return nil, err
}
latest := map[string]map[string]any{}
for _, row := range summaries {
if paper, ok := row["paper"].(map[string]any); ok {
latest[First(Str(paper, "_id"), Str(paper, "link"))] = row
}
}
for id, summary := range latest {
paper := papers[id]
if paper == nil {
continue
}
if ConferenceSourceHash(paper) != Str(summary, "source_hash") {
entry.StaleSummaries++
continue
}
if Str(summary, "category") != "" && Str(object(summary, "paper"), "summary_zh") != "" {
entry.Summaries++
}
}
for _, path := range []string{"conferences/" + key + ".jsonl", "abstracts/" + key + ".jsonl", "summary/" + key + "_summary.jsonl"} {
info, err := os.Stat(filepath.Join(c.Root, "top-conf/data", path))
if os.IsNotExist(err) {
continue
}
if err != nil {
return nil, err
}
modified := info.ModTime().UTC()
if entry.UpdatedAt == nil || modified.After(*entry.UpdatedAt) {
entry.UpdatedAt = &modified
}
}
entry.Job, err = c.ConferenceJob(conf, year)
if err != nil {
return nil, err
}
out = append(out, entry)
}
sort.Slice(out, func(i, j int) bool {
if out[i].Year != out[j].Year {
return out[i].Year > out[j].Year
}
return out[i].Conference < out[j].Conference
})
return out, nil
}
10 changes: 8 additions & 2 deletions internal/httpapi/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (s *Server) serve(w http.ResponseWriter, r *http.Request) {
e = s.auth(w, r, p)
case strings.HasPrefix(p, "/api/content/"):
e = s.content(w, r, p)
case p == "/api/catalog" || p == "/api/papers" || p == "/api/news" || p == "/api/reports" || p == "/api/trend":
case p == "/api/catalog" || p == "/api/papers" || p == "/api/news" || p == "/api/reports" || p == "/api/trend" || p == "/api/coverage":
if e = s.viewer(r); e == nil {
e = s.catalogHTTP(w, r, p)
}
Expand Down Expand Up @@ -242,6 +242,12 @@ func (s *Server) catalogHTTP(w http.ResponseWriter, r *http.Request, p string) e
return store.Fail(405, "Method not allowed")
}
switch p {
case "/api/coverage":
coverage, err := s.Catalog.Coverage()
if err != nil {
return err
}
reply(w, r, 200, map[string]any{"conferences": coverage})
case "/api/trend":
query := r.URL.Query()
scope := catalog.First(query.Get("scope"), "ai")
Expand Down Expand Up @@ -458,7 +464,7 @@ func (s *Server) static(w http.ResponseWriter, r *http.Request, p string) error

} else {
switch strings.TrimSuffix(p, "/") {
case "", "/index.html", "/top-conf", "/top-conf/index.html", "/field-briefing", "/field-briefing/index.html", "/summary-brief", "/summary-brief/index.html", "/inbox", "/inbox/index.html", "/impression", "/impression/index.html", "/secnews", "/secnews/index.html", "/arxiv", "/arxiv/index.html", "/trend", "/trend/index.html", "/authors", "/login", "/auth/login", "/auth/account":
case "", "/index.html", "/top-conf", "/top-conf/index.html", "/coverage", "/coverage/index.html", "/field-briefing", "/field-briefing/index.html", "/summary-brief", "/summary-brief/index.html", "/inbox", "/inbox/index.html", "/impression", "/impression/index.html", "/secnews", "/secnews/index.html", "/arxiv", "/arxiv/index.html", "/trend", "/trend/index.html", "/authors", "/login", "/auth/login", "/auth/account":
rel = "index.html"
default:
return store.Fail(404, "Not found")
Expand Down
16 changes: 15 additions & 1 deletion internal/httpapi/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func TestLocalContentIsolationCSRFAndInbox(t *testing.T) {
}
func TestCatalogOldRoutesAndPrivateFiles(t *testing.T) {
h := fixture(t)
for _, p := range []string{"/", "/index.html", "/top-conf/index.html", "/field-briefing/index.html", "/summary-brief/index.html", "/inbox/index.html", "/impression/index.html", "/secnews/index.html", "/arxiv/", "/arxiv/index.html", "/trend/", "/trend/index.html", "/login", "/top-conf/data/report/USENIX_2026_Report.html?download=1"} {
for _, p := range []string{"/", "/index.html", "/top-conf/index.html", "/coverage/", "/coverage/index.html", "/field-briefing/index.html", "/summary-brief/index.html", "/inbox/index.html", "/impression/index.html", "/secnews/index.html", "/arxiv/", "/arxiv/index.html", "/trend/", "/trend/index.html", "/login", "/top-conf/data/report/USENIX_2026_Report.html?download=1"} {
resp, e := http.Get(h.http.URL + p)
if e != nil {
t.Fatal(e)
Expand Down Expand Up @@ -358,6 +358,20 @@ func TestNewsScopeSelectsLatestPopulatedArchiveDate(t *testing.T) {
}
}

func TestCoverageFollowsReportVisibility(t *testing.T) {
h := fixture(t)
h.app.Config.RequireLogin = true
status, _, _ := h.request(t, "GET", "/api/coverage", nil, "", false)
if status != 401 {
t.Fatal("private coverage exposed", status)
}
h.login(t, "coverage@example.com")
status, result, _ := h.request(t, "GET", "/api/coverage", nil, "", true)
if status != 200 || len(result["conferences"].([]any)) != 1 {
t.Fatal("authenticated coverage unavailable", status, result)
}
}

func TestReleaseSymlinkAndReportAssets(t *testing.T) {
h := fixture(t)
link := filepath.Join(t.TempDir(), "current")
Expand Down
2 changes: 1 addition & 1 deletion internal/jobs/news.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func get(ctx context.Context, raw string) ([]byte, error) {
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return nil, fmt.Errorf("source returned HTTP %d", resp.StatusCode)
return nil, &sourceHTTPError{Status: resp.StatusCode}
}
b, e := io.ReadAll(io.LimitReader(resp.Body, (16<<20)+1))
if len(b) > 16<<20 {
Expand Down
Loading
Loading