Skip to content
Merged
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
18 changes: 9 additions & 9 deletions apps/gittensory-miner-ui/src/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ describe("isAuthenticatedRequest (#4858)", () => {
});

it("skips a malformed cookie pair with no '=' separator, without throwing", () => {
expect(isAuthenticatedRequest(`malformed; gittensory_miner_ui_token=${TOKEN}`, TOKEN)).toBe(true);
expect(isAuthenticatedRequest(`malformed; loopover_miner_ui_token=${TOKEN}`, TOKEN)).toBe(true);
});

it("skips a cookie pair with an empty name (leading '=')", () => {
expect(isAuthenticatedRequest(`=novalue; gittensory_miner_ui_token=${TOKEN}`, TOKEN)).toBe(true);
expect(isAuthenticatedRequest(`=novalue; loopover_miner_ui_token=${TOKEN}`, TOKEN)).toBe(true);
});

it("rejects the auth cookie when its value doesn't match the server's token", () => {
expect(isAuthenticatedRequest("gittensory_miner_ui_token=wrong-value", TOKEN)).toBe(false);
expect(isAuthenticatedRequest("loopover_miner_ui_token=wrong-value", TOKEN)).toBe(false);
});

it("accepts the auth cookie when its value matches the server's token exactly", () => {
expect(isAuthenticatedRequest(`gittensory_miner_ui_token=${TOKEN}`, TOKEN)).toBe(true);
expect(isAuthenticatedRequest(`loopover_miner_ui_token=${TOKEN}`, TOKEN)).toBe(true);
});
});

Expand All @@ -41,7 +41,7 @@ describe("handleAuthRequest (#4858)", () => {
});

it("falls through (null) for an authenticated /api/* request", () => {
expect(handleAuthRequest("/api/portfolio-queue", `gittensory_miner_ui_token=${TOKEN}`, TOKEN)).toBeNull();
expect(handleAuthRequest("/api/portfolio-queue", `loopover_miner_ui_token=${TOKEN}`, TOKEN)).toBeNull();
});

