fix(wiki): let the file page and the code reach each other - #2091
Open
RaghavChamadiya wants to merge 1 commit into
Open
fix(wiki): let the file page and the code reach each other#2091RaghavChamadiya wants to merge 1 commit into
RaghavChamadiya wants to merge 1 commit into
Conversation
The file route embedded a wiki body with no page list, so every backticked path in it rendered as dead text on the one surface where the reader is already looking at a file. It now resolves them the way the docs reader does, routing a file ref to the file route and a directory ref to its module page rather than to a route that 404s on a directory. The cycle page also read badly. Its members were bulleted once and then listed again as ranking rows, every list was loose, a symbol with no name printed a bare bullet, and a file with nothing public printed a heading with nothing under it. And it told a reader that a group of test files sharing a conftest "cannot be loaded, tested or extracted without the rest of it", which describes a working test tree as debt. An all-test cycle now gets its own sentence and its own heading.
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.
The wiki and the file route documented the same file and could not reach each other
Two crossings, one of them missing and one of them dead.
The file route rendered a wiki body with no page list.
files/[...path]/page.tsxpassed
contentand nothing else toWikiMarkdown, so every backticked path in theembedded documentation was plain text. The docs reader has resolved those since the
path index shipped; the file page, where the reader is already looking at a file, did
not.
The cycle page said something untrue about test code.
scc-620e46d9a910on thisrepo's own index is twenty files under
tests/unit/ingestion/parser/, all reaching ashared
conftest.py. The page told the reader that "nothing in this group can beloaded, tested or extracted without the rest of it", which describes a working pytest
tree as debt to pay down, and then offered to help break it.
The crossing
WikiMarkdownneedsbuildHrefas well aspages, and a function cannot cross froma server component into a client one, so this is a small client wrapper rather than
the one prop it looked like. It fetches the page list through the existing shared SWR
key instead of server-side: the list is repo-wide, and server-side it would ride the
flight payload of every file page. The tab mounts only when it is selected, and until
the list lands the paths render as plain code, exactly as before.
Refs route through the existing
pageHrefhelper, notfileEntityPath. The pathindex resolves a directory ref to its module page, and the file route calls
notFound()on a directory, so keying the href off "has a target_path" would haveturned seven dead text spans in this index into seven links to a 404. A wrong link is
worse than no link.
The cycle page
Before, on
scc-620e46d9a910:After:
The member list is now printed once. It moved from the bullets to the ranking table,
which is the superset: the bullets were capped at 30 and the table never was, and the
table says how entangled each member is. The empty-bullet and empty-heading fixes are
in the assembler rather than the template, because that is where a blank name and a
file with nothing public are produced.
Nothing leaves the index
Page.contentis one string that FTS5 indexes, the vector store embeds,get_contextreturns verbatim and a reader reads, so a prettier page that drops tokens is a
regression. Measured on all 15 SCC pages in this repo's live index by rendering the
same reconstructed context through both templates and diffing the backticked tokens:
nothing is lost on any page. Member counts run 2 / 3 / 20 (min / median / max), so
the 30-bullet cap was never reached and the deleted list was pure duplication. The one
live case of the new empty-heading guard is
_helpers.py, whose path still appears inthe table and on both sides of its loop edges.
Three of the fifteen summaries change, the three all-test cycles, because
_extract_summaryreads the opening paragraph. It trades boilerplate that wasbyte-identical across all fifteen summaries for
test files,fixtures,helpers,test tree, and stops asserting something false toget_answer.What I did not do
I did not bump
STRUCTURAL_GENERATION_VERSION. I started to, and then checkedwhat it reaches.
_structural_scc_pagepasses nosubject_hash, sostructural_content_hashreturns""and_structural_pagestores no render key;structural.py:600says so directly ("an empty hash keeps them out of thefingerprint-staleness sweep"). The bump therefore refreshes none of the pages this
change touches, while marking every stored
file_pageandsymbol_spotlightstalethrough
structural_fingerprintand re-rendering 4,438 of them, in this repo alone,to byte-identical output. All cost, no effect. Say the word if you want it anyway.
The "Open file page" link is unchanged. It shipped in #2082 and it works: the
door on a wiki file page reaches the file route, and this change completes the loop
back out of it. The dead-ref treatment was proposed for it (tertiary ink, accent on
hover only) and it currently renders in full accent. I left it alone. The comment
above it records deliberate decisions about its size and its position in the
provenance row, and the case for restyling is that it is the page's only action, not
that it is wrong. Worth a separate look, not a drive-by.
Gate
Clicked through on this repo's own index, against a local
next devbuild:Open file page ->, lands on/repos/{id}/files/packages/cli/src/repowise/cli/helpers.py/repos/{id}/files/packages/cli/src/repowise/cli/output.pyThe links read as ink: live refs take a 6% ground and primary ink with accent on hover
only, dead refs stay plain tertiary mono. In the "Depends on" section of that page,
.../cli/output.pyis decorated and.../cli/errors.pyand the__init__.pyentriesare not, because there is no page behind them.
Tests
Each behaviour change has a test that fails on the baseline source, verified by
restoring the pre-change file and re-running, not by assumption:
cycle whose members are all test files
packages/web/vitest.config.tsneededesbuild: { jsx: "automatic" }: the app'stsconfig says
jsx: preserve, which Vite cannot compile, so it fell back to theclassic transform and any component rendered from a test threw
React is not defined.