Skip to content

fix: all three critical findings and three of nine high - #6

Open
Lumi-node wants to merge 2 commits into
mainfrom
fix/critical-and-high
Open

Lumi-node wants to merge 2 commits into
mainfrom
fix/critical-and-high

Conversation

@Lumi-node

Copy link
Copy Markdown
Owner

From the four-lane review of a4d7dae. Full report: https://claude.ai/code/artifact/8b1df379-403b-4c2c-a866-29c541c25a45

Every fix was confirmed to fail against the unfixed code, not merely to pass against the fixed one.

Critical

The diagram subsystem was unreachable by any user. catalog diagram imported diagram_repo from drydock.diagram.mermaid — a function that had never existed in any commit — behind an except ImportError that reported "diagram module not available", blaming a module that was present and importable the whole time. All four generators were unit-tested, correct, and reachable by nothing.

diagram_repo is now written, and drydock diagram <path> exists as a top-level command — docs/concepts/diagrams.md had documented it across 290 lines, and drawing a picture of a directory shouldn't require ingesting it into a catalog first. That makes component_diagram reachable for the first time. All four kinds validated through mermaid-cli, not a regex. --kind now validates against one list shared by help text, error message and dispatch; the markdown branch goes through _emit so -o is no longer accepted and dropped.

The suite's only cross-cutting invariant was switched off. test_all_import_refs_no_spaces asserts a property across every parser and file, and its docstring says it "would have caught Bug B". It couldn't — the assertion sat inside except Exception: pass, and AssertionError is an Exception. Reintroducing the literal Bug B shape now fails the suite; before this it passed.

docs/concepts/diagrams.md documented a command that didn't exist. Every command on the page now runs.

High

architecture layer count flipped between identical runs (9 8 8 9 9 9 9 9) _depths() iterates sorted — the memoized cycle break no longer depends on set order
boundaries bridge membership varied with hash seed Sorted iteration; ordering extracted to rank_bridges with a total key
git found zero stable files in a stable repo Absolute thresholds against a percentile-derived busy line; new moderate category closes the dead zone. Now 186 stable of 198, summing exactly

The git one is worth spelling out: change_ratio = changes / max_changes was purely relative, so with a 90-day maximum of 3 changes a file touched once scored 0.33, cleared the > 0.3 bar and was reported as "high changes, concentrated risk" — 87 files on this repo, from the analyzer whose entire purpose is finding stable extraction candidates.

On the tests

Two of the new regression tests were vacuous on first writing and passed against the unfixed code. Both were rewritten until they actually failed:

  • The determinism tests had to move into subprocesses with varying PYTHONHASHSEED — set order is stable within a single process, so an in-process loop cannot observe hash-order nondeterminism at all.
  • The depths fixture had to become dense enough that neighbour order could vary; a ring where each node has one neighbour has no order to vary.
  • The bridge test never reproduced synthetically, so rather than ship something that couldn't fail, the ordering was extracted into rank_bridges and tested directly under shuffling.

Verification

549 tests pass on 3.10–3.13. Container smoke 14/14 plus the new diagram command. No new lint findings.

Six high findings remain, documented with repros in SESSIONS/2026-08-22.md.

Lumi-node and others added 2 commits August 22, 2026 23:12
From the 2026-08-22 four-lane review. Each fix was confirmed to fail against
the unfixed code before being kept, not merely to pass against the fixed one.

CRITICAL -- the diagram subsystem was unreachable by any user.
`catalog diagram` imported `diagram_repo` from drydock.diagram.mermaid, a
function that had never existed in any commit, behind an `except ImportError`
that reported "diagram module not available" -- blaming a module that was
present and importable the whole time. All four generators were unit-tested,
correct, and reachable by nothing. `diagram_repo` is now written, and
`drydock diagram <path>` exists as a top-level command: docs/concepts/diagrams.md
had documented it in detail across 290 lines, and drawing a picture of a
directory should not require ingesting it into a catalog first. That also makes
`component_diagram` reachable for the first time. All four kinds were validated
through mermaid-cli, not a regex. `--kind` is now validated against one list
shared by the help text, the error message and the dispatch, and the markdown
branch goes through `_emit` so `-o` is no longer accepted and dropped.

CRITICAL -- the suite's only cross-cutting invariant was switched off.
`test_all_import_refs_no_spaces` asserts a property across every parser and
every file, and its docstring says it "would have caught Bug B". It could not:
the assertion sat inside `except Exception: pass`, and AssertionError is an
Exception, so the test ate its own failure. The handler now catches only what
the parser raises, and a counter makes the test fail rather than pass vacuously
if the fixture ever stops producing imports. Reintroducing the literal Bug B
shape now fails the suite; before this it passed.

CRITICAL -- docs/concepts/diagrams.md documented a command that did not exist.
Every command on the page now runs. The `seams` kind was also misspelled
(the real kind is `seam`) and `--seam` takes a contract file, not a type name.

HIGH -- identical input produced different architecture. `_depths()` iterated a
set, and because the cycle break is memoized, neighbour order decided which
node in a cycle got depth 0. Layer counts flipped between consecutive runs on
any project with a cycle; Drydock is acyclic, which is why dogfooding never
showed it.

HIGH -- bridge files changed between runs. `boundaries.py` iterated `all_files`
raw and sorted on connection count alone, so ties kept walk order and the
`[:30]` truncation dropped a different set each time. The ordering is now a
module-level `rank_bridges` with a total key.

HIGH -- the git analyzer found zero stable files in a stable repo, from the
analyzer whose entire purpose is finding stable extraction candidates.
`change_ratio = changes / max_changes` was purely relative: with a 90-day
maximum of 3 changes, a file touched once scored 0.33, cleared the `> 0.3` bar
and was reported as "high changes, concentrated risk" -- 87 files on Drydock.
Churn is now absolute, against a busy line drawn from the 75th percentile with
a floor, and a `moderate` category closes the dead zone the old bands left
between 0.1 and 0.3, so the counts finally sum to the number of files analysed.
Drydock now reports 186 stable of 198, summing exactly.

Two of the new regression tests were vacuous on first writing and were
rewritten until they actually failed against the unfixed code: the determinism
tests had to move into subprocesses with varying PYTHONHASHSEED, because set
order is stable within a single process, and the depths fixture had to become
dense enough that neighbour order could vary at all.

549 tests pass on 3.10-3.13; container smoke 14/14 plus the new command; no new
lint findings.

Six high findings remain, listed in SESSIONS/2026-08-22.md.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The four-lane review, what was fixed, and the six high findings left open with
enough detail to resume cold.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant