Skip to content

feat(scripts): grafo de subsistema do ERP padrão + fechamento em N hops - #3

Merged
adapcon-franklin-satler merged 1 commit into
v8from
feat/grafo-modulo-padrao
Jul 29, 2026
Merged

feat(scripts): grafo de subsistema do ERP padrão + fechamento em N hops#3
adapcon-franklin-satler merged 1 commit into
v8from
feat/grafo-modulo-padrao

Conversation

@adapcon-franklin-satler

Copy link
Copy Markdown

Pedido: grafo do sistema têxtil da 8.1 (rotinas/CCT*). Entregue como um irmão do script de cliente, com a mesma mecânica de fechamento.

O que entra

.venv\Scripts\python.exe scripts\csw_grafo_modulo.py CCT --versao 8.1

CCT = os 99 diretórios rotinas/CCT* da 8.1, 11.386 rotinas. Resultado: 360.905 nós, 1.144.309 arestas, 1,5% em stub, 315s (399 MB). Sai em <out>\8.1-CCT.

Validado no CCTTGT010.mac: 254 nós, 641 chamadas saindo e 61 entrando, atravessando CCTADCCTTGT, CCCGI, CCFT e os componentes em COMP-8.0.

Classes não entram por regra de nome — o mapeamento é irregular (CCTCO tem classescls/TCo, CCTTGT não tem TTgt). Quem decide é o fechamento.

--hops N (padrão 1)

O que melhora é a proporção, não o absoluto: cada nível resolve o que o anterior pediu, e os arquivos novos têm a própria fronteira.

hop 1 hop 2
cliente GB 949 arq, 4,7% stub 2.038 arq, 2,9% stub (94k → 221k arestas, +30s)
têxtil 8.1 11.386+1.125 arq, 1,5% +2.710 arq, 1,4% — mas 5min → 74min

Ou seja: hop 2 vale para cliente pequeno, não vale para subsistema padrão grande. O padrão fica 1 e o README diz qual caso é qual.

Duas correções que essa tarefa expôs

Faltava o cswcore. A 8.1 tem csw81 e cswcore81 como árvores irmãs (as rotinas DD* vivem lá); o fechamento indexava só csw<vv>. Isso deixava 35 nomes em stub no CO sem necessidade.

cswutil divergente entre fontes. 7.5/csw75/pomcs.xml pede cswutil 8.0.21; custom/gb/pomcs.xml pede 7.0.130. Misturar ERP 7.5 com componentes 8.0 passaria batido — os nomes de rotina existem nas duas árvores, então o fechamento "fecharia" contra a versão errada e nada falharia. Agora o pomcs do cliente manda, a convenção de família é fallback, e a divergência é impressa:

! a árvore 7.5 declara cswutil 8.0.21 (COMP-8.0), mas vou usar COMP-7.0 pela
  pomcs.xml do cliente (cswutil 7.0.130); passe --comp para forçar

Nota de review

Os *zzz (CCTCzzz, %CSzzz — 4.767 arestas só no têxtil) nunca resolvem e não são falha: são os placeholders de versão do framework ($$ver^<MODULO>zzz), que não existem como arquivo. Documentado no fechar() e na skill.

Não incluí as alterações em graphify/extract.py e tests/test_zero_node_no_cache.py que estão na working tree desta máquina (cache de resultado skipped, issue Graphify-Labs#2258) — são de outra frente e não são minhas.

… closure

`scripts/csw_grafo_modulo.py CCT --versao 8.1` graphs a subsystem of the standard
ERP the same way the client script graphs a customization: scope by module prefix
inside a version tree, then close by dependency. `CCT` covers the 99 `rotinas/CCT*`
directories of 8.1 -- 11,386 routines, the textile subsystem -- and produced 360,905
nodes / 1,144,309 edges with 1.5% of edges left on stubs, in 315s.

Classes are not pulled in by a name rule. The routine->package mapping is irregular
(`CCTCO` has `classescls/TCo`, `CCTTGT` has no `TTgt`), so guessing loses classes
that exist and invents packages that do not. The closure decides instead: a class
enters when the module's code references it, which is also the only case where it
matters to this graph.

Shared machinery moved to `scripts/csw_grafo_comum.py`, which both entry points now
use. Two fixes fall out of that:

- The closure was missing the `cswcore` tree. 8.1 ships `csw81` AND `cswcore81` as
  sibling trees (the `DD*` routines live there); indexing only `csw<vv>` left 35
  names on stubs for client CO with no reason.
- Components tree was being derived from the version tree's pomcs.xml, which
  disagrees with the client's: `7.5/csw75/pomcs.xml` asks for cswutil 8.0.21 while
  `custom/gb/pomcs.xml` asks for 7.0.130. Mixing ERP 7.5 with 8.0 components would
  have been wrong in silence -- routine names exist in both trees, so the closure
  would "close" against the wrong version and nothing would fail. The client's
  pomcs now wins, family convention is the fallback, and a disagreement is printed
  with the `--comp` override.

`--hops N` (default 1) runs the closure repeatedly. What improves is the ratio, not
the absolute count: each level resolves what the previous asked for, and the files
it brings have their own frontier. Client GB: hop 1 = 949 files and 4.7% on stubs,
hop 2 = 2,038 files and 2.9%, edges 94k -> 221k. Large standard subsystems are the
opposite trade -- textile 8.1 went 1.5% -> 1.4% for 5min -> 74min -- so the default
stays 1 and the README says which case each suits.

The residue never reaches zero and that is not a defect: `*zzz` names are the
framework's version placeholders (`$$ver^CCTCzzz`, 4,767 edges in textile alone) and
exist in no tree.

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