Skip to content

P0 launch-readiness fixes + personal mode with job discovery and Claude web research - #4

Merged
Rebell-Leader merged 6 commits into
mainfrom
fix/p0-launch-readiness
Oct 19, 2026
Merged

Rebell-Leader merged 6 commits into
mainfrom
fix/p0-launch-readiness

Conversation

@Rebell-Leader

@Rebell-Leader Rebell-Leader commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR does three things:

  1. Fixes the P0 defects found in a full technical assessment
    (docs/ASSESSMENT.md).
  2. Adds a personal mode for using the app on your own job search.
  3. Adds search-profile personalisation, job discovery, and Claude
    web research
    .

It supersedes the unmerged branch claude/founding-team-setup-b5t2ge
(c1f9d6d). That branch was applied as a diff, with its CI failures fixed: a
lint error, two mypy errors, a schema-creation race in Compose, a backup step
that could never run (no pg_dump in the image), and a Telegram fix that
/unbind could bypass. A line-by-line check shows all of its additions are
here, either as-is or deliberately superseded.

1. P0 fixes (485d5b1)

LLM client

  • Current model defaults.
  • No temperature for models that reject it (Opus/Sonnet/Haiku 5.x return a
    400 on it).
  • A 16k output budget, plus detection of truncated, refused or empty output.
    The old 2000-token cap cut off the report's verdict block.
  • One retry policy, explicit timeouts, and pricing for the 5.5 models and
    gpt-5 mini/nano.

Pipeline

  • A posting that doesn't name the employer no longer aborts the analysis.
  • Manual hints now override extracted fields instead of skipping extraction.
  • The salary stage sees the posted salary range.

No-fabrication check

  • No longer whitelists skills copied from the posting.
  • Flags title inflation, dollar amounts and count claims.
  • Two tests encoded the bug and were corrected. One expected
    "Staff ML Engineer" to pass for a Senior's CV; the other's "clean" fixture
    claimed "Senior" without support.

ATS match

  • Understands "X (A, B)", aliases (K8s / Postgres / Golang), and ambiguous
    short names like "Go" and "R".

Resume and PDF

  • Resume parsing: clear errors on bad files; DOCX tables and headers are
    now read.
  • PDF export embeds a Unicode font (DejaVu, licence included) instead of
    crashing the CV tab on "Ł", "→" or "€".

Tracking and UI

  • A failed URL fetch no longer analyzes stale pasted text.
  • Status changes create stage events, so analytics and reminders are right.
  • Editable company/title on Save.
  • CSV import handles a BOM and is case-insensitive.
  • URLs: reads the JSON-LD JobPosting data that ATS pages embed.
  • The 2FA nested-expander crash is fixed.

Paid-launch blockers

  • The Stripe webhook crashed on every real event (stripe 15 Event has no
    .get).
  • Telegram /analyze now requires a linked chat.
  • One metered_llm gate now covers CV parsing, bulk import and tailoring.
  • SSRF: every redirect hop is re-validated, reads are capped, CGNAT
    addresses are blocked.
  • Posting-derived HTML is escaped.
  • Sign-out clears the whole session.
  • The system test is operator-only and redacts secrets.

Ops

  • Compose: the worker's -A target, image extras, pg_dump, a backups
    volume, restart policies.
  • pool_pre_ping; postgres:// URLs are rewritten.
  • scripts/run_local.sh and .python-version.

2. Personal mode, profile, discovery, web research (bcd7fb1)

Personal mode (PERSONAL_MODE=1, the default in run_local.sh)

  • A single local owner. The sign-up, login, 2FA, billing, quota, token,
    webhook and Telegram UI is hidden, and the Discover tab comes first.

Search profile (services/profile, table candidate_profiles)

  • Fields: roles, seniority, locations and remote region, work authorization,
    salary floor, must-haves, dealbreakers, industries, and a company watchlist.
  • Can be drafted from the master CV.
  • Drives a "Fit for You" report section. The verdict is capped on a
    dealbreaker or a salary under the floor.
  • Loaded automatically by the runner and the worker.

