Cleanup: extract constants, fix typecheck, add ESLint, organize store types
- Remove unused initCount state from useAuthGate hook - Replace magic number with MAX_SAVES_PER_USER constant in saves route - Extract duplicated EMAIL_REGEX and MIN_PASSWORD_LENGTH in auth routes - Fix game-simulation typecheck failure by adding DOM lib to tsconfig - Extract store UI types (ActivePage, InfraNav, etc.) to store/types.ts - Fix let→const for non-reassigned arrays in servingPipeline - Fix useless initial assignments in reputationSystem - Fix ambiguous multiline array access in sanityChecks - Add minimal ESLint config with typescript-eslint - Add .planning/ and *.log to .gitignore Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -75,7 +75,7 @@ interface CachedSlot {
|
||||
}
|
||||
|
||||
let cachedDeploymentVersion = -1;
|
||||
let cachedSlots: CachedSlot[] = [];
|
||||
const cachedSlots: CachedSlot[] = [];
|
||||
const fleetOutput: ModelServingSlot[] = [];
|
||||
|
||||
const mainRemaining = new Map<string, number>();
|
||||
@@ -83,7 +83,7 @@ const mainUsed = new Map<string, number>();
|
||||
const entRemaining = new Map<string, number>();
|
||||
const entUsed = new Map<string, number>();
|
||||
|
||||
let cachedUtilization: ModelUtilizationEntry[] = [];
|
||||
const cachedUtilization: ModelUtilizationEntry[] = [];
|
||||
|
||||
export function resetFleetCache(): void {
|
||||
cachedDeploymentVersion = -1;
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface ReputationTickResult {
|
||||
}
|
||||
|
||||
export function processReputation(state: GameState, researchBonuses?: ResearchBonuses): ReputationState & { _safetyIncident?: boolean } {
|
||||
let { safetyRecord, publicPerception, employeeSatisfaction, regulatoryStanding } = state.reputation;
|
||||
let { safetyRecord, publicPerception } = state.reputation;
|
||||
|
||||
let safetyIncident = false;
|
||||
if (state.models.bestDeployedSafetyScore > 0) {
|
||||
@@ -39,13 +39,13 @@ export function processReputation(state: GameState, researchBonuses?: ResearchBo
|
||||
const safetyResearchCount = state.research.completedResearch
|
||||
.filter(r => r.includes('alignment') || r.includes('interpretability') || r.includes('constitutional')).length;
|
||||
const complianceBonus = safetyResearchCount * 8;
|
||||
regulatoryStanding = Math.min(100, Math.max(0,
|
||||
const regulatoryStanding = Math.min(100, Math.max(0,
|
||||
50 + complianceBonus - regulatoryPressure,
|
||||
));
|
||||
|
||||
const talentMorale = Object.values(state.talent.departments)
|
||||
.reduce((sum, d) => sum + d.morale, 0) / 4;
|
||||
employeeSatisfaction = talentMorale * 100;
|
||||
const employeeSatisfaction = talentMorale * 100;
|
||||
|
||||
const reputationResearchBonus = researchBonuses?.reputationBonus ?? 0;
|
||||
publicPerception = Math.min(100, publicPerception + reputationResearchBonus * PUBLIC_PERCEPTION_GROWTH_RATE);
|
||||
|
||||
@@ -55,8 +55,8 @@ export function runSanityChecks(metrics: SimulationMetrics[]): SanityCheckResult
|
||||
const key = 'reputation-scale-consistency';
|
||||
if (!seen.has(key)) {
|
||||
seen.add(key);
|
||||
const lowName = ['safetyRecord', 'publicPerception', 'employeeSatisfaction', 'regulatoryStanding']
|
||||
[components.indexOf(belowThreshold[0])];
|
||||
const reputationFields = ['safetyRecord', 'publicPerception', 'employeeSatisfaction', 'regulatoryStanding'];
|
||||
const lowName = reputationFields[components.indexOf(belowThreshold[0])];
|
||||
violations.push({
|
||||
tick: m.tick, check: key,
|
||||
message: `${lowName} = ${belowThreshold[0].toFixed(2)} while others are 10+. Likely a scale mismatch (0-1 vs 0-100)`,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "@token-empire/tsconfig/node.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["ES2022", "DOM"],
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user