docs(user-guide,architecture): regenerate samples from real output (#97) - #99
Merged
Merged
Conversation
dev-montimage
force-pushed
the
docs/97-regenerate-user-guide-samples
branch
from
August 27, 2026 14:29
327f9c7 to
e0c457e
Compare
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.
dev-montimage
force-pushed
the
docs/97-regenerate-user-guide-samples
branch
from
August 27, 2026 14:35
e0c457e to
913ef67
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #97
Summary
docs/USER_GUIDE.mdwas left out of the file set of #72 (PR #95) and stillcarried sample output that no code path emits. Every fenced output block is now
spliced from an actual run against the repository's
smallFlows.pcap— the samemethod PR #95 used for the other docs — rather than hand-edited. The two
docs/ARCHITECTURE.mdidentifier fixes the issue asked for are folded in.Beyond the three defects the issue names, regenerating the file surfaced a
fourth fabrication and a broken-command class that acceptance criterion 5 forces
into scope: a whole "PCAP Statistics" section for a feature that does not exist,
and every example using the pre-subcommand form (
./mmtReader -t ...), whichexits 0 but only prints the help screen and analyzes nothing.
Approach
Option 2 (balanced): fix the fabricated output, make every documented command
actually runnable, and stop contradicting
docs/CONFIG.md.The blocks were not typed. A generator read the captured stdout of each
documented command and spliced contiguous verbatim slices into the page; long
tables are cut at an explicit
...row with the true row count stated, and theJSON sample is the real document with only its two arrays shortened (key order,
indentation and every value untouched, and it still parses).
Decision Record
docs/USER_GUIDE.mdhas not been touched since docs(doc-manager): reconcile all docs to code + generate missing docs #33 (54da1d2).PR docs(build,test): align README and DEVELOPMENT with the real build (#72) #95 corrected README/DEVELOPMENT/TESTING/PLAYBOOK/AGENT_ENVIRONMENT against
the real build but deliberately excluded this file, and PR fix(cli): honor json from config file and MMTREADER_JSON (#96) #98 (json option from config file and MMTREADER_JSON env var are silently ignored #96) then
changed config/env JSON behaviour without revisiting it. The guide therefore
documents a tool several releases behind the one in the repo — an uppercase
TCP.HTTP.Googlepath format, stat labelscli/output.cnever prints, a JSONschema predating both the
protocol_paths[]split and theversionobjectfrom [4.2] Introduce project version distinct from SDK version #70, and a PCAP-statistics section for a feature that was never
implemented.
plus the ARCHITECTURE.md naming; Option 2 — that, plus make every command
runnable and align the config/env sections with
docs/CONFIG.md; Option 3 —that, plus troubleshooting, option tables, CHANGELOG and a cross-doc sweep.
the untouched examples still omit the subcommand and point at a
capture.pcapthat exits 2. Option 3 — roughly doubles the review surface for a
priority: lowdocumentation issue, and even then leaves the same fabricationstanding in README.md and PLAYBOOK.md.
because leaving them out would have been self-inflicted:
docs/ARCHITECTURE.mdrepeated the same PCAP-statistics fabrication being deleted from the guide (and
that file is already in the diff), and both docs(build,test): align README and DEVELOPMENT with the real build (#72) #95 and fix(cli): honor json from config file and MMTREADER_JSON (#96) #98 set the house
convention of a CHANGELOG entry for doc corrections.
analyze --helpadvertises-i, --interface <iface>as"alternative to -t", but the parser rejects it — the tool's own help text is
wrong. It is reproduced verbatim here (it is real output) with a note flagging
the discrepancy; fixing the help string is a code change and belongs in its own
issue. The identical fabricated PCAP-statistics block still stands
in
README.md:584anddocs/PLAYBOOK.md:469-471; both are outside thisissue's named file set and worth a short follow-up. Sample values (packet
counts, the SDK build hash, the banner's build timestamp) are environment- and
build-specific, and there is no automated test pinning the docs to real output,
so this class of drift can recur — a doc-verification test group would prevent
it but would change the documented "14 numbered test groups" everywhere and was
left out of scope.
Analyzed at:
docs/97-regenerate-user-guide-samples @ 913ef67(2026-08-27), based onmain @ ccbb631Changes
docs/USER_GUIDE.mdanalyze/capturesubcommand and pointed atsmallFlows.pcap; fabricated "PCAP Statistics" section andis not an Etherneterror removed; troubleshooting messages spliced verbatim; option tables completed with-b,-cand-F; config/env sections aligned withdocs/CONFIG.mddocs/ARCHITECTURE.mdinsert_proto_info()→proto_info_insert()(cli/output.c:104, and the list is doubly-linked);engine_print_stats_ex()attributed tocore/engine.c:281; removed the Output Sequence bullet for the non-existent PCAP-statistics section; corrected the online-mode "Ethernet-only" claim, which contradictedcapture.c's 802.11 handlingCHANGELOG.md### Documentationentries under[Unreleased]for both filesTest Results
-Wall -WextraQA ran one independent reviewer pass on top of direct verification, and it
earned its keep: it caught a false claim this PR had introduced — that input
mode follows the
-t/-iflag rather than the subcommand, soanalyze -iwould capture live. It does not. Both input flags are gated symmetrically and
analyze -iexits 2 withError: -i/--interface is for 'capture' only(
cli/parse.c:394;capture -tis rejected the same way at:380). Fourplaces that leaned on the wrong reading were corrected, and a second reviewer
pass then confirmed the fix and returned clean. A slower first-cycle reviewer
additionally caught that
docs/ARCHITECTURE.mdstill called live capture"Ethernet-only (DLT_EN10MB check)" — contradicting
capture.cand this PR'sown new USER_GUIDE text. No datalink is ever rejected:
pcap_datalink()is readat
mmtReader.c:195, 802.11 is converted atcapture.c:289-312, and anythingelse passes through. Fixed, and British spellings I had introduced were
normalized to the repo's American convention. Beyond the acceptance criteria, every author-written claim in the guide
was checked against the source or by running the tool:
-bis consumed only onthe live path (
mmtReader.c:170-187);analyzeprints noINFO:lines; inputmode follows
-t/-irather than the subcommand (cli/parse.c:391,401), soanalyze -ireally does capture live;-x/-y/-zshare one optstring(
cli/parse.c:622) and work with both subcommands; the banner goes to stdout intext mode and stderr under
--json;pcap_stats()is called nowhere in thesource or the binary;
capture.cconverts 802.11 as well as Ethernet; and theprecedence chain was exercised end to end (config
json=1+MMTREADER_JSON=0→ text; config
json=0+--json→ JSON;MMTREADER_JSON=1+--text→text). Markdown fences balance and the single relative link resolves.
No C source changed, so the suite is unaffected; it was run to satisfy criterion 6.
make clean >/dev/null && make testexits 0 and endsAll tests passed!with thesingle tolerated root-gated skip (
SKIP: live capture on 'lo' unavailable).Acceptance Criteria Verification
docs/USER_GUIDE.mdis reproduced by running the documented command againstsmallFlows.pcapand pasting real outputgrep -n "TCP.HTTP" docs/USER_GUIDE.mdis emptyversionas an object withmmtreaderandmmt_dpikeysanalyze -t smallFlows.pcap -a -j -sdocument with only its arrays shortened:version{mmtreader,mmt_dpi},input_stats,protocol_paths[],protocols[],anomalies[]. Still parses as JSON.docs/ARCHITECTURE.mdnamesproto_info_insert()and attributesengine_print_stats_ex()tocore/engine.cdocs/ARCHITECTURE.md:165,168nameproto_info_insert()(cli/output.c:104); line 176 readscore/engine.c:281(core/engine.c:281).docs/USER_GUIDE.mdruns verbatim and exits 0```bashblocks were executed verbatim from the repo root: 11 pass, 0 fail. The 4 remaining aresudo … capture -i eth0live-capture examples, root-gated exactly like the suite's own tolerated skip; usage synopses with placeholders were moved out ofbashfences so they are no longer presented as runnable.make clean >/dev/null && make testexits 0, 0 failures (1 tolerated root-gated skip)All tests passed!, 52/52 CLI checks, 6/6 SDK checks, 0 failures, 1 skip (live capture on 'lo').