Repository navigation
Port resolution logic from SecID-Service - #18
Merged
Merged
Conversation
This was referenced Sep 25, 2026
kurtseifried
changed the base branch from
test/real-registry-harness
to
main
September 25, 2026 03:34
Rewrites resolver.py as a port of SecID-Service parser.ts, resolver.ts, kv-resolve.ts and identity.ts: unmatched subpaths return related, open_pattern and known_values are honoured, version_required sources, lookup tables, range_table, {id_lower}, ?lang and other qualifiers work, and corrected is returned where the Service returns it. Registry regexes compile with re.ASCII. A per-type index is built once instead of re-reading files per query, handlers run in the threadpool, overlay precedence is deterministic, oversized namespace segments are not_found, and /admin/reload diffs against the loaded commit and handles deletes and renames.
kurtseifried
force-pushed
the
fix/resolver-parity
branch
from
September 25, 2026 03:35
9152822 to
36509b5
Compare
CodeQL flagged load_namespaces/load_type_info as building paths from query data. Callers already pass only validated types, but the functions now substitute the SECID_TYPES constant so no caller-supplied string reaches the filesystem. Also replaces a URL-substring assertion in a test with an exact comparison.
Contributor
Author
|
Rebased onto main after the #17 squash; only this PR's commit remains, plus one follow-up: Pin registry type paths to the fixed type list. CodeQL (which runs now that the base is main) flagged |
…5/#207 - Skip synthetic RFC 2606 example.org client mock fixtures in _client_fixture_cases() (added in SecID-Client-SDK#27 for client-side percent-encoding and hostile-response parsing unit tests). - Add LIVE_OVERRIDES best_url support for encoding_ampersand (ccm@4.0#A&A-01 now resolves to a data-only control description after SecID#207). - Update cross-source tie-order test to secid:regulation/art-32 and add an explicit test for cross-source skipping of version_required sources (secid:control/IAM-12) plus a unit test in test_smoke.py for _locale_key '-' before '#' collation. AI-Agent: Gemini
…rename - Validate @Version against version_required children and versions_available; canonicalize version aliases per ADR-015 (SecID-Service#33 / c8b3a93). - Partition tight vs open child patterns in _determine_namespaces and include source-name and namespace-identity candidates so open child patterns do not suppress cross-source lookups like secid:reference/arxiv (SecID-Service#38). - Add literal-first, single-percent-decode fallback in RegistryIndex.resolve and friendly bare-search not_found messages (SecID-Service#33). - Include child data.note on URL-less cross-source hits. - In _changed_namespaces, inspect both base and head for modified files (M/T) so in-place namespace field changes evict the old namespace key on reload. AI-Agent: Gemini
…SSUES_URL in version miss - Match JS decodeURIComponent URIError behavior by skipping the percent-decode fallback when any % in the query is not followed by two hex digits (2,060/2,060 parity with SecID-Service). - Point _version_not_found guidance to ISSUES_URL without mentioning submit_feedback (which SecID-Server-API does not expose). AI-Agent: Gemini
Contributor
Author
|
Agent: Gemini (SecID governing agent) Review Summary (Gemini + OpenAI Codex
|
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.
Stacked on #17 (the real-registry harness), with base set to
test/real-registry-harness. Merge #17 first; this PR then retargets tomain. It removes every strict xfail #17 added, so CI stays green at each merge.Summary
resolver.pyis now a port of the live resolver: SecID-Serviceparser.ts,resolver.ts,kv-resolve.tsandidentity.ts. Function names follow the TypeScript so the two can be read side by side. It covers the review findings:H1 unmatched subpath. Returns
relatedwith "Subpath ... did not match any known pattern" and the source description, never the parent asfound. This fixesaaa-services#V-999999andcve#NOTACVE.top10@2025#...now givesnot_found"Version 2025 not found", which is what live returns.H2 open_pattern / known_values. Ported
isOpenPattern(sentinel tokens),isNodeOpenandnodeMatches. Open nodes are skipped in unscoped search, andknown_valuesis a closed set when the pattern is open.secid:advisory/HADOOP-1234,secid:reference/torvaldsandsecid:reference/ismapnow givenot_foundand no longer invent CSA artifact URLs. Namespace-scopedapache.org/jira#HADOOP-1234still resolves, and namespace identity search (secid:control/ismapreturnsismap.go.jp) is ported.H3 depth.
top10@2021#A01resolves, andtop10#A01givesrelated"requires a version" withversions_available,version_disambiguationandunversioned_behavior.@versionis kept in result secids (ccm@4.0#IAM-12).lookup_tableuses own-key semantics at any depth. A missing key returnsavailable_items.range_tableworks (Debian DSA/DLA URLs now resolve).{id_lower}/{id_upper}are supported, and?langworks with default-language weight +1 and a not-available message.?content_typeand?parsabilityqualifiers work, with source-level and item-level?qualifiersboth parsed.data.urls[]are filled in on registry-data results.H4 blocking I/O. Handlers are plain
def, so they run in the threadpool.RegistryIndexbuilds each type's namespace map once, lazily or at startup in bulk mode, instead of re-reading every file per unscoped query.H5 overlay precedence. One rule everywhere (
load_namespaces): a later--registrydir overrides an earlier one by namespace. It is used by bulk_load, the index, load_single and reload. There is a test for every query order in both modes.Medium
not_found: the per-type index does no filesystem joins, andload_singlecatchesOSError.re.ASCII, soCVE-٢٠٢١-٤٤٢٢٨no longer matches, andre.searchis used to mirrorRegExp.test.correctedis returned where the Service returns it (redhat.com/RHSA-2026:0932).secid:lists all 10 types, andsecid:<type>/secid:<type>/*return the type listing, in both lazy and bulk mode./admin/reloadnow diffs against the commit last loaded, not "the last 24h". It handlesD(old blob viagit show) andR/C(both sides,-M), re-resolves every changed namespace against all dirs (so overlay precedence holds), and invalidates the index. With no git or no base commit, it falls back to a full reload that evicts deleted namespaces.Low
/ : @ ! $ & ' ( ) * + , ; =stay as they are, soRHSA-2026:0932and DOIs are unchanged.not_found"Invalid type", per spec and live.not_foundresponses carry submission guidance pointing at the SecID issue tracker.Deliberate differences from live (documented in the module docstring)
data.urls[]substitution.submit_feedbackMCP tool.github.com/users#torvaldshas a namespace and a subpath but no source name, so live (and now this server) lists the sources and ignores the subpath.Test results
Real-registry suite (#17), both load modes: 54 passed / 62 xfailed before, 124 passed / 0 xfailed after. The suite gained 3 targeted cases (tie order, bare source name, prefix-optional) and a test that every structured registry example resolves to its URL (200/200). Full suite: 174 passed.
Live parity. A scratch script compared status plus the full ordered
(secid, url)result list againstsecid.cloudsecurityalliance.orgon 1,941 queries. These were sampled from 560 random namespaces: namespace listings, sources, example IDs scoped and unscoped, bogus subpaths, and bare identifiers. All of them are identical. The one difference found during that run was the weight-tie ordering: JSlocaleCompareputs-before#. It is fixed with an ICU-order sort key and covered by a test.Regex safety
No registry patterns change. Patterns are compiled with
re.ASCIIand cached, and input stays capped at 256 chars per component.