Repository navigation
feat(map): stage 1c, the adversarial layer over the code map - #1053
Merged
Merged
Conversation
The map stays the only source of truth. This layer tries to falsify it and
turns each weakness it confirms into a deterministic rule with a regression
test. It never marks anything Reached.
Defects it found in the map, each fixed and pinned by a fixture reading:
- An associated function read Reached from a constructed value; only a type
named where a call dispatches (a type argument, an associated item) now
counts as evidence (probe::Built::Example::static_fn).
- `self::`, `super::` and `crate::` calls in a macro body fitted no
candidate, which risked a false Dead; the call's site decides, or every
candidate stays open (probe::macros::through_self).
- A call name the build also uses from outside the workspace was read as the
outside item's; every workspace candidate now stays undecided.
- Calls in code the shipped build does not compile (test modules, gated-off
items) counted as its calls; each call carries its cfg gates.
- The Android crate list was incomplete. The checker found witnesses through
unreached nodes in dsm-anchor-core and dsm-anchor-verifier; each build's
crates now come from its own `cargo tree`.
- A reference in a statement the shipped build's features turn off counted as
an edge (a false Reached), and a gate the map cannot decide was read as
decided. Each edge now carries every site it is written at. A build keeps
only the sites its cfg compiles, and an edge into an undecided item is
uncertain (probe::gates::called_under_leak, undecided_twin,
roots::Java_fixture_Probe_gated). The Android map has none today
(uncompiled-edges 0).
The layer:
- The fixture crate (tools/requirement_map/fixture) covers these shapes,
each read through the real pipeline (86 readings):
- receivers, associated functions, generic dispatch, UFCS, trait objects;
- outside traits, function-local impls, ambiguous and never-made types;
- macros that define, write impls, call, use common names, or write two
items over one extent;
- block-item collisions, format captures, call cycles;
- JNI roots: declared, renamed, undeclared, internal, gated;
- cfg(test), debug_assertions, and dev-dependency feature leakage.
- Mutation cases (tools/requirement_map/fixture/mutations.toml, run by
ci/requirement_map_mutations.py in temporary copies):
- 14 fixture changes;
- 2 on the real tree: a JNI declaration removed, and the core router
adapter never built (a full Android re-index);
- 17 faults planted in copies of the fixture's map and the real map.
- The check (ci/requirement_map.py check): 17 declared rules.
- Contradictions in the map's own tables, including a new closure rule: a
proven non-dispatch step from a reached definition must lead to a
reached one.
- The committed sentinels (26, one real example per rule where one
exists), entry points and counts, with any jump in Indeterminate
readings refused.
- tools/requirement_map/rules.tsv lists every code, edge kind, entry-point
kind and check rule, with its unit tests, fixture readings, mutation cases
and sentinel, or why one is missing. src/rules.rs fails when:
- a rule has no row;
- a citation does not exist;
- a code's examples read another code.
- Root kinds are named constants (graph::root).
- Paths are written from their UTF-8 components. A name that is not UTF-8 is
an error, never replaced, and a package at the repository root reads
`src/`.
- CI runs the check and every mutation case after the map; committed.tsv
(what the map reads) is kept for review.
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.
Stage 1c: the adversarial layer over the code map
The map stays the only source of truth. This layer attacks it and turns every weakness it confirms into a deterministic rule with a regression test. It never marks anything Reached, and it adds no exceptions.
Defects it found in the map (all fixed, each pinned by a fixture reading)
probe::Built::Example::static_fnread Reachedself::,super::andcrate::calls in a macro body fitted no candidatethrough_self)cargo treecalled_under_leak,undecided_twin, the gated JNI export)uncompiled-edges 0)What the layer is
tools/requirement_map/fixture): 86 readings through the real pipeline, covering:internal, gated;mutations.toml, 33 in all), each run in a temporary copy that is removed afterwards:ci/requirement_map.py check): 17 declared rules.tools/requirement_map/rules.tsv, checked bysrc/rules.rs): every code, edge kind, entry-point kind and check rule, with its unit tests, fixture readings, mutation cases and sentinel. Where a column is empty, the row says why. The test fails when a rule has no row, a citation is missing, or a code's examples read another code.committed.tsv, the entry points and counts this map reads, is kept as an artifact for review.Known before merge
committed.tsv, after you review them.Verification on
8b6abf0be(local, macOS; the node build is indexed only on Linux)requirement_mapunit tests (--release): 93 passed, including the rule-table test.make lintexits 0, andcargo clippy -p requirement_map --all-targets -D warningsis clean.origin/main: exit 0.make requirement-map-fixture: all 86 readings as expected.make requirement-map+make requirement-map-check:make requirement-map-mutations: 33 cases run, 0 failed: