revert: drop AP_RPUTS single-arg patch and fn_HGet renames
Both workarounds existed because Five was missing two features that
just landed upstream:
Five 7629f95 (variadic PValue) makes FUNCTION foo(...) / PValue()
actually return the caller's variadic args instead of the caller's
first LOCAL slot. AP_RPUTS / AP_ECHO can go back to their `( ... )`
signature now.
Five f3e0ffe (file-local STATIC FUNCTION) gives each .prg its own
namespace for `STATIC FUNCTION name`, so the seven duplicate
`STATIC FUNCTION fn_HGet` definitions across labdb's api/*.prg
files no longer collide. The sed-renamed unique names can revert
to the upstream definitions.
Files
app/bridge/bridge_request.prg ← cp from fivenode/native/
app/api/{device-status,record-detail,records-list,session-detail,
session-stats,sessions-list,session-export}.prg
← cp from fivenode/labdb/api/
fivenode-upstream is now byte-identical to fivenode_go's app/ copy
of those files. No more "// fivenode_go patch" comments, no more
file-prefix renames.
Verified end-to-end against the same live postgres@16 cluster:
/api/admin-stats.prg -> {"active_sessions":1,"devices":2,...}
/api/sessions-list.prg -> 2 rows w/ full session data
/api/admin-devices.prg -> 2 devices w/ api_key, created_at
/api/hello.prg -> hello (unchanged)
/ -> 200 text/html (static)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -63,7 +63,7 @@ FUNCTION Main()
|
|||||||
AP_JSONRESPONSE(hOut)
|
AP_JSONRESPONSE(hOut)
|
||||||
RETURN NIL
|
RETURN NIL
|
||||||
|
|
||||||
FUNCTION device_status_fn_hget(h, k, xDefault)
|
STATIC FUNCTION fn_HGet(h, k, xDefault)
|
||||||
IF xDefault == NIL ; xDefault := "" ; ENDIF
|
IF xDefault == NIL ; xDefault := "" ; ENDIF
|
||||||
IF HB_ISHASH(h) .AND. hb_HHasKey(h, k) .AND. h[k] != NIL
|
IF HB_ISHASH(h) .AND. hb_HHasKey(h, k) .AND. h[k] != NIL
|
||||||
RETURN h[k]
|
RETURN h[k]
|
||||||
|
|||||||
@@ -20,6 +20,6 @@ FUNCTION Main()
|
|||||||
})
|
})
|
||||||
RETURN NIL
|
RETURN NIL
|
||||||
|
|
||||||
FUNCTION record_detail_fn_hget(h, k)
|
STATIC FUNCTION fn_HGet(h, k)
|
||||||
IF HB_ISHASH(h) .AND. hb_HHasKey(h, k) ; RETURN h[k] ; ENDIF
|
IF HB_ISHASH(h) .AND. hb_HHasKey(h, k) ; RETURN h[k] ; ENDIF
|
||||||
RETURN ""
|
RETURN ""
|
||||||
|
|||||||
@@ -47,6 +47,6 @@ FUNCTION Main()
|
|||||||
})
|
})
|
||||||
RETURN NIL
|
RETURN NIL
|
||||||
|
|
||||||
FUNCTION records_list_fn_hget(h, k)
|
STATIC FUNCTION fn_HGet(h, k)
|
||||||
IF HB_ISHASH(h) .AND. hb_HHasKey(h, k) ; RETURN h[k] ; ENDIF
|
IF HB_ISHASH(h) .AND. hb_HHasKey(h, k) ; RETURN h[k] ; ENDIF
|
||||||
RETURN ""
|
RETURN ""
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ FUNCTION Main()
|
|||||||
})
|
})
|
||||||
RETURN NIL
|
RETURN NIL
|
||||||
|
|
||||||
FUNCTION session_detail_fn_hget(h, k)
|
STATIC FUNCTION fn_HGet(h, k)
|
||||||
IF HB_ISHASH(h) .AND. hb_HHasKey(h, k) ; RETURN h[k] ; ENDIF
|
IF HB_ISHASH(h) .AND. hb_HHasKey(h, k) ; RETURN h[k] ; ENDIF
|
||||||
RETURN ""
|
RETURN ""
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ FUNCTION Main()
|
|||||||
AP_RPUTS(cBOM + fn_Join(aLines, cCRLF))
|
AP_RPUTS(cBOM + fn_Join(aLines, cCRLF))
|
||||||
RETURN NIL
|
RETURN NIL
|
||||||
|
|
||||||
FUNCTION session_export_fn_hget(h, k)
|
STATIC FUNCTION fn_HGet(h, k)
|
||||||
IF HB_ISHASH(h) .AND. hb_HHasKey(h, k) ; RETURN h[k] ; ENDIF
|
IF HB_ISHASH(h) .AND. hb_HHasKey(h, k) ; RETURN h[k] ; ENDIF
|
||||||
RETURN ""
|
RETURN ""
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,6 @@ FUNCTION Main()
|
|||||||
|
|
||||||
RETURN NIL
|
RETURN NIL
|
||||||
|
|
||||||
FUNCTION session_stats_fn_hget(h, k)
|
STATIC FUNCTION fn_HGet(h, k)
|
||||||
IF HB_ISHASH(h) .AND. hb_HHasKey(h, k) ; RETURN h[k] ; ENDIF
|
IF HB_ISHASH(h) .AND. hb_HHasKey(h, k) ; RETURN h[k] ; ENDIF
|
||||||
RETURN NIL
|
RETURN NIL
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ FUNCTION Main()
|
|||||||
RETURN NIL
|
RETURN NIL
|
||||||
|
|
||||||
// Safe hash get (returns "" for missing key)
|
// Safe hash get (returns "" for missing key)
|
||||||
FUNCTION sessions_list_fn_hget(hHash, cKey)
|
STATIC FUNCTION fn_HGet(hHash, cKey)
|
||||||
IF HB_ISHASH(hHash) .AND. hb_HHasKey(hHash, cKey)
|
IF HB_ISHASH(hHash) .AND. hb_HHasKey(hHash, cKey)
|
||||||
RETURN hHash[ cKey ]
|
RETURN hHash[ cKey ]
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|||||||
@@ -108,26 +108,37 @@ RETURN AP_HEADERSOUTSET( "Content-Type", cType )
|
|||||||
|
|
||||||
// ── Output ──
|
// ── Output ──
|
||||||
|
|
||||||
// fivenode_go patch: collapsed (...) -> single arg. Five's PValue returns
|
FUNCTION AP_RPUTS( ... )
|
||||||
// the caller's LOCALs rather than the actual variadic args (declared
|
|
||||||
// params are 0 for `(...)`, so the runtime never copies args into the
|
LOCAL n, u
|
||||||
// locals slot PValue reads). Every call site in this codebase passes
|
|
||||||
// exactly one value, so the collapse is behaviour-preserving.
|
FOR n := 1 TO PCount()
|
||||||
// TODO: revert once Five gains true variadic PValue support.
|
u := PValue( n )
|
||||||
FUNCTION AP_RPUTS( u )
|
IF ValType( u ) == "C"
|
||||||
IF ValType( u ) == "C"
|
bridge_output_append( u )
|
||||||
bridge_output_append( u )
|
ELSE
|
||||||
ELSE
|
bridge_output_append( fn_ValToChar( u ) )
|
||||||
bridge_output_append( fn_ValToChar( u ) )
|
ENDIF
|
||||||
ENDIF
|
NEXT
|
||||||
|
|
||||||
RETURN NIL
|
RETURN NIL
|
||||||
|
|
||||||
FUNCTION AP_ECHO( u )
|
FUNCTION AP_ECHO( ... )
|
||||||
IF ValType( u ) == "C"
|
|
||||||
bridge_output_append( u )
|
LOCAL n, u
|
||||||
ELSEIF ValType( u ) != "U"
|
|
||||||
bridge_output_append( fn_ValToChar( u ) )
|
FOR n := 1 TO PCount()
|
||||||
ENDIF
|
u := PValue( n )
|
||||||
|
IF ValType( u ) == "C"
|
||||||
|
bridge_output_append( u )
|
||||||
|
ELSEIF ValType( u ) != "U"
|
||||||
|
bridge_output_append( fn_ValToChar( u ) )
|
||||||
|
ENDIF
|
||||||
|
IF n < PCount()
|
||||||
|
bridge_output_append( " " )
|
||||||
|
ENDIF
|
||||||
|
NEXT
|
||||||
|
|
||||||
RETURN NIL
|
RETURN NIL
|
||||||
|
|
||||||
// ── Parameter Parsing ──
|
// ── Parameter Parsing ──
|
||||||
|
|||||||
Reference in New Issue
Block a user