Changelog
Source:NEWS.md
cvmdata (development version)
New features
cvm_arguments()says, for one table, which arguments ofcvm_fetch()are required, optional or not allowed, and the values each one takes:basisis required for the statements published individual and consolidated and refused elsewhere,as_ofonly applies to a registry,yearnot to a single snapshot. It reads the same table schemas thatcvm_fetch()checks its arguments against, so the two never disagree; a test holds them together for every table.cnpj_lookup()finds a company’s CNPJ by name, or part of one, in the three CVM company registers (cad/companhias,cad/estrangeiras,cad/incentivadas). Every word must appear, in any order, ignoring case and accents. It lists every match, cancelled registrations included, and never picks one: the CNPJ you choose goes tocvm_fetch(cnpj = ), which still takes only a CNPJ or a ticker. The errorcvm_fetch()gives for a name passed ascnpjnow points to it.
Minor improvements
-
yearpassed to a table without yearly files (cad,recompra_acoes) is now refused with the other argument checks, before the ticker lookup, as the help ofcvm_fetch()says. It was refused later, by the reader, with the same message.
Bug fixes
- Reading the mirror no longer goes through the GitHub API, which allows 60 requests an hour per IP address without a token. On a shared address (a CI runner, a university network) the limit could run out, and the 403 that followed was reported as “Release tag … may not exist yet”. The list of files of a mirror release now comes from the index the release publishes (
__source_hash.json), read from its download URL, which has no such limit, as pinned dates already were. The API is only the fallback for a release without a readable index; there, an exhausted limit is reported as such, with the advice to setGITHUB_PAT.
cvmdata 0.3.1 (2026-11-16)
Bug fixes
The mirror now returns the same columns as the CVM. It added a
yearcolumn (the partition value of its files) thatsource = "cvm"does not have, so the same code gave different columns depending on the source.cvm_fetch()andcvm_versions()drop it.year = NULLwith a company that has no filing in the latest yearly file now steps back to the year before, up to three years, with acvmdata_warn_year_fallbackwarning, from the mirror as from the CVM. The mirror returned zero rows without a word (for example, the consolidated income statement of any civil-year company while the DFP file of the current year only holds the companies with another fiscal year). Both sources now share one implementation of the step back.
Both were found by reading the same tables from the two sources in the owner’s review script (data-raw/revisao-do-dono.R).
cvmdata 0.3.0 (2026-11-15)
The version submitted to rOpenSci. One function, cvm_fetch(), reads the nine datasets of the CVM group of listed companies (104 tables); cvm_versions() returns every version of a filing; the default source is a dated, checksummed mirror that carries data about companies, with a first edition deposited on Zenodo (DOI 10.5281/zenodo.24260441). The sections below list every change since 0.2.0, the most recent first within each.
New
- The data of the mirror can be cited: the first Zenodo edition was published on 2026-11-15, DOI
10.5281/zenodo.24260441;10.5281/zenodo.24260440resolves to the latest edition.citation("cvmdata")now gives the data as well as the package, and the README says how to cite.
⚠️ Breaking changes
The mirror and the Zenodo editions carry data about companies, not about people. The tables in which the CVM describes natural persons left the mirror:
freadministrador_membro_conselho_fiscal,membro_comite,relacao_familiar,relacao_subordinacao,responsavel,auditor_responsavel,posicao_acionaria,posicao_acionaria_classe_acaoandtransacao_parte_relacionada, andfcadri(besides the three counts of declarations of board members, already out).cvm_fetch()andcvm_versions()now read a table that is not in the mirror from the CVM by themselves, with a message (classcvmdata_message_unmirrored), instead of failing; they still fail under an explicitsource = "mirror"and undercvm_release_set()with a date, because the CVM has no dated snapshot. In the tables that stay, the columns that name a person are gone:resp,tp_resp,dt_ini_resp,mun_resp,uf_respandpais_respin thecad;contatoand its dates infca/departamento_acionistas; the technical lead infca/auditor;cpf_auditorinfre/auditor, where the row of an auditor who is a natural person is left out. The reason: whether hosting personal data on services abroad is an international transfer under the LGPD (art. 33; Resolução CD/ANPD nº 19/2024) could not be settled, and reading from the CVM on the user’s machine redistributes nothing. The entries below about masked CPFs, birth years, biographies and people who ask to leave now matter only for what a text about a company happens to mention.The mirror and the Zenodo editions no longer redistribute full CPFs and birth dates. The CVM publishes them by legal duty; a public and permanent deposit keeps only what research needs. Every CPF, in the columns that hold it (
cpf*,documento_*) and in free text, becomes***.456.789-**, the way the Federal Revenue publishes its open CNPJ data; a foreign document in those columns becomes***; anddata_nascimento(fre:administrador_membro_conselho_fiscal,membro_comite) becomes the integer columnano_nascimento. Names and CNPJs stay as published, and the masked CPF plus the name still follow a person across tables. Scripts that readdata_nascimentofrom the mirror needano_nascimento, orsource = "cvm", which still reads everything from the CVM untouched. The dated snapshots are rewritten too, socvm_release_set()returns the masked values for past dates. See “Personal data” in?cvm_fetch.The biography column
experiencia_profissionalof thefretablesadministrador_membro_conselho_fiscalandmembro_comiteis no longer in the mirror or in the Zenodo editions. The texts mention union and party membership, elected office, religion, health and convictions, which the Brazilian LGPD treats as sensitive data (art. 5, II; art. 11), and no list of words separates those texts from the others safely. Profession, position, body and dates of office stay. Scripts that read the column needsource = "cvm".A person named in the mirror can ask to leave it. The robot reads a private list (never in the repository) and, for each person on it, keeps the row and replaces the name with
[omitido a pedido do titular], empties the columns that describe the person (masked CPF, birth year, profession, nationality) and replaces a mention of the name in any text of the dataset. Seats, dates of office and shareholding percentages stay, so counts and sums are unchanged. The sidecar of each release carries only how many people asked (privacy_suppressed), and a run whose list is shorter than the previous one stops instead of putting somebody back.The mirror has a privacy notice,
PRIVACY.mdandPRIVACY.pt-BR.md(the Portuguese version prevails): what the mirror leaves out, what a text about a company may still say about a person, who answers for it and how to ask for a name to be removed. It is linked from the README and fromDATA-LICENSE.md, cited in the notes of every mirror release and shipped inside the Zenodo editions. The procedure for requests is indata-raw/decisions/.DATA-LICENSE.mdand the README of the Zenodo editions now say that the ODbL does not license the personal data in the tables: the licence governs the rights over the database (its section 2.4), and whoever reuses the names answers for that processing under the law that applies to them.The five
fretables that count employees by race, gender or disability (empregado_PCD,empregado_local_declaracao_genero,empregado_local_declaracao_raca,empregado_posicao_declaracao_genero,empregado_posicao_declaracao_raca) come from the mirror without the companies that, in a year, have a group of fewer than 10 people or a group in which everybody declared the same category. Nobody is named in these tables, so a count is anonymised data while it cannot be traced to a person (LGPD, art. 12); in a group of one, or in a unanimous one, it can. The whole filing of the company leaves the table, so no row can be rebuilt by subtraction. Measured on the 2025 FRE: 10% to 11% of the companies by position, 29% to 32% by region and 38% inempregado_PCD, holding 0.1% to 15% of the people counted. Totals computed from these tables are now lower than the CVM’s. Reading one of them raises the new warningcvmdata_warn_privacy_omittedwith the companies and the share of people left out in each year; the numbers stay in the new attributeomitted, whichprint()announces and which survives dplyr verbs; and a company asked for bycnpjortickerthat was left out is named, instead of zero rows that would read as “did not file”. The Zenodo editions carry the same numbers inprivacy_omitted.csv.source = "cvm"reads every company.Three
fretables left the mirror and the Zenodo editions:administrador_declaracao_genero,administrador_declaracao_racaandadministrador_PCD. They count the gender, race and disability declarations of board members by body, and the members of each body are named in another table: in a body where everybody declared the same, the count is the declaration of each person (measured on the 2025 FRE: 68% of the race rows and 84% of the disability rows). Race and health are sensitive data under the LGPD (art. 5, II), which gives a private person no ground to redistribute them (art. 11), and gender identity is argued to be.cvm_fetch()andcvm_versions()now refuse these tables under the default source withcvmdata_error_inputand point tosource = "cvm", which reads them from the CVM as before. Their partitions and history assets are removed from the-latestrelease at the next publish and from the dated snapshots after it. The workforce tables (empregado_*) are unchanged.The mirror and the Zenodo editions no longer carry contact data. The columns of e-mail, telephone and fax are gone from every table, for people and for companies alike (
email,tel,telefone,fax, theirddd_*,ddi_*andcd_pais_*parts and the*_respvariants), and so is the street address of a person:logradouro_resp,compl_resp,bairro_respandcep_respincad, andlogradouro,complemento,bairroandcepinfcadrianddepartamento_acionistasand infreauditor_responsavel. The address of the company (cad,fcaenderecoandescriturador) stays, and so do the city, state and country of a person. The field of the company is not spared because small companies declare somebody’s own address there: 296 of the 696 company e-mails ofcadincentivadasare webmail. Scripts that need these columns read them withsource = "cvm". The dated snapshots are rewritten once more, with a public record here.The four skeleton fetchers
fund_fetch(),agent_fetch(),offering_fetch()andevent_fetch(), exported since v0.1.0.9000 as placeholders that only aborted, are gone, and so is their condition classcvmdata_error_input_group. The 2026-05-25 architecture of five fetchers by data contract is superseded: a single function serves every dataset, and the groups planned for v0.4-v0.8 (funds, agents, offerings, events) will extendcvm_fetch()through their schemas instead of shipping new functions.cvm_groups()keeps itscontractcolumn as a planning map.issuer_fetch()is removed; usecvm_fetch(). Select issuers withcnpjortickerinstead ofissuer, and the statement basis withbasisinstead ofreport_type. Theissuerargument guessed what it was given (CNPJ, CVM code, ticker or company name) and, when a name matched several companies in an interactive session, opened autils::menu(); a data function should take an input of a known type and never stop to ask. Those paths are gone with it: look a CVM code or a company name up incvm_fetch("cad", "companhias"), which carriescd_cvm,denom_socialandcnpj_ciaside by side. The package no longer importslifecycle.cvm_fetch()andcvm_versions()losevalidate:on_erroris now the single error strategy, with two modes."abort"(default) stops with a classed error when a CVM file departs from its schema (cvmdata_error_parse, whatvalidate = "strict"did) or when one of several yearly files fails to download (cvmdata_error_http)."warn"reads the file anyway (cvmdata_warn_validation) and returns the years that downloaded (cvmdata_warn_partial_failure). The two arguments answered the same question with two vocabularies, and the silent modes (validate = "skip",on_error = "silent") hid the problem with no trace;suppressWarnings()around a"warn"call does that on purpose. Passingvalidateaborts with this migration. The articles also said the eight FRE tables without a published META could only be read withvalidate = "warn"; they always read under the default, checked against the header their schema declares.-
The
submissaotable of every dataset (dfp,itr,fre,fca,cgvn,vlmo) now returns the complete filing history: one row per delivery, re-filings included, each with its receipt date (dt_receb/data_entrega), document id (id_doc/id_documento/protocolo_entrega) andversao, as the CVM publishes it. The schemas no longer declarekeep_latest_versionfor it; the detail tables still keep the last delivery. The CVM statement CSVs carry a single version per filing, sosubmissaowas the only place the history could be read from, and the index is where the Travessia and TRV cases of the 0.2.0.9000 fixes below are visible. Code that joinssubmissaoto a detail table on the issuer and reference date now matches every delivery; to get the current filing, keep the last row per key:sub |> dplyr::arrange(dt_receb, as.integer(id_doc), as.integer(versao)) |> dplyr::slice_tail(n = 1, by = c(cnpj_cia, dt_refer))The fetch-time check that warns about a stale filing (
cvmdata_warn_stale_filing) computes that row itself before comparing. The parquet mirror (source = "mirror", the default) carries the history once the weekly ETL republishes the six datasets with this version of the package; until then it serves the collapsed index.
New features
The mirror gets quarterly editions with a DOI. Four times a year (the first weekly round of January, April, July and October) the ETL prepares, as a Zenodo draft the maintainer publishes by hand, the whole mirror as it stood on that day: every dataset, the superseded versions, the column dictionary, the code lists, the data licence and the checksums, one version of a single record per edition. The release notes of every mirror release now describe what the assets are (layout, transformations, dictionary) for whoever downloads them without the package. The first edition is January 2027; the weekly snapshots keep serving the dates in between, without a DOI.
New dataset
recompra_acoes(programas de recompra de ações) in thecompanhiasgroup, with three tables:recompra_acoes(one row per buyback program, with the issuer’s CNPJ),intermediarios(the brokers of each program) andquantidades(share quantities by type and class). The CVM publishes the whole history, since 1997, as one ZIP without a year, so the tables take noyearorfrom/to, likecad. The two child tables carry onlyid_programa:cnpjandtickerselect the issuer’s programs inrecompra_acoesand keep the child rows of those programs, declared in their schemas asissuer_via. The mirror publishes the dataset from the first run of its weekly ETL.The help of
cvm_fetch()gains a section Arguments by table that states, in one place, which tables takeyearandfrom/to, which requirebasis, which acceptreadingandas_of, the tables that start after their dataset or are published empty from a year, and the tablescvm_versions()covers. The section is generated from the table schemas when the documentation is built, by the same predicates the argument checks call (R/util-table-arguments.R), so it cannot drift from what the checks enforce; a test holds the two together for every table and pins the rendered text. Measured on the 74 tables: no argument is refused after a download, every refusal happens before.Dated snapshots of the mirror. Every weekly ETL run that changes something now also publishes the release
mirror-<group>-<dataset>-snapshot-<YYYY-MM-DD>, carrying the partitions whose content changed (the first one carries every partition) and a complete__source_hash.jsonthat says, for each partition of that day’s mirror, which snapshot release holds its bytes. Snapshots are never deleted;-latestkeeps being rewritten in place, so older clients work unchanged. Measured in October 2026 over 144 weeks of CVM deliveries, a weekly round changes about 60 MB (11% of the partitions), so the snapshots cost about 3.5 GB a year against 32 GB for a full copy per week.cvm_release_set()/cvm_release_get()and the optioncvmdata.mirror_releasepin a session to the mirror as it was on a date:cvm_release_set("2026-11-01")resolves to the most recent snapshot on or before that day and everycvm_fetch()andcvm_versions()call withsource = "mirror"reads from it, so a script reproduces the same bytes months later."latest"(the default) follows the weekly refresh. A date before the first snapshot of a dataset is an error that names the earliest date available. Under a pin,cvm_versions()drops the history rows superseded after the pinned date.Every
cvm_tblcarries a seventh provenance attribute,release: the GitHub release the rows were read from whensource = "mirror"(the snapshot tag, or the-latesttag for a release older than the snapshots),NAforsource = "cvm".print()shows it next tosource;rbind()/vctrs::vec_rbind()reconcile different releases to"mixed"like the other attributes.Integrity of mirror downloads. The sidecar now publishes the SHA-256 and size of every parquet, and the client checks both: a cached copy that does not match (a truncated download, or the same partition from another snapshot) is replaced, and a download that does not match is discarded and aborts with the new condition class
cvmdata_error_http_integrity(a subclass ofcvmdata_error_http). A parquet DuckDB cannot open is removed from the cache so the next call downloads it again. Before this, a corrupt parquet was a cache hit for ever. As a consequence, a weekly change of the mirror no longer evicts the whole dataset from the local cache: only the partitions whose bytes changed are downloaded again.The
cvm_tblclass and its provenance attributes now survivegroup_by()and every verb after it (summarise(),mutate(),filter(),select(),ungroup(),[), andrbind()/vctrs::vec_rbind()of severalcvm_tbls (dplyr_reconstruct(),dplyr_row_slice(),dplyr_col_modify(),group_by(),ungroup(),summarise(),[,names<-,rbind(),vec_ptype2()andvec_cast()methods). Before,group_by()dropped the class and the next verb dropped the attributes without a word, andvec_rbind()returned a plain tibble. When the inputs ofrbind()/vec_rbind()differ insource,group,dataset,tableorpackage_version, the result says"mixed"andfetched_atkeeps the oldest timestamp.dplyr::bind_rows()keeps the first input’s provenance, dplyr’s rule for every data frame subclass, and?cvm_tblsays so.?cvm_tblalso lists which operations keep the provenance and which drop it by design; printing acvm_tblwhose attributes were stripped no longer shows a header of empty fields.cvm_versions()returns every known version of a filing, the current one included:cvm_versions(dataset, table, cnpj, ticker, year, basis, ...), the identifying part ofcvm_fetch()’s signature, without its row filters (reading,from/toandas_ofare refused by name). The result has the columns of the table plussuperseded_at,superseded_by_versao,history_source,id_docandmotivo_reapresentacao; the rows of the current version carryhistory_source = "current"and no supersession. Only the tables that keep a single filing per document (keep_latest_versionin their schema) have a history; asking for another aborts. On the mirror (the default) the call reads thehistoryasset the ETL keeps next to each partition: the filings replaced since 2026-10 and, for the DFP and ITR statements, the ones recovered from the CVM’s filing system back to 2010 (history_source = "rad"). Withsource = "cvm"it reads the yearly CSV without collapsing it, which keeps only the versions the CVM still publishes, usually just the current one, with no dates; the call says so. Measured on the consolidated DFP income statements of 2023: Petrobras filed twice with the same net income; Braskem three times, version 1 in R$ units (a loss of R$ 4.5 million) and version 2 “to reflect the R$ thousand scale” (R$ 4.89 billion); 108 issuers of the 2024 statement had a version superseded, 14 of them with a different net income.cvm_fetch()is unchanged and keeps ignoring the history assets.cvm_versions()gains a sixth version column,scale_error, that tells a superseded version filed in the wrong unit from a true restatement. About one superseded DFP or ITR version in twenty is a filing in R$ units where the form asks for R$ thousand (or the reverse), replaced within days by the same figures a thousand times larger; without a mark the row a thousand times smaller read as a restatement. The ETL now judges every superseded version once, over the whole document (the eight statements, individual and consolidated), and writes one of three values:"apenas erro de escala"(every shared account differs by the same factor of 1000 and neither version has an account the other lacks),"erro de escala e outras mudanças"(more than half of the shared accounts follow one factor of 1000, but some changed otherwise or exist in one version only) and"sem erro de escala"(everything else, the current version included). The rule reads theÚLTIMOrows, leaves out the per-share accounts (3.99*) and takes a zero on both sides as saying nothing. Measured on the 6,825 superseded versions of DFP 2010–2025 and ITR 2011–2026: 353 “apenas”, 28 “e outras mudanças” (Braskem DFP 2023 version 1 among them: the scale and other operating expenses, R$ 360 million higher in version 2), every one of them recovered from the RAD. A call whose result holds such a version says so once, with a message (suppressMessages()silences it);NAmarks a version the ETL has not judged yet.-
cvm_fetch()is the single public fetcher, built on the same pipeline asissuer_fetch():cvm_fetch(dataset, table, cnpj, ticker, year, from, to, basis, ...).- Issuers are selected by
cnpj(CNPJ only, with or without punctuation; a CVM code or a company name aborts) and/orticker(B3 trading code, resolved throughfca/valor_mobiliariofrom the samesource). The free-text and CVM-code lookups ofissuerwere not carried over: the registrycvm_fetch("cad", "companhias")is the place to resolve a name or a code to a CNPJ. - The period is
year(whole published years, as before) or afrom/towindow of complete dates: the yearly files spanned by the window are read and rows are kept by the document’s reference date (dt_refer/data_referencia). Giving both aborts, as does an incomplete date or a window on a snapshot table such as CAD. -
basisreplacesreport_typefor the tables published in individual and consolidated variants:"ind","con"orc("ind", "con"), which stacks both. There is no default, because many issuers file only individual statements. Those tables always carry abasiscolumn in the result, on both backends; the mirror’sreport_typepartition column no longer leaks throughcvm_fetch().
- Issuers are selected by
cvm_fetch()gainsreading, for the DFP and ITR statement tables (the ones withordem_exerc): the two readings of a fiscal exercise, side by side. Every yearly file carries the exercise it is about (ÚLTIMO) and the comparative the issuer presented for the previous one (PENÚLTIMO), and the comparative is often restated: about a third of the DFP issuers in 2023 restated 2022 (Porto Seguro’s consolidated total assets of 2022 are R$ 50.5 bn in the 2022 file and R$ 39.9 bn in the 2023 one). Withreading = "original"the call returns theÚLTIMOrows of the file ofyear; withreading = "restated", thePENÚLTIMOrows of the file ofyear + 1, which the call reads on its own; with both, the two stacked. Rows come as published, with areadingcolumn appended:dt_referandversaoare those of the document each row came from, anddt_fim_exerc(plusdt_ini_exerc) identify the exercise. An exercise whose following file is not published yet has no restated reading, and the call says so.from/tothen apply to the exercise end. The default,reading = NULL, returns each file as before,ÚLTIMOandPENÚLTIMOtogether and noreadingcolumn. Two things the data showed while measuring: in the ITR, the comparative of a balance sheet is the previous year end, not the previous year’s quarter; and the banks, which adopted CMN Resolution 4,966 in 2025 without restating, carry the 2024 comparative of their individual statements as zeros, which the restated reading returns as the CVM publishes them.-
Delisted companies (decisions of 2026-10-21, after a quant reader’s questions):
-
cvm_fetch("cad", "companhias", as_of = "2015-12-31")keeps the registrations in force on a date: registered on or before it and not cancelled by it. The register is today’s state of every registration ever granted (cancellations back to 1984 are three quarters of the file), so this is the survivorship-free universe a backtest needs; the rows are still today’s (a company cancelled in 2017 is in the 2015 universe withsit = "CANCELADA"), because the CVM does not publish past states of the register. Registry tables declare the date columns in their schema (as_of:); every other table rejects the argument. Measured against the 2015 DFP index: 599 of the 633 filers fall inside the 640-company universe, the 34 outside being 11 companies absent from the register and 23 that registered in 2016 and filed the 2015 statements on registration. -
tickernow resolves against every yearlyfca/valor_mobiliariofile that carries trading codes (2018 onwards; the column is empty before), not only the file of the latest requested year. A code that left the exchange (GOLL4,BPAN4) resolves for anyyear, andPETR4resolves for years before 2018, which used to abort. A code that maps to more than one issuer now aborts asking forcnpjinstead of picking one; none does today. - The register’s key,
(cnpj_cia, cd_cvm, tp_merc), is documented in?cvm_fetch(section Company register): 107 registrations repeat in rows that differ only intp_merc, and 34 CNPJs hold two registrations under distinct CVM codes. The file is returned as published; the recipe for one row per registration is in the help.
-
A year the table is not published for is refused before any download. A table can start later than its dataset: the CVM’s yearly ZIP simply lacks its CSV before then. The schemas now declare the measured first year of 19 tables that used to claim 2010 or 2011 (
composicao_capitalof the DFP and ITR from 2020; fourteen FRE tables such asacao_entregue,remuneracao_variaveland the diversity tables from 2023;mercado_estrangeirofrom 2019,titular_valor_mobiliariofrom 2018,titulo_exteriorfrom 2016; measured on the mirror’s inventory and confirmed in the ZIP members).cvm_fetch()aborts withcvmdata_error_input(“not published for”) whenyearnames an earlier year, and afrom/towindow drops the years the table does not exist for, saying so. The backend errors for a CSV missing from a ZIP, or a partition missing from the mirror, now say the table is not published for that year instead of blaming the schema.
Data coverage
Two new tables in
cad, the CVM’s other company registers:cvm_fetch("cad", "estrangeiras")(foreign companies, 27 rows) andcvm_fetch("cad", "incentivadas")(companies registered under the tax-incentive regime, 3570 rows). Likecad/companhiasthey are one file with today’s state of every registration, andas_ofapplies. Their issuer column iscnpj(notcnpj_cia), whichcnpj =now recognises; they have notp_merc. Incad/incentivadas,cd_cvmis empty for about 40% of the rows and several CNPJs were cancelled and registered again; the rows stay as the CVM publishes them. The codelist generator leaves four free-text columns ofcad/estrangeiras(resp,auditor,cidade,estado) out of the snapshot: with 27 rows they stay under the cardinality cap.The 25 legacy
fretables are covered: tables the CVM published in the yearly FRE ZIPs from 2010 and then dropped (endividamento,obrigacao,distribuicao_dividendos,historico_emissor,plano_recompra,ativo_imobilizadoand 19 more), measured on every ZIP 2010-2024. Twenty end in 2023, the threecapital_social_*_classe_acaoin 2022, andgrupo_economico_reestruturacaoandvalor_mobiliario_tesouraria_ultimo_exercicioin 2016. Each has a single header across its years. Five have no CVM-published META (distribuicao_dividendos,distribuicao_dividendos_classe_acao,endividamento,informacao_financeira,obrigacao) and follow themeta_status: missingpath of the eight current ones. They are read with the corrected reader of this release from the start.New schema field
last_year: the last year whose ZIP carries the table.cvm_fetch(),cvm_versions()andissuer_fetch()refuse a lateryearwithcvmdata_error_inputbefore downloading, afrom/towindow is cut at it with a message, andyear = NULLon such a table aborts asking for an explicityear, rather than resolving to the dataset’s latest year (where the table does not exist) or silently to the table’s last year (old data passed as current). The mirror ETL no longer schedules the later years.Corrected the declared
first_yearfor the v0.2 datasets, which had been set to 2021 — the year they were first verified — rather than the earliest year the CVM directory listing actually serves.first_yearnow equalsmin(cvm_dataset_years())for every yearly table:fcareaches back to 2010,ipeto 2003, andcgvnandvlmoto 2018. The CSV headers in those earlier years already match the current schema, so the data reads cleanly under strict validation. This invariant matters becausefirst_yearis now load-bearing: both the year-clamp (below) and the ETL’s expected-year enumeration key off it, so a value above the listing minimum makes the clamp reject — and the mirror ETL hard- fail on — years the portal genuinely publishes. The newdata-raw/audit-first-year.Rchecks the invariant against the live portal.
Bug fixes
The reader of the mirror’s index no longer fails on a skip entry whose missing field is encoded as an empty object (
{}) instead ofnull. The one-off repair of the sidecars on 2026-11-07 wrote the fre index that way and every read of fre failed for about an hour with “arguments imply differing number of rows”; the index was written again, and the reader now takes both encodings as a missing value.A mirror pinned to a date other than its latest snapshot (
cvm_release_set("2026-11-04")) no longer fails withcvmdata_error_http_integrityon the partitions that had not changed since an earlier snapshot. The ETL rewrites every parquet on every run, and two runs over the same rows write different bytes (the file’s metadata carries the run’sfetched_at); the sidecar of a dated snapshot published the digest of the file just written while pointing the client at the earlier snapshot’s bytes, so the download check rejected a correct file. The dated sidecar now carries the digest of the bytes it points to, carried over from run to run, and the sidecars already published were rebuilt from the bytes themselves (inst/etl/repair-snapshot-digests.R). Found by the digest check of the Zenodo edition robot on 2026-11-07.A passing failure of GitHub or of the CVM portal no longer fails the call on the first answer. The package asked for each file up to three times but repeated only on HTTP 429 and 503, so the 504 that the download host of GitHub Releases returned on 2026-11-05, for files that were there, stopped
cvm_fetch()andcvm_versions()at once. Every request now follows one rule: an HTTP 5xx, a 429 and a request with no response are tried up to four times, with growing waits (about fifteen seconds in the worst case). A 4xx is never retried, since the same request would bring the same answer: a file that does not exist is still reported immediately. When the four attempts fail, thecvmdata_error_httpsays so and suggests trying again in a few minutes; the error of the release listing no longer suggests that the release “may not exist yet” when GitHub answered a 5xx.An unreadable
__source_hash.jsonis a warning, never silence. The sidecar of a mirror release was requested once and any failure was swallowed, which left the session exactly as if the release had none: cached files served without checking that the release still held them, downloads not verified against the published digests, a missing year without its reason, and under a pinned date the error “has no dated snapshots yet”. The request now follows the retry rule above; if the sidecar still cannot be read, the call goes on with acvmdata_warn_sidecar_unreadwarning that says what the session goes without, and the first call after five minutes asks for it again. Under a pinned date the call stops with the real reason.cvm_versions()returned filings “superseded” by their ownversao(versao == superseded_by_versao,history_source = "mirror"). The files of the CVM carry the name its register holds for the company today, in every row of every year; when a company is renamed the CVM rewrites that label under the same filing, and the mirror’s history took each rewrite for a re-filing. Three renames in the week of 2026-11-03 (Light S.A. left court-supervised reorganisation, Ambipar and Environmental ESG entered it) filed 99,070 such rows: 20,886 indfp, 75,701 initr, 2,051 infre, 432 incgvn, with nothing but the name changed. The register’s name is now left out of the comparison (denom_cia,nome_companhia, andnome_empresarialincgvn; infcathat column is the name the company typed in the form and still counts), so a rename is no longer a version, as it is not one for the CVM. The first publish of each dataset after this change removes the rows already filed; an asset left without rows stays as an empty file. The old name remains in the dated snapshot of the mirror (cvm_release_set()).The mirror of
fcahad not been republished since 2026-10-27. The weekly ETL appends the filings superseded in the week to the history asset of each partition, and the history ofendereco2026, written whentelefonewas still read as a number, could not be joined with rows that hold it as text: the publish offcastopped there, three attempts in a row, on 2026-11-03. The join now brings both sides to one type first. The history follows the current reading: a column now read as text is stored as text, a text column now read as a date or a number is converted when every stored value survives, and otherwise both sides stay as text, so a change of type never stops a publication again. The same join serves the RAD backfill. For the same reasoncvm_versions("fca", "endereco", year = 2026)showed the superseded telephone numbers as"30462550.0"; the asset is rewritten with"30462550"the next time a filing of that partition is superseded.cvm_fetch("fre", "transacao_parte_relacionada", year = 2022:2023)failed with “Can’t combinetaxa_jurosand ”: the CVM publishes the interest rate as free text since the 2023 FRE (“CDI + 1,50% a.a.”, “N/A”), and the dictionary still declared it numeric, so each year was guessed on its own. The dictionary snapshot is rebuilt from the CVM META of 2026-11-01, which declares it varchar: taxa_jurosis now character in every year, with the value as published ("0.000000", no longer0). The same refresh brings 81 declared sizes up to date (cvm_dictionary()’stamanho: CNPJ and CPF columns 20 -> 18, among others); sizes do not change the reading. The mirror’s history treats a change of declared types as a change of reader, so re-reading the old years does not file them as re-filings.cvm_fetch("cad", "companhias")returned the phone columnsfax,fax_respandtel_respas numbers, whileteland the other phone columns of the package are text. The CVM’s META declares the three numeric; the reader now keeps them as character, so a number starting with zero cannot lose it. Measured on 2026-11-01 over the 2,678 rows of the register, no value had lost anything yet (the leading zeros were only the CVM’s0placeholders); these were the only phone columns of the dictionary still read as numbers.cvm_codelist()listed free text as categories and missed values in use. The codelists were sampled from the latest year alone, and in May that was a 2026 with five months of filings (one DFP). Measured on 2026-11-01 over every year: 13 of the 178 columns were free text (auditor names, hand-written nationalities, download links; 66 to 14,013 distinct values) and 49 lacked values (the foreign market country listed 5 of its 31). The snapshot now spans every published year: 12 free-text columns and theescala_moedacolumns (dropped by the scale transformation, never returned) leave, 10 columns enter, and the 49 are complete. The CVM’s sector classification (fca/geral/setor_atividade, 66 values) stays a codelist above the 50-value cap on purpose.cvm_codelist()gainsfirst_seen_yearandlast_seen_year, the first and last year each value appears in. A rate that a quoting defect had filed as a contractual position (“5,13% a.a.”) is gone.-
The CSV reader lost whole rows and values without a word, and now keeps them. Three defects, measured on 2026-10-25:
-
Quotes. The CVM does not quote: a
"in its files is a character of the text, and no field holds the delimiter or a line break. Read with readr’s default quote, a text starting with"swallowed the following lines into one field. In FRE 2024 alone five tables lost 2,803 of 30,679 rows (transacao_parte_relacionada1,820,administrador_membro_conselho_fiscal548,remuneracao_total_orgao206,outro_valor_mobiliario145,auditor84), two of them without any warning. The reader now reads withquote = "". -
Types guessed from the first 1,000 rows. A column empty there was guessed logical and every later value became
NA(the CNPJ offre/transacao_parte_relacionada.documento_parte_relacionadain every year). Columns are now guessed over every row. -
Text columns read as numbers or logicals. A column the CVM dictionary declares as text (
varchar,char) is now always character: 32 such columns came out as logical or double in some year (telephone and fax lost their leading zeros).
The mirror is rebuilt by the next weekly run. Code that relied on those columns being numeric or logical (e.g.
fcatelefone/fax) now gets character. The publish keeps a fingerprint of the reader in__source_hash.json(reader); in the run where it changes, the history counts a filing as superseded only when its delivery changed, so rows the old reader lost are not filed as re-filings. -
Quotes. The CVM does not quote: a
Every table now checks the column NAMES of the CVM CSV, not only their count. Until now only the 8 FRE tables without a CVM dictionary had their names checked; in the other 66 a column the CVM renamed or swapped at the same count went silently into the result and into the mirror. The expected names come from the embedded dictionary snapshot (the CVM’s META), compared as a set. Measured before switching it on: the header of every CSV of every yearly ZIP (1,244 headers, 2003-2026) carries exactly the dictionary’s names in all 74 tables. A mismatch is
cvmdata_error_parseundervalidate = "strict"andcvmdata_warn_validationunder"warn".The mirror’s
__source_hash.jsonsidecar is now actually read in production. GitHub serves release assets asapplication/octet-stream, httr2 refuses to parse JSON under that type by default, and the refusal was swallowed into “no hash”, so since the sidecar shipped no installed client had ever evicted a stale L3 copy by hash or quoted the skip manifest in the “No parquet assets match” error (the tests’ mock answeredapplication/json). Found on 2026-10-25 when the first pinned read of a dated snapshot said the mirror had none.The parquet mirror (
source = "mirror", the default) had stopped updating in June 2026. The weekly ETL skipped a publish whenever the CVM dictionary files were unchanged, and they rarely change, so new filings, restatements and package fixes never reached the mirror. The publish hash now covers the content of every parquet as well. Thevlmomirror release had also been left as a draft since June, which madesource = "mirror"fail forvlmowith a 404; the ETL now publishes the release explicitly and checks it without credentials. Releases are now updated in place instead of deleted and recreated, so the mirror no longer goes empty while a new snapshot uploads, and a failed asset upload is retried before the run gives up.keep_latest_versionnow keeps the last filing delivered, ranked by receipt date, then CVM document id, thenversao, instead of the highestversao. The version number is not a filing key: the DFP 2023 index lists two “version 1” filings for TRV XLIII Securitizadora, and the DFP 2024 index lists versions 1, 2 and again 1 for Travessia Securitizadora VI, the last one being the filing the issuer carries forward.submissaoused to return both TRV rows and the superseded Travessia row. Tables with no delivery columns still keep the highestversao.issuer_fetch()checks each table against its dataset’s filing index (submissao). The CVM statement CSVs repeat rows: a sweep of every DFP and ITR file from 2010 to 2026 found 884 issuer-period-table cases with the whole statement doubled and 110 with a few accounts repeated, some from two filings under the same version (TRV XLIII, DFP 2023), most with a single filing in the index. Sums over those issuers counted double. Identical rows are now dropped andcvmdata_warn_duplicate_filingnames the issuers; copies that differ invl_contaare kept and flagged withcvmdata_warn_conflicting_filing. When the table holds an earlier filing than the last delivery (the Travessia case, whose statement CSVs stayed on version 2),cvmdata_warn_stale_filingnames the issuers. Both checks run for either backend and can be turned off withoptions(cvmdata.check_filings = FALSE). See defects #14 and #15 in the data-defects article.The mirror ETL no longer burns a whole runner on a portal that is not answering it. Of the 14 scheduled mirror runs between 2026-06-09 and 2026-09-08, 8 went red, every one of them in stage 01 and on a different
(group, dataset)each week, while the sibling jobs on other runners downloaded normally; the 2026-09-08frejob logged0 ok / 612 failed, all of them 10 s TCP connect timeouts, after 5 h 51 min — minutes short of GitHub’s 6 h job ceiling. Probing the portal from eight runners in parallel on 2026-09-11 showed it answering in ~0,15 s over IPv4 from every one, each on a different Azure egress IP, so these episodes are the portal dropping some egress addresses for a while rather than anything wrong with the URLs the ETL builds. Three changes follow from that: a transport failure (DNS, TCP connect, TLS, read timeout) now carries thecvmdata_error_http_transportsubclass, which an HTTP status such as 404 does not, so “the portal did not answer” is distinguishable from “this file is not published”; stage 01 trips a circuit breaker after 8 consecutive transport failures with nothing yet fetched, exiting 3 in about 5 min instead of walking hundreds of pairs that cannot succeed; and the job carries a 120 min ceiling for the partial outage, where interleaved successes would keep resetting the breaker. A newETL mirror retryworkflow then re-runs only the failed jobs, each landing on a fresh egress IP, up to 3 attempts.CVM portal requests now retry transient failures.
cvm_dataset_years()(directory listing) and thesource = "cvm"HEAD/GET downloads wrap theirhttr2calls inreq_retry(max_tries = 3, retry_on_failure = TRUE), so an intermittent portal timeout — which the open-data portal produces sporadically — no longer aborts the call (or the mirror ETL) on the first attempt. Matches the retry already used on the GitHub Releases mirror path.cvm_dataset_years()no longer hard-fails when the CVM directory index is unreachable. After the retries above are exhausted it falls back to the declared coverage range —first_year(now verified to equal the listing minimum) through the current year — and warns with classcvmdata_warn_year_listing_fallback, instead of aborting. This removes the directory listing as a single point of failure for the mirror ETL, which from foreign CI IPs occasionally cannot reach the index even though the per-year archives download fine. A reachable index that genuinely lists no archives still aborts.issuer_fetch()with a free-textissuerandyear = NULLno longer aborts with “No issuers match …” when the company is simply absent from the latest probed year (e.g. a header-only current year, or an issuer that has not yet filed). Text matching now participates in the descending year fallback like CNPJ and CD_CVM matching do, walking down to an earlier year that holds the filer; a genuine typo still aborts with the spelling hint on the last candidate year. The same applies to an explicit multi-year request (e.g.year = 2012:2024): a text issuer absent from some of the requested years now contributes no rows for those years instead of aborting the whole span, and the spelling error is raised once only if no requested year matched.-
issuer_fetch()with explicit years that precede a dataset’s first published year (e.g.year = 2005:2024fordfp, which starts in2010) no longer fails with a raw HTTP 404. The years before
first_yearare dropped before any request, with an informational message listing them, and the remaining years are fetched normally. When every requested year is too early the call aborts with a clearcvmdata_error_inputinstead of a network error. This applies to both the"mirror"and"cvm"backends; genuine 404s on years that do exist remain governed byon_error. issuer_fetch()on the current, not-yet-filed year of an annual financial table (e.g.dfp/dfc_mdfor fiscal 2026 early in 2026) no longer aborts with “non-numeric argument to binary operator”. The CVM publishes a header-only CSV for such years; themultiply_by_scaletransform now no-ops on a 0-row table and returns a clean empty tibble.ETL parquet mirror: the pipeline tolerates
(table, year)pairs that legitimately produce no parquet, so a single absent year no longer fails the whole dataset publish. Stage 02 records each skipped tuple with a reason —empty(0 rows upstream) orabsent(the detail table’s CSV is not in that year’s ZIP because CVM only began publishing it later, e.g.dfp/itrcomposicao_capitalbefore 2020, or severalfretables in early years) — and stage 02b treats a missing parquet for such a tuple as a soft pass instead of a hard failure. A parquet that is missing without a recorded reason still hard-fails. Fixes the reddfp/itr/fremirror jobs.
New features
A table the CVM publishes without content from some year on is now handled like a table that starts late. The schema records the year (
empty_from) and the reason (empty_reason); today onlyfca/departamento_acionistas, whose CSV has the header only since 2024 because Resolução CVM 59/2021 revoked item 6 of the Formulário Cadastral (in force since 2023-01-02; 546 rows in 2023, zero from 2024 on). An explicityearfrom that year on is refused before any download (cvmdata_error_input, as for a year beforefirst_year), afrom/towindow drops those years with a message, andyear = NULLwarns (cvmdata_warn_empty_upstream) that the latest year has no content: the mirror returns the last year with content, the portal returns the latest file as published, with zero rows. Until nowyear = NULLreturned 2023 from the mirror and zero rows from the portal with no explanation.The mirror now says why a partition is missing. The ETL already recorded every (table, year, basis) it wrote no parquet for, with the reason —
emptywhen the CVM publishes the CSV with the header only,absentwhen the CSV is not in the yearly ZIP — but kept the record to itself. It now travels inside the__source_hash.jsonsidecar of each release (no new asset, so existing installations keep working), and the “no parquet assets match” error quotes it for the years it covers. First case it explains:fre/mercado_estrangeiroandfre/titular_valor_mobiliariohave no CSV in the CVM’s 2026 ZIP, although the dictionary still lists them and Resolução CVM 80 still asks for the data (items 12.6 and 12.4 of Anexo C).
Documentation
The
itr-dfparticle shows how to compare companies on the CVM’s fixed accounts (st_conta_fixa == "S"), with what a measurement over every DFP and ITR statement found on 2026-11-01. Within one standard chart, the fixed accounts carry the same name in 99.2% of the companies, and the flag of a company’s account changes between years in 0.3-0.4% of cases. Banks and insurers follow other charts, where the same fixed code means something else (3.01is revenue from sales for Petrobras and revenue from financial intermediation for Itaú). No argument is added, because the column is already in every statement.The data licence is now stated. The CVM publishes every dataset the package covers under the Open Data Commons Open Database License (ODbL) v1.0; the parquet mirror is a derivative database and is redistributed under the same licence. The new
DATA-LICENSE.mdcarries the notice and the attribution, the README (both languages) and the Cache and mirror backend article summarise it, and the notes of everymirror-*-latestrelease carry the notice from the next publish on. The package code remains MIT.The README (both languages), the DESCRIPTION and the introduction vignette now say up front that the default backend is a parquet mirror of the CVM portal maintained by the package author in GitHub Releases, refreshed weekly, and that
source = "cvm"reads the official portal directly. The vignette no longer claims that the package “hits the CVM portal on every invocation”, which has been false since v0.1.0 made the mirror the default.
Internal
A fifth ETL stage,
inst/etl/05-label-scale.R, writes thescale_errorcolumn into the history assets of the DFP and ITR statements. The verdict needs every table of a version and of its successor, so it is not given where the rows are written (the mirror path sees one partition at a time, the RAD path one document without its successor): the stage runs after 03 inetl-mirror.yamland after 04 inetl-rad.yaml, reads from the release the history and current assets of the years whose history moved since they were last judged (scale_labeledandscale_rulein__source_hash.json), judges every superseded version (inst/etl/util-scale.R) and rewrites the history assets of those years. The versions of a document are paired in the order ofsuperseded_at,id_docandversao, the current one last; a version the mirror path filed holds only the tables whose content changed, so the tables it lacks are taken from its successor before the comparison.--alljudges every year (the backfill, alabel_allinput ofetl-rad.yaml);--dry-runwrites locally. The release I/O the three stages shared by copy (download_release_asset(),download_public_asset(),upload_release_asset(), the asset names) now lives ininst/etl/util-release.R.The package passes
pkgcheck::pkgcheck(), the automated gate of the rOpenSci software review: thecvm_tbltopic documents its value,print.cvm_tbl()returns its input invisibly in both branches, the two session-cache resets that only the tests called moved fromR/to the test helpers, the CRAN badge (a link to a page that does not exist yet) left the READMEs, andcodemeta.jsonis generated withcodemetar::write_codemeta().The two ETL workflows that append to the history assets (
etl-mirror.yaml, weekly, andetl-rad.yaml, daily) share the GitHub Actions concurrency groupetl-history, so a run of one waits for the other to finish. The schedules alone did not keep them apart: the RAD run readsdfpanditrin series and can last until 08:40 UTC, past the Tuesday 07:00 UTC run of the mirror.The mirror ETL keeps the filings it supersedes. Every CVM annual file carries only the filing delivered last for each company and reference date, so when a company restated a statement the previous rows vanished from the mirror on the next weekly publish. Now, for every partition whose content hash moved,
inst/etl/03-publish.Rdownloads the parquet of the previous release and compares it filing by filing (inst/etl/util-history.R): the rows of the filings the new file replaces or drops are appended, withsuperseded_atandsuperseded_by_versao, to a cumulative history asset of the same partition (<table>__report_type=R__year=Y__history.parquet). A filing counts as changed by the content of its rows, never by a newversaoor document id alone, and a column the CVM adds upstream is not a change of every filing. The-latestparquets and the client are untouched (parse_mirror_asset_name()rejects the history names);__source_hash.jsongains ahistorymap. Only tables that keep the last delivery (keep_latest_version) have a history;submissaoalready lists every delivery. Reading the history fromcvm_fetch()is a separate item.The filings superseded BEFORE the mirror kept a history are recovered from the CVM document archive (RAD) by a daily robot (
.github/workflows/etl-rad.yaml,inst/etl/04-rad-fetch.R): every DFP/ITR delivery thesubmissaoindex lists that is not the current one is downloaded, read from its XML (inst/etl/util-rad.R, both layouts the RAD has used since 2010) into the eight statement tables with exactly the columns and conventions of the CSV, and appended to the same history assets withhistory_source = "rad", the receipt date of the delivery that replaced it (superseded_at), itsid_docand the reason for restatement the document declares (motivo_reapresentacao). Rows written by the mirror path carryhistory_source = "mirror". The reader was calibrated against 60 current filings of 2010-2025 read back from the mirror, account by account: values, accounts, periods and descriptions identical;st_conta_fixadiffers in 30 rows of three 2019 documents, because the CSV takes that flag from the chart of accounts in force when the file is generated; the history keeps the document’s own flag, the one that held when the filing was delivered. Documents the robot cannot read are listed in the public asset__rad_unread.csvof each release. The first real run (2026-10-20, DFP 2025) set aside 8 of 73 documents and stopped, as designed, over two defects of the reader, both fixed: the XML is parsed without libxml2’s 10 MB text-node limit (the embedded PDF of five documents exceeded it, and libxml2 2.9 refused the whole file as “Extra content at the end of the document”), and the DMPL columns of the flat variant follow the document’s own order of elements rather than a fixed map (the converter only reorders the three-way split of consolidated equity: controlling, non-controlling, consolidated), so the equity columns of financial institutions, which differ between two filing templates (AjustesAvaliacaoPatrimonialbefore or afterLucroPrejuizoAcumulado,ReservasReavaliacao, nine consolidated columns with the ninth unlabelled), come out as the CSV writes them: Banestes, Banco Pine, Daycoval, BTG Pactual and Itaú, DFP 2025, account by account, zero differences. The state now records which reader set a document aside, and attempts made by an earlier reader no longer spend the document. The old layout accepts the same nine consolidated DMPL columns (it stopped at eight: Banrisul DFP 2021 and BRB DFP 2020 were set aside on 2026-10-23; measured against the CSV, the ninth is the consolidated equity, unlabelled, as in the new layout). And a ZIP that is not a DFP/ITR at all is set aside as a document of another type instead of crashing the reader: the ITR 2023 index lists id 132214 for Dibens Leasing, and the RAD serves an IPE under it. Two decisions of 2026-10-23 on the remaining documents set aside: a blank CNPJ in the document (all zeros: Inter & Co, DFP 2021, a company abroad) is checked by the CVM code of the index instead of being refused as a different CNPJ (the rows carry the index’s identity either way); and the download gives up only when the connection stalls (below 1 KB/s for 180 s; 60 s on the first round, which cut 29 downloads in a day that the next attempt completed) or past 15 min, instead of 180 s of total time, which no document with a huge embedded PDF ever fitted (NEXPE DFP 2021, 59 MB in 180 s; Orizon DFP 2020, 126 MB). Two classes the first full round under that policy (2026-10-24) left aside, both of the old layout: a company that does not consolidate keeps the TEMPLATE of the consolidated DMPL in the document (records without a period and no column list: Ferrovia Centro-Atlântica DFP 2018 and 2020, Sabesp 2019, Banese 2019, Newtel 2018, Bradesco 2019 v1), which is an unfiled statement, not a defect — the CSV has no consolidated DMPL row for any of them; and a fiscal year closing on 29 February (Camil DFP 2020-02-29) has its previous exercise closing on the 28th, as the CSV writes it, instead of crashing the date arithmetic. Two ITR 2021-06-30 documents (Magazine Luiza and Méliuz v1, set aside on 2026-10-25) write per-share values whose decimal point was lost:55E-2,-50000000000000001E-3,-002,123, where the CSV has 0.055, -0.005, -0.02 and 1.23. The reader now reads scientific notation, a dot after a lone zero (-0.05), and, in the per-share accounts (3.99*) only, puts the lost point back after the first digit, as the CVM converter does; measured against 15 other RAD documents, whose digits-only per-share values are all0. A document filed under a branch’s CNPJ (Pacaembu Construtora, ITR 2020-09-30 v1: 0002-49 in the document, the head office 0001-68 in the index) is read when the CNPJ root and the CVM code both match the index; the rows carry the index’s identity. Stage 04 gains--reread <id_doc>(and therereadinput ofetl-rad.yaml): the listed documents are read again, done or not, and their new rows replace their RAD rows in the history. A sweep of the published history (2,953 documents with per-share values) found one document read before the per-share fix with the point lost: Dommo Energia DFP 2021 v1, stored at -1.2e19 per share.The RAD robot records a run that finds its whole queue empty and publishes
__rad_state.jsonfor it. Only a checkpoint recorded the run until now, and a checkpoint needs a document: DFP emptied its queue on 2026-11-04, its state stopped on that day, and anything reading the last run of the state (the portfolio monitor does) took a robot with nothing left to do for a robot that had stopped. A run narrowed by--yearor--rereadstill records nothing when it has nothing to do.The RAD robot asks a document again when the RAD’s internal download service fails for the request (“The HTTP service located at …DownloadDocumento.svc is unavailable”), up to four more times, 10 s apart, before counting a download failure. From 2026-11-06 the service fails per request and not for a stretch: six daily ITR runs in a row stopped as
rad-downafter reading 6 to 194 of 300 documents, and on 2026-11-12 one document asked 30 times from outside GitHub failed 8 times, the next request delivering the ZIP every time. The 15 min pause of the outage rule did nothing for that. A document that fails every time still joins the outage streak. The first run with the retries (2026-11-12) showed they were not enough from the GitHub runner: the failure came in blocks of 25 in a row (five documents, five tries each), three times, where a connection per request had got it scattered. As an experiment, every request to the RAD now opens and closes its own connection, and the log says, for each failed attempt, whether the connection was new and how long the answer took. The run with both (2026-11-12) read 292 of 300 with no pause, every retry on a new connection. Three of its eight failures were the same backend answering “The underlying connection was closed”; that text is now asked again too, and so is “There is not enough space on the disk.” (2026-11-20: the RAD’s own disk, given twice to a document it served as a ZIP on the next two requests).The RAD robot no longer fails as a defect of its own when the mirror cannot serve the delivery index. On 2026-11-12 GitHub answered HTTP 500 to one partition on each of the client’s four attempts and the run died before reaching the RAD. A year that fails with an HTTP error is asked again twice, 60 s apart; if it still fails, the run ends with exit status 3 and the annotation
Fonte inalcançável(the contract the MCP servers of the portfolio already write), which tells the portfolio panel that nothing was measured.The RAD robot stops when a year of the
submissaoindex does not read from the mirror, naming the year, instead of dropping it in silence. On 2026-11-05 the ITR index came without 2012 and 2013 (4,732 deliveries) and the run went on with a queue that skipped both years. The years asked for are now thesubmissaopartitions the release’s__source_hash.jsonlists, so a year the mirror does not publish is never asked for.The RAD reader tells whose a document is by the CVM code when the CNPJ written in it is not the index’s. It already did so for a blank CNPJ and, together with the CNPJ root, for a branch’s; the root no longer counts. Measured case: Technos, ITR 2011-06-30 v1 (id 10642), whose envelope carries the auditor’s CNPJ (61.562.112/0001-20) under the company’s name and CVM code. Version 2, the one the CVM publishes under the right CNPJ, carries the same slip and differs from version 1 only in the declared scale (units in v1, thousands in v2), which the history keeps as each version said it. The document’s own CNPJ is noted in the run log and in
__rad_state.json(cnpj_doc). Another CVM code, or none, is still another document.New contract test
test-schema-snapshot-consistency.Rpins the invariants between the hand-written schema YAMLs and the derivedcvm_dictionary_snapshot.csv: every installed(group, dataset, table)has snapshot rows and vice versa,expected_field_countequals the snapshot’s row count,meta_statusagrees row by row, and the 8 META-less FRE tables declare exactly the field names the snapshot carries. Measured on 2026-09-17: 74 YAMLs, 74 tables in the snapshot, zero divergences. This retires the pre-v0.1 roadmap item “generate the remaining YAMLs from the dictionary snapshot”: the dependency runs the other way (data-raw/build-dictionary-snapshot.Rreads each YAML’scvm_dictionary_urlto build the snapshot), so a generator would be circular, and there are no remaining YAMLs to generate.data-raw/README.mdno longer lists the schema YAMLs as a built artefact.
cvmdata 0.2.0 (2026-05-29)
⚠️ Breaking changes
-
cvm_fetch()has been renamedissuer_fetch()to reflect the contract of CVM’s company-issuer datasets (the v0.1 scope). The rename is mechanical:cvm_fetch(dataset, table, companies = ..., years = ..., ...) ↓ issuer_fetch(dataset, table, issuer = ..., year = ..., ...)The arguments
companiesandyearshave been renamed to the singularissuerandyearfor tidyverse-canonical naming. The semantics are unchanged:issueraccepts a character vector of CNPJs / CD_CVMs / free-text identifiers;yearaccepts an integer vector of years and defaults to the latest available year whenNULL. The renamed arguments still accept vectors of any length.cvm_fetch()is removed without a deprecation wrapper. Calls using the old name will fail withcould not find function "cvm_fetch". Likewise, passing the old argument names will abort withcvmdata_error_inputand a hint suggesting the new names.Rationale: cvmdata has zero CRAN distribution and zero external users at v0.1.0; the breaking change is contained to a few collaborators who can update their scripts in one pass. The alternative (a soft-deprecated wrapper kept until v1.0) would carry the maintenance cost of a redundant code path through the entire v0.x cycle, with no external users to protect.
cad_fetch()has been removed without replacement. Useissuer_fetch("cad", "companhias")instead — the call site is one character longer and removes a thin alias that was only retained for ergonomics during the Session 01 prototype.Four further fetchers (
fund_fetch(),agent_fetch(),offering_fetch(),event_fetch()) will be exported as skeletons in the following development cycle. v0.1.0.9000 itself only shipsissuer_fetch()as a functional fetcher.
New features
New dataset
cgvn(Codigo Brasileiro de Governanca Corporativa) covered byissuer_fetch(). Two tables:submissao(12 fields, one row per ICBGC informe filed by a company per fiscal year) andpraticas(11 fields, “pratique ou explique” detail with 54 recommended practices per filing —id_item,capitulo,principio,pratica_recomendada,pratica_adotada∈ {Sim, Nao, Parcialmente, Nao se Aplica},explicacao). CKAN coverage 2021+.praticasdoes not carrycodigo_cvm; CD_CVM filtering routes throughcgvn/submissaoautomatically. Embedded dictionary and codelist snapshots regenerated to include the new tables. Decision doc:data-raw/decisions/cvmdata_v0-2_planejamento_decisao.md.New dataset
vlmo(Valores Mobiliarios Negociados e Detidos por insiders, art. 11 of CVM Resolution 44) covered byissuer_fetch(). Two tables:submissao(12 fields, one row per filing) andconsolidado(17 fields, one row per security movement). Unlike the other detail tables,consolidadocarries nokeep_latest_versiontransformation: it is event-per-row, so everyversaois retained verbatim (deduping by version would collapse distinct movements). Insider identity is opaque by design of the CVM — the detail has no CPF; only the categorytipo_cargoand, for corporate insiders, a name inempresaplustipo_empresa. Theissuerargument therefore filters the issuing company, not the individual insider; a per-category filter is a trivialdplyrstep on the returned tibble.consolidadodoes not carrycodigo_cvm; CD_CVM filtering routes throughvlmo/submissaoautomatically. The package table is namedconsolidado(notcon, the CVM file token) becauseconis a reserved device name on Windows. Embedded dictionary and codelist snapshots regenerated to include the new tables. Decision doc:data-raw/decisions/cvmdata_v0-2_planejamento_decisao.md.-
New dataset
fca(Formulario Cadastral) covered byissuer_fetch(), the largest v0.2 surface with 10 tables:submissao(9 fields, classic convention identical to ITR/DFP/FRE —cnpj_cia,dt_refer,cd_cvm) plus 9 FRE-detail tables (cnpj_companhia/data_referencia):auditor,canal_divulgacao,departamento_acionistas,dri,endereco,escriturador,geral,pais_estrangeiro_negociacao,valor_mobiliario. The classic-vs-detail split means CD_CVM filtering of a detail routes throughfca/submissao(which carriescd_cvm+cnpj_cia) and maps to the detail’scnpj_companhia. CKAN coverage 2021+.Note:
fca/departamento_acionistasis published with a valid 23-field header but zero data rows from 2024 onward (it carried data through 2023, then zeroed after a regulatory change). The reader returns the empty tibble without aborting; usefca/enderecoorfca/drifor shareholder-department contact information. B3 ticker support in
issuer =. Theissuerargument now recognises B3 trading tickers (e.g."PETR4","BBDC11","ITSA4F") alongside CNPJ, CD_CVM and free text. A ticker is resolved to its issuer CNPJ viafca/valor_mobiliario(thecodigo_negociacaocolumn), analogous to the existing CD_CVM → CNPJ resolution viasubmissao— no external data source. Only active securities (empty/futuredata_fim_negociacao) are matched; the lookup table is cached per R session. Tickers cover only exchange-listed securities, so an unknown ticker aborts withcvmdata_error_inputrather than failing silently. Embedded dictionary and codelist snapshots regenerated to include the FCA tables. Decision doc:data-raw/decisions/cvmdata_v0-2_planejamento_decisao.md.New dataset
ipe(Informacoes Periodicas e Eventuais) covered byissuer_fetch(). A single-table manifest (ipe, 13 fields, ~50k documents/year) of every periodic and eventual document a company filed with the CVM:cnpj_companhia,data_referencia,codigo_cvm,categoria,tipo,especie,assunto,data_entrega,tipo_apresentacao,protocolo_entrega,versaoandlink_download. There is no separatesubmissaotable — the CSV is the manifest.codigo_cvmis native, so CD_CVM filtering matches directly (nosubmissaobridge). The manifest is event-per-row: likevlmo/consolidadoit declares nokeep_latest_versiontransformation, so re-submissions and everyversaoof a document are retained verbatim. Slice by document class with a trivialdplyr::filter()oncategoriaon the returned tibble.link_downloadis returned as a plain URL to the document on the CVM portal; OCR and PDF download are out of scope. IPE overlaps VLMO on the “Valores Mobiliarios negociados e detidos” category — IPE indexes the document, VLMO carries the structured insider movements; see theipe-vlmoarticle. CKAN coverage 2021+. Embedded dictionary and codelist snapshots regenerated to include the new table. Decision doc:data-raw/decisions/cvmdata_v0-2_planejamento_decisao.md.cvm_groups()lists the 18 CKAN groups published by the CVM Open Data Portal, with the number of datasets each group carries and the canonicalcvmdatafetcher contract (issuer,fund,agent,offeringorevent) that covers it. The table is static (verified against<https://dados.cvm.gov.br/group/>on 2026-05-25) and serves as the navigation entry point for the universe of CVM data; only thecompanhiasgroup is functionally implemented in v0.1.0.9000, but the remaining 17 rows document the planned coverage exposed via the four skeleton fetchers shipped in the previous development entry.cvm_datasets(),cvm_tables()andcvm_dataset_years()gained an optionalgroupargument, completing the discovery surface started in the previous entry (cvm_dictionary()andcvm_codelist()already accepted it). WhengroupisNULL(default) the functions preserve their v0.1 behaviour:cvm_datasets()returns every installed dataset across every group,cvm_tables()andcvm_dataset_years()resolve the group by uniqueness across the schema tree. When set, the functions restrict the result to that group; unknown groups abort withcvmdata_error_input. From v0.4 onward, when datasets may collide between groups, callingcvm_tables("foo")withoutgroupaborts withcvmdata_error_input_ambiguous.Four new fetchers exported with skeleton implementation:
fund_fetch()(fund datasets —fundos-de-investimento,fundos-de-investimento-imobiliarios,fundos-estruturados, full implementation arriving in v0.4-v0.6);agent_fetch()(registered agents across the eightadministradores,agentes-autonomos,agentes-fiduciarios,auditores,consultores-de-valores-mobiliarios,coordenadores-de-ofertas,participantes-intermediariosandinvestidores-nao-residentesgroups, v0.7);offering_fetch()(public offerings —ofertas-publicasandplataformas-de-crowdfunding, v0.7); andevent_fetch()(sanctioning proceedings and declaratory acts —atividade-sancionadoraandatos-declaratorios, v0.8). Calling any of these in v0.1.0.9000 aborts with the new condition classcvmdata_error_input_groupand a message pointing to ROADMAP.md. Exporting the skeletons now locks the complete public API surface ahead of incremental data implementation, so later releases (v0.4+) extend coverage without reshaping the API.New condition class
cvmdata_error_input_group(inherits fromcvmdata_error_input, which in turn inherits fromcvmdata_error). Emitted by the four new skeleton fetchers when called in v0.1.0.9000. Sibling ofcvmdata_error_input_ambiguous(introduced in the previous development entry); neither subclass is a parent of the other.Parquet mirror became
<group>-aware end-to-end. The GitHub-Releases producer (inst/etl/0{1,2,2b,3}-*.R) and the workflow.github/workflows/etl-mirror.yamlnow take--group(matrix(group, dataset)), write to<workspace>/out/parquet/<group>/<dataset>/..., and publish to the moving releasemirror-<group>-<dataset>-latest. The mirror consumer (R/util-mirror-assets.R,R/source-mirror-duckdb.R) reads the same naming convention;mirror_release_tag()andmirror_list_assets()gained a leadinggroupargument. The session-scoped asset cache now keys on(group, dataset). Operational note: the four pre-Sessao-08 GitHub Releases (mirror-cad-latest, …) must be renamed in place via the GitHub API tomirror-companhias-<dataset>-latestbefore consumers on this code can read them; the rename is the operator’s task and is intentionally not automated. Until that rename happens,source = "mirror"aborts with HTTP 404; users can fall back tocvm_source_set("cvm").Returned tibbles (
cvm_tblclass) now carry agroupprovenance attribute, slotted betweenfetched_atanddataset. The total number of attached attributes goes from five to six (source,fetched_at,group,dataset,table,package_version).print.cvm_tbl()rendersgroupin the header alongside the existing fields, so a snapshot taken at the REPL self-documents which CKAN group the data came from.load_schema()stamps the resolved group onto the schema list so downstream callers propagate it without re-running the schema-tree lookup.
Documentation
New article
vignettes/articles/groups-overview.Rmdlists the 18 CKAN groups and maps each to one of the five fetcher contracts, with a worked example per fetcher (onlyissuer_fetch()runs; the four skeletons stay ineval = FALSEchunks until v0.4+). Linked from the pkgdown Articles navbar.Article
cvm-defects.Rmdrenamed todata-defects.Rmd. The taxonomy of publication quirks covers any upstream source the package will integrate (the universe widens beyond CVM proper from v0.4+); the new name reflects that scope. URL on the pkgdown site moves from/articles/cvm-defects.htmlto/articles/data-defects.html. No content change._pkgdown.yml:cvm_groupslisted first in the Discovery reference; the section description now points users at it as the entry to the group taxonomy.
Internal
Reader identifier classification refactored from an ad-hoc regex list (
R/util-csv-cvm.R:.identifier_patterns) to a prefix-based helper (identifier_columns()) with two lists:.identifier_prefixes(^cnpj,^cpf,^codigo_,^cd_cvm,^cep,^ddi_,^ddd_,^id_,^protocolo) and.identifier_exact(caixa_postal,tel,versao). Covers v0.1 without regression and absorbs the v0.2 identifier columns (codigo_cvm_auditor,cnpj_escriturador,cpf_responsavel,id_item,ddi_telefone,protocolo_entrega,codigo_negociacao) without per-dataset additions.tx_keep_latest_version()(transform-schema) now accepts an extrakeys: [...]field in the YAML transformation declaration. Used bycgvn/praticasto dedup on(cnpj_companhia, data_referencia, id_item)so the 54 distinct practices per filing all survive.New internal helper
cdcvm_col(df)resolves the CVM-code column to eithercd_cvm(CAD/ITR/DFP/FRE submissao) orcodigo_cvm(CGVN/VLMO/IPE submissao). Applied bymatch_by_cd_cvm()andresolve_cd_cvm_via_submissao()so the CD_CVM lookup path works for both naming conventions.Codelist builder (
data-raw/build-codelists-snapshot.R) exclude pattern list re-aligned with the reader’s identifier rules (broader^codigo_and^id_instead of the v0.1 narrow exact matches; added^ddi_and^protocolo). Mirrors the reader refactor so new identifier-shaped columns in v0.2 datasets are not falsely promoted to codelists.Cache layout migrated from
<cache>/{raw,parquet}/<dataset>/to<cache>/{raw,parquet}/<group>/<dataset>/. The<group>segment is the CVM CKAN group slug (companhiasfor the four v0.1 datasets); this clears the path for v0.2+ datasets that live under other groups (fundos-de-investimento, etc.) without colliding dataset slugs. A one-time internal helper (cache_migrate_v0_1_to_v0_2(), not exported) runs automatically on first invocation ofcvm_fetch(),cvm_cache_info()orcvm_cache_clear()post-upgrade and relocates pre-existing artifacts; the helper is idempotent and writes an audit log undertools::R_user_dir("cvmdata", "config")/cache_migrate_log.rds.cvm_cache_info()now exposes thegroupcolumn as the first key, ahead ofdataset.cvm_cache_clear()gained agroupargument that scopes deletion to a CKAN group (e.g.cvm_cache_clear(group = "companhias")). Precedence:what = "all"overrides the filter; otherwise the target path is composed as<cache>/<what>/<group>/<dataset>/<year>/, with each segment becoming optional from the right.Schema YAML files moved from
inst/extdata/schemas/<dataset>/<table>.yamltoinst/extdata/schemas/<group>/<dataset>/<table>.yaml. The internal loaderload_schema()gained an optionalgroupargument; when omitted (the v0.1.0.9000 path) it resolves by uniqueness across the installed schema tree, so existing calls compile unchanged. The constant.dataset_group_mapshipped by the previous release as technical debt has been removed –dataset_group(),known_groups()and the newknown_datasets()now walk the installed schema tree on first call and memoize the result per R session.cvm_dictionary_snapshot.csvandcvm_codelists_snapshot.csvgained agroupcolumn as the first key column. Composite key changed from(dataset, table, ...)to(group, dataset, table, ...). The bundled CSVs were regenerated against the live CVM portal; aside from the new column, the dictionary snapshot is byte-identical to the previous build and the codelists snapshot reflects organic drift in a handful of FRE categorical columns.cvm_dictionary()andcvm_codelist()gained an optionalgroupargument. When omitted, both functions resolve by uniqueness across the embedded snapshot; from v0.4 onward, datasets present in more than one group will abort withcvmdata_error_input_ambiguous(a new condition class that inherits fromcvmdata_error_input).New condition class
cvmdata_error_input_ambiguous(inherits fromcvmdata_error_input, which in turn inherits fromcvmdata_error). Emitted byload_schema(),dataset_group(),cvm_dictionary()andcvm_codelist()when a(dataset, table)resolution returns more than one candidate group and the caller did not supplygroupto disambiguate.
Bug fixes
-
cvm_fetch()andcad_fetch()no longer fail with the crypticcvmdata_error_internal“Got archive=, file=” when the R session runs underLC_CTYPE = "C". The schema loader now reads the bundled YAMLs forcing UTF-8 instead of relying on the active locale, so multibyte characters in the schema comment headers (e.g. “Demonstração”, “Exercício”) never causeyaml::read_yaml()to returnNULL. A regression test underLC_CTYPE = "C"was added. - The PDF version of the package manual now builds cleanly on the macOS R builder with the default pdflatex
inputencsetup; a stray U+2264 (“less than or equal to”) character in the roxygen docs ofcvm_codelist()has been replaced by ASCII.
cvmdata 0.1.0 (2026-05-24)
First public release. Covers the four core CVM publicly-traded-company datasets — CAD (registry), DFP (annual statements), ITR (quarterly statements) and FRE (reference form) — with a tidy cvm_fetch() API, year-partitioned mirror in GitHub Releases (refreshed weekly), and an HTTP-with-cache backend against dados.cvm.gov.br for byte-level freshness.
Breaking changes
- The default
sourceofcvm_fetch()is now"mirror"(parquet via DuckDB), not"cvm"(CVM Open Data Portal). Scripts that need byte-level freshness from the regulator should passsource = "cvm"explicitly or persist the choice withcvm_source_set("cvm"). The"cvm"backend remains fully supported.
ETL and mirror
- New stage
inst/etl/02b-validate.Rruns between csv-to-parquet generation and the GitHub Releases publish. Applies a hybrid set ofpointblankchecks: structural failures (missing parquet, unreadable file,n_rows == 0, wrong identifier type) exit 1 and block the publish; content failures (CNPJ format,cd_cvmregex, date range) emit a warning and let the publish proceed. The validation markdown report is uploaded as a workflow artifact for post-hoc inspection regardless of outcome. -
arrowandpointblankjoin theSuggestsfield — both are consumed only by the ETL scripts.
Documentation
- New article
cache-and-mirror.Rmd(CRAN-safe via bundled RDS) documents the dual-backend contract, the L1 / L3 cache layout, the four common workflows (mirror switch, CVM vs Mirror equivalence, cache inspection, TTL + LRU tuning) and the eight pre-publish checks the mirror ETL runs. Linked fromREADME.Rmdand the pkgdown navbar.
cvmdata 0.0.0.9000
- Initial scaffolding.
- First implementation:
cad_fetch()for the CAD registry. - Exported utility:
cnpj_clean()for stripping punctuation from CNPJ vectors. - Add ITR (quarterly financial statements) coverage: 11 schemas mirroring DFP.
-
companiesarg accepts CD_CVM on every table of a dataset, even those that don’t carrycd_cvmnatively (e.g.composicao_capital,parecer): the CD_CVM is resolved to CNPJ via the dataset’ssubmissaotable for the same year. Previously the filter silently returned an empty tibble for these tables. - Add FRE (annual reference form) coverage: 36 schemas including 8 with
meta_status: missing(administrador_PCD, empregado_PCD, and six empregado tables that the CVM does not publish a META for); first dataset exercising the missing-META reader policy against real data. -
companiesarg now also filters FRE-detail tables, which use a different header convention from CAD/ITR/DFP:cnpj_companhia,data_referencia,nome_companhia(nocd_cvm).match_by_cnpj(),match_by_text(),disambiguate_text_match()andtx_keep_latest_version()accept either column pair; existing CAD/ITR/DFP behaviour is unchanged. - Public cache API:
cvm_cache_path(),cvm_cache_set_path(),cvm_cache_info()andcvm_cache_clear(). The internal source backend now consumescvm_cache_path()as the single source of truth for the cache root.cvm_cache_info()lists every artifact under<cache>/raw/(upstream CSV/ZIP plus CSVs extracted from yearly ZIPs) with ETag/Last-Modified metadata sourced from*.etag.rdssidecars when present.cvm_cache_clear()acceptswhat ∈ c("all", "raw")plus optionaldatasetandyearfilters; in interactive sessions it asks for confirmation viautils::askYesNo(). - Public source API:
cvm_source_get()andcvm_source_set().cvm_source_get()readsgetOption("cvmdata.source", "cvm");cvm_source_set()validates the value againstc("cvm", "mirror")and persists it.cvm_fetch()now declaressource = NULLand resolves the default viacvm_source_get(), so precedence is arg > option > built-in default. The built-in default is"cvm"in the v0.1 series and transitions to"mirror"in the release that ships the Phase F mirror; this flip will be announced in NEWS.md of that release. Until then, passingsource = "mirror"aborts withcvmdata_error_internal(in-domain value, not yet implemented).