From 26a86e0746d530a8069baa46b1cf8ee07c9f1561 Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 19 Aug 2025 21:49:19 +0200 Subject: [PATCH] fix: Resolve temp directory permission issues for policy creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed default temp directory to local backend/temp instead of system temp - Added write permission test during temp directory initialization - Implemented fallback to OS temp directory if local temp fails - Added unique random suffix to policy filenames to avoid conflicts - Set proper file permissions (0o644) when writing policy files - Improved error handling for temp directory creation failures - Fixed fs.constants reference for file access checks This resolves the EACCES permission denied error when creating policies in Docker/production environments. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .claude-flow/metrics/agent-metrics.json | 1 + .claude-flow/metrics/performance.json | 9 + .claude-flow/metrics/system-metrics.json | 962 +++++++++++++++++++++++ .claude-flow/metrics/task-metrics.json | 10 + backend/src/services/minio.service.js | 47 +- 5 files changed, 1016 insertions(+), 13 deletions(-) create mode 100644 .claude-flow/metrics/agent-metrics.json create mode 100644 .claude-flow/metrics/performance.json create mode 100644 .claude-flow/metrics/system-metrics.json create mode 100644 .claude-flow/metrics/task-metrics.json diff --git a/.claude-flow/metrics/agent-metrics.json b/.claude-flow/metrics/agent-metrics.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.claude-flow/metrics/agent-metrics.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.claude-flow/metrics/performance.json b/.claude-flow/metrics/performance.json new file mode 100644 index 0000000..f925603 --- /dev/null +++ b/.claude-flow/metrics/performance.json @@ -0,0 +1,9 @@ +{ + "startTime": 1755632885258, + "totalTasks": 1, + "successfulTasks": 1, + "failedTasks": 0, + "totalAgents": 0, + "activeAgents": 0, + "neuralEvents": 0 +} \ No newline at end of file diff --git a/.claude-flow/metrics/system-metrics.json b/.claude-flow/metrics/system-metrics.json new file mode 100644 index 0000000..bd0fd45 --- /dev/null +++ b/.claude-flow/metrics/system-metrics.json @@ -0,0 +1,962 @@ +[ + { + "timestamp": 1755630503522, + "memoryTotal": 25769803776, + "memoryUsed": 25372360704, + "memoryFree": 397443072, + "memoryUsagePercent": 98.45771789550781, + "memoryEfficiency": 1.5422821044921875, + "cpuCount": 14, + "cpuLoad": 0.26150948660714285, + "platform": "darwin", + "uptime": 4316656 + }, + { + "timestamp": 1755630533522, + "memoryTotal": 25769803776, + "memoryUsed": 25419972608, + "memoryFree": 349831168, + "memoryUsagePercent": 98.64247639973959, + "memoryEfficiency": 1.3575236002604072, + "cpuCount": 14, + "cpuLoad": 0.20131138392857142, + "platform": "darwin", + "uptime": 4316686 + }, + { + "timestamp": 1755630563522, + "memoryTotal": 25769803776, + "memoryUsed": 25694879744, + "memoryFree": 74924032, + "memoryUsagePercent": 99.70925649007162, + "memoryEfficiency": 0.29074350992837594, + "cpuCount": 14, + "cpuLoad": 0.17288643973214285, + "platform": "darwin", + "uptime": 4316716 + }, + { + "timestamp": 1755630593522, + "memoryTotal": 25769803776, + "memoryUsed": 25620234240, + "memoryFree": 149569536, + "memoryUsagePercent": 99.41959381103516, + "memoryEfficiency": 0.5804061889648438, + "cpuCount": 14, + "cpuLoad": 0.13671875, + "platform": "darwin", + "uptime": 4316746 + }, + { + "timestamp": 1755630623523, + "memoryTotal": 25769803776, + "memoryUsed": 25668927488, + "memoryFree": 100876288, + "memoryUsagePercent": 99.60854848225912, + "memoryEfficiency": 0.39145151774087594, + "cpuCount": 14, + "cpuLoad": 0.13975306919642858, + "platform": "darwin", + "uptime": 4316776 + }, + { + "timestamp": 1755630653524, + "memoryTotal": 25769803776, + "memoryUsed": 25417973760, + "memoryFree": 351830016, + "memoryUsagePercent": 98.63471984863281, + "memoryEfficiency": 1.3652801513671875, + "cpuCount": 14, + "cpuLoad": 0.14240373883928573, + "platform": "darwin", + "uptime": 4316806 + }, + { + "timestamp": 1755630683524, + "memoryTotal": 25769803776, + "memoryUsed": 25482526720, + "memoryFree": 287277056, + "memoryUsagePercent": 98.88521830240884, + "memoryEfficiency": 1.1147816975911553, + "cpuCount": 14, + "cpuLoad": 0.12820870535714285, + "platform": "darwin", + "uptime": 4316836 + }, + { + "timestamp": 1755630713525, + "memoryTotal": 25769803776, + "memoryUsed": 25658949632, + "memoryFree": 110854144, + "memoryUsagePercent": 99.56982930501303, + "memoryEfficiency": 0.4301706949869697, + "cpuCount": 14, + "cpuLoad": 0.21644810267857142, + "platform": "darwin", + "uptime": 4316866 + }, + { + "timestamp": 1755630743525, + "memoryTotal": 25769803776, + "memoryUsed": 25397051392, + "memoryFree": 372752384, + "memoryUsagePercent": 98.55353037516275, + "memoryEfficiency": 1.446469624837249, + "cpuCount": 14, + "cpuLoad": 0.15963309151785715, + "platform": "darwin", + "uptime": 4316896 + }, + { + "timestamp": 1755630773526, + "memoryTotal": 25769803776, + "memoryUsed": 25460899840, + "memoryFree": 308903936, + "memoryUsagePercent": 98.8012949625651, + "memoryEfficiency": 1.1987050374349053, + "cpuCount": 14, + "cpuLoad": 0.18167550223214285, + "platform": "darwin", + "uptime": 4316926 + }, + { + "timestamp": 1755630803526, + "memoryTotal": 25769803776, + "memoryUsed": 25620709376, + "memoryFree": 149094400, + "memoryUsagePercent": 99.42143758138022, + "memoryEfficiency": 0.5785624186197822, + "cpuCount": 14, + "cpuLoad": 0.15227399553571427, + "platform": "darwin", + "uptime": 4316956 + }, + { + "timestamp": 1755630833528, + "memoryTotal": 25769803776, + "memoryUsed": 25450168320, + "memoryFree": 319635456, + "memoryUsagePercent": 98.75965118408203, + "memoryEfficiency": 1.2403488159179688, + "cpuCount": 14, + "cpuLoad": 0.11882672991071429, + "platform": "darwin", + "uptime": 4316986 + }, + { + "timestamp": 1755630863527, + "memoryTotal": 25769803776, + "memoryUsed": 25585336320, + "memoryFree": 184467456, + "memoryUsagePercent": 99.28417205810547, + "memoryEfficiency": 0.7158279418945312, + "cpuCount": 14, + "cpuLoad": 0.20584542410714285, + "platform": "darwin", + "uptime": 4317016 + }, + { + "timestamp": 1755630893528, + "memoryTotal": 25769803776, + "memoryUsed": 25530957824, + "memoryFree": 238845952, + "memoryUsagePercent": 99.07315572102866, + "memoryEfficiency": 0.9268442789713447, + "cpuCount": 14, + "cpuLoad": 0.16057477678571427, + "platform": "darwin", + "uptime": 4317046 + }, + { + "timestamp": 1755630923529, + "memoryTotal": 25769803776, + "memoryUsed": 25398001664, + "memoryFree": 371802112, + "memoryUsagePercent": 98.55721791585287, + "memoryEfficiency": 1.442782084147126, + "cpuCount": 14, + "cpuLoad": 0.17592075892857142, + "platform": "darwin", + "uptime": 4317076 + }, + { + "timestamp": 1755630953529, + "memoryTotal": 25769803776, + "memoryUsed": 25363333120, + "memoryFree": 406470656, + "memoryUsagePercent": 98.42268625895181, + "memoryEfficiency": 1.5773137410481866, + "cpuCount": 14, + "cpuLoad": 0.130615234375, + "platform": "darwin", + "uptime": 4317106 + }, + { + "timestamp": 1755630983530, + "memoryTotal": 25769803776, + "memoryUsed": 25401737216, + "memoryFree": 368066560, + "memoryUsagePercent": 98.57171376546225, + "memoryEfficiency": 1.428286234537751, + "cpuCount": 14, + "cpuLoad": 0.115966796875, + "platform": "darwin", + "uptime": 4317136 + }, + { + "timestamp": 1755631013531, + "memoryTotal": 25769803776, + "memoryUsed": 25560481792, + "memoryFree": 209321984, + "memoryUsagePercent": 99.18772379557291, + "memoryEfficiency": 0.8122762044270928, + "cpuCount": 14, + "cpuLoad": 0.13706752232142858, + "platform": "darwin", + "uptime": 4317166 + }, + { + "timestamp": 1755631043532, + "memoryTotal": 25769803776, + "memoryUsed": 25594445824, + "memoryFree": 175357952, + "memoryUsagePercent": 99.31952158610025, + "memoryEfficiency": 0.6804784138997491, + "cpuCount": 14, + "cpuLoad": 0.15391322544642858, + "platform": "darwin", + "uptime": 4317196 + }, + { + "timestamp": 1755631073532, + "memoryTotal": 25769803776, + "memoryUsed": 25516785664, + "memoryFree": 253018112, + "memoryUsagePercent": 99.01816050211588, + "memoryEfficiency": 0.9818394978841241, + "cpuCount": 14, + "cpuLoad": 0.3173130580357143, + "platform": "darwin", + "uptime": 4317226 + }, + { + "timestamp": 1755631103533, + "memoryTotal": 25769803776, + "memoryUsed": 25574047744, + "memoryFree": 195756032, + "memoryUsagePercent": 99.24036661783853, + "memoryEfficiency": 0.7596333821614678, + "cpuCount": 14, + "cpuLoad": 0.2618931361607143, + "platform": "darwin", + "uptime": 4317256 + }, + { + "timestamp": 1755631133533, + "memoryTotal": 25769803776, + "memoryUsed": 25391906816, + "memoryFree": 377896960, + "memoryUsagePercent": 98.533566792806, + "memoryEfficiency": 1.466433207194001, + "cpuCount": 14, + "cpuLoad": 0.21470424107142858, + "platform": "darwin", + "uptime": 4317286 + }, + { + "timestamp": 1755631163534, + "memoryTotal": 25769803776, + "memoryUsed": 25416155136, + "memoryFree": 353648640, + "memoryUsagePercent": 98.6276626586914, + "memoryEfficiency": 1.3723373413085938, + "cpuCount": 14, + "cpuLoad": 0.19827706473214285, + "platform": "darwin", + "uptime": 4317316 + }, + { + "timestamp": 1755631193535, + "memoryTotal": 25769803776, + "memoryUsed": 25490620416, + "memoryFree": 279183360, + "memoryUsagePercent": 98.9166259765625, + "memoryEfficiency": 1.0833740234375, + "cpuCount": 14, + "cpuLoad": 0.18429129464285715, + "platform": "darwin", + "uptime": 4317346 + }, + { + "timestamp": 1755631223536, + "memoryTotal": 25769803776, + "memoryUsed": 25501188096, + "memoryFree": 268615680, + "memoryUsagePercent": 98.95763397216797, + "memoryEfficiency": 1.0423660278320312, + "cpuCount": 14, + "cpuLoad": 0.14582170758928573, + "platform": "darwin", + "uptime": 4317376 + }, + { + "timestamp": 1755631253536, + "memoryTotal": 25769803776, + "memoryUsed": 25678905344, + "memoryFree": 90898432, + "memoryUsagePercent": 99.64726765950522, + "memoryEfficiency": 0.3527323404947822, + "cpuCount": 14, + "cpuLoad": 0.15809849330357142, + "platform": "darwin", + "uptime": 4317406 + }, + { + "timestamp": 1755631283536, + "memoryTotal": 25769803776, + "memoryUsed": 25562431488, + "memoryFree": 207372288, + "memoryUsagePercent": 99.1952896118164, + "memoryEfficiency": 0.8047103881835938, + "cpuCount": 14, + "cpuLoad": 0.13776506696428573, + "platform": "darwin", + "uptime": 4317436 + }, + { + "timestamp": 1755631313538, + "memoryTotal": 25769803776, + "memoryUsed": 25595183104, + "memoryFree": 174620672, + "memoryUsagePercent": 99.32238260904947, + "memoryEfficiency": 0.6776173909505303, + "cpuCount": 14, + "cpuLoad": 0.12904575892857142, + "platform": "darwin", + "uptime": 4317466 + }, + { + "timestamp": 1755631343538, + "memoryTotal": 25769803776, + "memoryUsed": 25686786048, + "memoryFree": 83017728, + "memoryUsagePercent": 99.67784881591797, + "memoryEfficiency": 0.32215118408203125, + "cpuCount": 14, + "cpuLoad": 0.15244838169642858, + "platform": "darwin", + "uptime": 4317496 + }, + { + "timestamp": 1755631373539, + "memoryTotal": 25769803776, + "memoryUsed": 25667272704, + "memoryFree": 102531072, + "memoryUsagePercent": 99.60212707519531, + "memoryEfficiency": 0.3978729248046875, + "cpuCount": 14, + "cpuLoad": 0.15230887276785715, + "platform": "darwin", + "uptime": 4317526 + }, + { + "timestamp": 1755631403540, + "memoryTotal": 25769803776, + "memoryUsed": 25704955904, + "memoryFree": 64847872, + "memoryUsagePercent": 99.74835713704428, + "memoryEfficiency": 0.2516428629557197, + "cpuCount": 14, + "cpuLoad": 0.17086356026785715, + "platform": "darwin", + "uptime": 4317556 + }, + { + "timestamp": 1755631433541, + "memoryTotal": 25769803776, + "memoryUsed": 25678086144, + "memoryFree": 91717632, + "memoryUsagePercent": 99.64408874511719, + "memoryEfficiency": 0.3559112548828125, + "cpuCount": 14, + "cpuLoad": 0.13239397321428573, + "platform": "darwin", + "uptime": 4317586 + }, + { + "timestamp": 1755631463542, + "memoryTotal": 25769803776, + "memoryUsed": 25535905792, + "memoryFree": 233897984, + "memoryUsagePercent": 99.09235636393228, + "memoryEfficiency": 0.9076436360677178, + "cpuCount": 14, + "cpuLoad": 0.24588448660714285, + "platform": "darwin", + "uptime": 4317616 + }, + { + "timestamp": 1755631493543, + "memoryTotal": 25769803776, + "memoryUsed": 25504579584, + "memoryFree": 265224192, + "memoryUsagePercent": 98.97079467773438, + "memoryEfficiency": 1.029205322265625, + "cpuCount": 14, + "cpuLoad": 0.19705636160714285, + "platform": "darwin", + "uptime": 4317646 + }, + { + "timestamp": 1755631523544, + "memoryTotal": 25769803776, + "memoryUsed": 25554649088, + "memoryFree": 215154688, + "memoryUsagePercent": 99.16508992513022, + "memoryEfficiency": 0.8349100748697822, + "cpuCount": 14, + "cpuLoad": 0.17449079241071427, + "platform": "darwin", + "uptime": 4317676 + }, + { + "timestamp": 1755631553544, + "memoryTotal": 25769803776, + "memoryUsed": 25486049280, + "memoryFree": 283754496, + "memoryUsagePercent": 98.89888763427734, + "memoryEfficiency": 1.1011123657226562, + "cpuCount": 14, + "cpuLoad": 0.15286690848214285, + "platform": "darwin", + "uptime": 4317706 + }, + { + "timestamp": 1755631583545, + "memoryTotal": 25769803776, + "memoryUsed": 25557581824, + "memoryFree": 212221952, + "memoryUsagePercent": 99.17647043863931, + "memoryEfficiency": 0.8235295613606866, + "cpuCount": 14, + "cpuLoad": 0.19217354910714285, + "platform": "darwin", + "uptime": 4317736 + }, + { + "timestamp": 1755631613546, + "memoryTotal": 25769803776, + "memoryUsed": 25610829824, + "memoryFree": 158973952, + "memoryUsagePercent": 99.38309987386069, + "memoryEfficiency": 0.6169001261393134, + "cpuCount": 14, + "cpuLoad": 0.2553013392857143, + "platform": "darwin", + "uptime": 4317766 + }, + { + "timestamp": 1755631643547, + "memoryTotal": 25769803776, + "memoryUsed": 25605275648, + "memoryFree": 164528128, + "memoryUsagePercent": 99.3615468343099, + "memoryEfficiency": 0.6384531656900947, + "cpuCount": 14, + "cpuLoad": 0.20026506696428573, + "platform": "darwin", + "uptime": 4317796 + }, + { + "timestamp": 1755631673546, + "memoryTotal": 25769803776, + "memoryUsed": 25645006848, + "memoryFree": 124796928, + "memoryUsagePercent": 99.5157241821289, + "memoryEfficiency": 0.48427581787109375, + "cpuCount": 14, + "cpuLoad": 0.19960239955357142, + "platform": "darwin", + "uptime": 4317826 + }, + { + "timestamp": 1755631703547, + "memoryTotal": 25769803776, + "memoryUsed": 25556582400, + "memoryFree": 213221376, + "memoryUsagePercent": 99.17259216308594, + "memoryEfficiency": 0.8274078369140625, + "cpuCount": 14, + "cpuLoad": 0.20413643973214285, + "platform": "darwin", + "uptime": 4317856 + }, + { + "timestamp": 1755631733548, + "memoryTotal": 25769803776, + "memoryUsed": 25685377024, + "memoryFree": 84426752, + "memoryUsagePercent": 99.67238108317056, + "memoryEfficiency": 0.32761891682943656, + "cpuCount": 14, + "cpuLoad": 0.15087890625, + "platform": "darwin", + "uptime": 4317886 + }, + { + "timestamp": 1755631763549, + "memoryTotal": 25769803776, + "memoryUsed": 25694175232, + "memoryFree": 75628544, + "memoryUsagePercent": 99.70652262369791, + "memoryEfficiency": 0.2934773763020928, + "cpuCount": 14, + "cpuLoad": 0.13326590401785715, + "platform": "darwin", + "uptime": 4317916 + }, + { + "timestamp": 1755631793550, + "memoryTotal": 25769803776, + "memoryUsed": 25671483392, + "memoryFree": 98320384, + "memoryUsagePercent": 99.61846669514975, + "memoryEfficiency": 0.38153330485025094, + "cpuCount": 14, + "cpuLoad": 0.13661411830357142, + "platform": "darwin", + "uptime": 4317946 + }, + { + "timestamp": 1755631823552, + "memoryTotal": 25769803776, + "memoryUsed": 25508610048, + "memoryFree": 261193728, + "memoryUsagePercent": 98.98643493652344, + "memoryEfficiency": 1.0135650634765625, + "cpuCount": 14, + "cpuLoad": 0.20570591517857142, + "platform": "darwin", + "uptime": 4317976 + }, + { + "timestamp": 1755631853552, + "memoryTotal": 25769803776, + "memoryUsed": 25604456448, + "memoryFree": 165347328, + "memoryUsagePercent": 99.35836791992188, + "memoryEfficiency": 0.641632080078125, + "cpuCount": 14, + "cpuLoad": 0.24410574776785715, + "platform": "darwin", + "uptime": 4318006 + }, + { + "timestamp": 1755631883552, + "memoryTotal": 25769803776, + "memoryUsed": 25418678272, + "memoryFree": 351125504, + "memoryUsagePercent": 98.6374537150065, + "memoryEfficiency": 1.362546284993499, + "cpuCount": 14, + "cpuLoad": 0.2744140625, + "platform": "darwin", + "uptime": 4318036 + }, + { + "timestamp": 1755631913553, + "memoryTotal": 25769803776, + "memoryUsed": 25366560768, + "memoryFree": 403243008, + "memoryUsagePercent": 98.43521118164062, + "memoryEfficiency": 1.564788818359375, + "cpuCount": 14, + "cpuLoad": 0.19513811383928573, + "platform": "darwin", + "uptime": 4318066 + }, + { + "timestamp": 1755631943553, + "memoryTotal": 25769803776, + "memoryUsed": 25578356736, + "memoryFree": 191447040, + "memoryUsagePercent": 99.25708770751953, + "memoryEfficiency": 0.7429122924804688, + "cpuCount": 14, + "cpuLoad": 0.16824776785714285, + "platform": "darwin", + "uptime": 4318096 + }, + { + "timestamp": 1755631973555, + "memoryTotal": 25769803776, + "memoryUsed": 25654280192, + "memoryFree": 115523584, + "memoryUsagePercent": 99.55170949300131, + "memoryEfficiency": 0.44829050699868844, + "cpuCount": 14, + "cpuLoad": 0.15851702008928573, + "platform": "darwin", + "uptime": 4318126 + }, + { + "timestamp": 1755632003556, + "memoryTotal": 25769803776, + "memoryUsed": 25674121216, + "memoryFree": 95682560, + "memoryUsagePercent": 99.62870279947916, + "memoryEfficiency": 0.3712972005208428, + "cpuCount": 14, + "cpuLoad": 0.14847237723214285, + "platform": "darwin", + "uptime": 4318156 + }, + { + "timestamp": 1755632033556, + "memoryTotal": 25769803776, + "memoryUsed": 25697812480, + "memoryFree": 71991296, + "memoryUsagePercent": 99.72063700358072, + "memoryEfficiency": 0.2793629964192803, + "cpuCount": 14, + "cpuLoad": 0.19747488839285715, + "platform": "darwin", + "uptime": 4318186 + }, + { + "timestamp": 1755632063557, + "memoryTotal": 25769803776, + "memoryUsed": 25689751552, + "memoryFree": 80052224, + "memoryUsagePercent": 99.6893564860026, + "memoryEfficiency": 0.3106435139974053, + "cpuCount": 14, + "cpuLoad": 0.16169084821428573, + "platform": "darwin", + "uptime": 4318216 + }, + { + "timestamp": 1755632093558, + "memoryTotal": 25769803776, + "memoryUsed": 25472860160, + "memoryFree": 296943616, + "memoryUsagePercent": 98.84770711263022, + "memoryEfficiency": 1.1522928873697822, + "cpuCount": 14, + "cpuLoad": 0.16231863839285715, + "platform": "darwin", + "uptime": 4318246 + }, + { + "timestamp": 1755632123559, + "memoryTotal": 25769803776, + "memoryUsed": 25504120832, + "memoryFree": 265682944, + "memoryUsagePercent": 98.96901448567709, + "memoryEfficiency": 1.0309855143229072, + "cpuCount": 14, + "cpuLoad": 0.17518833705357142, + "platform": "darwin", + "uptime": 4318276 + }, + { + "timestamp": 1755632153560, + "memoryTotal": 25769803776, + "memoryUsed": 25511968768, + "memoryFree": 257835008, + "memoryUsagePercent": 98.99946848551431, + "memoryEfficiency": 1.0005315144856866, + "cpuCount": 14, + "cpuLoad": 0.19395228794642858, + "platform": "darwin", + "uptime": 4318306 + }, + { + "timestamp": 1755632183561, + "memoryTotal": 25769803776, + "memoryUsed": 25697878016, + "memoryFree": 71925760, + "memoryUsagePercent": 99.72089131673178, + "memoryEfficiency": 0.2791086832682197, + "cpuCount": 14, + "cpuLoad": 0.17295619419642858, + "platform": "darwin", + "uptime": 4318336 + }, + { + "timestamp": 1755632213562, + "memoryTotal": 25769803776, + "memoryUsed": 25678807040, + "memoryFree": 90996736, + "memoryUsagePercent": 99.64688618977866, + "memoryEfficiency": 0.3531138102213447, + "cpuCount": 14, + "cpuLoad": 0.18247767857142858, + "platform": "darwin", + "uptime": 4318366 + }, + { + "timestamp": 1755632243563, + "memoryTotal": 25769803776, + "memoryUsed": 25691914240, + "memoryFree": 77889536, + "memoryUsagePercent": 99.69774881998697, + "memoryEfficiency": 0.3022511800130303, + "cpuCount": 14, + "cpuLoad": 0.17609514508928573, + "platform": "darwin", + "uptime": 4318396 + }, + { + "timestamp": 1755632273564, + "memoryTotal": 25769803776, + "memoryUsed": 25695027200, + "memoryFree": 74776576, + "memoryUsagePercent": 99.70982869466147, + "memoryEfficiency": 0.2901713053385322, + "cpuCount": 14, + "cpuLoad": 0.13563755580357142, + "platform": "darwin", + "uptime": 4318426 + }, + { + "timestamp": 1755632303565, + "memoryTotal": 25769803776, + "memoryUsed": 25695977472, + "memoryFree": 73826304, + "memoryUsagePercent": 99.71351623535156, + "memoryEfficiency": 0.2864837646484375, + "cpuCount": 14, + "cpuLoad": 0.12984793526785715, + "platform": "darwin", + "uptime": 4318456 + }, + { + "timestamp": 1755632333566, + "memoryTotal": 25769803776, + "memoryUsed": 25671680000, + "memoryFree": 98123776, + "memoryUsagePercent": 99.61922963460287, + "memoryEfficiency": 0.38077036539712594, + "cpuCount": 14, + "cpuLoad": 0.16486467633928573, + "platform": "darwin", + "uptime": 4318486 + }, + { + "timestamp": 1755632363567, + "memoryTotal": 25769803776, + "memoryUsed": 25698402304, + "memoryFree": 71401472, + "memoryUsagePercent": 99.7229258219401, + "memoryEfficiency": 0.2770741780599053, + "cpuCount": 14, + "cpuLoad": 0.1396484375, + "platform": "darwin", + "uptime": 4318516 + }, + { + "timestamp": 1755632393568, + "memoryTotal": 25769803776, + "memoryUsed": 25669730304, + "memoryFree": 100073472, + "memoryUsagePercent": 99.61166381835938, + "memoryEfficiency": 0.388336181640625, + "cpuCount": 14, + "cpuLoad": 0.20333426339285715, + "platform": "darwin", + "uptime": 4318546 + }, + { + "timestamp": 1755632423568, + "memoryTotal": 25769803776, + "memoryUsed": 25696583680, + "memoryFree": 73220096, + "memoryUsagePercent": 99.71586863199869, + "memoryEfficiency": 0.28413136800131156, + "cpuCount": 14, + "cpuLoad": 0.24072265625, + "platform": "darwin", + "uptime": 4318576 + }, + { + "timestamp": 1755632453568, + "memoryTotal": 25769803776, + "memoryUsed": 25604243456, + "memoryFree": 165560320, + "memoryUsagePercent": 99.357541402181, + "memoryEfficiency": 0.6424585978190009, + "cpuCount": 14, + "cpuLoad": 0.3972865513392857, + "platform": "darwin", + "uptime": 4318606 + }, + { + "timestamp": 1755632483569, + "memoryTotal": 25769803776, + "memoryUsed": 25172787200, + "memoryFree": 597016576, + "memoryUsagePercent": 97.68327077229819, + "memoryEfficiency": 2.3167292277018134, + "cpuCount": 14, + "cpuLoad": 0.29642159598214285, + "platform": "darwin", + "uptime": 4318636 + }, + { + "timestamp": 1755632513571, + "memoryTotal": 25769803776, + "memoryUsed": 25194283008, + "memoryFree": 575520768, + "memoryUsagePercent": 97.76668548583984, + "memoryEfficiency": 2.2333145141601562, + "cpuCount": 14, + "cpuLoad": 0.23629324776785715, + "platform": "darwin", + "uptime": 4318666 + }, + { + "timestamp": 1755632543572, + "memoryTotal": 25769803776, + "memoryUsed": 24935530496, + "memoryFree": 834273280, + "memoryUsagePercent": 96.76259358723959, + "memoryEfficiency": 3.237406412760407, + "cpuCount": 14, + "cpuLoad": 0.22579520089285715, + "platform": "darwin", + "uptime": 4318696 + }, + { + "timestamp": 1755632573573, + "memoryTotal": 25769803776, + "memoryUsed": 25013403648, + "memoryFree": 756400128, + "memoryUsagePercent": 97.06478118896484, + "memoryEfficiency": 2.9352188110351562, + "cpuCount": 14, + "cpuLoad": 0.213623046875, + "platform": "darwin", + "uptime": 4318726 + }, + { + "timestamp": 1755632603573, + "memoryTotal": 25769803776, + "memoryUsed": 24782438400, + "memoryFree": 987365376, + "memoryUsagePercent": 96.16851806640625, + "memoryEfficiency": 3.83148193359375, + "cpuCount": 14, + "cpuLoad": 0.18526785714285715, + "platform": "darwin", + "uptime": 4318756 + }, + { + "timestamp": 1755632633575, + "memoryTotal": 25769803776, + "memoryUsed": 25081577472, + "memoryFree": 688226304, + "memoryUsagePercent": 97.32933044433594, + "memoryEfficiency": 2.6706695556640625, + "cpuCount": 14, + "cpuLoad": 0.16385323660714285, + "platform": "darwin", + "uptime": 4318786 + }, + { + "timestamp": 1755632663574, + "memoryTotal": 25769803776, + "memoryUsed": 25544785920, + "memoryFree": 225017856, + "memoryUsagePercent": 99.12681579589844, + "memoryEfficiency": 0.8731842041015625, + "cpuCount": 14, + "cpuLoad": 0.14644949776785715, + "platform": "darwin", + "uptime": 4318816 + }, + { + "timestamp": 1755632693575, + "memoryTotal": 25769803776, + "memoryUsed": 25601949696, + "memoryFree": 167854080, + "memoryUsagePercent": 99.34864044189453, + "memoryEfficiency": 0.6513595581054688, + "cpuCount": 14, + "cpuLoad": 0.14167131696428573, + "platform": "darwin", + "uptime": 4318846 + }, + { + "timestamp": 1755632723576, + "memoryTotal": 25769803776, + "memoryUsed": 25258278912, + "memoryFree": 511524864, + "memoryUsagePercent": 98.01502227783203, + "memoryEfficiency": 1.9849777221679688, + "cpuCount": 14, + "cpuLoad": 0.16489955357142858, + "platform": "darwin", + "uptime": 4318876 + }, + { + "timestamp": 1755632753577, + "memoryTotal": 25769803776, + "memoryUsed": 25391693824, + "memoryFree": 378109952, + "memoryUsagePercent": 98.5327402750651, + "memoryEfficiency": 1.4672597249349053, + "cpuCount": 14, + "cpuLoad": 0.20413643973214285, + "platform": "darwin", + "uptime": 4318906 + }, + { + "timestamp": 1755632783577, + "memoryTotal": 25769803776, + "memoryUsed": 25409503232, + "memoryFree": 360300544, + "memoryUsagePercent": 98.60184987386069, + "memoryEfficiency": 1.3981501261393134, + "cpuCount": 14, + "cpuLoad": 0.18600027901785715, + "platform": "darwin", + "uptime": 4318936 + }, + { + "timestamp": 1755632813578, + "memoryTotal": 25769803776, + "memoryUsed": 25430818816, + "memoryFree": 338984960, + "memoryUsagePercent": 98.68456522623697, + "memoryEfficiency": 1.3154347737630303, + "cpuCount": 14, + "cpuLoad": 0.17347935267857142, + "platform": "darwin", + "uptime": 4318966 + }, + { + "timestamp": 1755632843580, + "memoryTotal": 25769803776, + "memoryUsed": 25397166080, + "memoryFree": 372637696, + "memoryUsagePercent": 98.55397542317709, + "memoryEfficiency": 1.4460245768229072, + "cpuCount": 14, + "cpuLoad": 0.16939871651785715, + "platform": "darwin", + "uptime": 4318996 + }, + { + "timestamp": 1755632873580, + "memoryTotal": 25769803776, + "memoryUsed": 25414664192, + "memoryFree": 355139584, + "memoryUsagePercent": 98.62187703450522, + "memoryEfficiency": 1.3781229654947822, + "cpuCount": 14, + "cpuLoad": 0.16291155133928573, + "platform": "darwin", + "uptime": 4319026 + } +] \ No newline at end of file diff --git a/.claude-flow/metrics/task-metrics.json b/.claude-flow/metrics/task-metrics.json new file mode 100644 index 0000000..0e11afc --- /dev/null +++ b/.claude-flow/metrics/task-metrics.json @@ -0,0 +1,10 @@ +[ + { + "id": "cmd-hooks-1755632885292", + "type": "hooks", + "success": true, + "duration": 4.192417000000006, + "timestamp": 1755632885296, + "metadata": {} + } +] \ No newline at end of file diff --git a/backend/src/services/minio.service.js b/backend/src/services/minio.service.js index a7a9c38..61cfe38 100644 --- a/backend/src/services/minio.service.js +++ b/backend/src/services/minio.service.js @@ -1,8 +1,10 @@ const { exec, spawn } = require('child_process'); const util = require('util'); const fs = require('fs').promises; +const fsConstants = require('fs').constants; const path = require('path'); const crypto = require('crypto'); +const os = require('os'); const config = require('../config'); const { logger } = require('../utils/logger'); const { AppError } = require('../middleware/errorHandler.middleware'); @@ -12,17 +14,30 @@ const execAsync = util.promisify(exec); class MinIOService { constructor(alias = config.minio.defaultAlias) { this.alias = alias; - this.tempDir = process.env.TEMP_DIR || path.join(__dirname, '../../temp'); + // Use local temp directory by default, fallback to system temp if needed + this.tempDir = path.join(__dirname, '../../temp'); this.ensureTempDir(); } async ensureTempDir() { try { - await fs.mkdir(this.tempDir, { recursive: true }); + await fs.mkdir(this.tempDir, { recursive: true, mode: 0o755 }); + // Test write permissions + const testFile = path.join(this.tempDir, '.write-test'); + await fs.writeFile(testFile, 'test'); + await fs.unlink(testFile); // Clean up old temp files (older than 1 hour) this.cleanupTempFiles(); } catch (error) { - logger.error('Failed to create temp directory:', error); + logger.error('Failed to create or write to temp directory:', error); + // Fallback to node's temp directory + this.tempDir = path.join(os.tmpdir(), 'minio-webui-temp'); + try { + await fs.mkdir(this.tempDir, { recursive: true, mode: 0o755 }); + logger.info(`Using fallback temp directory: ${this.tempDir}`); + } catch (fallbackError) { + logger.error('Failed to create fallback temp directory:', fallbackError); + } } } @@ -236,12 +251,14 @@ class MinIOService { }] }; - // Write policy to temp file - const policyFile = path.join(this.tempDir, `${policyName}-${Date.now()}.json`); + // Write policy to temp file with unique name + const timestamp = Date.now(); + const randomStr = Math.random().toString(36).substring(7); + const policyFile = path.join(this.tempDir, `${policyName}-${timestamp}-${randomStr}.json`); - // Ensure temp directory exists before writing - await fs.mkdir(this.tempDir, { recursive: true }); - await fs.writeFile(policyFile, JSON.stringify(policy, null, 2)); + // Ensure temp directory exists and is writable + await this.ensureTempDir(); + await fs.writeFile(policyFile, JSON.stringify(policy, null, 2), { mode: 0o644 }); try { // Verify the file was written @@ -337,18 +354,22 @@ class MinIOService { throw new AppError('Invalid policy document', 400); } - const policyFile = path.join(this.tempDir, `${policyName}-${Date.now()}.json`); + // Generate unique filename + const timestamp = Date.now(); + const randomStr = Math.random().toString(36).substring(7); + const policyFile = path.join(this.tempDir, `${policyName}-${timestamp}-${randomStr}.json`); try { - // Ensure temp directory exists before writing - await fs.mkdir(this.tempDir, { recursive: true }); + // Ensure temp directory exists and is writable + await this.ensureTempDir(); await fs.writeFile(policyFile, - typeof policyDocument === 'string' ? policyDocument : JSON.stringify(policyDocument, null, 2) + typeof policyDocument === 'string' ? policyDocument : JSON.stringify(policyDocument, null, 2), + { mode: 0o644 } ); // Verify the file was written - await fs.access(policyFile); + await fs.access(policyFile, fsConstants.R_OK); await this.executeCommand( `mc admin policy create ${this.alias} ${policyName} ${policyFile}`