feat(remap): affectedSurfaces — sound, opt-in selective-remap core (#75)#158
Merged
Conversation
Given the files a change touched, a surface→entry map, and a module graph
(any tool's output as { from, to } edges — dependency-cruiser maps directly),
return exactly the surfaces that could have rendered differently, or the
sentinel 'all'. Sound by construction: over-approximates and resolves every
uncertainty to 'all' — global/vanilla stylesheets, createGlobalStyle,
design-system configs, unbounded import(x), and unplaceable files force a full
re-capture; computed import(`../dir/${x}`) is recovered as a bundler context
module (directory-level, never a miss). Ships classifyStyleChange.
Purely additive, adds no dependency, never touches the default gate. Answers
#75's Q1 (global classifier), Q2 (dynamic composition), Q4 (graph tool);
groundwork validated in the #155/#157 spikes.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🗺️ StyleProof report📊 View the side-by-side visual report →To accept: rebuild the map with |
Fallow audit reportNo GitHub PR/MR findings. Generated by fallow. |
Fallow audit report0 inline findings selected for GitHub review. |
…yleproof github urls) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What and why
Closes the core of #75 (selective remap) — the sound reasoning half, as a new opt-in export. Given the files a change touched, a surface→entry map, and a module graph,
affectedSurfacesreturns exactly the surfaces that could have rendered differently, or the sentinel'all'.Validated first as spikes — #155 (why not GitNexus: it drops CSS edges and false-negatives on
lazy) and #157 (dependency-cruiser is sound; the ceiling is dynamic composition + the global-CSS classifier). This lands that decision as real, tested code.Design choices that keep it safe and framework-agnostic:
{ from, to }edges (dependency-cruiser'smodules[].dependencies[]maps directly). StyleProof adds no dependency and stays framework-agnostic; graph production — where framework-specific resolution lives — is the caller's.createGlobalStyle, design-system configs, an unbounded dynamicimport(x), and files the graph can't place all force'all'. A computed template-literal import with a static directory prefix is recovered as a bundler context module (directory-level precision, never a miss).maincapturing all as the trust-but-verify net.Proof (required)
Rendered/screenshot proof is Not applicable: this adds a pure, deterministic reasoning function with no capture/diff/report rendering path and no visual output — so the evidence is behavioural, per the template's "Behaviour / guards / CLI: paste the actual command or test output".
End-to-end on a real
dependency-cruisergraph (generichome/pricing/dashboardfixture — a static import, a string-literallazy, a computed template-literal import over../components/, a CSS module, a vanilla sheet, a global token sheet):Reads: a scoped change resolves to just the surfaces that can render it (the win); a global / vanilla / unbounded change resolves to
all(never a silent miss); a computed import is soundly coarsened to its whole directory.Tests — 25 new (13 classifier cases across vanilla / CSS Modules / styled-components / vanilla-extract / Tailwind / Sass, 12 reachability + fail-closed cases). Full suite:
Gates — pass (run by the pre-commit hook):
build·typecheck·lint·format:checkall clean;fallow— ✓ No issues in 5 changed files.Checklist
Not applicablewith the technical reasonnpm run demo:report— N/A, rendering untouchednpm run build && npm run typecheck && npm run lint && npm run format:checkpassnpm testpasses (274/274);test:e2eN/A — no capture/engine path changed[Unreleased]entry.agents/DEFINITION_OF_DONE.mdand.agents/skills/pr-inline-screenshot-proof/SKILL.mdNot applicablewith the technical reason — latter🤖 Generated with Claude Code