fix: Critical code review fixes — race conditions, panic recovery, LTRIM/RTRIM

CRITICAL fixes:
- fileio.go: Add sync.Mutex to file handle table (race condition #2)
  allocHandle/getHandle/removeHandle thread-safe helpers
- goroutine.go: Add defer/recover to GoLaunch/GoLaunchBlock
  Goroutine panic no longer crashes entire process (#5)

HIGH fixes:
- strings.go: Implement proper LTrim (TrimLeft) and RTrim (TrimRight)
  Previously both aliased to AllTrim — silent semantic bug (#18)
- register.go: TRIM = RTrim (Harbour compatible)

From 53-issue senior code review.
Remaining: 47 issues (HIGH: 10, MEDIUM: 18, LOW: 16, CRITICAL: 3)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-01 10:17:30 +09:00
parent a2430fa44b
commit 7c61db70c3
6 changed files with 149 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
{
"version": "2.0",
"lastUpdated": "2026-03-31T02:56:59.267Z",
"lastUpdated": "2026-04-01T01:16:33.700Z",
"activeFeatures": [
"hbrt",
"hbrtl",
@@ -33,9 +33,9 @@
"documents": {},
"timestamps": {
"started": "2026-03-27T09:33:04.512Z",
"lastUpdated": "2026-03-31T01:15:54.989Z"
"lastUpdated": "2026-04-01T01:14:37.127Z"
},
"lastFile": "/mnt/d/charles/five/hbrt/dynamic_syntax_test.go"
"lastFile": "/mnt/d/charles/five/hbrt/goroutine.go"
},
"hbrtl": {
"phase": "do",
@@ -46,9 +46,9 @@
"documents": {},
"timestamps": {
"started": "2026-03-27T11:15:10.675Z",
"lastUpdated": "2026-03-31T01:06:49.182Z"
"lastUpdated": "2026-04-01T01:16:33.700Z"
},
"lastFile": "/mnt/d/charles/five/hbrtl/rawtty.go"
"lastFile": "/mnt/d/charles/five/hbrtl/register.go"
},
"tests": {
"phase": "do",
@@ -280,7 +280,7 @@
"session": {
"startedAt": "2026-03-27T06:06:49.620Z",
"onboardingCompleted": false,
"lastActivity": "2026-03-31T02:56:59.267Z"
"lastActivity": "2026-04-01T01:16:33.700Z"
},
"history": [
{
@@ -5418,6 +5418,72 @@
"feature": "mem",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-04-01T00:50:44.331Z",
"feature": "hbrtl",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-04-01T00:51:04.728Z",
"feature": "hbrtl",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-04-01T00:51:29.797Z",
"feature": "hbrtl",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-04-01T00:53:27.988Z",
"feature": "hbrtl",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-04-01T00:53:39.882Z",
"feature": "hbrtl",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-04-01T00:53:51.335Z",
"feature": "hbrtl",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-04-01T01:12:51.547Z",
"feature": "hbrtl",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-04-01T01:14:22.341Z",
"feature": "hbrt",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-04-01T01:14:37.127Z",
"feature": "hbrt",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-04-01T01:15:49.420Z",
"feature": "hbrtl",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-04-01T01:16:33.700Z",
"feature": "hbrtl",
"phase": "do",
"action": "updated"
}
]
}

View File

@@ -115,7 +115,7 @@ if condition {
```prg
LOCAL cCustomerName, nTotalBalance, dLastPurchase, lIsActive
cCustomerName := "Charles Kwon" // c = Character
cCustomerName := "Charles KWON" // c = Character
nTotalBalance := 15000.50 // n = Numeric
dLastPurchase := Date() // d = Date
lIsActive := .T. // l = Logical