Job discovery (tools/job_sources, services/discovery, table discovered_jobs)

  • Public APIs only. Watchlist boards: Greenhouse, Lever (incl. the EU host),
    Ashby and SmartRecruiters, with ATS auto-detection. Aggregators: Arbeitnow,
    Remotive, RemoteOK, HN "Who is hiring", and Adzuna when a key is set.
  • Pipeline: cached and attributed. Title prefilter. Recency filter for
    aggregators only. Per-user dedupe that keeps each job's status.
  • Ranking: a deterministic match score plus flags (Americas-only remote for
    EU candidates, below the salary floor, seniority mismatch, dealbreakers).
  • Haiku fit triage, open-web discovery through Claude web search, and deep
    analysis or tracking straight from the feed.

Frontier research (utils/llm.web_research)

  • Claude server-side web search and fetch (the 20260209 tools), with
    pause_turn continuation and cited sources. Used for company research
    (news, funding, layoffs, Glassdoor/Kununu) and salary data.
  • Search fees go into the cost ledger.
  • Server-side refusal fallbacks (fallbacks: "default") on Opus/Sonnet
    5.x. They switch off automatically if the endpoint rejects the beta;
    ANTHROPIC_REFUSAL_FALLBACK=0 turns them off.

3. Migration safety (1fe44dd)

  • On a database without the new tables, analyses still run (with an empty
    profile), and Discover / Profile show a "run alembic upgrade head" hint
    instead of halting the whole page.

4. CI: mypy against the lockfile (52d496b)

  • The mypy job now installs from uv.lock (uv sync --frozen) and runs
    uv lock --check, so it type-checks the versions Replit runs.
  • It had been pip-installing unpinned latest packages. numpy 2.5's stubs use
    3.12-only syntax that mypy rejects under python_version = 3.11; ui/
    reaches them through streamlit.
  • The test jobs stay on the latest versions as a forward-compatibility
    signal. They pass on numpy 2.5, pandas 3, streamlit 1.66 and anthropic 1.x.

5. Architecture: feature isolation, dead code, lighter deps (49895eb)

  • Feature registry: utils/features.py declares core vs side features
    (accounts, billing, api_tokens, webhooks, telegram, notifications, sharing,
    background, audit_log, rate_limits).
  • Personal mode turns all side features off. app.py doesn't import
    their modules, and the services skip webhook dispatch and the billing /
    rate-limit gates. A fresh-subprocess test asserts that no side-feature
    module, and none of celery / stripe / telegram / pyotp / qrcode, loads in
    personal mode.
  • The personal sidebar keeps what a single user needs: LLM spend (7/30
    days, per model) and backup / full JSON export.
  • LangGraph replaced by an explicit stage sequence. The graph was a
    strictly linear 4-node chain, and checkpointing was already done by hand.
    Together with removing the unused LangChain Tool wrappers, that drops
    langgraph, langchain, langchain-core, langsmith and ~20 packages,
    and cuts app import time from 930 to 605 ms.
  • Dead code removed: analyze_compensation_package,
    _normalize_skill, _split_inline_bold, audit.count_by_kind, and the
    stale DEVELOPMENT.md. Layering rules re-verified mechanically.
  • New personal journey test: feed → track → stage quick-actions →
    status → tailored CV (fabrication flagged) → cover letter → PDF.

⚠️ Deploy notes (Replit)

  • The live deploy never runs Alembic. .replit sets USE_ALEMBIC=1 but
    runs plain streamlit run. It has drifted before: the users.email_verified
    column was hand-patched in June (see attached_assets/). Production is
    probably missing several migrations, including this PR's c4e8a2f61d39.
  • Before redeploying:
    1. Back up the database.
    2. Check SELECT version_num FROM alembic_version.
    3. Stamp or upgrade, following the procedure in docs/ASSESSMENT.md
      ("Remaining P0").
    4. Only then change the run command to
      alembic upgrade head && streamlit run app.py.
  • .replit is deliberately unchanged in this PR.
  • Behaviour changes:
    • Telegram /analyze needs a linked chat; set
      TELEGRAM_ALLOW_UNLINKED_ANALYZE=1 to allow anonymous chats.
    • The System test tab is operator-only (ADMIN_EMAILS).
    • The default models are now Haiku 5.5 / Opus 5.5 (Anthropic) and gpt-5-mini /
      gpt-5 (OpenAI). Replit's env overrides still apply.
  • Remotive's API terms forbid redistributing its jobs. That's fine for
    personal use, but drop it as a source before a hosted, paid launch.

