Skip to content

Рефакторинг: удаление nlohmann::json из проекта#91

Merged
netkeep80 merged 4 commits intonetkeep80:mainfrom
konard:issue-90-391adb4e50e7
Feb 28, 2026
Merged

Рефакторинг: удаление nlohmann::json из проекта#91
netkeep80 merged 4 commits intonetkeep80:mainfrom
konard:issue-90-391adb4e50e7

Conversation

@konard
Copy link
Copy Markdown
Contributor

@konard konard commented Feb 28, 2026

Исправляет

Fixes #90 (пункт 2: удаление nlohmann::json)

Что сделано

1. Удалён third_party/nlohmann/json.hpp (~930 КБ, ~25 500 строк)

Единственная внешняя зависимость проекта полностью удалена. Проект теперь не имеет внешних зависимостей по JSON.

2. Замена nlohmann::detail::to_chars в pjson_serializer.h

Форматирование double переведено с алгоритма Grisu2 из nlohmann на стандартный std::to_chars (C++17). Добавлена логика гарантированного суффикса .0 для целых значений (100.0 → "100.0"), что совпадает с ожидаемым поведением тестов.

3. Удалены _to_nlohmann() и _from_nlohmann() из pjson.h

Вспомогательные методы для конвертации pjson ↔ nlohmann::json больше не нужны: прямая сериализация to_string() / from_string() реализована (F6, задача #84).

4. Рефакторинг тестовых файлов

Файл Изменение
test_pjson_serial.cpp Round-trip через pjson::from_string + to_string вместо nlohmann::json::parse + dump()
test_pjson_large.cpp Полностью переписан: загрузка test.json через прямой парсер F6, верификация без nlohmann
test_pjson_opt.cpp Тест round-trip: нормализация через pjson вместо nlohmann::json::dump()
test_pjson_bench.cpp Убраны бенчмарки nlohmann-пути (которого больше нет), оставлены измерения F6

5. Обновлён readme.md

Убраны ссылки на nlohmann как зависимость/аналог, добавлены файлы pjson_serializer.h, pjson_interning.h, pjson_node_pool.h в таблицу проекта.

Результат тестирования

Все 245 тестов проходят локально (ctest, Ubuntu, GCC, C++17 Release).

100% tests passed, 0 tests failed out of 245
Total Test time (real) = 48.88 sec

🤖 Generated with Claude Code

konard and others added 2 commits February 28, 2026 16:21
Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: netkeep80#90
- Удалён third_party/nlohmann/json.hpp (~25k строк, ~930 КБ)
- pjson_serializer.h: замена nlohmann::detail::to_chars на std::to_chars
  (C++17) с добавлением ".0" для целых double (100.0 → "100.0")
- pjson.h: удалены вспомогательные методы _to_nlohmann() и _from_nlohmann();
  прямая сериализация to_string()/from_string() уже реализована (F6)
- Тесты: все ссылки на nlohmann заменены на pjson::from_string/to_string;
  round-trip верификация — нормализация через pjson вместо nlohmann::dump()
- readme.md: обновлены упоминания nlohmann, добавлены pjson_serializer.h,
  pjson_interning.h, pjson_node_pool.h в таблицу файлов проекта
- Все 245 тестов проходят

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] рефакторинг кода Рефакторинг: удаление nlohmann::json из проекта Feb 28, 2026
@konard konard marked this pull request as ready for review February 28, 2026 16:32
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Feb 28, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $3.255673
  • Calculated by Anthropic: $2.796012 USD
  • Difference: $-0.459660 (-14.12%)
    📎 Log file uploaded as Gist (2347KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard konard marked this pull request as draft February 28, 2026 16:56
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Feb 28, 2026

🤖 AI Work Session Started

Starting automated work session at 2026-02-28T16:56:30.477Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented Feb 28, 2026

🔄 Auto-restart triggered

Reason: CI failures detected

Starting new session to address the issues.


Auto-restart-until-mergeable mode is active. Will continue until PR becomes mergeable.

- pjson_serializer.h: исправить выравнивание переменных (char buf[64],
  std::to_chars_result res, std::size_t len) в соответствии с .clang-format
  (AlignConsecutiveDeclarations требует точное выравнивание по clang-format)
- pam_core.h: добавить #include <typeinfo> для поддержки typeid(T).name()
  на MSVC (без этого заголовка MSVC выдаёт C2027: use of undefined type 'type_info')

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Feb 28, 2026

🔄 Auto-restart-until-mergeable Log (iteration 1)

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.628619
  • Calculated by Anthropic: $1.315182 USD
  • Difference: $-0.313437 (-19.25%)
    📎 Log file uploaded as Gist (4181KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented Feb 28, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard konard marked this pull request as ready for review February 28, 2026 17:28
@netkeep80 netkeep80 merged commit 6ee02a6 into netkeep80:main Feb 28, 2026
7 checks passed
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Feb 28, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.426159
  • Calculated by Anthropic: $2.363087 USD
  • Difference: $0.936928 (+65.70%)
    📎 Log file uploaded as Gist (3088KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

рефакторинг кода

2 participants