Skip to content

Fix query consistency and refresh dependencies#39

Open
dex-the-ai wants to merge 1 commit into
mainfrom
deps/update-2026-06-16
Open

Fix query consistency and refresh dependencies#39
dex-the-ai wants to merge 1 commit into
mainfrom
deps/update-2026-06-16

Conversation

@dex-the-ai

@dex-the-ai dex-the-ai commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • fix the airport and airline query endpoints to use request-plus scan consistency so newly written docs are immediately visible to N1QL-backed quickstart flows
  • refresh targeted npm dependencies (express, prettier, ts-jest, yaml) and update the lockfile with npm audit fix
  • clear production audit findings while keeping the remaining dev-only Jest/Istanbul audit drift deferred because it needs a breaking toolchain change

Verification

  • npm install
  • npm test (baseline on origin/main: 3 list/query suites failed before the consistency fix)
  • npm install express@^4.22.2 prettier@^3.8.4 ts-jest@^29.4.11 yaml@^2.9.0
  • npm audit fix
  • npm test
  • npm start
  • curl http://127.0.0.1:3100/api/v1/airport/list --get --data-urlencode country="United States" --data limit=2 --data offset=0
  • curl http://127.0.0.1:3100/api/v1/airport/direct-connections --get --data airport=SFO --data limit=2 --data offset=0
  • curl http://127.0.0.1:3100/api/v1/airline/to-airport --get --data airport=SFO --data limit=2 --data offset=0

Evidence

  • npm test passes after the fix: 16 suites / 16 tests.
  • Local walkthrough succeeded against the local travel-sample bucket, including airport listing, direct-connections lookup, airline-to-airport lookup, and the Swagger UI.
  • Visual proof captured from the Swagger surface:
    • tutorial-maintenance/runs/couchbase-examples__typescript-quickstart/2026-06-16T1848PDT/screenshots/swagger-ui.png
    • tutorial-maintenance/runs/couchbase-examples__typescript-quickstart/2026-06-16T1848PDT/walkthrough-swagger.webm
  • Supporting artifacts:
    • tutorial-maintenance/runs/couchbase-examples__typescript-quickstart/2026-06-16T1848PDT/verification.md
    • tutorial-maintenance/runs/couchbase-examples__typescript-quickstart/2026-06-16T1848PDT/walkthrough-http.txt
    • tutorial-maintenance/runs/couchbase-examples__typescript-quickstart/2026-06-16T1848PDT/npm-test-post-audit-fix.log
Walkthrough excerpt
$ curl http://127.0.0.1:3100/api/v1/airport/list?country=United%20States&limit=2&offset=0
[{"airportname":"Aberdeen Regional Airport","city":"Aberdeen","country":"United States","faa":"ABR"}, ...]

$ curl http://127.0.0.1:3100/api/v1/airport/direct-connections?airport=SFO&limit=2&offset=0
[{"destinationairport":"ABQ"},{"destinationairport":"ACV"}]

$ curl http://127.0.0.1:3100/api/v1/airline/to-airport?airport=SFO&limit=2&offset=0
[{"callsign":"AIRFRANS","country":"France","iata":"AF","icao":"AFR","name":"Air France"}, ...]

Notes

  • tutorial-maintenance/tutorials.json still says this repo's GitHub Actions runtime is Node 20.x, but the repo itself already declares Node 24 in CI/docs/runtime files.
  • Full npm audit still reports 19 moderate dev-only findings in the Jest/Istanbul stack; npm audit fix --force wants a breaking ts-jest change, so that larger toolchain move was deferred from this sweep.

Media evidence

  • Auto-attached reviewer-facing media from the local verification artifacts captured during this run.
  • This keeps the main PR body self-contained instead of relying on a follow-up comment for visual proof.

Swagger Ui

Notes
  • Local artifact path: tutorial-maintenance/runs/couchbase-examples__typescript-quickstart/2026-06-16T1848PDT/screenshots/swagger-ui.png

Walkthrough Swagger

Notes
  • Local artifact path: tutorial-maintenance/runs/couchbase-examples__typescript-quickstart/2026-06-16T1848PDT/walkthrough-swagger.webm

@dex-the-ai dex-the-ai requested a review from prajwal-pai77 June 16, 2026 02:16
@dex-the-ai

Copy link
Copy Markdown
Contributor Author

Owner ping for this maintenance PR: @prajwal-pai77

Requesting review from the manifest-listed owner(s) where GitHub does not already show a pending review request.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates several project dependencies in package.json and package-lock.json, and configures the Couchbase query options to use QueryScanConsistency.RequestPlus in both airline and airport controllers. The review feedback recommends importing and using the official QueryOptions type from the couchbase SDK instead of redefining it locally. Additionally, it highlights the performance implications of using RequestPlus consistency in production environments, suggesting eventual or state-based consistency as more performant alternatives.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

import { makeResponse } from '../shared/makeResponse'
import { getDatabase } from '../../db/connection'
import { GetResult, QueryResult } from 'couchbase'
import { GetResult, QueryResult, QueryScanConsistency } from 'couchbase'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Import QueryOptions from the couchbase SDK so that you can use the official SDK type instead of redefining it locally in multiple controller functions.

Suggested change
import { GetResult, QueryResult, QueryScanConsistency } from 'couchbase'
import { GetResult, QueryResult, QueryScanConsistency, QueryOptions } from 'couchbase'

LIMIT: number
OFFSET: number
}
scanConsistency: QueryScanConsistency

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Instead of defining a custom local QueryOptions type in multiple controller functions (which shadows the official SDK type and duplicates code), you can use the official QueryOptions type imported from the couchbase SDK. This reduces redundancy and improves maintainability.\n\nFor example, you can remove the local type QueryOptions block entirely and declare options as:\ntypescript\nlet options: QueryOptions\n

`
options = {
parameters: { COUNTRY: country, LIMIT: limit, OFFSET: offset },
scanConsistency: QueryScanConsistency.RequestPlus,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

While using QueryScanConsistency.RequestPlus is highly appropriate for quickstarts and tutorials to ensure newly created documents are immediately visible (Read-Your-Own-Writes consistency), it has significant performance implications in production. RequestPlus forces the query engine to wait for the indexer to catch up with the latest mutations, which can increase query latency and resource utilization under high write loads. For production environments, consider using eventual consistency (QueryScanConsistency.NotBounded) or state-based consistency (such as AtPlus using mutation tokens) to maintain high throughput and low latency.

import { makeResponse } from '../shared/makeResponse'
import { getDatabase } from '../../db/connection'
import { GetResult, QueryResult } from 'couchbase'
import { GetResult, QueryResult, QueryScanConsistency } from 'couchbase'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Import QueryOptions from the couchbase SDK so that you can use the official SDK type instead of redefining it locally in multiple controller functions.

Suggested change
import { GetResult, QueryResult, QueryScanConsistency } from 'couchbase'
import { GetResult, QueryResult, QueryScanConsistency, QueryOptions } from 'couchbase'

LIMIT: number
OFFSET: number
}
scanConsistency: QueryScanConsistency

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Instead of defining a custom local QueryOptions type in multiple controller functions (which shadows the official SDK type and duplicates code), you can use the official QueryOptions type imported from the couchbase SDK. This reduces redundancy and improves maintainability.\n\nFor example, you can remove the local type QueryOptions block entirely and declare options as:\ntypescript\nlet options: QueryOptions\n

@prajwal-pai77 prajwal-pai77 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @dex-the-ai
Can you pls check the comment regarding query scan eventual consistency instead of read your own writes consistency?

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