Skip to content

feat: tiered CI pipeline with self-hosted runner (#44)#51

Merged
jh-lee-cryptolab merged 10 commits intomainfrom
worktree-worktree-issue-44-ci-pipeline
Apr 7, 2026
Merged

feat: tiered CI pipeline with self-hosted runner (#44)#51
jh-lee-cryptolab merged 10 commits intomainfrom
worktree-worktree-issue-44-ci-pipeline

Conversation

@jh-lee-cryptolab
Copy link
Copy Markdown
Contributor

@jh-lee-cryptolab jh-lee-cryptolab commented Apr 7, 2026

Context

No automated test execution on PRs — tests run manually before merging. Regressions can slip through undetected.

TL;DR

Self-hosted CI runner on OCI + GitHub Actions workflow for automated lint, test, and Docker build. Test suite cleaned up to focus on vault logic only, with fixture-based integration tests for the decrypt pipeline.

Summary

  • Add OCI Terraform config for self-hosted GitHub Actions runner (2 OCPU / 8 GB, 3 concurrent jobs)
  • Add CI workflow (ci.yml) with check job (format → lint → test) and build-image job (main push only)
  • Add .mise.ci.toml for CI-minimal toolset (python/buf/ruff only) via MISE_ENV=ci
  • Switch docker-publish.yml to self-hosted runner
  • Remove pyenvector-only unit tests (test_crypto.py) and trim test_public_key.py — unit tests now verify vault logic only
  • Remove old integration tests (unit test duplicates)
  • Add fixture generation script (scripts/generate-test-fixtures.py) that captures real CiphertextScore blobs from enVector Cloud
  • Add fixture-based integration tests for _decrypt_scores_impl (protobuf → FHE decrypt → top-K) and _decrypt_metadata_impl (HKDF → AES decrypt)

Alternatives

  • ubuntu-latest runners: rejected — all CI on self-hosted for consistent environment and no per-minute billing
  • Separate e2e tier with live enVector: rejected — Vault is a decryption-only server with no runtime enVector calls; fixture-based integration tests provide sufficient coverage
  • Testing pyenvector encrypt/decrypt in unit tests: rejected — not vault logic, pyenvector's responsibility

Test plan

  • CI workflow triggers on PR push (check job: format, lint, 157 tests)
  • Docker build + smoke test runs on push to main only
  • Self-hosted runner picks up jobs (labels: self-hosted, vault-ci)
  • 153 unit tests pass — vault logic only (token auth, admin API, audit, validation, decrypt top-K, metadata DEK)
  • 4 integration tests pass — real CiphertextScore decrypt + metadata decrypt via fixtures
  • Fixtures committed to repo, no enVector Cloud access needed in CI

Closes #44

@jh-lee-cryptolab jh-lee-cryptolab self-assigned this Apr 7, 2026
@jh-lee-cryptolab jh-lee-cryptolab force-pushed the worktree-worktree-issue-44-ci-pipeline branch 2 times, most recently from 10b84d7 to 0a6d8f2 Compare April 7, 2026 02:07
jh-lee-cryptolab and others added 4 commits April 7, 2026 12:12
Terraform config and bootstrap script for a GitHub Actions self-hosted
runner on OCI Compute (VM.Standard.E5.Flex, 2 OCPU / 8 GB). Installs
Docker CE and registers the runner with labels self-hosted + vault-ci.
Supports 3 concurrent jobs. Node.js 24 forced for GitHub Actions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Single-job CI on self-hosted vault-ci runner: format:check → lint →
test (unit + integration). Docker build + smoke test on push to main
only. Uses .mise.ci.toml via MISE_ENV=ci. Adds curl to Dockerfile
runtime. Switches docker-publish.yml to self-hosted runner.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Delete test_crypto.py (7) and integration/test_vault_api.py (5) which
tested pyenvector, not vault logic. Trim test_public_key.py (7→3).
Update mise test task to include integration tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fixture generation script captures real CiphertextScore blobs from
enVector Cloud and AES metadata envelopes. Fixtures committed so CI
runs without cloud access. Tests verify _decrypt_scores_impl (protobuf
→ FHE decrypt → top-K) and _decrypt_metadata_impl (HKDF → AES).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jh-lee-cryptolab jh-lee-cryptolab force-pushed the worktree-worktree-issue-44-ci-pipeline branch from 555904f to 5edea73 Compare April 7, 2026 03:14
jh-lee-cryptolab and others added 2 commits April 7, 2026 13:55
EMBEDDING_DIM (384) and FHE_DIM (1024) were incorrectly separated.
pyenvector Cipher dim is the vector dimension, not a crypto parameter.
Unify to a single DIM=768, fix index.delete_index() → index.drop(),
and regenerate all test fixtures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Unify EMBEDDING_DIM/FHE_DIM to single DIM=768
- Generate document vectors with controlled query similarity (0.3~0.9)
- Use randn + L2 normalize for realistic cosine similarity distribution
- Clean up stale server keys/index before regeneration
- Fix index cleanup: delete_index() → drop()
- Regenerate all fixtures with dim=768

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@heeyeon01
Copy link
Copy Markdown

The current fixture setup documents the input and output formats. Given that security is critical for this repository, I wonder exposing this level of detailed sample data is appropriate?

Comment thread ci/oci/main.tf Outdated
- Add tests/fixtures.tar.gz.gpg (AES256 symmetric encryption)
- Add tests/fixtures/ to .gitignore (plaintext decrypted at test time)
- Add mise tasks: fixtures:decrypt, fixtures:encrypt
- GPG passphrase managed via FIXTURES_GPG_PASSPHRASE env / GitHub secret

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jh-lee-cryptolab jh-lee-cryptolab force-pushed the worktree-worktree-issue-44-ci-pipeline branch from 5ce16e1 to 1b1cc47 Compare April 7, 2026 05:25
jh-lee-cryptolab and others added 3 commits April 7, 2026 14:26
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove public SSH access (0.0.0.0/0:22) and ssh_authorized_keys from
CI runner instance. Access via OCI Cloud Shell instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread .github/workflows/docker-publish.yml
Copy link
Copy Markdown
Contributor

@sunchuljung sunchuljung left a comment

Choose a reason for hiding this comment

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

LGTM

@jh-lee-cryptolab
Copy link
Copy Markdown
Contributor Author

jh-lee-cryptolab commented Apr 7, 2026

The current fixture setup documents the input and output formats. Given that security is critical for this repository, I wonder exposing this level of detailed sample data is appropriate?

@heeyeon01 Thanks for the review. All the fixtures are now encrypted with gpg key for security.

@jh-lee-cryptolab jh-lee-cryptolab merged commit f0dd6ea into main Apr 7, 2026
2 checks passed
@jh-lee-cryptolab jh-lee-cryptolab deleted the worktree-worktree-issue-44-ci-pipeline branch April 7, 2026 05:54
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.

Tiered CI pipeline: unit → integration → e2e with self-hosted runner

3 participants