Skip to content

docs(build,test): align README and DEVELOPMENT with the real build (#72) - #95

Merged
luongnv89 merged 4 commits into
mainfrom
docs/72-align-docs-real-build
Aug 27, 2026
Merged

luongnv89 merged 4 commits into
mainfrom
docs/72-align-docs-real-build

Conversation

@luongnv89

Copy link
Copy Markdown
Collaborator

Summary

Closes #72 (F-DOCS-001, F-DOCS-002) — the last issue of the modernization epic #75.

The docs had drifted from the tree across four recently merged PRs (#91, #92, #93, #94). Every factual claim in this PR was verified by running the command or reading the current source; nothing was inferred, and nothing from the issue body (which quotes a MODERNIZATION_PLAN.md that no longer exists) was trusted.

Approach

Three classes of drift were fixed:

1. Broken build commands. The manual compile in docs/DEVELOPMENT.md omitted flows.c and failed at link (undefined reference to 'flows_create', flows_attach, flows_destroy, flows_print_top). The GDB recipe compiled a single translation unit and used pre-subcommand argv. docs/TESTING.md's two unit-test compile lines pointed at the wrong paths (test_config.c instead of tests/test_config.c) and omitted config.c. All four now run verbatim, exit 0, warning-free.

2. Stale prerequisites and build facts. libconfuse-dev was listed as a prerequisite in README.md and docs/DEVELOPMENT.md though config.c implements its own INI parser and the link line is -lmmt_core -ldl -lpcap. The docs now also describe the -Wall -Wextra warning gate (kept in WARNFLAGS so make CFLAGS=... cannot disable it) and the -DMMTREADER_VERSION product-version injection, with file:line citations.

3. Test-count drift — the most-repeated error. Several docs still cited "~194 unit asserts", "13 numbered test groups", and in places "27/27 CLI checks". Totals were re-measured from a real run and standardized everywhere.

Beyond the two files the issue names, the README's sample output was invented (a banner format the binary never printed, tables in a layout it does not use). It is replaced with output captured from ./mmtReader analyze -t smallFlows.pcap -a, including the version object introduced in #93.

Measured totals (standardized across all docs)

Signal Measured
Numbered test groups 14 (plus sub-groups 2b and 5b)
Unit asserts, groups 5–11 incl. 5b 252 (40 + 9 + 73 + 43 + 38 + 37 + 7 + 5)
CLI integration checks (group 12) 35 / 35
SDK version-gate checks (group 14) 6 / 6
Failures 0
Tolerated skips 1 — live capture on lo (root-gated)

Broken documented commands found and fixed

Command Where Failure
manual gcc compile docs/DEVELOPMENT.md link error — flows.c missing from the source list
GDB build docs/DEVELOPMENT.md compiled only mmtReader.c; run -t ... also skipped the subcommand
gcc ... test_config.c config.c docs/TESTING.md test_config.c: No such file — path missing tests/
gcc ... test_parse.c cli/parse.c docs/TESTING.md config.h not found; config.c not linked

All four now execute as written.

Changes

File What changed
docs/DEVELOPMENT.md Prereqs (libconfuse out, jq in), SDK minimum, real Makefile variables, working manual compile, working GDB recipe, flows.c/cli_mode_t/flows_t added to structure and types, real build/--version output, rewritten Testing section, corrected project layout
README.md apt line, no-config-library note, make/make test sections with real output, real sample output and JSON, duplicated Usage Examples block removed, -F <seconds> semantics, project structure and docs table
docs/TESTING.md Full 14-group table with per-suite assert counts, expected totals, tolerated skip, fixed compile commands, test.pcap described accurately
AGENT_ENVIRONMENT.md 13→14 groups, 252 asserts, group 14 row, real compile line, WARNFLAGS/VERSION_DEFS notes, corrected Makefile/test_cli.sh line refs
CLAUDE.md 13→14 numbered test groups
docs/PLAYBOOK.md Experiment 3 metric 38→37 protocol paths (measured)
docs/CHANGELOG.md Pointer to the root CHANGELOG.md that holds [Unreleased]
CHANGELOG.md Documentation entry under [Unreleased]
skills/mmt-reader/references/installation.md libconfuse removed; SDK ≥ 1.8.0 troubleshooting row added

Test Results

$ make clean && make test
...
Passed: 35 / 35
Failed: 0 / 35
SKIP: live capture on 'lo' unavailable — Couldn't activate device lo: socket: Operation not permitted
All tests passed!
$ echo $?
0

make coverage also verified green (76.53% line / 61.56% branch).

Acceptance Criteria Verification

Criterion Status Evidence
Manual build command from docs/DEVELOPMENT.md runs verbatim and links Extracted the code block programmatically and executed it — exit 0, zero warnings, resulting binary reports mmtReader version: 0.3.0
grep -ri libconfuse README.md docs/ is empty Exit 1 (no matches)
jq prerequisite from task 0.5 remains Present in README.md, docs/DEVELOPMENT.md, AGENT_ENVIRONMENT.md, docs/TESTING.md
make clean && make test exits 0, 0 failures, 1 tolerated skip Output above
README and DEVELOPMENT match actual observed output Every sample regenerated from live runs; independently re-verified by a review pass that re-ran all commands and opened every cited line range

Notes

  • Not fixed, deliberately: .oss-ready/*.md still mentions libconfuse. Those are point-in-time audit artifacts of a past OSS-readiness review, not living documentation; rewriting them would falsify the record. They are outside the acceptance-criteria grep scope.

Closes F-DOCS-001 and F-DOCS-002. Every claim below was verified by running
the command or reading the current source, not inferred.

Build:
- The manual compile in docs/DEVELOPMENT.md now names flows.c (it previously
  failed at link with `undefined reference to 'flows_create'`) and carries
  -Wall -Wextra plus -DMMTREADER_VERSION, matching what `make` emits.
- The GDB recipe built a single translation unit and used the pre-subcommand
  argv; it now builds every source at -O0 and runs `run analyze -t ...`.
- libconfuse is documented away everywhere: config.c has its own INI parser
  and the link line is `-lmmt_core -ldl -lpcap`. jq stays as a test-time-only
  prerequisite.
- The WARNFLAGS gate and the -DMMTREADER_VERSION injection are now described
  in README, DEVELOPMENT and AGENT_ENVIRONMENT, with file:line citations.

Tests — re-measured from an actual `make clean && make test`, replacing the
"~194 unit asserts / 13 test groups" figures that several docs still carried:
14 numbered groups (plus sub-groups 2b and 5b), 252 unit asserts across
groups 5-11, 35/35 CLI integration checks, 6/6 SDK-check assertions, one
tolerated `lo` skip. docs/TESTING.md gains the full per-group table, and its
two unit-test compile commands (which pointed at the wrong paths and omitted
config.c) now run verbatim.

README output samples: the banner, protocol tables, input statistics and JSON
document were invented; they are replaced with output captured from
`./mmtReader analyze -t smallFlows.pcap -a`, including the `version` object
introduced in #70. A duplicated Usage Examples block is removed, `-F` is
documented as taking seconds, and the two changelogs are cross-referenced.
@luongnv89
luongnv89 merged commit 38c3e88 into main Aug 27, 2026
2 checks passed
@luongnv89
luongnv89 deleted the docs/72-align-docs-real-build branch August 27, 2026 10:47
dev-montimage pushed a commit that referenced this pull request Aug 27, 2026
docs/USER_GUIDE.md was left out of #72 (PR #95) and still carried sample
output no code path emits. Every block below was spliced from an actual run
against smallFlows.pcap, not hand-edited, the same method PR #95 used.

Fabrications removed:
- The protocol-path format `TCP.HTTP.Google` (lines 61, 94-95, 110, 164, 332)
  is really the dotted lowercase stack, e.g. `ethernet.ip.tcp.http.msn`.
- The INPUT STATISTICS sample printed `Input:` and `Sessions:` labels that do
  not exist. cli/output.c:304-340 emits Packets:, Data:, Total Sessions:,
  Protocols:, Duration:, Bandwidth:, pps: and fps:, plus IPv4/IPv6/Active
  Sessions only under -s.
- The JSON sample predated both the `protocol_paths[]` split and the breaking
  `version` object from #70. It now shows version{mmtreader,mmt_dpi},
  input_stats, protocol_paths[], protocols[] and anomalies[], with only the
  array lengths reduced.
- Section "4. PCAP Statistics" described kernel/driver drop counts that are
  never produced: pcap_stats() is called nowhere, and the strings appear in
  neither the source nor the binary. Section and its troubleshooting entry are
  gone; ARCHITECTURE.md's matching Output Sequence bullet went with them.
- Troubleshooting invented `eth0 is not an Ethernet`. The real messages are
  spliced in verbatim, and capture.c supports WiFi as well as Ethernet.

Commands: every example was pre-subcommand (`./mmtReader -t ...`), which exits
0 but only prints help, and several pointed at a `capture.pcap` that does not
exist and exits 2. All now carry analyze/capture and use smallFlows.pcap; the
11 runnable ones were executed verbatim and exit 0, the 4 live-capture ones
are root-gated like the suite's own tolerated skip.

Config and environment sections now agree with docs/CONFIG.md as rewritten by
#96: which keys are live versus parsed-but-unused, and the precedence chain
defaults < ~/.mmtreader.conf < --config < environment < CLI flags.

ARCHITECTURE.md: the sorted-list helper is proto_info_insert()
(cli/output.c:104), not insert_proto_info(), and it builds a doubly-linked
list; engine_print_stats_ex() is defined in core/engine.c:281, not
cli/output.c.

Verified: 198 pasted output lines matched against fresh tool output, 11/11
runnable documented commands exit 0, `grep -n "TCP.HTTP" docs/USER_GUIDE.md`
empty, and `make clean && make test` exits 0 with the single tolerated
root-gated `lo` skip.

Input flags are subcommand-gated symmetrically: `analyze -i` and `capture -t`
each exit 2 (cli/parse.c:380,394). `analyze --help` nonetheless advertises
`-i` as "alternative to -t"; that help text is reproduced verbatim with a note
flagging it, since it is the tool's own output and a pre-existing bug.
dev-montimage pushed a commit that referenced this pull request Aug 27, 2026
docs/USER_GUIDE.md was left out of #72 (PR #95) and still carried sample
output no code path emits. Every block below was spliced from an actual run
against smallFlows.pcap, not hand-edited, the same method PR #95 used.

Fabrications removed:
- The protocol-path format `TCP.HTTP.Google` (lines 61, 94-95, 110, 164, 332)
  is really the dotted lowercase stack, e.g. `ethernet.ip.tcp.http.msn`.
- The INPUT STATISTICS sample printed `Input:` and `Sessions:` labels that do
  not exist. cli/output.c:304-340 emits Packets:, Data:, Total Sessions:,
  Protocols:, Duration:, Bandwidth:, pps: and fps:, plus IPv4/IPv6/Active
  Sessions only under -s.
- The JSON sample predated both the `protocol_paths[]` split and the breaking
  `version` object from #70. It now shows version{mmtreader,mmt_dpi},
  input_stats, protocol_paths[], protocols[] and anomalies[], with only the
  array lengths reduced.
- Section "4. PCAP Statistics" described kernel/driver drop counts that are
  never produced: pcap_stats() is called nowhere, and the strings appear in
  neither the source nor the binary. Section and its troubleshooting entry are
  gone; ARCHITECTURE.md's matching Output Sequence bullet went with them.
- Troubleshooting invented `eth0 is not an Ethernet`. The real messages are
  spliced in verbatim, and capture.c supports WiFi as well as Ethernet.

Commands: every example was pre-subcommand (`./mmtReader -t ...`), which exits
0 but only prints help, and several pointed at a `capture.pcap` that does not
exist and exits 2. All now carry analyze/capture and use smallFlows.pcap; the
11 runnable ones were executed verbatim and exit 0, the 4 live-capture ones
are root-gated like the suite's own tolerated skip.

Config and environment sections now agree with docs/CONFIG.md as rewritten by
#96: which keys are live versus parsed-but-unused, and the precedence chain
defaults < ~/.mmtreader.conf < --config < environment < CLI flags.

ARCHITECTURE.md: the sorted-list helper is proto_info_insert()
(cli/output.c:104), not insert_proto_info(), and it builds a doubly-linked
list; engine_print_stats_ex() is defined in core/engine.c:281, not
cli/output.c.

Verified: 198 pasted output lines matched against fresh tool output, 11/11
runnable documented commands exit 0, `grep -n "TCP.HTTP" docs/USER_GUIDE.md`
empty, and `make clean && make test` exits 0 with the single tolerated
root-gated `lo` skip.

Input flags are subcommand-gated symmetrically: `analyze -i` and `capture -t`
each exit 2 (cli/parse.c:380,394). `analyze --help` nonetheless advertises
`-i` as "alternative to -t"; that help text is reproduced verbatim with a note
flagging it, since it is the tool's own output and a pre-existing bug.

ARCHITECTURE.md's online-mode characteristics claimed "Ethernet-only
(DLT_EN10MB check)", which contradicted both capture.c and this change's own
USER_GUIDE text. No datalink is ever rejected: pcap_datalink() is read at
mmtReader.c:195, 802.11 is converted at capture.c:289-312, and anything else
passes through to a handler initialized as DLT_EN10MB.
luongnv89 added a commit that referenced this pull request Aug 27, 2026
…) (#99)

docs/USER_GUIDE.md was left out of #72 (PR #95) and still carried sample
output no code path emits. Every block below was spliced from an actual run
against smallFlows.pcap, not hand-edited, the same method PR #95 used.

Fabrications removed:
- The protocol-path format `TCP.HTTP.Google` (lines 61, 94-95, 110, 164, 332)
  is really the dotted lowercase stack, e.g. `ethernet.ip.tcp.http.msn`.
- The INPUT STATISTICS sample printed `Input:` and `Sessions:` labels that do
  not exist. cli/output.c:304-340 emits Packets:, Data:, Total Sessions:,
  Protocols:, Duration:, Bandwidth:, pps: and fps:, plus IPv4/IPv6/Active
  Sessions only under -s.
- The JSON sample predated both the `protocol_paths[]` split and the breaking
  `version` object from #70. It now shows version{mmtreader,mmt_dpi},
  input_stats, protocol_paths[], protocols[] and anomalies[], with only the
  array lengths reduced.
- Section "4. PCAP Statistics" described kernel/driver drop counts that are
  never produced: pcap_stats() is called nowhere, and the strings appear in
  neither the source nor the binary. Section and its troubleshooting entry are
  gone; ARCHITECTURE.md's matching Output Sequence bullet went with them.
- Troubleshooting invented `eth0 is not an Ethernet`. The real messages are
  spliced in verbatim, and capture.c supports WiFi as well as Ethernet.

Commands: every example was pre-subcommand (`./mmtReader -t ...`), which exits
0 but only prints help, and several pointed at a `capture.pcap` that does not
exist and exits 2. All now carry analyze/capture and use smallFlows.pcap; the
11 runnable ones were executed verbatim and exit 0, the 4 live-capture ones
are root-gated like the suite's own tolerated skip.

Config and environment sections now agree with docs/CONFIG.md as rewritten by
#96: which keys are live versus parsed-but-unused, and the precedence chain
defaults < ~/.mmtreader.conf < --config < environment < CLI flags.

ARCHITECTURE.md: the sorted-list helper is proto_info_insert()
(cli/output.c:104), not insert_proto_info(), and it builds a doubly-linked
list; engine_print_stats_ex() is defined in core/engine.c:281, not
cli/output.c.

Verified: 198 pasted output lines matched against fresh tool output, 11/11
runnable documented commands exit 0, `grep -n "TCP.HTTP" docs/USER_GUIDE.md`
empty, and `make clean && make test` exits 0 with the single tolerated
root-gated `lo` skip.

Input flags are subcommand-gated symmetrically: `analyze -i` and `capture -t`
each exit 2 (cli/parse.c:380,394). `analyze --help` nonetheless advertises
`-i` as "alternative to -t"; that help text is reproduced verbatim with a note
flagging it, since it is the tool's own output and a pre-existing bug.

ARCHITECTURE.md's online-mode characteristics claimed "Ethernet-only
(DLT_EN10MB check)", which contradicted both capture.c and this change's own
USER_GUIDE text. No datalink is ever rejected: pcap_datalink() is read at
mmtReader.c:195, 802.11 is converted at capture.c:289-312, and anything else
passes through to a handler initialized as DLT_EN10MB.
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.

[4.4] Align DEVELOPMENT and README docs with the real build

1 participant