Skip to content

fix: 修复 BOSS 实习岗位类型筛选#342

Merged
can4hou6joeng4 merged 2 commits into
can4hou6joeng4:masterfrom
louisgreen0726:fix/boss-internship-filter
Jul 19, 2026
Merged

fix: 修复 BOSS 实习岗位类型筛选#342
can4hou6joeng4 merged 2 commits into
can4hou6joeng4:masterfrom
louisgreen0726:fix/boss-internship-filter

Conversation

@louisgreen0726

Copy link
Copy Markdown
Contributor

关联 Issue / Related Issue

无现有 Issue。本 PR 直接修复已复现的 BOSS 实习筛选错误。

变更说明 / Summary

BOSS 直聘的职位类型存在两层编码:搜索请求中的“实习”应使用 jobType=1902,列表响应中真实实习岗位的 jobType4。原实现把“实习”错误映射成了兼职参数 1903,并且仅依赖请求条件,可能把标题含“接受实习生”的全职或兼职岗位当作实习结果。

本 PR 做了以下修复:

  • 将 BOSS “实习”请求参数从 1903 修正为 1902,与全职 1901、兼职 1903 明确区分。
  • 仅在 BOSS 且明确只请求实习时,按响应 jobType=4 失败关闭;类型缺失或非 4 的岗位不进入搜索、导出和批量打招呼候选。
  • 在职位列表和详情模型中保留原始岗位类型、规范化用工类型、每周实习天数、最短实习周期及结算类型,导出和索引缓存同步保留相关字段。
  • 升级搜索缓存结构版本,避免升级后继续复用旧版本产生的混合岗位缓存。
  • 修复严格过滤后导出可能过早停止翻页的问题:按目标数量估算基础页数,并增加固定过滤余量,同时保留有界请求上限。
  • 增加搜索管线、导出、批量打招呼、详情模型、展示与缓存的回归测试。

该校验不会影响智联等其他平台,也不会影响全职、兼职或混合职位类型搜索。

变更类型 / Type

  • feat: 新功能
  • fix: Bug 修复
  • refactor: 重构(不改变外部行为)
  • perf: 性能优化
  • docs: 文档
  • test: 测试
  • chore: 构建/依赖/配置
  • ci: CI 工作流

Breaking Change

  • 本 PR 不包含 破坏性变更
  • 本 PR 包含 破坏性变更(请在下方说明迁移路径)

输出信封结构不变,仅为职位数据增加字段;严格实习搜索会正确排除非实习或类型缺失的结果。

截图 / Screenshot

无 UI 截图。终端职位表新增 type 列,用于显示规范化用工类型。

测试 / Test Plan

  • 相关回归测试通过:156 passed
  • uv run ruff check src/ tests/ 无报错
  • uv run mypy src/boss_agent_cli 无报错
  • uv run boss --help 可加载
  • uv run boss schema --format native 返回合法 JSON 信封
  • 新增/修改的功能已有对应测试覆盖
  • git diff --check 通过
  • uv run pytest tests/ -q 全部通过

隔离本机用户配置后,全量测试结果为 1601 passed, 2 failed。两个失败均为现有 Windows 环境问题,与本 PR 无关:

  1. test_chat_snapshot_page_merge 使用系统默认 CP936 读取 UTF-8 JSON,触发 UnicodeDecodeError
  2. test_all_checks_pass 在当前 Windows 环境中将 windows_uv_tool_path 判为 warn,而测试固定断言为 ok

文档与契约 / Docs & Contracts

  • 未新增命令,无需更新命令 schema
  • 未新增 MCP 工具
  • 未新增错误码
  • 已更新 CHANGELOG.md[Unreleased] 段落

安全与规范 / Safety & Convention

  • commit message 格式: fix: 修复 BOSS 实习岗位类型筛选
  • Co-authored-by 尾注或 AI 署名行
  • 无敏感信息(Token / 密码 / Cookie / security_id 实值 / 手机号 / 微信 / 真实账号)
  • 未提交本机登录态、缓存、简历、候选池或个人路径
  • 无新增外部 CDN / script 依赖

