Skip to content

chore: remove superseded Python Cloud Functions from functions/ - #72

Open
chenyuan99 wants to merge 1 commit into
mainfrom
claude/remove-stale-functions-requirements
Open

chore: remove superseded Python Cloud Functions from functions/#72
chenyuan99 wants to merge 1 commit into
mainfrom
claude/remove-stale-functions-requirements

Conversation

@chenyuan99

Copy link
Copy Markdown
Owner

Summary

functions/ contained a complete Python codebase sitting alongside the live TypeScript one — main.py (184 lines) plus requirements.txt. #71 removed the Flask backend/; this removes the Python leftovers inside the Cloud Functions directory itself.

Every Python entry point is already superseded, and the TypeScript version adds the two agent functions Python never had:

functions/main.py functions/src/index.ts
create_user_profile createUserProfile
get_tax_documents getTaxDocuments
get_tax_summary getTaxSummary
process_new_tax_document processNewTaxDocument
runAccountant, runAuditor

Why this is more than dead code

firebase.json declares source: "functions" with no explicit runtime. The Firebase CLI infers the runtime from the manifest it finds in that directory — package.json means Node, requirements.txt means Python. With both present and a valid main.py next to them, that inference had two defensible answers.

Removing the Python side makes the runtime unambiguous.

Vulnerability

This clears the last remaining pip finding after #71pytest 7.4.0, CVE-2025-71176 (Creation of Temporary File in Directory with Insecure Permissions, Medium 6.8). It came from functions/requirements.txt, which was never used by anything: the Cloud Functions tests run under Vitest in functions/test/.

Also updated

CONTRIBUTING.md still instructed contributors to pip install -r requirements.txt and run pytest. Replaced with the npm workspaces that actually exist, plus the typecheck step.

Verification

  • npx tsc --noEmit clean
  • npm run build produces functions/lib/index.js
  • 60/60 tests pass

Remaining after this

Five OpenTelemetry findings, all transitive under genkit@1.41.0 and all covered in #70: the latest genkit still pins the OTel 1.x line while the patches are on 2.x, and the advisories require a Jaeger propagator, a Prometheus exporter, or Baggage propagation — none of which this app enables. They are best left until genkit ships an OTel bump.

That would take the repository from 64 vulnerabilities to 5, none reachable.

🤖 Generated with Claude Code

functions/ contained a complete Python codebase alongside the live
TypeScript one: main.py plus requirements.txt. Every entry point in it has
a TypeScript equivalent in src/index.ts, which also adds the two agent
functions the Python version never had:

  create_user_profile      -> createUserProfile
  get_tax_documents        -> getTaxDocuments
  get_tax_summary          -> getTaxSummary
  process_new_tax_document -> processNewTaxDocument
  (none)                   -> runAccountant, runAuditor

Beyond dead code, this was a deployment hazard. firebase.json declares
`source: "functions"` with no explicit runtime, and the Firebase CLI infers
the runtime from the manifest it finds. With package.json and
requirements.txt both present, that inference had two valid answers.

It was also the last remaining pip vulnerability after #71: pytest 7.4.0,
CVE-2025-71176.

CONTRIBUTING.md still told contributors to `pip install -r requirements.txt`
and run `pytest`; updated to the npm workspaces that actually exist.

Verified: functions typechecks, builds to lib/index.js, and passes 60/60.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@chenyuan99 chenyuan99 self-assigned this Aug 24, 2026
@chenyuan99

Copy link
Copy Markdown
Owner Author

This PR does exactly what it claims; the two red checks are expected.

Check main 71a6563 this PR
License Compliance pass pass 7 → 0 — green for the first time, cleared by #71
Security Analysis 6 vulnerabilities 5 the pytest finding this PR removes
Dependency Quality 46 issues 46 unchanged — an npm-tree metric, untouched by deleting a requirements.txt

Security Analysis stays red only because FOSSA's gate is binary and 5 > 0.

Where the remaining 5 come from

All OpenTelemetry, all transitive under genkit@1.41.0:

CVE Package Severity Requires
CVE-2026-44902 auto-instrumentations-node, sdk-node High 7.5 Prometheus exporter running and exposed
CVE-2026-59892 propagator-jaeger High 7.5 Jaeger propagator configured
CVE-2026-54285 core (×2) Medium 5.3 W3C Baggage propagation

functions/src/ai.ts is genkit({ plugins: [googleAI()] }) — no Prometheus exporter, no Jaeger propagator, no Baggage. None of these code paths execute. FOSSA's own EPSS scores put them at 0.3–0.5% (28th–38th percentile).

They cannot be fixed by moving forward: genkit@1.41.0 is the latest and still pins the OTel 1.x line while the patches are on 2.x. Forcing 2.x through overrides under a genkit built against the 1.x API risks runtime breakage in exchange for patching code the app never runs. Best left until genkit ships an OTel bump.

Arc across #70, #71, #72

64 → 5 vulnerabilities, 7 → 0 license issues. The 8 remaining Dependabot alerts are the same OTel cluster plus docs/ mintlify transitives, both covered in #70.

Unrelated finding worth a separate issue

While reading the current Genkit docs I found that @genkit-ai/googleai is deprecated — npm's message is "Use @genkit-ai/google-genai package instead." This project pins ^1.28.0, last published 2026-03-26; the successor @genkit-ai/google-genai is at 1.41.0, matching genkit core.

That is relevant to the CLAUDE.md note deferring gemini-3 until "Genkit ships the fix" for thoughtSignature handling — the fix may exist in the successor package, and being pinned to a deprecated plugin would have prevented it from arriving. I have not verified that claim, and it does not affect the OTel findings above (those come through genkit core, not this plugin). Out of scope here.

🤖 Addressed by Claude Code

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