Testing

  • Unit tests: 752 pass (697 at baseline), 7 live e2e skipped. New
    regression tests cover each fixed bug: fabrication holes, ATS realism,
    JSON-LD, the SSRF redirect, the Unicode PDF, Stripe via the real SDK
    object, status → stage, CSV import, the bot link requirement, connectors,
    ranking, the discovery lifecycle, web research pause_turn/fallback,
    personal-mode rendering, and an unmigrated database.
  • Static checks: ruff, mypy (now also ui/), bandit and the JS tests
    are clean. The CI Postgres table check now also covers the new tables and
    three it had been missing.
  • Live checks:
    • Every connector ran against the real APIs.
    • A full discovery refresh: 1,250 postings fetched → 73 matched the
      profile → 48 new.
    • The Discover tab was driven through AppTest: refresh, render, dismiss.
    • A fresh local boot applied all 20 migrations.
  • Not verified: real Anthropic calls (no key was available), the Docker
    image build, and the Replit deploy. Run one real deep analysis before
    relying on the web-research path.

🤖 Generated with Claude Code

https://claude.ai/code/session_01P1Ts4ix4BDwKwSBfgRphwq

Rebell-Leader and others added 6 commits October 19, 2026 23:18
Core analysis pipeline
- utils/llm: current model defaults (claude-haiku-5-5 / claude-opus-5-5,
  gpt-5-mini / gpt-5); temperature only for models that accept it; 16k
  output budget with max_tokens/length/refusal/empty detection
  (LLMOutputError, never retried); one retry policy that skips 4xx;
  explicit timeouts; pricing for 5.5 and gpt-5 mini/nano.
- Missing employer no longer aborts the analysis; manual hints override
  extraction instead of skipping it; salary stage sees the posted range.

CV / tailoring
- Fabrication check no longer whitelists posting skills; flags title
  inflation, dollar amounts and count claims; less prose noise; labels
  terms copied from the posting. Two tests that encoded the bug updated.
- Tailoring prompt gets responsibilities and a posting excerpt.
- ATS match understands "X (A, B)", aliases, ambiguous short names.
- Resume parsing: clear errors, DOCX tables/headers; fixed always-true
  glyph warning. PDF export embeds DejaVu (Unicode) instead of crashing.

Tracking / UI
- URL fetch failure no longer analyzes stale pasted text; readable
  results; status changes create stages (analytics + reminders); editable
  company/title on save; CSV import BOM/header/status case; JSON-LD
  JobPosting extraction; 2FA nested-expander crash.

Paid-launch blockers
- Stripe webhook crash on stripe 15 Event objects; Telegram /analyze
  requires a linked chat; metered_llm gate for CV parsing, bulk import and
  tailoring; SSRF redirect re-validation + capped streamed reads + CGNAT;
  escaped skills HTML; full session clear on sign-out; operator-only
  system test with secret redaction.

Ops
- Includes the unmerged founding-team-setup branch (c1f9d6d, applied as a
  diff) with its lint/mypy/compose-race/backup fixes; compose worker -A
  target, image extras, pg_dump, restart policies; pool_pre_ping;
  postgres:// rewrite; scripts/run_local.sh; .python-version.
- docs/ASSESSMENT.md: verified state, remaining blockers, pilot protocol.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P1Ts4ix4BDwKwSBfgRphwq
Personal mode (PERSONAL_MODE=1, default in scripts/run_local.sh)
- Single local owner account (services/personal); no sign-up/login, 2FA,
  billing, quota, token, webhook or Telegram UI. Discover tab first.

Search profile (services/profile, table candidate_profiles)
- Target roles, seniority, locations/work mode/remote region, work
  authorization, salary floor, must-haves, dealbreakers, industries, company
  stage, languages, keywords, company watchlist; "draft from my master CV".
- Feeds a "Fit for You" report section and a verdict that a dealbreaker or
  sub-floor salary caps; loaded automatically by run_analysis_sync and the
  worker. The master CV is the default resume for the fit/ATS analysis.

Job discovery (tools/job_sources, services/discovery, table discovered_jobs)
- Public APIs only: Greenhouse/Lever(+EU)/Ashby/SmartRecruiters watchlist
  boards with ATS auto-detect; Arbeitnow, Remotive, RemoteOK, HN "Who is
  hiring", Adzuna (with key). Cached per source; attribution shown.
