Commit Graph

1016 Commits

Author SHA1 Message Date
Houmgaor
88fc17e790 fix: purge excess guild posts and clarify alliance TODO
Purge oldest guild posts beyond the limit (100 messages, 4 news) after
each new post is created. Replace misleading alliance application TODO
with a note that the feature is not yet implemented.
2026-02-17 18:12:07 +01:00
Houmgaor
46bbb6adf9 fix: resolve all remaining lint errors (errcheck) across 49 files
Fix unchecked error returns on bf.Seek(), db.Exec(), QueryRow().Scan(),
pkt.Build(), logger.Sync(), and binary.Write() calls. The linter now
passes with 0 errors, build compiles, and all tests pass with -race.
2026-02-17 18:07:38 +01:00
Houmgaor
2a0e3e2c84 fix: re-enable CI lint job and fix ~65 lint errors (partial)
Re-enable the golangci-lint job in CI (disabled Oct 2025), update to
Go 1.25 and golangci-lint-action v7. Fix errcheck, gosimple S1009,
staticcheck SA4031 and SA2001 errors across 54 files. Remaining ~39
lint errors will be addressed in follow-up commits.
2026-02-17 17:59:00 +01:00
Houmgaor
d2b5bb72f8 refactor: extract gametime package, replace fmt.Printf with zap logging
Move time utilities (TimeAdjusted, TimeMidnight, TimeWeekStart, TimeWeekNext,
TimeGameAbsolute) from channelserver into common/gametime to break the
inappropriate dependency where signserver, entranceserver, and api imported
the 38K-line channelserver package just for time functions.

Replace all fmt.Printf debug logging in sys_session.go and handlers_object.go
with structured zap logging for consistent observability.
2026-02-17 17:54:51 +01:00
Houmgaor
fb3e86f429 fix: handle Query/QueryRow/transaction errors in channel server handlers
Add error checking and logging for ~25 database call sites that were
silently dropping errors, preventing resource leaks (unclosed rows),
nil pointer panics, and silent data corruption in festa transactions.
2026-02-17 17:44:35 +01:00
Houmgaor
645c4ddd38 test: increase code coverage from 45.1% to 48.3%
Add unit tests across multiple packages:
- byteframe: SetBE/SetLE byte order switching
- config: Mode.String() for all safe version ranges
- mhfpacket: 28 Parse methods, 5 Build methods, empty packet builds,
  variable-length packets, NOT IMPLEMENTED error paths, UpdateWarehouse
- network: PacketID.String() for known IDs, out-of-range, and all valid
- channelserver: handleMsgMhfGetPaperData (6 switch cases), grpToGR
  (11 input values), gacha handlers, TimeGameAbsolute, equipSkinHistSize
  (4 config branches), guild mission handlers, dumpSaveData disabled path
- entranceserver: makeHeader with various inputs
2026-02-17 17:32:54 +01:00
Houmgaor
85cdac036e fix: validate quest file existence in seasonConversion fallbacks
The final fallback in seasonConversion blindly constructed a filename
without checking if it existed on disk. When the file was missing,
handleMsgSysGetFile would send doAckBufFail, but the original Frontier
client does not gracefully handle this during quest loading — causing a
softlock instead of showing the built-in error dialog.

Now every fallback path validates file existence before returning, and
also tries the opposite time-of-day variant as a last resort. If no
file variant exists at all, the original filename is returned with a
warning log so the failure ack is still sent.
2026-02-17 01:19:26 +01:00
Houmgaor
0bd724f74e test: backport remaining test files from v9.2.x-stable
Import 18 network packet test files and 5 server infrastructure test
files, adapted for main branch APIs: fix config import alias (_config),
remove non-existent DevMode field, use global handlerTable instead of
per-server handlers map, and correct validateToken mock expectations
to include both token and tokenID arguments.

Adds go-sqlmock dependency for database mocking in signserver tests.
2026-02-17 00:09:41 +01:00
Houmgaor
be4cd2001c test: import 38 channelserver test files from v9.2.x-stable
Port test files from v9.2.x-stable branch to increase channelserver
coverage from 13.8% to 25.6% (556 tests passing).