@can4hou6joeng4
can4hou6joeng4 force-pushed the fix/boss-internship-filter branch from 802c802 to 151b4ff Compare July 17, 2026 03:56
@can4hou6joeng4

Copy link
Copy Markdown
Owner

Rebased onto master after the 1.16.0 release and pushed (maintainer edit). The rebase needed one fix: your ### Added bullet + ### Fixed section were silently auto-merging into the just-shipped ## [1.16.0] section (git does this with no conflict markers), so I moved them into a fresh ## [Unreleased] — they'll ship in 1.17.0.

Full CI is green on the rebased commit (P0 baseline, lint, typecheck, docs, tests 3.10–3.13), and it's MERGEABLE/CLEAN now.

Before merge, could you confirm the two empirical BOSS API assumptions — request jobType=1902 == 实习, and response jobType==4 == 实习? The filter is fail-closed on missing/non-4 jobType, so if BOSS ever omits it on a genuine internship a strict 实习 search would silently drop that job. If both hold against a live search, this is good for the 1.17.0 cycle. Thanks for the fix — nice catch on the 1903 collision.

@louisgreen0726

Copy link
Copy Markdown
Contributor Author

已确认,这两个假设都来自 2026-07-16 至 2026-07-17 的 BOSS 现场搜索,不是 mock 或仅根据标题推断:

  1. 请求参数:在 BOSS 网页端手工交叉检查后,“实习”筛选对应 jobType=1902jobType=1903 对应“兼职”。原先正是因为两者都映射成 1903,才会把网页明确标为兼职的岗位带入“实习”结果。
  2. 响应枚举:使用 jobType=1902,跨 14 个关键词完成了 24 个成功搜索页,共检查 360 个列表岗位卡。严格类型预筛中,jobType 缺失或非 4 的计数为 0;后续按地区、薪资、方向等条件保留的 91 条候选,全部为 raw_job_type=4,并规范化为 employment_type=实习,同时具有实习特有的 daysPerWeekDesc / leastMonthDesc 字段。

因此可以确认当前现场语义是:请求 1902 == 实习,响应 4 == 实习

这里的 fail-closed 是有意设计,且只在 BOSS 的“仅实习”请求中启用:如果以后 BOSS 省略或更改该枚举,宁可记录类型不匹配并少返回,也不要把兼职/全职岗位进入后续导出或批量候选;混合职位类型搜索和其他平台不受影响。

感谢帮忙 rebase,并把 CHANGELOG 调整到新的 [Unreleased]

@can4hou6joeng4 can4hou6joeng4 added this to the 1.17.0 milestone Jul 17, 2026

@can4hou6joeng4 can4hou6joeng4 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

感谢修复与详实的现场验证,已复核通过:

  • boss.yaml 实习 1903→1902 与你在网页端交叉验证的结果一致;响应侧校验仅在 zhipin 且明确只搜实习时按 jobType=4 失败关闭,混合类型搜索与其他平台不受影响(均有测试覆盖)。
  • cache_schema: 2 通过缓存键版本化让旧的混合岗位缓存自然失效,无需数据迁移,处理干净。
  • 新增字段均为加性扩展、信封结构不变,字段名也避开了输出脱敏关键词表。
  • export 的过滤余量固定 +5 页、有上界,不会因 hasMore 异常形成无界翻页。
  • 已确认 run_search_pipeline(platform, ...) 在真实调用链上传入的是带 name 属性的 Platform 实例,过滤在生产路径生效,不只是测试 fake。

CI 9 项全绿,合并。

@can4hou6joeng4
can4hou6joeng4 merged commit dfa6550 into can4hou6joeng4:master Jul 19, 2026
9 checks passed
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.

2 participants