erlware/Erlang-and-OTP-in-Action-Source
43.0
Weak · 23 September 2026
6.1k
lines of production code
Erlang
with C
5
measurements over time
What this system is
This system is an Erlang-based distributed application framework that manages resource discovery and caching across nodes. It includes a TCP RPC server, a simple cache with process validation, and a resource discovery service that tracks local and found resources. Additionally, it provides a JSON parsing capability implemented via both Erlang NIFs and C-based port drivers for compatibility with different Erlang/OTP versions.
Features
Add C-based JSON parser port program
A new C source file (jp\_prog.c) has been added to implement an Erlang port program that interfaces with the YAJL JSON parser. This component handles reading JSON data from the Erlang runtime, parsing it using the YAJL library, and returning the result as an Erlang term. The implementation includes specific error handling for parsing failures and data encoding mismatches, ensuring that errors are returned as tuples rather than crashing the port.
_chapter\_12/plain\_port/json\_parser/c\src · high confidence
Added Erlang NIF implementations for JSON parsing on R13 and R14
Added C source files for the JSON parser NIFs, providing separate implementations for Erlang/OTP R13 and R14. The R13 version uses the older \enif\_alloc\/\enif\_realloc\/\enif\_free\ API, while the R14 version uses the newer \enif\_alloc\/\enif\_realloc\/\enif\_free\ API without the environment pointer, ensuring compatibility with both legacy and modern Erlang runtimes.
_chapter\_12/nifs/json\_parser/c\src · high confidence
Added Erlang NIF-based JSON parser with R13/R14 support
Users can now parse JSON documents using a native interface (NIF) implementation. The change introduces the Erlang module json\_parser, which loads the native library jp\_nifs, and provides the parse\_document/1 function. The build instructions in the README have been updated to support both Erlang/OTP R13 and R14, with specific compilation commands and notes on the YAJL library.
_chapter\_12/nifs/json\parser · high confidence
Added Erlang application metadata for JSON parser NIFs
The json\_parser application metadata file (json\_parser.app) was added, defining the application as version 0.1.0 with dependencies on the kernel and stdlib applications. A .gitignore file was also added to exclude compiled .beam files from version control.
_chapter\_12/nifs/json\parser/ebin · high confidence
Added Erlang port driver for JSON parsing
Added a new C source file (jp\_driver.c) that implements a linked-in port driver for interfacing with the YAJL JSON parser. This introduces the underlying C implementation for the JSON parser feature described in chapter 12, handling data parsing, error states, and output encoding via the Erlang driver API.
_chapter\_12/port\_driver/json\_parser/c\src · high confidence
Added JSON parser application metadata and build artifacts
The json\_parser application was added to the Erlang build, including the json\_parser.app file which defines the application structure with modules jp\_app, jp\_sup, jp\_server, and json\_parser, and a .gitignore file to exclude compiled .beam files from version control.
_chapter\_12/plain\_port/json\parser/ebin · medium confidence
Added JSON parser application with port driver support
Introduced the json\_parser application, which implements a JSON parser using a port driver. The application includes modules jp\_app, jp\_sup, jp\_server, and json\_parser, with jp\_sup and jp\_server registered as system processes. The application depends on kernel and stdlib, and is configured to start jp\_app as the main application process.
_chapter\_12/port\_driver/json\parser/ebin · high confidence
Added JSON parser port driver and Erlang interface
Introduced a new JSON parser component consisting of an Erlang application (jp\_app), a gen\_server (jp\_server) for managing the port, a supervisor (jp\_sup), and a public API module (json\_parser). The implementation loads a C-based port driver (jp\_driver) to handle JSON parsing, with build instructions provided in the new README file.
_chapter\_12/port\_driver/json\parser · high confidence
Introduce Erlang/OTP application for JSON parsing via C port
Added a new Erlang application (json\_parser) that exposes a user-facing API (json\_parser:parse\_document/1) to parse JSON documents. The implementation uses a C-based port program (jp\_prog) linked against the YAJL library, with the Erlang side managing the port lifecycle and message passing via a gen\_server (jp\_server) and supervision tree (jp\_sup, jp\_app).
_chapter\_12/plain\_port/json\parser · high confidence
Behavioural changes
Prevent stale process references in cache lookups
The cache lookup logic in sc\_store.erl now verifies that a stored process ID is still alive before returning it. A new internal function, is\_pid\_alive, checks the process status locally or remotely via RPC, ensuring that dead or stale PIDs are not returned to callers. This change also removes an unnecessary call to add\_table\_copy for the schema table.
_chapter\_10/simple\_cache, chapter\_11/simple\_cache, chapter\_13/simple\cache · medium confidence
Refactored resource discovery server state and API parameters
The resource discovery server's internal state has been refactored to use more descriptive field names: 'local\_resources' and 'resources' are now 'local\_resource\_tuples' and 'found\_resource\_tuples' respectively. Correspondingly, the public API function 'add\_local\_resource' now accepts a 'Resource' argument instead of 'Instance', and the server's message handling has been updated to reflect these new internal structures, improving code clarity and IDE completion support.
_chapter\_10/resource\_discovery, chapter\_11/resource\_discovery, chapter\_13/resource\discovery · high confidence
Refactors resource discovery to use tuples instead of separate resource maps
The resource discovery module now stores local and found resources as lists of {Type, Resource} tuples rather than separate dictionaries of instances. This change aligns the code with the book's implementation, simplifying how resources are tracked and traded between nodes.
_chapter\08 · medium confidence
Renamed internal state variables and parameters in the resource discovery server
The \rd\_server\ module in \chapter\_09/resource\_discovery\ was updated to rename internal state fields and function parameters for clarity. Specifically, \local\_resources\ was renamed to \local\_resource\_tuples\, and \resources\ was renamed to \found\_resource\_tuples\ within the server's state record. Correspondingly, the \add\_local\_resource/2\ function and its internal handling were updated to use \Resource\ instead of \Instance\ as the parameter name, and the \resources\_for\_types\ helper was updated to reflect the new tuple-based storage structure.
_chapter\_09/resource\discovery · medium confidence
Renamed parameters in resource discovery and store for clarity
In the resource discovery module, the parameter names for adding and deleting local resources were changed from 'Instance' to 'Resource' across the public API and internal server handlers. Additionally, the unnecessary call to 'add\_table\_copy' for the 'schema' table was removed from the 'sc\_store' module.
_simple\cache · high confidence
Stale process references are now validated before returning cached PIDs
The cache lookup in sc\_store now checks whether a stored process ID is still alive before returning it. If the process is dead, the lookup returns an error instead of a stale reference. This prevents errors caused by using invalid PIDs from the cache.
_chapter\_09/simple\cache · medium confidence
Updated .app files and renamed a variable in chapter\_11
The .app files for the simple\_cache and resource\_discovery components were updated to include additional registered processes. Specifically, the simple\_cache application now registers sc\_element\_sup and sc\_event, while the resource\_discovery application registers rd\_server, ensuring these processes are properly tracked by the Erlang runtime.
_chapter\11 · medium confidence
Updated README and application registrations in Chapter 10
The README for Chapter 10 now includes instructions for generating .boot files, and the sys.config file references have been clarified to allow using -sname instead of -name. Additionally, the resource\_discovery and simple\_cache applications have been updated to register the rd\_server and sc\_element\_sup/sc\_event processes respectively.
_chapter\10 · medium confidence
Updated README and registered new Erlang processes
The README instructions for starting nodes were updated to clarify host name configuration and correct the path for the simple\_cache ebin directory. Additionally, the resource\_discovery and simple\_cache application files were modified to register new processes: rd\_server was added to the registered list in resource\_discovery.app, and sc\_element\_sup and sc\_event were added to the registered list in simple\_cache.app.
_chapter\09 · medium confidence
Updated build instructions and registered new OTP processes
The chapter\_13 README was updated to reflect a new command for generating the .boot file and to use the OTPROOT environment variable for the JInterface library path. Additionally, the resource\_discovery and simple\_cache application files were modified to register new processes: rd\_server for resource\_discovery, and sc\_element\_sup and sc\_event for simple\_cache.
_chapter\13 · medium confidence
Updated registered process names and supervisor parameters in application files
The OTP application files for the TCP RPC and simple cache modules now register additional processes with the Erlang node. Specifically, the TCP RPC application registers 'tr\_server' alongside 'tr\_sup', and the simple cache application registers 'sc\_element\_sup' and 'sc\_event' alongside 'sc\_sup'. Additionally, the HTTP interface supervisor's 'start\_link' function now accepts a 'Port' argument instead of 'LSock', reflecting a parameter rename.
_chapter\_04, chapter\_07, chapter\_11/http\interface · medium confidence
Test coverage
Simplified tr\_server test to remove stop call
The test suite for tr\_server was simplified by removing the explicit stop call from the startstop\_test, which has been renamed to start\_test. This change ensures the test focuses solely on the server start functionality, preventing potential confusion or side effects from the previous stop logic.
_chapter\03 · medium confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.
Score
- CAI 39 → 43 (+3.5)
- Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 100 → 96 (-3.8)
- Architecture 100 → 100 (+0.0)
- Maturity 26 → 40 (+14.4)
- Readiness 24 → 24 (+0.0)
- Security 63 → 63 (+0.0)
Resolved (13)
- Coverage not included — suite not readable by the collector
- Dependency hygiene not measured — no supported dependency manifest was read
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- No exposed public API
- Test reliability not included
- The single README describes the project as a collection of tools without stating how to install dependencies or run any example. (README)
- complexity unreadable for .erl, .java — churn × complexity hotspots could not be measured
- dormant codebase — no living knowledge left to concentrate
New (61)
- Coverage not measured — no coverage collector is wired up
- Duplicated block (10 lines × 2) (chapter_04/tcp_rpc/src/tr_app.erl)
- Duplicated block (10 lines × 2) (chapter_12/plain_port/json_parser/src/jp_app.erl)
- Duplicated block (10 lines × 4) (chapter_07/simple_cache/src/simple_cache.erl)
- Duplicated block (10 lines × 4) (chapter_09/resource_discovery/src/rd_app.erl)
- Duplicated block (10 lines × 4) (chapter_09/simple_cache/src/sc_app.erl)
- Duplicated block (10 lines × 4) (chapter_09/simple_cache/src/sc_app.erl)
- Duplicated block (10 lines × 4) (chapter_09/simple_cache/src/sc_store.erl)
- Duplicated block (10 lines × 4) (chapter_09/simple_cache/src/sc_store.erl)
- Duplicated block (10 lines × 5) (chapter_08/resource_discovery.erl)
- Duplicated block (10 lines × 6) (chapter_07/simple_cache/src/sc_sup.erl)
- Duplicated block (10 lines × 7) (chapter_06/simple_cache/src/sc_element.erl)
- Duplicated block (11 lines × 5) (chapter_09/resource_discovery/src/resource_discovery.erl)
- Duplicated block (12 lines × 2) (chapter_11/gen_web_server/src/gen_web_server.erl)
- Duplicated block (12 lines × 6) (chapter_06/simple_cache/src/sc_sup.erl)
- Duplicated block (12 lines × 6) (chapter_07/simple_cache/src/sc_event_logger.erl)
- Duplicated block (12–13 lines × 5) (chapter_09/simple_cache/src/sc_app.erl)
- Duplicated block (15 lines × 2) (chapter_06/simple_cache/src/sc_store.erl)
- Duplicated block (16 lines × 4) (chapter_09/simple_cache/src/sc_store.erl)
- Duplicated block (20 lines × 6) (chapter_07/simple_cache/src/sc_event.erl)
- …and 41 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
erlware/Erlang-and-OTP-in-Action-Source was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 23 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 3836eb0e44ce5126617cd06541346950bb31677c — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-955b9cee9818.