Adapted all files to main's struct definitions: config import alias,
Airou/CatDefinition rename, packet field mismatches, Raviente struct
differences, and maxPlayers defaults. Removed tests referencing
production code not yet on main (Player, FestivalColour, etc.).
Excluded handlers_register_test.go (Raviente completely redesigned).
2026-02-16 22:19:44 +01:00
Houmgaor
b1c8b2848f security: fix CodeQL warnings for integer overflow and workflow permissions
- handlers_tower.go: add bounds checks before int-to-int16 and int-to-uint16
  conversions to prevent overflow/wraparound (CodeQL #7, #8)
- go-improved.yml, go.yml: add top-level `permissions: contents: read` to
  restrict workflow token scope (CodeQL #15, #16, #17)
2026-02-16 19:14:14 +01:00
Houmgaor
10e09630a6 fix: send failure ack for missing quest/scenario files instead of crashing client
When a quest or scenario file was missing, handleMsgSysGetFile sent nil
data via doAckBufSucceed, which crashed the game client. Now sends
doAckBufFail so the client can handle the missing file gracefully.

Closes #109
2026-02-16 18:35:44 +01:00
Houmgaor
7dfc3e6049 Merge upstream/main into main
Resolve conflict in handlers_stage.go: keep lock-free packet
building pattern (copy session list, release lock, then build)
over upstream's in-lock QueueSendMHF approach.

Fix test compilation: remove objectIDs field references after
upstream removed it from Server struct.

Resync vendor directory with updated go.mod dependencies.
2026-02-16 11:31:42 +01:00
wish
e9bd0b2ddb Merge pull request #151 from Mezeporta/test/aobp 2025-12-17 09:27:56 +11:00
Houmgaor
0fac429fac fix(transmog): fix transmog issues.
Untested commit.
2025-11-09 11:57:28 +01:00
Houmgaor
36065ce273 fix(plate data): was not save, nor transmog data. 2025-11-01 18:14:30 +01:00
Houmgaor
3da54fade8 chore: adds remaining logging for Hunter Navi and Plate data. 2025-11-01 17:14:05 +01:00
Houmgaor
afc554f1ec fix(save): avoid double-save.
feat(logging): more complete logging data.
2025-11-01 00:37:59 +01:00
Houmgaor
18592c5ded fix(handlers): trying to fix issues with incomplete saves. 2025-10-31 13:10:17 +01:00
Houmgaor
2d3edcfd10 test: session lifecycle tests to reveal issues with sessions configuration. 2025-10-31 12:59:32 +01:00
Houmgaor
d3fd0c72b0 tests: extra tests for Dicord bit and nullcomp. 2025-10-27 12:33:33 +01:00
Houmgaor
25d218fbcd tests(integration): more complete tests with integration of a test database, 2025-10-27 11:58:12 +01:00
Houmgaor
e1a461e892 fix(stage): fix deadlock that was preventing stage change. 2025-10-27 01:13:43 +01:00
Houmgaor
5aa17a749f test(api): comprehensive test suite for server/api. 2025-10-21 01:09:37 +02:00
Houmgaor
73e874f43f fix: array bound crashes on clans. 2025-10-21 00:21:50 +02:00
Houmgaor
060635e422 fix(stage): fix race condition with stages. 2025-10-21 00:00:08 +02:00
Houmgaor
1c32be98cc fix(session): race condition. 2025-10-19 23:49:23 +02:00
Houmgaor
4908731773 fix(ci): remove linting, fix not passing test. 2025-10-19 23:39:23 +02:00
Houmgaor
c55f23442b fix(lint): fixing go static check failing. 2025-10-19 22:52:58 +02:00
Houmgaor
fc6e479df9 fix(lint): fixing more complex formatters problems. 2025-10-19 22:46:21 +02:00
Houmgaor
1398383a8d fix(lint): automated linting, with simple formatter. 2025-10-19 22:43:05 +02:00
Houmgaor
f79e05c0c9 feat(go): upgrade from go 1.21 to 1.23
BREAKING CHANGE: will not work properly with Go 1.21.
2025-10-19 22:24:48 +02:00
Houmgaor
3cb77bd669 tests: more tests for the guild system. 2025-10-19 21:52:14 +02:00
Houmgaor
506ff2dc66 test(quest): adds test cases for quest handler. 2025-10-19 21:28:07 +02:00
Houmgaor
0e7bc553d7 test: fix issues in tests with cryptography 2025-10-19 21:18:55 +02:00
Houmgaor
8a92a7957e fix(crashes): trying to investigate the causes of crash.
New unit tests to that end.
2025-10-19 19:02:29 +02:00
wish
ce364720de alpelo object system backport test commit 2025-10-05 16:19:34 +11:00
wish
c4ec2efde5 alpelo object system backport test commit 2025-10-05 16:18:22 +11:00
wish
aad3b088b9 alpelo object system backport test commit 2025-10-05 16:14:39 +11:00
wish
dd36f367a9 alpelo object system backport test commit 2025-10-05 16:10:47 +11:00
wish
531b3d2fa6 Remove unused import 'math' from handlers_guild.go
Removed unused 'math' import from handlers_guild.go
2025-08-29 22:56:46 +10:00
wish
7459dede49 fix guild poogie outfit unlock 2025-08-28 23:27:56 +10:00
wish
8d1c6a79e2 S6 compatibility fix 2025-05-04 01:47:30 +10:00
wish
c539905c1d implement SysWaitStageBinary timeout 2025-03-16 23:04:42 +11:00
wish
69a2a7ca3b MhfReadMercenaryW changes 2025-03-16 15:51:10 +11:00
wish
7e58a26693 Merge remote-tracking branch 'origin/main' 2025-03-10 11:38:23 +11:00
wish
8c219be30f fix InfoGuild response on <G10 2025-03-10 11:38:00 +11:00
wish
f9cfb07760 Merge pull request #134 from ZeruLight/fix/packet-queue
fix/packet-queue
2025-03-09 14:41:10 +11:00
wish
f2862ea4b8 prevent concurrent map write to questCache 2025-03-08 11:41:57 +11:00
wish
3e71c308f4 minor MhfInfoGuild changes 2025-03-06 23:01:22 +11:00
wish
3c0d29ed41 fix invalidateSessions 2025-02-27 20:06:05 +11:00