- Title prefilter, recency for aggregators only, per-user dedupe that keeps
  status, deterministic match score + flags (US-only remote for EU
  candidates, salary below floor, seniority mismatch, dealbreakers), Haiku
  fit triage, open-web discovery via Claude web search, deep analysis and
  tracking from the feed (ui/discover, ui/profile).

Frontier research (utils/llm.web_research)
- Claude server-side web search/fetch (20260209 tools) with pause_turn
  continuation and cited sources, for company and salary research; web
  search fees in the cost ledger; server-side refusal fallbacks on
  Opus/Sonnet 5.x with automatic opt-out if the beta is rejected.

Also: posting-derived report fields fenced as untrusted, block-aware HTML
to text, profile + feed in account export, CI schema check covers the new
(and three previously missing) tables, mypy covers ui/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P1Ts4ix4BDwKwSBfgRphwq
The live Replit deploy has lagged migrations before (users.email_verified
was patched by hand in June). With candidate_profiles / discovered_jobs
missing, the profile lookup would fail every analysis and the Discover tab
would halt the script, taking every later tab down with it.

- services/profile.profile_prompt_for: best-effort profile prompt (logs
  and returns "" on a DB error); used by the web, runner and worker paths.
- app.py: Discover and the profile editor show a "run alembic upgrade
  head" hint instead of raising.
- account export skips the new sections when the tables don't exist.
- Regression tests drop both tables and assert analyses and the rest of
  the page still work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P1Ts4ix4BDwKwSBfgRphwq
The mypy job pip-installed unpinned latest deps. numpy 2.5's stubs use
3.12-only `type` statements, which mypy rejects under python_version 3.11,
and ui/ (now type-checked) reaches them via streamlit. Install with
`uv sync --frozen` instead, so the gate checks the versions Replit runs,
and fail fast with `uv lock --check` when uv.lock drifts from pyproject.

The test jobs stay on pip-resolved latest versions as a forward-compat
signal (they pass on numpy 2.5 / pandas 3 / streamlit 1.66 / anthropic 1.x).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P1Ts4ix4BDwKwSBfgRphwq
…in; dead code

Feature isolation
- utils/features.py declares core vs side features (accounts, billing,
  api_tokens, webhooks, telegram, notifications, sharing, background,
  audit_log, rate_limits); PERSONAL_MODE=1 turns every side feature off.
- app.py imports side-feature modules only outside personal mode and gates
  their call sites (share view, background analyses, stage notifications,
  share links); services skip webhook dispatch and billing / rate-limit
  gates when the feature is off; reminders imports Telegram lazily.
- Personal-mode sidebar keeps what a single user still needs: LLM spend
  (7/30 days, per model) and backup / full JSON export (built on click,
  not on every rerun), plus a password-safe db.session.describe_database.
- Guarded by tests: a fresh-subprocess check that no side-feature module
  (or celery / stripe / telegram / pyotp / qrcode) loads in personal mode,
  and a personal journey test: feed → track → stage quick-actions → status
  → tailored CV (fabrication flagged) → cover letter → PDF.

Dead code and dependencies
- LangGraph ran a strictly linear 4-node graph with its own checkpointing
  done by hand; replaced by an explicit stage sequence. Removing the unused
  LangChain Tool wrappers (+ analyze_compensation_package) and both
  dependencies drops ~20 packages and cuts app import time 930 -> 605 ms.
- Removed _normalize_skill, _split_inline_bold, audit.count_by_kind and
  the stale pre-Phase-1 DEVELOPMENT.md; environment banner prints once per
  process instead of on every Streamlit rerun.
- Layering rules re-verified mechanically (no violations).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P1Ts4ix4BDwKwSBfgRphwq
Live-verified research (2026-10-20): which ATSs DE deeptech companies use,
the next ten sources in implementation order with exact endpoints, auth,
data and terms (Personio, Teamtailor, Recruitee, Workable, Pinpoint,
Softgarden, the DevJobs RSS network, Reed, Workday, JOIN), sources to avoid
(Getro, Consider, Wellfound, WTTJ/Otta, consumer boards, grey government
APIs), what community lists really are, and how similar products source
jobs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P1Ts4ix4BDwKwSBfgRphwq
@Rebell-Leader
Rebell-Leader merged commit e5a2197 into main Oct 19, 2026
7 checks passed
@Rebell-Leader
Rebell-Leader deleted the fix/p0-launch-readiness branch October 19, 2026 22:55
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