it("returns a 401 JSON body for an unauthenticated /api/* request", () => {
Expand Down Expand Up @@ -101,7 +101,7 @@ describe("authPlugin (#4858)", () => {
middleware({ url: "/", headers: {} }, res, () => {
calledNext = true;
});
expect(headers["Set-Cookie"]).toBe(`gittensory_miner_ui_token=${TOKEN}; HttpOnly; SameSite=Strict; Path=/`);
expect(headers["Set-Cookie"]).toBe(`loopover_miner_ui_token=${TOKEN}; HttpOnly; SameSite=Strict; Path=/`);
expect(calledNext).toBe(true);
});

Expand All @@ -128,18 +128,18 @@ describe("authPlugin (#4858)", () => {
const middleware = captureMiddleware();
const { res, headers } = fakeResponse();
let calledNext = false;
middleware({ url: "/api/portfolio-queue", headers: { cookie: `gittensory_miner_ui_token=${TOKEN}` } }, res, () => {
middleware({ url: "/api/portfolio-queue", headers: { cookie: `loopover_miner_ui_token=${TOKEN}` } }, res, () => {
calledNext = true;
});
expect(calledNext).toBe(true);
expect(headers["Set-Cookie"]).toBe(`gittensory_miner_ui_token=${TOKEN}; HttpOnly; SameSite=Strict; Path=/`);
expect(headers["Set-Cookie"]).toBe(`loopover_miner_ui_token=${TOKEN}; HttpOnly; SameSite=Strict; Path=/`);
});

it("uses deps.generateToken so a fixed test token is deterministic across requests", () => {
const middleware = captureMiddleware({ generateToken: () => "fixed-token-123" });
const { res } = fakeResponse();
let calledNext = false;
middleware({ url: "/api/ledgers", headers: { cookie: "gittensory_miner_ui_token=fixed-token-123" } }, res, () => {
middleware({ url: "/api/ledgers", headers: { cookie: "loopover_miner_ui_token=fixed-token-123" } }, res, () => {
calledNext = true;
});
expect(calledNext).toBe(true);
Expand Down
2 changes: 1 addition & 1 deletion apps/gittensory-miner-ui/vite-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import type { Plugin } from "vite";
// request never reaches any of them. This also means any FUTURE /api/* endpoint (e.g. a write action) is
// covered automatically, with no per-endpoint auth wiring required.

const COOKIE_NAME = "gittensory_miner_ui_token";
const COOKIE_NAME = "loopover_miner_ui_token";

export type AuthDeps = {
/** Injectable so tests get a deterministic token instead of a real random one. */
Expand Down
14 changes: 7 additions & 7 deletions packages/gittensory-engine/src/miner-prediction-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
// Scoped as an on-demand RENDERER, not a live HTTP registry: gittensory-miner is a local CLI, not a daemon, so a
// caller renders this to stdout for its own scrape/cron setup and reads the ledger itself (no data collection of
// its own lives here — this stays a pure, side-effect-free function like the rest of gittensory-engine). It mirrors
// the metric-naming (`gittensory_miner_*_total`) and HELP/TYPE/label conventions of src/selfhost/metrics.ts rather
// the metric-naming (`loopover_miner_*_total`) and HELP/TYPE/label conventions of src/selfhost/metrics.ts rather
// than importing across the package boundary.
//
// Counters emitted:
// - `gittensory_miner_predictions_total{conclusion="..."}` — predictions recorded, one series per predicted
// - `loopover_miner_predictions_total{conclusion="..."}` — predictions recorded, one series per predicted
// conclusion (e.g. merge/close/hold).
// - `gittensory_miner_prediction_correct_total` — predictions whose realized outcome matched the prediction.
// - `gittensory_miner_prediction_incorrect_total` — predictions whose realized outcome differed.
// - `loopover_miner_prediction_correct_total` — predictions whose realized outcome matched the prediction.
// - `loopover_miner_prediction_incorrect_total` — predictions whose realized outcome differed.
// The correct/incorrect counters only move for rows carrying a resolved outcome; unresolved rows count toward
// `predictions_total` only, so the surface is meaningful before outcome-pairing exists and grows once it does.

export const MINER_PREDICTIONS_TOTAL = "gittensory_miner_predictions_total";
export const MINER_PREDICTION_CORRECT_TOTAL = "gittensory_miner_prediction_correct_total";
export const MINER_PREDICTION_INCORRECT_TOTAL = "gittensory_miner_prediction_incorrect_total";
export const MINER_PREDICTIONS_TOTAL = "loopover_miner_predictions_total";
export const MINER_PREDICTION_CORRECT_TOTAL = "loopover_miner_prediction_correct_total";
export const MINER_PREDICTION_INCORRECT_TOTAL = "loopover_miner_prediction_incorrect_total";

/** One prediction-ledger row for metrics: its predicted `conclusion`, plus an optional realized-outcome pairing
* (`correct`: true = matched, false = differed, null/undefined = not yet resolved). */
Expand Down
2 changes: 1 addition & 1 deletion packages/gittensory-miner/lib/deny-hook-synthesis.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function resolveDenyHookSynthesisDbPath(env = process.env) {
const configHome = typeof env.XDG_CONFIG_HOME === "string" && env.XDG_CONFIG_HOME.trim()
? env.XDG_CONFIG_HOME.trim()
: join(homedir(), ".config");
return join(configHome, "gittensory-miner", defaultDbFileName);
return join(configHome, "loopover-miner", defaultDbFileName);
}

function normalizeDbPath(dbPath) {
Expand Down
6 changes: 3 additions & 3 deletions packages/gittensory-miner/lib/event-ledger-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ export function renderLedgerTable(events) {

const EVENT_LEDGER_METRICS_USAGE = "Usage: gittensory-miner ledger metrics";

// Prometheus metric name for the per-type event-ledger counter. Mirrors the `gittensory_miner_*_total` naming and
// Prometheus metric name for the per-type event-ledger counter. Mirrors the `loopover_miner_*_total` naming and
// the HELP/TYPE/label conventions of the engine's renderMinerPredictionMetrics
// (packages/gittensory-engine/src/miner-prediction-metrics.ts) rather than importing across the package boundary.
const MINER_EVENTS_TOTAL = "gittensory_miner_events_total";
const MINER_EVENTS_TOTAL = "loopover_miner_events_total";

/** HELP-text escaping — backslash + newline (mirrors miner-prediction-metrics.ts's escapeHelpText). */
function escapeHelpText(help) {
Expand All @@ -184,7 +184,7 @@ function escapeLabelValue(value) {
}

/**
* Render event-ledger activity as Prometheus text-exposition counters: one `gittensory_miner_events_total{type}`
* Render event-ledger activity as Prometheus text-exposition counters: one `loopover_miner_events_total{type}`
* series per event type, so a self-hoster's own Grafana/alerting can scrape ledger activity instead of polling
* `ledger list --json` (#4841). Pure + side-effect-free — the caller supplies the rows and prints the result;
* deterministic (series emitted in sorted type order); always emits HELP/TYPE so an empty ledger is still a
Expand Down
2 changes: 1 addition & 1 deletion packages/gittensory-miner/lib/governor-ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function resolveGovernorLedgerDbPath(env = process.env) {
const configHome = typeof env.XDG_CONFIG_HOME === "string" && env.XDG_CONFIG_HOME.trim()
? env.XDG_CONFIG_HOME.trim()
: join(homedir(), ".config");
return join(configHome, "gittensory-miner", defaultDbFileName);
return join(configHome, "loopover-miner", defaultDbFileName);
}

function normalizeDbPath(dbPath) {
Expand Down
4 changes: 2 additions & 2 deletions packages/gittensory-miner/lib/governor-metrics-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { argsWantJson, describeCliError, reportCliFailure } from "./cli-error.js

const GOVERNOR_METRICS_USAGE = "Usage: gittensory-miner governor metrics";

export const GOVERNOR_RATE_LIMIT_REMAINING_RATIO = "gittensory_miner_governor_rate_limit_remaining_ratio";
export const GOVERNOR_CAP_USAGE_RATIO = "gittensory_miner_governor_cap_usage_ratio";
export const GOVERNOR_RATE_LIMIT_REMAINING_RATIO = "loopover_miner_governor_rate_limit_remaining_ratio";
export const GOVERNOR_CAP_USAGE_RATIO = "loopover_miner_governor_cap_usage_ratio";

/** HELP-text escaping — backslash + newline (mirrors miner-prediction-metrics.ts's escapeHelpText). */
function escapeMetricsHelpText(help) {
Expand Down
2 changes: 1 addition & 1 deletion packages/gittensory-miner/lib/laptop-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function resolveMinerStateDir(env = process.env) {
const configHome = typeof env.XDG_CONFIG_HOME === "string" && env.XDG_CONFIG_HOME.trim()
? env.XDG_CONFIG_HOME.trim()
: join(homedir(), ".config");
return join(configHome, "gittensory-miner");
return join(configHome, "loopover-miner");
}

/** Path to the laptop-mode SQLite bootstrap file inside the miner state directory. */
Expand Down
2 changes: 1 addition & 1 deletion packages/gittensory-miner/lib/local-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function resolveLocalStoreDbPath(defaultDbFileName, explicitEnvVarName, e
const configHome = typeof env.XDG_CONFIG_HOME === "string" && env.XDG_CONFIG_HOME.trim()
? env.XDG_CONFIG_HOME.trim()
: join(homedir(), ".config");
return join(configHome, "gittensory-miner", defaultDbFileName);
return join(configHome, "loopover-miner", defaultDbFileName);
}

/** Trim and validate a caller-supplied (or resolved-default) DB path, throwing `invalidPathError` if it is empty. */
Expand Down
2 changes: 1 addition & 1 deletion packages/gittensory-miner/lib/orb-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function resolveOrbExportDbPath(env = process.env) {
typeof env.XDG_CONFIG_HOME === "string" && env.XDG_CONFIG_HOME.trim()
? env.XDG_CONFIG_HOME.trim()
: join(homedir(), ".config");
return join(configHome, "gittensory-miner", defaultDbFileName);
return join(configHome, "loopover-miner", defaultDbFileName);
}

function normalizeDbPath(dbPath) {
Expand Down
2 changes: 1 addition & 1 deletion packages/gittensory-miner/lib/plan-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function resolvePlanStoreDbPath(env = process.env) {
const configHome = typeof env.XDG_CONFIG_HOME === "string" && env.XDG_CONFIG_HOME.trim()
? env.XDG_CONFIG_HOME.trim()
: join(homedir(), ".config");
return join(configHome, "gittensory-miner", defaultDbFileName);
return join(configHome, "loopover-miner", defaultDbFileName);
}

function normalizeDbPath(dbPath) {
Expand Down
6 changes: 3 additions & 3 deletions packages/gittensory-miner/lib/portfolio-queue-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,11 +499,11 @@ export function runQueueClaimBatch(args, options = {}) {

const QUEUE_METRICS_USAGE = "Usage: gittensory-miner queue metrics";

// Prometheus metric names for the portfolio-queue gauges (#5186). Mirrors the `gittensory_miner_*` naming and
// Prometheus metric names for the portfolio-queue gauges (#5186). Mirrors the `loopover_miner_*` naming and
// HELP/TYPE/label conventions of event-ledger-cli.js's renderEventLedgerMetrics / the engine's
// renderMinerPredictionMetrics, rather than importing across the package boundary.
export const QUEUE_ITEMS = "gittensory_miner_portfolio_queue_items";
export const QUEUE_OLDEST_IN_PROGRESS_LEASE_AGE_SECONDS = "gittensory_miner_portfolio_queue_oldest_in_progress_lease_age_seconds";
export const QUEUE_ITEMS = "loopover_miner_portfolio_queue_items";
export const QUEUE_OLDEST_IN_PROGRESS_LEASE_AGE_SECONDS = "loopover_miner_portfolio_queue_oldest_in_progress_lease_age_seconds";

/** HELP-text escaping — backslash + newline (mirrors miner-prediction-metrics.ts's escapeHelpText). */
function escapeMetricsHelpText(help) {
Expand Down
2 changes: 1 addition & 1 deletion packages/gittensory-miner/lib/prediction-ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function resolvePredictionLedgerDbPath(env = process.env) {
const configHome = typeof env.XDG_CONFIG_HOME === "string" && env.XDG_CONFIG_HOME.trim()
? env.XDG_CONFIG_HOME.trim()
: join(homedir(), ".config");
return join(configHome, "gittensory-miner", defaultDbFileName);
return join(configHome, "loopover-miner", defaultDbFileName);
}

function normalizeDbPath(dbPath) {
Expand Down
2 changes: 1 addition & 1 deletion packages/gittensory-miner/lib/repo-clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function resolveRepoCloneBaseDir(env = process.env) {
if (explicitConfigDir) return join(explicitConfigDir, DEFAULT_CLONE_DIR_NAME);

const configHome = typeof env.XDG_CONFIG_HOME === "string" && env.XDG_CONFIG_HOME.trim() ? env.XDG_CONFIG_HOME.trim() : join(homedir(), ".config");
return join(configHome, "gittensory-miner", DEFAULT_CLONE_DIR_NAME);
return join(configHome, "loopover-miner", DEFAULT_CLONE_DIR_NAME);
}

// GitHub owner/repo names are restricted to alphanumerics, hyphens, underscores, and periods, and are never
Expand Down
2 changes: 1 addition & 1 deletion packages/gittensory-miner/lib/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function resolveMinerStateDir(env = process.env) {
const configHome = typeof env.XDG_CONFIG_HOME === "string" && env.XDG_CONFIG_HOME.trim()
? env.XDG_CONFIG_HOME.trim()
: join(homedir(), ".config");
return join(configHome, "gittensory-miner");
return join(configHome, "loopover-miner");
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/gittensory-miner/lib/worktree-allocator.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function resolveWorktreeAllocatorDbPath(env = process.env) {
const configHome = typeof env.XDG_CONFIG_HOME === "string" && env.XDG_CONFIG_HOME.trim()
? env.XDG_CONFIG_HOME.trim()
: join(homedir(), ".config");
return join(configHome, "gittensory-miner", defaultDbFileName);
return join(configHome, "loopover-miner", defaultDbFileName);
}

export function resolveWorktreeBaseDir(env = process.env) {
Expand All @@ -43,7 +43,7 @@ export function resolveWorktreeBaseDir(env = process.env) {
const configHome = typeof env.XDG_CONFIG_HOME === "string" && env.XDG_CONFIG_HOME.trim()
? env.XDG_CONFIG_HOME.trim()
: join(homedir(), ".config");
return join(configHome, "gittensory-miner", defaultWorktreeDirName);
return join(configHome, "loopover-miner", defaultWorktreeDirName);
}

function normalizeDbPath(dbPath) {
Expand Down
Loading
Loading