Skip to content

fix(templates): match function template variables to their code - #15414

Merged
HarshMN2345 merged 1 commit into
mainfrom
fix-template-variable-names
Nov 9, 2026
Merged

HarshMN2345 merged 1 commit into
mainfrom
fix-template-variable-names

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Fixes #15372.

  • sync-with-pinecone and rag-with-langchain asked for PINECONE_INDEX_NAME; the code at 1.2.0 reads PINECONE_INDEX_ID.
  • generate-with-replicate asked for REPLICATE_API_KEY; the code reads REPLICATE_API_TOKEN.
  • Removes the duplicate generate-with-replicate entry.

@luxor-code-review

luxor-code-review Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Review complete. No blocking issues — approved ✅; 2 nitpicks below.

🧹 Nitpicks (2) — 🟢 2 low
  • 🟢 Stale "name of the index" wording on PINECONE_INDEX_ID (function.php:1802) — The variable was renamed from PINECONE_INDEX_NAME to PINECONE_INDEX_ID (app/config/templates/function.php:1802), but its description still reads "The name of the index in Pinecone." with placeholder my-index.
  • 🟢 Console docs still instruct REPLICATE_API_KEY (index.markdoc) — The template variable was renamed to REPLICATE_API_TOKEN (app/config/templates/function.php:1663), but the console integration guide still tells users to add REPLICATE_API_KEY in the Variables step of apps/console/src/content/docs/products/ai/integrations/replicate/index.markdoc.

This change aligns the function template catalog in app/config/templates/function.php with the variable names the starter code actually reads: the Replicate generate-image template now expects REPLICATE_API_TOKEN instead of REPLICATE_API_KEY, and the Pinecone vector-search template now expects PINECONE_INDEX_ID instead of PINECONE_INDEX_NAME. A duplicated generate-with-replicate template entry is also dropped so the catalog no longer advertises the same starter twice.

Files Change
app/config/templates/function.php Renames REPLICATE_API_KEY to REPLICATE_API_TOKEN and PINECONE_INDEX_NAME to PINECONE_INDEX_ID, and removes the duplicate generate-with-replicate entry from the template catalog.

Reviewed commit: e64f975

@appwrite

appwrite Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The function template catalog now uses the environment variable names expected by the Replicate and Pinecone template code. It also removes the duplicate Replicate entry.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 1
File Change
app/config/templates/function.php Renamed the Replicate and Pinecone variable keys and removed the duplicate Replicate template.
🔇 Filtered out · 1

Findings Hansi considered but did not post.

Finding Why
Add regression coverage for template variable names Verifier: AGENTS.md says unit tests must not mirror config shape or values. A test that asserts template variable names would do exactly that. The change is a config value fix, and the repo has no comparable tests for template contents, so a missing-test comment here is not warranted.

Reviewed e64f975 · Details · Comment @appwrite review to re-run, or mention @appwrite with a question.

@appwrite appwrite Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Tier S · Looks good to merge. Summary

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix-template-variable-names (after).

Metric Before After Change
🚀 Requests/sec 212.59 216.32 ⚪ +1.8%
⏱️ Latency P50 79.31 ms 79.85 ms ⚪ +0.7%
⏱️ Latency P95 195.83 ms 188.23 ms ⚪ -3.9%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 79.85 188.23 13,680 216.32 -7.61
Account 154.75 307.38 720 12.15 +38.45
TablesDB 76.66 142.25 7,440 120.7 -14.83
Storage 74.72 165.16 3,600 59.83 -7.91
Functions 115.39 231.49 1,920 32.54 +10.91

Top API waits (after)

API request Max wait (ms)
account.name.update 562.89
functions.create 401.89
account.prefs.update 341.1
tablesdb.rows.create 332.42
account.get 325.08

@HarshMN2345
HarshMN2345 merged commit 0c52b62 into main Nov 9, 2026
69 checks passed
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

6 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (3)
  • php.appwrite.secret-compare-timing (1)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

adityaoberai added a commit that referenced this pull request Nov 9, 2026
Stripe, Autodesk and Box sign-in, and the Pinecone, LangChain RAG,
Replicate and Redis Cloud templates were held back from the catalog because
they didn't work as released. Their fixes are merged (#15414, #15416,
#15417, #15421 and appwrite/templates#498), so add their pages:

- Autodesk is new. The others come from the held-back drafts, without the
  workarounds for the template variable names and the hardcoded Redis port.
- The template pages say what Any execute access exposes and how to narrow
  it, like the other template pages.
- The pages list Cloud only, because no self-hosted release includes the
  fixes yet.

Each page gets a cover in the catalog style. Etsy sign-in and the GitHub
issue bot template still don't work, so they stay out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ChiragAgg5k pushed a commit that referenced this pull request Nov 12, 2026
fix(templates): match function template variables to their code

(cherry picked from commit 0c52b62)
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.

🐛 Bug Report: Pinecone, LangChain RAG and Replicate function templates ask for variables their code doesn't read

1 participant