Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Add deployment_id and gpu_specification_id UUID to instances table
ALTER TABLE sis_api.instances ADD IF NOT EXISTS (deployment_id uuid, gpu_specification_id uuid);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- migration files ---'
git ls-files 'migrations/cassandra/keyspaces/sis_api/*' | sort

printf '%s\n' '--- repository test and migration references ---'
rg -n -i --glob '!vendor' --glob '!node_modules' \
  'cassandra|migration|migrations|IF NOT EXISTS|StorageAttachedIndex' \
  .github Makefile* README* go.mod go.sum package.json pyproject.toml 2>/dev/null | head -n 250

printf '%s\n' '--- likely test files ---'
git ls-files | rg -i '(^|/)(test|tests|spec|specs)(/|$)|(_test|\.spec|\.test)\.' | head -n 250

Repository: NVIDIA/nvcf

Length of output: 17899


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- migration test script ---'
wc -l migrations/cassandra/tests/test-execute-sqls.sh
cat -n migrations/cassandra/tests/test-execute-sqls.sh

printf '%s\n' '--- Cassandra migration tree ---'
git ls-files 'migrations/cassandra/**' | sort

printf '%s\n' '--- relevant migration contents ---'
for f in \
  migrations/cassandra/keyspaces/sis_api/01_init_keyspace.up.sql \
  migrations/cassandra/keyspaces/sis_api/03_init_tables.up.sql \
  migrations/cassandra/keyspaces/sis_api/07_add_deployment_and_gpu_spec_id.up.sql \
  migrations/cassandra/keyspaces/sis_api/08_add_indexes_for_deployment_and_gpu_spec_id.up.sql
do
  echo "### $f"
  cat -n "$f"
done

printf '%s\n' '--- tracked change summary ---'
git diff --stat
git status --short

Repository: NVIDIA/nvcf

Length of output: 31709


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- migration documentation ---'
for f in migrations/cassandra/README.md migrations/cassandra/keyspaces/README.md; do
  echo "### $f"
  cat -n "$f"
done

printf '%s\n' '--- migration test references ---'
rg -n -C 4 \
  'test-execute-sqls|migrations/cassandra/tests|execute_sqls\.sh|migrations/cassandra' \
  .github Makefile* BUILD* WORKSPACE* WORKSPACE.bazel 2>/dev/null | head -n 300

printf '%s\n' '--- migration executor ---'
wc -l migrations/cassandra/execute_sqls.sh
cat -n migrations/cassandra/execute_sqls.sh

printf '%s\n' '--- migration ordering and idempotency markers ---'
python3 - <<'PY'
from pathlib import Path

root = Path("migrations/cassandra/keyspaces")
for keyspace in sorted(p.parent.name for p in root.glob("*/01_init_keyspace.up.sql")):
    files = sorted(p.name for p in (root / keyspace).glob("*.up.sql"))
    print(keyspace, ":", ", ".join(files))
    for name in files:
        text = (root / keyspace / name).read_text()
        print(f"  {name}: IF NOT EXISTS={text.upper().count('IF NOT EXISTS')}")
PY

Repository: NVIDIA/nvcf

Length of output: 22912


Add coverage for the new Cassandra migrations.

Extend migrations/cassandra/tests/test-execute-sqls.sh to check both UUID columns, both indexes, migration ordering, and repeat application. If tests are intentionally omitted, document the reason in the Pull Request description.

📍 Affects 2 files
  • migrations/cassandra/keyspaces/sis_api/07_add_deployment_and_gpu_spec_id.up.sql#L2-L2 (this comment)
  • migrations/cassandra/keyspaces/sis_api/08_add_indexes_for_deployment_and_gpu_spec_id.up.sql#L2-L3
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@migrations/cassandra/keyspaces/sis_api/07_add_deployment_and_gpu_spec_id.up.sql`
at line 2, Extend migrations/cassandra/tests/test-execute-sqls.sh to cover
migrations 07 and 08: verify both UUID columns, both indexes, migration
ordering, and successful repeat application; the migration SQL files require no
direct changes. If coverage is intentionally omitted, document the reason in the
Pull Request description.

Source: Coding guidelines

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Indexes for deployment_id and gpu_specification_id
CREATE CUSTOM INDEX IF NOT EXISTS idx_instances_by_deployment_id ON sis_api.instances (deployment_id) USING 'StorageAttachedIndex';
CREATE CUSTOM INDEX IF NOT EXISTS idx_instances_by_gpu_specification_id ON sis_api.instances (gpu_specification_id) USING 'StorageAttachedIndex';
Loading