Skip to content

Apply OSCM naming convention to infrastructure and environment#747

Merged
forstmeier merged 2 commits intomasterfrom
infrastructure-and-environment-renaming
Feb 5, 2026
Merged

Apply OSCM naming convention to infrastructure and environment#747
forstmeier merged 2 commits intomasterfrom
infrastructure-and-environment-renaming

Conversation

@forstmeier
Copy link
Copy Markdown
Collaborator

@forstmeier forstmeier commented Feb 5, 2026

Overview

Apply consistent OSCM naming convention across infrastructure resources and application code.

Changes

  • Update application code environment variable references from PSF_* to OSCM_*
  • Update Rust datamanager default S3 bucket name from pocketsizefund-data to oscm-data
  • Update all AWS infrastructure resources to use oscm prefix
  • Update Flox environment name to fund (matches repository name)
  • Update pyproject.toml project name to fund (matches repository name)
  • Fixes Apply OSCM naming convention to infrastructure #697

Infrastructure resources updated:

  • S3 buckets: oscm-data-*, oscm-model-artifacts-*
  • ECR repositories: oscm/*
  • ECS cluster and services: oscm-*
  • Security groups: oscm-alb, oscm-ecs-tasks, oscm-vpc-endpoints
  • Service discovery namespace: oscm.local
  • CloudWatch log groups: /ecs/oscm/*
  • IAM roles and policies: oscm-*
  • SSM parameters: /oscm/*
  • Load balancer and target groups: oscm-*

Environment variable changes:

  • PSF_DATAMANAGER_BASE_URLOSCM_DATAMANAGER_BASE_URL
  • PSF_EQUITYPRICEMODEL_BASE_URLOSCM_EQUITYPRICEMODEL_BASE_URL
  • PSF_UNCERTAINTY_THRESHOLDOSCM_UNCERTAINTY_THRESHOLD

Context

This change implements a cleaner naming convention that separates project-level naming (using "fund" for the repository/environment) from infrastructure-level naming (using "oscm" as a concise organization identifier). This approach:

  • Makes the Flox environment and Python project name match the repository name ("fund")
  • Keeps AWS infrastructure naming concise with "oscm" prefix
  • Ensures all environment variables follow the OSCM_* convention
  • Maintains consistency across all infrastructure resources

All comprehensive checks passed:

  • Python: Linting and formatting completed successfully
  • Rust: Compilation, formatting, and linting completed successfully

Summary by CodeRabbit

  • Chores
    • Updated project branding and public names across configs and infrastructure (pocketsizefund → OSCM/fund).
    • Renamed environment variables used for service connectivity and configuration.
    • Changed default S3 bucket name and related metadata.
    • Adjusted repository workflow permissions to allow additional management actions.

Update all infrastructure resources and code references to use OSCM
naming convention for consistency and clarity.

Changes:
- Application code: Update environment variable names from PSF_* to OSCM_*
- Rust datamanager: Update default S3 bucket name to oscm-data
- Infrastructure: Rename all AWS resources to use oscm prefix
- Environment: Update Flox environment name to "fund"
- Project: Update pyproject.toml name to "fund"

Infrastructure resources updated:
- S3 buckets, ECR repositories, ECS services
- Security groups, service discovery namespace
- CloudWatch log groups, IAM roles and policies
- SSM parameters, load balancer, target groups

Environment variable changes:
- PSF_DATAMANAGER_BASE_URL → OSCM_DATAMANAGER_BASE_URL
- PSF_EQUITYPRICEMODEL_BASE_URL → OSCM_EQUITYPRICEMODEL_BASE_URL
- PSF_UNCERTAINTY_THRESHOLD → OSCM_UNCERTAINTY_THRESHOLD

Resolves #697

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@forstmeier forstmeier added rust Rust code updates python Python code updates labels Feb 5, 2026
Copilot AI review requested due to automatic review settings February 5, 2026 02:30
@forstmeier forstmeier added the rust Rust code updates label Feb 5, 2026
@forstmeier forstmeier added the python Python code updates label Feb 5, 2026
@github-project-automation github-project-automation Bot moved this to To Do in Overview Feb 5, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a consistent naming convention across the codebase, transitioning from "pocketsizefund" to "oscm" for infrastructure resources and environment variables, while aligning project-level naming with the repository name "fund".

Changes:

  • Updated all AWS infrastructure resources to use "oscm" prefix (S3 buckets, ECR repositories, ECS services, security groups, IAM roles, etc.)
  • Renamed environment variables from PSF_* to OSCM_* pattern
  • Updated project and environment names to "fund" to match repository name

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyproject.toml Changed project name from "pocketsizefund" to "fund"
maskfile.md Updated title from "Pocket Size Fund" to "OSCM"
infrastructure/parameters.py Updated SSM parameter paths and tags from "pocketsizefund" to "oscm"
infrastructure/main.py Renamed all AWS resources and environment variables to use "oscm" prefix
infrastructure/Pulumi.yaml Updated Pulumi project name and description to use "oscm"
applications/portfoliomanager/src/portfoliomanager/server.py Changed environment variable names from PSF_* to OSCM_*
applications/portfoliomanager/src/portfoliomanager/risk_management.py Updated UNCERTAINTY_THRESHOLD environment variable to OSCM_*
applications/equitypricemodel/src/equitypricemodel/server.py Changed DATAMANAGER_BASE_URL environment variable to OSCM_*
applications/datamanager/src/state.rs Updated default S3 bucket name from "pocketsizefund-data" to "oscm-data"
.github/workflows/close_stale_issues_and_pull_requests.yaml Added actions and contents permissions
.flox/env.json Changed environment name from "pocketsizefund" to "fund"

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

This PR standardizes naming from "pocketsizefund"/"PSF" to "oscm"/"OSCM" across infra and app configs, updates several environment variable keys and SSM parameter names, adjusts type hints/casts for Polars DataFrame usage, and expands workflow permissions.

Changes

Cohort / File(s) Summary
Environment & Project Config
\.flox/env.json, infrastructure/Pulumi.yaml, pyproject.toml, maskfile.md
Project name/metadata and documentation title updated from "pocketsizefund"/"Pocket Size Fund" to "oscm"/"fund"/"OSCM".
Infrastructure Exports & Parameters
infrastructure/__main__.py, infrastructure/parameters.py
Pulumi export and README generation renamed from psf_base_urloscm_base_url; SSM parameter paths and project tags updated to /oscm/... and oscm.
CI Workflow Permissions
.github/workflows/close_stale_issues_and_pull_requests.yaml
Added actions: write and contents: write permissions under workflow permissions.
Datamanager Defaults
applications/datamanager/src/state.rs
Default S3 bucket name changed from pocketsizefund-dataoscm-data (env fallback updated and log message adjusted).
Service Base URLs (env keys)
applications/equitypricemodel/src/equitypricemodel/server.py, applications/portfoliomanager/src/portfoliomanager/server.py
Environment variable keys changed from PSF_* to OSCM_* for DATAMANAGER/EQUITYPRICEMODEL base URLs; defaults unchanged.
Portfoliomanager Threshold Env
applications/portfoliomanager/src/portfoliomanager/risk_management.py
Renamed env var PSF_UNCERTAINTY_THRESHOLDOSCM_UNCERTAINTY_THRESHOLD (default 0.1 preserved).
Polars Typing Casts
applications/equitypricemodel/src/equitypricemodel/server.py, applications/equitypricemodel/.../predictions_schema.py, applications/equitypricemodel/.../tide_data.py, applications/portfoliomanager/.../portfolio_schema.py
Added cast imports and wrapped places that may return LazyFrame/DataFrame with cast("pl.DataFrame", ...) to make runtime types explicit; no control-flow changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: applying OSCM naming convention across infrastructure and environment configuration files.
Linked Issues check ✅ Passed All coding objectives from issue #697 are met: infrastructure resources updated to oscm naming, environment variables renamed (PSF_* to OSCM_*), and Flox environment naming updated to 'fund'.
Out of Scope Changes check ✅ Passed All changes are directly related to applying OSCM naming convention. Type hints additions (cast imports and wrappers) are minimal type-safety improvements aligned with the refactoring scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch infrastructure-and-environment-renaming

Comment @coderabbitai help to get the list of available commands and usage tips.

chrisaddy
chrisaddy previously approved these changes Feb 5, 2026
@github-project-automation github-project-automation Bot moved this from To Do to In Progress in Overview Feb 5, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 5, 2026

Greptile Overview

Greptile Summary

This PR applies a comprehensive naming convention update from pocketsizefund/PSF_* to oscm/OSCM_* across infrastructure and application code. The changes also include Polars type checking fixes.

Key Changes:

  • Environment variables: PSF_DATAMANAGER_BASE_URL, PSF_EQUITYPRICEMODEL_BASE_URL, PSF_UNCERTAINTY_THRESHOLDOSCM_* equivalents
  • AWS infrastructure: All resources (S3 buckets, ECR repos, ECS services, IAM roles, etc.) renamed from pocketsizefund-* to oscm-*
  • AWS Secrets Manager: pocketsizefund/production/environment_variablesoscm/production/environment_variables
  • SSM parameters: /pocketsizefund/*/oscm/*
  • Project naming: Flox environment and pyproject.toml use fund (repository name)
  • Pulumi export: psf_base_urloscm_base_url
  • Type safety: Added cast("pl.DataFrame", ...) for Polars LazyFrame collect() operations to resolve union type issues

Issue Found:

  • maskfile.md lines 250-253 still reference psf_base_url which will cause the invoke command to fail since the Pulumi export was renamed to oscm_base_url

Infrastructure Impact:
This change requires coordination with deployed infrastructure:

  • Check that AWS Secrets Manager secret oscm/production/environment_variables exists
  • Check that SSM parameters are migrated to /oscm/* paths
  • Verify ECS task definitions can access the renamed secret

Confidence Score: 3/5

  • Safe to merge after fixing maskfile.md reference to renamed Pulumi output
  • Score reflects one syntax error that will break the invoke command in maskfile.md. The naming convention changes are thorough and consistent, but require infrastructure coordination (Secrets Manager, SSM parameters). The Polars type casting improvements are sound.
  • maskfile.md requires fix before merge - lines 250-253 reference psf_base_url instead of oscm_base_url

Important Files Changed

Filename Overview
applications/equitypricemodel/src/equitypricemodel/server.py Updated env var PSF_DATAMANAGER_BASE_URL to OSCM_DATAMANAGER_BASE_URL and added Polars type casts
applications/portfoliomanager/src/portfoliomanager/server.py Updated env vars PSF_DATAMANAGER_BASE_URL and PSF_EQUITYPRICEMODEL_BASE_URL to OSCM_* and added type cast
infrastructure/main.py Comprehensive rename: all AWS resources, secrets, env vars, and exports updated from pocketsizefund/PSF_* to oscm/OSCM_*
maskfile.md Updated title to OSCM but missed updating psf_base_url references in invoke command (lines 250, 253)

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
maskfile.md (2)

250-256: ⚠️ Potential issue | 🔴 Critical

Stale reference to psf_base_url will cause runtime failure.

The Pulumi output was renamed from psf_base_url to oscm_base_url in infrastructure/__main__.py (line 1150), but this script still references the old name. The invoke command for datamanager and portfoliomanager will fail because the output no longer exists.

🐛 Proposed fix
-base_url=$(pulumi stack output psf_base_url --stack production 2>/dev/null || echo "")
+base_url=$(pulumi stack output oscm_base_url --stack production 2>/dev/null || echo "")

 if [ -z "$base_url" ]; then
-    echo "psf_base_url not found - infrastructure might not be deployed"
+    echo "oscm_base_url not found - infrastructure might not be deployed"
     exit 1
 fi

86-86: 🧹 Nitpick | 🔵 Trivial

Consider renaming the Docker buildx builder for consistency.

The buildx builder is still named psf-builder. For consistency with the OSCM naming convention, consider renaming it to oscm-builder.

♻️ Proposed fix
-docker buildx create --use --name psf-builder 2>/dev/null || docker buildx use psf-builder || (echo "Using default buildx builder" && docker buildx use default)
+docker buildx create --use --name oscm-builder 2>/dev/null || docker buildx use oscm-builder || (echo "Using default buildx builder" && docker buildx use default)
🤖 Fix all issues with AI agents
In `@applications/equitypricemodel/src/equitypricemodel/server.py`:
- Line 61: The environment variable lookup for DATAMANAGER_BASE_URL currently
only checks OSCM_DATAMANAGER_BASE_URL and defaults to "http://datamanager:8080",
which can break setups still using the old PSF_DATAMANAGER_BASE_URL; update the
logic that sets DATAMANAGER_BASE_URL to first try
os.getenv("OSCM_DATAMANAGER_BASE_URL"), then fall back to
os.getenv("PSF_DATAMANAGER_BASE_URL") (or the default) so legacy deployments
continue to work, and ensure the symbol DATAMANAGER_BASE_URL is assigned using
that prioritized lookup.

In `@applications/portfoliomanager/src/portfoliomanager/server.py`:
- Around line 66-71: The environment variable constants DATAMANAGER_BASE_URL and
EQUITYPRICEMODEL_BASE_URL currently only read OSCM_* names, which will break
deployments still using PSF_*; change the getenv logic for DATAMANAGER_BASE_URL
and EQUITYPRICEMODEL_BASE_URL to first check the OSCM_* var, then fall back to
the corresponding PSF_* var (and finally to the existing default URL) so both
new and legacy env names are honored during rollout; update any similar
constants to follow this OSCM then PSF then default pattern and keep names
DATAMANAGER_BASE_URL and EQUITYPRICEMODEL_BASE_URL to avoid downstream changes.

Comment thread applications/equitypricemodel/src/equitypricemodel/server.py
Comment thread applications/portfoliomanager/src/portfoliomanager/server.py
coderabbitai[bot]
coderabbitai Bot previously approved these changes Feb 5, 2026
Add explicit type casting to resolve type checker errors where Polars
operations return InProcessQuery | DataFrame union types but code expects
plain DataFrame objects.

Changes:
- Add typing.cast imports to affected files
- Cast .collect() results to DataFrame type
- Cast schema validation results to DataFrame type

Files updated:
- predictions_schema.py: Cast grouped aggregations and lazy collects
- portfolio_schema.py: Cast aggregation results
- server.py (both): Cast schema validation results
- tide_data.py: Cast data validation result

All Python checks now pass:
- Formatting: passed
- Linting: passed
- Type checking: passed (15 errors resolved)
- Tests: 79 passed
- Coverage: 94%

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 5, 2026

Additional Comments (1)

maskfile.md
Pulumi output variable name not updated - should be oscm_base_url instead of psf_base_url (updated in infrastructure/__main__.py:1150)

base_url=$(pulumi stack output oscm_base_url --stack production 2>/dev/null || echo "")

if [ -z "$base_url" ]; then
    echo "oscm_base_url not found - infrastructure might not be deployed"
Prompt To Fix With AI
This is a comment left during a code review.
Path: maskfile.md
Line: 250:253

Comment:
Pulumi output variable name not updated - should be `oscm_base_url` instead of `psf_base_url` (updated in `infrastructure/__main__.py:1150`)

```suggestion
base_url=$(pulumi stack output oscm_base_url --stack production 2>/dev/null || echo "")

if [ -z "$base_url" ]; then
    echo "oscm_base_url not found - infrastructure might not be deployed"
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@applications/equitypricemodel/src/equitypricemodel/predictions_schema.py`:
- Line 45: The variable lazy_frame is misleading because after calling
data.lazyframe.collect() it contains a concrete pl.DataFrame; rename the
variable (e.g., to df or data_frame) wherever it is defined and referenced to
reflect its actual type and update the cast expression cast("pl.DataFrame",
data.lazyframe.collect()) to use the new name (references: lazy_frame,
data.lazyframe.collect(), cast, pl.DataFrame) so readers aren’t confused about
LazyFrame vs DataFrame.

@graphite-app graphite-app Bot requested a review from chrisaddy February 5, 2026 02:54
@forstmeier forstmeier merged commit e07d25f into master Feb 5, 2026
8 checks passed
@forstmeier forstmeier deleted the infrastructure-and-environment-renaming branch February 5, 2026 02:55
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Overview Feb 5, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Python code updates rust Rust code updates

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Apply OSCM naming convention to infrastructure

3 participants