Skip to content

Add env-gated control for Google Sheets vocab writes (default-on)#13

Merged
MaheeGamage merged 3 commits into
feature/implement-v2from
copilot/task-6-pending-task
Jun 14, 2026
Merged

Add env-gated control for Google Sheets vocab writes (default-on)#13
MaheeGamage merged 3 commits into
feature/implement-v2from
copilot/task-6-pending-task

Conversation

Copilot AI commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Task 006 still had one open item: allow reading without writing vocabulary rows to Google Sheets. This PR adds an environment-controlled save gate with default-on behavior and updates task/docs to reflect completion.

  • Save gating (client + server)

    • Added env-driven gating for vocab persistence:
      • NEXT_PUBLIC_VOCAB_SAVING_ENABLED controls client-side save calls.
      • VOCAB_SAVING_ENABLED provides server-side runtime override for POST /api/vocab.
    • POST /api/vocab now short-circuits with { ok: true, skipped: 'disabled' } when saving is disabled.
  • Shared flag parsing

    • Introduced vocabSavingFlag.ts to centralize env parsing and falsey values (0 | false | no | off) and avoid duplicated logic.
  • Config + docs

    • Restored and tracked .env.local.example with auth vars plus save-toggle vars.
    • Updated README with build-time vs runtime behavior for the two flags.
    • Marked task 006 as in-review and checked off the pending env-toggle step in project tracking.
// src/modules/vocab-store/vocabSavingFlag.ts
export const isClientVocabSavingEnabled = (): boolean =>
  isEnabled(process.env.NEXT_PUBLIC_VOCAB_SAVING_ENABLED);

export const isServerVocabSavingEnabled = (): boolean =>
  isEnabled(process.env.VOCAB_SAVING_ENABLED ?? process.env.NEXT_PUBLIC_VOCAB_SAVING_ENABLED);

@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
finnish-learner Ready Ready Preview, Comment Jun 14, 2026 7:33am

@MaheeGamage
MaheeGamage marked this pull request as ready for review June 14, 2026 07:35
Copilot AI review requested due to automatic review settings June 14, 2026 07:35
@MaheeGamage
MaheeGamage merged commit 2f0cb27 into feature/implement-v2 Jun 14, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds environment-controlled gating for vocabulary persistence to Google Sheets so the app can be used in “read-only” mode without writing new vocab rows, while keeping default-on behavior.

Changes:

  • Introduces shared env parsing for save enablement (NEXT_PUBLIC_VOCAB_SAVING_ENABLED, optional server override VOCAB_SAVING_ENABLED).
  • Skips client save calls and short-circuits the server POST /api/vocab when saving is disabled.
  • Updates docs/tracking files and restores a committed .env.local.example.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/modules/vocab-store/vocabSavingFlag.ts Centralized default-on env flag parsing for client/server save gating.
src/modules/vocab-store/saveVocab.ts Client-side early return when vocab saving is disabled.
src/app/api/vocab/route.ts Server-side POST early return when saving is disabled.
README.md Documents the two env flags and clarifies build-time vs server override usage.
.project/tasks/task-006_google-sheets-adapter.md Marks task status/step completion and logs the save-toggle implementation.
.project/overview.md Updates task-006 status to in-review in project overview.
.gitignore Un-ignores .env.local.example so it can be committed.
.env.local.example Adds example env file including auth vars and save-toggle vars.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +71 to +73
- 2026-06-13: Added env save-toggle (`NEXT_PUBLIC_VOCAB_SAVING_ENABLED`, optional server
override `VOCAB_SAVING_ENABLED`) with default-on behavior. When disabled, client skips
save requests and server POST short-circuits safely.
@MaheeGamage
MaheeGamage deleted the copilot/task-6-pending-task branch June 17, 2026 11:00
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.

3 participants