Skip to content

🐏🎀 ↝ [zihdoc te6e1b g5zk5h ++]: Posthog survey & major dx changes#219

Merged
Gizmotronn merged 11 commits intomainfrom
survey-tests
Feb 21, 2026
Merged

🐏🎀 ↝ [zihdoc te6e1b g5zk5h ++]: Posthog survey & major dx changes#219
Gizmotronn merged 11 commits intomainfrom
survey-tests

Conversation

@Gizmotronn
Copy link
Member

This pull request significantly refactors the project's GitHub Actions CI/CD workflows by consolidating multiple separate workflow files into a single, unified pipeline (.github/workflows/pipeline.yml). It also updates configuration for development and testing environments, and makes minor improvements to linting and Docker ignore settings. The changes aim to simplify maintenance, improve reliability, and centralize automation logic.

CI/CD Workflow Consolidation and Improvements:

  • Replaces several individual workflow files (build, test, E2E, CodeQL, notifications, anomaly log deletion, SolarHealth unlock, and Supabase table check) with a single, comprehensive workflow in .github/workflows/pipeline.yml. The new pipeline orchestrates testing, building, deployment, scheduled maintenance, and security analysis, with conditional steps and improved environment handling.
  • Removes the following obsolete workflow files, transferring their logic into the new pipeline:
    • .github/workflows/build.yml
    • .github/workflows/codeql.yml
    • .github/workflows/cypress.yml.go
    • .github/workflows/e2e.yml.go
    • .github/workflows/eventstable.yml.txt
    • .github/workflows/notify-unclassified-discoveries.yml
    • .github/workflows/delete-push-anomaly-log.yml
    • .github/workflows/unlock-solarhealth-anomalies.yml

Environment and Configuration Updates:

  • Adds PostHog analytics environment variables to .env.example to support analytics integration.
  • Adds a DATABASE_URL for local Postgres to .env.test to improve test consistency and local development setup.

Linting and Docker Ignore Adjustments:

  • Updates .eslintrc.json to disable several TypeScript and React linting rules, reducing noise and friction during development.
  • Refines .dockerignore to only ignore Docker Compose files in the ops/compose/ directory, making Docker context more precise.

These changes centralize and streamline CI/CD automation, improve local and test environment configuration, and make development smoother by reducing unnecessary lint warnings.

@Gizmotronn Gizmotronn self-assigned this Feb 21, 2026
@github-advanced-security
Copy link
Contributor

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Check failure

Code scanning / CodeQL

Insecure randomness

This uses a cryptographically insecure random number generated at [Math.random()](1) in a security context.

Copilot Autofix

AI 8 days ago

In general, to fix insecure randomness in browser/React code, replace uses of Math.random() in security‑sensitive contexts with crypto.getRandomValues, which is a cryptographically secure pseudorandom number generator. For generating a random floating‑point number in [0, 1), you can take an unsigned 32‑bit integer from crypto.getRandomValues(new Uint32Array(1))[0] and scale it by 2^-32. This avoids predictability while still fitting into the same usage pattern as Math.random().

For this specific file, src/components/discovery/data-sources/Astronomers/PlanetHunters/PlanetGenerator.tsx, we should introduce a small helper function that returns a secure random float in [0, 1) and then replace the two usages of Math.random() used to compute latitude and longitude. This will preserve existing behavior (still generating a uniform‑like float in [0,1) and mapping it into the same angle ranges) but use a cryptographically secure source. The helper can be defined near the top of the file (after imports) and implemented using window.crypto.getRandomValues with a Uint32Array. No existing imports need to change; no new external dependencies are necessary.

Concretely:

  • Add a secureRandom() helper that returns a number in [0,1).
  • Replace:
    • latitude: Math.random() * 180 - 90 with latitude: secureRandom() * 180 - 90
    • longitude: Math.random() * 360 - 180 with longitude: secureRandom() * 360 - 180
      in both the catch block and the else block where the fallback position is set.
      This maintains functionality while eliminating the insecure RNG.
Suggested changeset 1
src/components/discovery/data-sources/Astronomers/PlanetHunters/PlanetGenerator.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/components/discovery/data-sources/Astronomers/PlanetHunters/PlanetGenerator.tsx b/src/components/discovery/data-sources/Astronomers/PlanetHunters/PlanetGenerator.tsx
--- a/src/components/discovery/data-sources/Astronomers/PlanetHunters/PlanetGenerator.tsx
+++ b/src/components/discovery/data-sources/Astronomers/PlanetHunters/PlanetGenerator.tsx
@@ -16,6 +16,17 @@
 import { Textarea } from "@/src/components/ui/textarea";
 import { mergeClassificationConfiguration } from "@/src/lib/gameplay/classification-configuration";
 
+// Generate a cryptographically secure random number in the range [0, 1)
+function secureRandom(): number {
+  if (typeof window !== "undefined" && window.crypto && window.crypto.getRandomValues) {
+    const array = new Uint32Array(1);
+    window.crypto.getRandomValues(array);
+    return array[0] * Math.pow(2, -32);
+  }
+  // Fallback to Math.random() if crypto is unavailable (should be rare)
+  return Math.random();
+}
+
 interface PlanetGeneratorProps {
   classificationId: string;
   editMode?: boolean;
@@ -254,14 +265,14 @@
               position = typeof configLocation === 'string' ? JSON.parse(configLocation) : configLocation;
             } catch {
               position = {
-                latitude: Math.random() * 180 - 90,
-                longitude: Math.random() * 360 - 180,
+                latitude: secureRandom() * 180 - 90,
+                longitude: secureRandom() * 360 - 180,
               };
             }
           } else {
             position = {
-              latitude: Math.random() * 180 - 90,
-              longitude: Math.random() * 360 - 180,
+              latitude: secureRandom() * 180 - 90,
+              longitude: secureRandom() * 360 - 180,
             };
           }
 
EOF
@@ -16,6 +16,17 @@
import { Textarea } from "@/src/components/ui/textarea";
import { mergeClassificationConfiguration } from "@/src/lib/gameplay/classification-configuration";

// Generate a cryptographically secure random number in the range [0, 1)
function secureRandom(): number {
if (typeof window !== "undefined" && window.crypto && window.crypto.getRandomValues) {
const array = new Uint32Array(1);
window.crypto.getRandomValues(array);
return array[0] * Math.pow(2, -32);
}
// Fallback to Math.random() if crypto is unavailable (should be rare)
return Math.random();
}

interface PlanetGeneratorProps {
classificationId: string;
editMode?: boolean;
@@ -254,14 +265,14 @@
position = typeof configLocation === 'string' ? JSON.parse(configLocation) : configLocation;
} catch {
position = {
latitude: Math.random() * 180 - 90,
longitude: Math.random() * 360 - 180,
latitude: secureRandom() * 180 - 90,
longitude: secureRandom() * 360 - 180,
};
}
} else {
position = {
latitude: Math.random() * 180 - 90,
longitude: Math.random() * 360 - 180,
latitude: secureRandom() * 180 - 90,
longitude: secureRandom() * 360 - 180,
};
}

Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
@Gizmotronn Gizmotronn merged commit 84d5121 into main Feb 21, 2026
16 checks passed
Copy link
Member Author

@Gizmotronn Gizmotronn left a comment

Choose a reason for hiding this comment

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

Checks seemed to pass, now it's up to the merge...

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.

1 participant